2000-12-03 17:52:14 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
static GstCaps*
|
|
|
|
mpeg2dec_sink_caps (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"mpeg2dec_sink",
|
|
|
|
"video/mpeg",
|
|
|
|
gst_props_new (
|
|
|
|
"mpegtype", GST_PROPS_LIST (
|
|
|
|
GST_PROPS_INT(1),
|
|
|
|
GST_PROPS_INT(2)
|
|
|
|
),
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps*
|
|
|
|
mp1parse_src_caps (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"mp1parse_src",
|
|
|
|
"video/mpeg",
|
|
|
|
gst_props_new (
|
|
|
|
"mpegtype", GST_PROPS_LIST (
|
|
|
|
GST_PROPS_INT(1)
|
|
|
|
),
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps*
|
|
|
|
mpeg2dec_src_caps (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"mpeg2dec_src",
|
|
|
|
"video/raw",
|
|
|
|
gst_props_new (
|
|
|
|
"fourcc", GST_PROPS_LIST (
|
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2'))
|
2000-12-03 17:52:14 +00:00
|
|
|
),
|
2001-04-14 18:56:37 +00:00
|
|
|
"width", GST_PROPS_INT_RANGE (16, 4096),
|
|
|
|
"height", GST_PROPS_INT_RANGE (16, 4096),
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps*
|
|
|
|
raw_sink_caps (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"raw_sink_caps",
|
|
|
|
"video/raw",
|
|
|
|
gst_props_new (
|
|
|
|
"fourcc", GST_PROPS_LIST (
|
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2'))
|
|
|
|
),
|
|
|
|
"height", GST_PROPS_INT_RANGE (16, 256),
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps*
|
|
|
|
raw2_sink_caps (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"raw2_sink_caps",
|
|
|
|
"video/raw",
|
|
|
|
gst_props_new (
|
|
|
|
"fourcc", GST_PROPS_LIST (
|
2001-03-31 00:13:51 +00:00
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
2001-04-14 18:56:37 +00:00
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2'))
|
|
|
|
),
|
|
|
|
"height", GST_PROPS_INT_RANGE (16, 4096),
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2000-12-07 18:38:54 +00:00
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
static GstCaps*
|
|
|
|
get_testcaps (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"raw2_sink_caps",
|
|
|
|
"video/raw",
|
|
|
|
gst_props_new (
|
|
|
|
"fourcc", GST_PROPS_LIST (
|
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V'))
|
|
|
|
),
|
|
|
|
"height", GST_PROPS_INT_RANGE (16, 4096),
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2000-12-03 20:15:24 +00:00
|
|
|
|
2000-12-03 17:52:14 +00:00
|
|
|
static GstCaps *sinkcaps = NULL,
|
|
|
|
*rawcaps = NULL,
|
|
|
|
*rawcaps2 = NULL,
|
2000-12-03 20:15:24 +00:00
|
|
|
*rawcaps3 = NULL,
|
2000-12-03 17:52:14 +00:00
|
|
|
*mp1parsecaps = NULL;
|
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2000-12-03 17:52:14 +00:00
|
|
|
{
|
|
|
|
gboolean testret;
|
2000-12-11 00:04:25 +00:00
|
|
|
xmlDocPtr doc;
|
|
|
|
xmlNodePtr parent;
|
|
|
|
|
|
|
|
doc = xmlNewDoc ("1.0");
|
2001-01-18 15:29:46 +00:00
|
|
|
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
|
2000-12-03 17:52:14 +00:00
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
g_thread_init (NULL);
|
2000-12-03 17:52:14 +00:00
|
|
|
_gst_type_initialize ();
|
2001-04-14 18:56:37 +00:00
|
|
|
_gst_props_initialize ();
|
|
|
|
_gst_caps_initialize ();
|
2000-12-03 17:52:14 +00:00
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
sinkcaps = mpeg2dec_sink_caps ();
|
2001-01-18 15:29:46 +00:00
|
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
|
2000-12-11 00:04:25 +00:00
|
|
|
gst_caps_save_thyself (sinkcaps, parent);
|
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
rawcaps = mpeg2dec_src_caps ();
|
2001-01-18 15:29:46 +00:00
|
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
|
2000-12-11 00:04:25 +00:00
|
|
|
gst_caps_save_thyself (rawcaps, parent);
|
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
rawcaps2 = raw_sink_caps ();
|
2001-01-18 15:29:46 +00:00
|
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL);
|
2000-12-11 00:04:25 +00:00
|
|
|
gst_caps_save_thyself (rawcaps2, parent);
|
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
mp1parsecaps = mp1parse_src_caps ();
|
2001-01-18 15:29:46 +00:00
|
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL);
|
2000-12-11 00:04:25 +00:00
|
|
|
gst_caps_save_thyself (mp1parsecaps, parent);
|
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
rawcaps3 = raw2_sink_caps ();
|
2001-01-18 15:29:46 +00:00
|
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
|
2000-12-11 00:04:25 +00:00
|
|
|
gst_caps_save_thyself (rawcaps3, parent);
|
|
|
|
|
|
|
|
xmlDocDump(stdout, doc);
|
2000-12-03 17:52:14 +00:00
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (mp1parsecaps, rawcaps);
|
2000-12-03 20:15:24 +00:00
|
|
|
g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret);
|
2000-12-03 17:52:14 +00:00
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (mp1parsecaps, sinkcaps);
|
2000-12-03 20:15:24 +00:00
|
|
|
g_print ("4 <-> 1 == %d (valid, subset)\n", testret);
|
2000-12-03 17:52:14 +00:00
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (sinkcaps, mp1parsecaps);
|
2000-12-03 20:15:24 +00:00
|
|
|
g_print ("1 <-> 4 == %d (invalid, superset)\n", testret);
|
2000-12-03 17:52:14 +00:00
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (rawcaps, rawcaps2);
|
2000-12-03 20:15:24 +00:00
|
|
|
g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret);
|
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (rawcaps, rawcaps3);
|
|
|
|
g_print ("2 <-> 5 == %d (valid)\n", testret);
|
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (rawcaps3, rawcaps);
|
|
|
|
g_print ("5 <-> 2 == %d (invalid)\n", testret);
|
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (rawcaps2, rawcaps3);
|
|
|
|
g_print ("3 <-> 5 == %d (valid)\n", testret);
|
2000-12-03 17:52:14 +00:00
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (rawcaps2, rawcaps);
|
2000-12-03 20:15:24 +00:00
|
|
|
g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret);
|
2000-12-03 17:52:14 +00:00
|
|
|
|
|
|
|
testret = gst_caps_check_compatibility (rawcaps, rawcaps);
|
2000-12-03 20:15:24 +00:00
|
|
|
g_print ("2 <-> 2 == %d (valid, same caps)\n", testret);
|
2000-12-07 18:38:54 +00:00
|
|
|
|
|
|
|
return 0;
|
2000-12-03 17:52:14 +00:00
|
|
|
}
|