diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2001-02-19 22:15:07 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2001-02-19 22:15:07 +0000 |
commit | a011f87ee29fa3178a548b02f1c03a8ff37d6cf7 (patch) | |
tree | 2f6f54712912a08deeed91ceec1afe98e27d9b33 | |
parent | 2d181e4d1d7c39d1fd816a7f9a9901216769c666 (diff) |
Added the caps negotiation test programBRANCH-CAPSNEGO1-20010308-FREEZE
Original commit message from CVS:
Added the caps negotiation test program
-rw-r--r-- | tests/nego/.gitignore | 9 | ||||
-rw-r--r-- | tests/nego/Makefile.am | 5 | ||||
-rw-r--r-- | tests/nego/nego1.c | 59 |
3 files changed, 73 insertions, 0 deletions
diff --git a/tests/nego/.gitignore b/tests/nego/.gitignore new file mode 100644 index 0000000000..3224b98fe1 --- /dev/null +++ b/tests/nego/.gitignore @@ -0,0 +1,9 @@ +Makefile +Makefile.in +*.o +*.lo +*.la +.deps +.libs +*.xml +nego1 diff --git a/tests/nego/Makefile.am b/tests/nego/Makefile.am new file mode 100644 index 0000000000..4260472389 --- /dev/null +++ b/tests/nego/Makefile.am @@ -0,0 +1,5 @@ +noinst_PROGRAMS = nego1 + +# jsut apps here, this is safe +LIBS += $(GST_LIBS) +CFLAGS += $(GST_CFLAGS) diff --git a/tests/nego/nego1.c b/tests/nego/nego1.c new file mode 100644 index 0000000000..23848bc87a --- /dev/null +++ b/tests/nego/nego1.c @@ -0,0 +1,59 @@ +#include <gst/gst.h> + +/* this is an example of the src pad dictating the caps + * the sink pad only accepts audio/raw */ + +static GstCaps* +negotiate (GstPad *pad, GstCaps *caps, gint count) +{ + g_print ("negotiation entered\n"); + + if (!strcmp (gst_caps_get_mime (caps), "audio/raw")) + return caps; + + return NULL; +} + +int +main(int argc,char *argv[]) +{ + GstPad *srcpad, *sinkpad; + GstCaps *new; + + gst_init(&argc,&argv); + + srcpad = gst_pad_new ("src", GST_PAD_SRC); + sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + + gst_pad_connect (srcpad, sinkpad); + + gst_pad_set_negotiate_function (sinkpad, negotiate); + + /* fill in our desired caps */ + new = gst_caps_new_with_props ( + "src_caps", /* name */ + "audio/raw", /* mime */ + gst_props_new ( + "format", GST_PROPS_INT (16), + "depth", GST_PROPS_INT (16), + "rate", GST_PROPS_INT (48000), + "channels", GST_PROPS_INT (2), + NULL + ) + ); + + gst_pad_set_caps (srcpad, new); + + new = gst_caps_new_with_props ( + "src_caps", /* name */ + "video/raw", /* mime */ + gst_props_new ( + "format", GST_PROPS_FOURCC ('Y','U','Y','V'), + NULL + ) + ); + + gst_pad_set_caps (srcpad, new); + + exit (0); +} |