diff --git a/tests/Makefile.am b/tests/Makefile.am index e640909812..dfe949c355 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -noinst_PROGRAMS = init loadall simplefake states +noinst_PROGRAMS = init loadall simplefake states caps LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la diff --git a/tests/caps.c b/tests/caps.c new file mode 100644 index 0000000000..56de3553f3 --- /dev/null +++ b/tests/caps.c @@ -0,0 +1,83 @@ +#include + +static GstTypeFactory mpegfactory = { + "video/mpeg", // major type + ".mpg .mpeg", // extenstions + NULL, // typefind function +}; + +static GstCapsFactory mpeg2dec_sink_caps = { + "video/mpeg", + "mpegtype", GST_CAPS_LIST ( + GST_CAPS_INT(1), + GST_CAPS_INT(2) + ), + NULL +}; + +static GstCapsFactory mp1parse_src_caps = { + "video/mpeg", + "mpegtype", GST_CAPS_LIST ( + GST_CAPS_INT(1) + ), + NULL +}; + +static GstCapsFactory mpeg2dec_src_caps = { + "video/raw", + "fourcc", GST_CAPS_LIST ( + GST_CAPS_INT32 (0x32315659), + GST_CAPS_INT32 (0x32314544) + ), + "width", GST_CAPS_INT_RANGE (16, 4096), + "height", GST_CAPS_INT_RANGE (16, 4096), + NULL +}; + +static GstCapsFactory raw_sink_caps = { + "video/raw", + "fourcc", GST_CAPS_LIST ( + GST_CAPS_INT32 (0x32315659) + ), + "height", GST_CAPS_INT_RANGE (16, 256), + NULL +}; + +static GstCaps *sinkcaps = NULL, + *rawcaps = NULL, + *rawcaps2 = NULL, + *mp1parsecaps = NULL; + +int main(int argc,char *argv[]) +{ + gboolean testret; + + _gst_type_initialize (); + + sinkcaps = gst_caps_register (mpeg2dec_sink_caps); + gst_caps_dump (sinkcaps); + rawcaps = gst_caps_register (mpeg2dec_src_caps); + gst_caps_dump (rawcaps); + rawcaps2 = gst_caps_register (raw_sink_caps); + gst_caps_dump (rawcaps2); + mp1parsecaps = gst_caps_register (mp1parse_src_caps); + gst_caps_dump (mp1parsecaps); + + testret = gst_caps_check_compatibility (mp1parsecaps, rawcaps); + g_print ("%d\n", testret); + + testret = gst_caps_check_compatibility (mp1parsecaps, sinkcaps); + g_print ("%d\n", testret); + + testret = gst_caps_check_compatibility (sinkcaps, mp1parsecaps); + g_print ("%d\n", testret); + + testret = gst_caps_check_compatibility (rawcaps, rawcaps2); + g_print ("%d\n", testret); + + testret = gst_caps_check_compatibility (rawcaps2, rawcaps); + g_print ("%d\n", testret); + + testret = gst_caps_check_compatibility (rawcaps, rawcaps); + g_print ("%d\n", testret); +} diff --git a/tests/states.c b/tests/states.c index baafa21402..6401f37ce3 100644 --- a/tests/states.c +++ b/tests/states.c @@ -39,8 +39,8 @@ int main(int argc,char *argv[]) { gst_pad_connect(gst_element_get_pad(src,"src"), gst_element_get_pad(sink,"sink")); - gst_bin_create_plan(bin); - gst_element_set_state(bin,GST_STATE_PLAYING); + gst_bin_create_plan (GST_BIN (bin)); + gst_element_set_state (bin, GST_STATE_PLAYING); - gst_bin_iterate(bin); + gst_bin_iterate (GST_BIN (bin)); }