Added a test program for the capabilities

Original commit message from CVS:
Added a test program for the capabilities
This commit is contained in:
Wim Taymans 2000-12-03 17:52:14 +00:00
parent 4f55ae4ded
commit 9652a3aef9
3 changed files with 87 additions and 4 deletions

View file

@ -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

83
tests/caps.c Normal file
View file

@ -0,0 +1,83 @@
#include <gst/gst.h>
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);
}

View file

@ -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));
}