Fix tests to use GstCaps2, static caps, and static pad templates

Original commit message from CVS:
Fix tests to use GstCaps2, static caps, and static pad templates
This commit is contained in:
David Schleef 2003-11-25 08:59:43 +00:00
parent b9e3755c14
commit 59f94cac76
30 changed files with 596 additions and 962 deletions

View file

@ -1,7 +1,7 @@
TESTS_ENVIRONMENT=\
G_DEBUG=fatal_warnings \
GST_PLUGIN_PATH=$(top_builddir) \
GST_PLUGIN_PATH=$(top_builddir)/gst:. \
GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml

View file

@ -171,8 +171,8 @@ gst_bstest_class_init (GstBsTestClass * klass)
}
static GstCaps *
gst_bstest_getcaps (GstPad *pad, GstCaps *caps)
static GstCaps2 *
gst_bstest_getcaps (GstPad *pad, const GstCaps2 *caps)
{
GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad));
GstPad *otherpad;

View file

@ -1,116 +1,63 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1),
GST_PROPS_INT (2)
)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS(
"video/mpeg, "
"mpegtype:int={1,2}"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1)
)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS(
"video/mpeg, "
"mpegtype:int={1}"
);
GST_CAPS_FACTORY (rawcaps,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YV12\", \"YUY2\"}, "
"width:int=[16,4096], "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps2,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12"))
),
"height", GST_PROPS_INT_RANGE (16, 256)
)
GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YUY2\"}, "
"height:int=[16,256]"
);
GST_CAPS_FACTORY (rawcaps3,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YV12\", \"YUY2\"}, "
"height:int=[16,4096]"
);
/* these caps aren't used yet
GST_CAPS_FACTORY (rawcaps4,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
#if 0
/* these caps aren't used yet */
GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YV12\", \"YUYV\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps5,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YUYV\", \"YUY2\"}, "
"height:int=[16,4096]"
);
*/
#endif
GST_CAPS_FACTORY(rawcaps6,
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','V'))
)
)
GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS(
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YUYV\""
);
GST_CAPS_FACTORY(rawcaps7,
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2'))
)
)
GstStaticCaps2 rawcaps7 = GST_STATIC_CAPS(
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YV12\""
);
int
@ -121,43 +68,53 @@ main (int argc, char *argv[])
gst_init (&argc, &argv);
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&mp1parsecaps),
gst_static_caps2_get (&rawcaps));
g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&mp1parsecaps),
gst_static_caps2_get (&sinkcaps));
g_print ("4 <-> 1 == %d (valid, subset)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&sinkcaps),
gst_static_caps2_get (&mp1parsecaps));
g_print ("1 <-> 4 == %d (invalid, superset)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps2));
g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps3));
g_print ("2 <-> 5 == %d (valid)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps3),
gst_static_caps2_get (&rawcaps));
g_print ("5 <-> 2 == %d (invalid)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps2),
gst_static_caps2_get (&rawcaps3));
g_print ("3 <-> 5 == %d (valid)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps2),
gst_static_caps2_get (&rawcaps));
g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps));
g_print ("2 <-> 2 == %d (valid, same caps)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps6), GST_CAPS_GET (rawcaps7));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps6),
gst_static_caps2_get (&rawcaps7));
g_print ("6 <-> 7 == %d (invalid, second caps doesn't fit)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;

View file

@ -22,9 +22,8 @@
gint
main (gint argc, gchar *argv[])
{
GstCaps *caps;
GstProps *props;
GstPropsEntry *entry;
#if 0
GstCaps2 *caps;
gst_init (&argc, &argv);
@ -80,6 +79,7 @@ main (gint argc, gchar *argv[])
/* caps too */
g_assert (GST_CAPS_IS_FIXED (caps));
#endif
return 0;
}

View file

@ -1,44 +1,40 @@
#include <gst/gst.h>
GST_CAPS_FACTORY (rawcaps1,
GST_CAPS_NEW (
"raw1_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
),
GST_CAPS_NEW (
"raw1_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
)
GstStaticCaps2 rawcaps1 = GST_STATIC_CAPS(
"video/x-raw-yuv, "
"fourcc:fourcc=\"YUYV\", "
"height:int=640, "
"width:int=480, "
"framerate:float=30.0; "
"video/x-raw-yuv, "
"fourcc:fourcc=\"I420\", "
"height:int=640, "
"width:int=480, "
"framerate:float=30.0"
);
int
main (int argc, char *argv[])
{
GstCaps *caps1;
GstCaps *caps2;
GstCaps *caps;
GstCaps2 *caps1;
GstCaps2 *caps2;
GstCaps2 *caps;
gst_init (&argc, &argv);
caps1 = GST_CAPS_GET (rawcaps1);
caps2 = gst_caps_copy_1 (GST_CAPS_GET (rawcaps1));
caps1 = gst_caps2_copy( gst_static_caps2_get (&rawcaps1));
caps2 = gst_caps2_copy_1 (gst_static_caps2_get (&rawcaps1));
gst_caps_set(caps1, "height", GST_PROPS_INT(640));
gst_caps_set(caps1, "width", GST_PROPS_INT(480));
gst_caps_set(caps1, "framerate", GST_PROPS_FLOAT(30.0));
#if 0
gst_caps2_set(caps1, "height", GST_PROPS_INT(640));
gst_caps2_set(caps1, "width", GST_PROPS_INT(480));
gst_caps2_set(caps1, "framerate", GST_PROPS_FLOAT(30.0));
#endif
caps = gst_caps_intersect(caps1, caps2);
caps = gst_caps2_intersect(caps1, caps2);
g_print("caps %s\n", gst_caps_to_string(caps));
g_print("caps %s\n", gst_caps2_to_string(caps));
if(caps == NULL)return 1;
if (gst_caps2_is_empty (caps)) return 1;
return 0;
}

View file

@ -1,103 +1,65 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT_RANGE (20,40),
"foo2", GST_PROPS_INT_RANGE (20,40),
"foo3", GST_PROPS_INT_RANGE (10,20)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=[20,40], "
"foo2:int=[20,40], "
"foo3:int=[10,20]"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT (30),
"foo2", GST_PROPS_INT_RANGE (20,30),
"foo3", GST_PROPS_INT_RANGE (20,30)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=30, "
"foo2:int=[20,30], "
"foo3:int=[20,30]"
);
GST_CAPS_FACTORY (rawcaps,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,4096], "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps2,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
)
GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS (
"video/raw, "
"height:int=[16,256], "
"depth:int=16"
);
GST_CAPS_FACTORY (rawcaps3,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YUY2\", \"YV12\" }, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps4,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YUY2\",\"YV12\",\"YUYV\" }, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps5,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps5 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YUYV\",\"YUY2\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps6,
GST_CAPS_NEW (
"raw6_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
),
GST_CAPS_NEW (
"raw6_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
)
GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc=\"YUYV\", "
"height:int=640, "
"width:int=480, "
"framerate:double=30.0; "
"video/raw, "
"fourcc:fourcc=\"I420\", "
"height:int=640, "
"width:int=480, "
"framerate:double=30.0; "
);
int
@ -105,7 +67,7 @@ main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
GstCaps2 *caps;
gst_init (&argc, &argv);
@ -115,32 +77,36 @@ main (int argc, char *argv[])
/*
g_mem_chunk_info ();
for (i = 0; i<100000; i++) {
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4));
gst_caps_unref (caps);
caps = gst_caps2_intersect (gst_static_caps2_get (rawcaps3), GST_CAPS_GET (rawcaps4));
gst_caps2_unref (caps);
}
g_mem_chunk_info ();
*/
caps = gst_caps_intersect (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
caps = gst_caps2_intersect (gst_static_caps2_get (&sinkcaps),
gst_static_caps2_get (&mp1parsecaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps2));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps3),
gst_static_caps2_get (&rawcaps4));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps5));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps3),
gst_static_caps2_get (&rawcaps5));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps6),
gst_caps_copy_1(GST_CAPS_GET (rawcaps6)));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps6),
gst_caps2_copy_1(gst_static_caps2_get (&rawcaps6)));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
xmlDocDump(stdout, doc);

View file

@ -1,87 +1,46 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"foo1", GST_PROPS_INT_RANGE (20,40),
"foo2", GST_PROPS_INT_RANGE (20,40),
"foo3", GST_PROPS_INT_RANGE (10,20)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS (
"video/mpeg, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"foo1:int=[20,40], "
"foo2:int=[20,40], "
"foo3:int=[10,20]"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"foo4", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS (
"video/mpeg, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"foo4:fourcc={\"YV12\",\"YUY2\"}"
);
GST_CAPS_FACTORY (rawcaps,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
)
)
GstStaticCaps2 rawcaps = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,4096], "
"height:int=[16,4096], "
"fourcc:fourcc={\"YV12\",\"YUY2\"}"
);
GST_CAPS_FACTORY (rawcaps2,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
),
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
)
GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,256], "
"height:int=16; "
"video/raw, "
"width:int=[16,256], "
"height:int=16"
);
GST_CAPS_FACTORY (rawcaps3,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
),
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
),
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,256], "
"height:int=16; "
"video/raw, "
"width:int=[16,256], "
"height:int=16; "
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}"
"height:int=[16,4096]"
);
/* defined, not used
@ -116,32 +75,32 @@ main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
GstCaps2 *caps;
gst_init (&argc, &argv);
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
caps = gst_caps_normalize (GST_CAPS_GET (sinkcaps));
caps = gst_caps2_normalize (gst_static_caps2_get (&sinkcaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (mp1parsecaps));
caps = gst_caps2_normalize (gst_static_caps2_get (&mp1parsecaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (rawcaps));
caps = gst_caps2_normalize (gst_static_caps2_get (&rawcaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (rawcaps2));
caps = gst_caps2_normalize (gst_static_caps2_get (&rawcaps2));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (rawcaps3));
caps = gst_caps2_normalize (gst_static_caps2_get (&rawcaps3));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
xmlDocDump(stdout, doc);

View file

@ -1,104 +1,60 @@
#include <gst/gst.h>
#include <string.h>
GST_CAPS_FACTORY (caps1,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1),
GST_PROPS_INT (2)
)
)
GstStaticCaps2 caps1 = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int={1,2}"
);
GST_CAPS_FACTORY (caps2,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1)
)
)
GstStaticCaps2 caps2 = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int={1}"
);
GST_CAPS_FACTORY (caps3,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps3 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"width:int=[16,4096], "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (caps4,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12"))
),
"height", GST_PROPS_INT_RANGE (16, 256)
)
GstStaticCaps2 caps4 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc=\"YV12\", "
"height:int=[16,256]"
);
GST_CAPS_FACTORY (caps5,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps5 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (caps6,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps6 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUYV\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (caps7,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps7 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YVYV\",\"YUY2\"}, "
"height:int=[16,4096]"
);
GstStaticCaps2 caps8 = GST_STATIC_CAPS (
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YUYV\""
);
GstStaticCaps2 caps9 = GST_STATIC_CAPS (
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YV12\""
);
GST_CAPS_FACTORY(caps8,
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','V'))
)
)
GST_CAPS_FACTORY(caps9,
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2'))
)
)
static gint test = 0;
static gint failures = 0;
@ -114,21 +70,19 @@ static gint failures = 0;
} \
}G_STMT_END
static void
test_caps_func (GstCaps *caps)
test_caps_func (const GstCaps2 *caps)
{
gchar *str1, *str2;
gboolean ret = FALSE;
str1 = gst_caps_to_string (caps);
gst_caps_unref (caps);
caps = gst_caps_from_string (str1);
str1 = gst_caps2_to_string (caps);
caps = gst_caps2_from_string (str1);
if (!caps) {
g_print ("%3d, INFO : no caps from %s\n", test, str1);
TEST_END (ret);
return;
}
str2 = gst_caps_to_string (caps);
gst_caps_unref (caps);
str2 = gst_caps2_to_string (caps);
g_print ("%3d, INFO : %s <==> %s\n", test, str1, str2);
ret = strcmp (str1, str2) == 0;
g_free (str1);
@ -136,7 +90,7 @@ test_caps_func (GstCaps *caps)
TEST_END (ret);
}
static void
test_caps (GstCaps *caps)
test_caps (const GstCaps2 *caps)
{
TEST_START;
test_caps_func (caps);
@ -144,11 +98,11 @@ test_caps (GstCaps *caps)
static void
test_string (gchar *str)
{
GstCaps *caps;
GstCaps2 *caps;
TEST_START;
g_print ("%3d, INFO : checking %s\n", test, str);
caps = gst_caps_from_string (str);
caps = gst_caps2_from_string (str);
if (!caps) {
g_print ("%3d, INFO : no caps from %s\n", test, str);
TEST_FAIL;
@ -159,11 +113,11 @@ test_string (gchar *str)
static void
test_string_fail (gchar *str)
{
GstCaps *caps;
GstCaps2 *caps;
TEST_START;
g_print ("%3d, INFO : checking %s for failure\n", test, str);
caps = gst_caps_from_string (str);
caps = gst_caps2_from_string (str);
TEST_END (caps == NULL);
}
int
@ -173,18 +127,18 @@ main (int argc, char *argv[])
goto bla;
bla:
/* stupidity tests */
test_caps (gst_caps_new ("no_props", "audio/raw", NULL));
test_caps (gst_caps2_new_simple ("audio/raw", NULL));
/* all sorts of caps */
test_caps (GST_PAD_TEMPLATE_GET (caps1));
test_caps (GST_PAD_TEMPLATE_GET (caps2));
test_caps (GST_PAD_TEMPLATE_GET (caps3));
test_caps (GST_PAD_TEMPLATE_GET (caps4));
test_caps (GST_PAD_TEMPLATE_GET (caps5));
test_caps (GST_PAD_TEMPLATE_GET (caps6));
test_caps (GST_PAD_TEMPLATE_GET (caps7));
test_caps (GST_PAD_TEMPLATE_GET (caps8));
test_caps (GST_PAD_TEMPLATE_GET (caps9));
test_caps (gst_static_caps2_get (&caps1));
test_caps (gst_static_caps2_get (&caps2));
test_caps (gst_static_caps2_get (&caps3));
test_caps (gst_static_caps2_get (&caps4));
test_caps (gst_static_caps2_get (&caps5));
test_caps (gst_static_caps2_get (&caps6));
test_caps (gst_static_caps2_get (&caps7));
test_caps (gst_static_caps2_get (&caps8));
test_caps (gst_static_caps2_get (&caps9));
/* mime types */
test_string ("audio/raw");

View file

@ -1,26 +1,20 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT_RANGE (20,40),
"foo2", GST_PROPS_INT_RANGE (20,40),
"foo3", GST_PROPS_INT_RANGE (10,20)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=[20,40], "
"foo2:int=[20,40], "
"foo3:int=[10,20]"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT (30),
"foo2", GST_PROPS_INT_RANGE (20,30),
"foo3", GST_PROPS_INT_RANGE (20,30)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=30, "
"foo2:int=[20,30], "
"foo3:int=[20,30]"
);
int
@ -28,16 +22,17 @@ main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
GstCaps2 *caps;
gst_init (&argc, &argv);
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
caps = gst_caps_union (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
caps = gst_caps2_union (gst_static_caps2_get (&sinkcaps),
gst_static_caps2_get (&mp1parsecaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
xmlDocDump(stdout, doc);

View file

@ -25,7 +25,7 @@ gint
main (gint argc, gchar *argv[])
{
GstElement *pipeline;
gint i = 10000;
gint i = 1000;
gint step = 100;
free (malloc(8)); /* -lefence */

View file

@ -28,7 +28,7 @@ gint
main (gint argc, gchar *argv[])
{
GstElement *pipeline;
gint i = 10000;
gint i = 1000;
gint step = 100;
free (malloc(8)); /* -lefence */

View file

@ -11,7 +11,7 @@ main (gint argc, gchar *argv[])
gst_init (&argc, &argv);
i = 10000;
i = 1000;
pipeline = gst_pipeline_new ("main_pipeline");

View file

@ -3,7 +3,7 @@
int main(int argc,char *argv[])
{
GstElement *bin, *element;
gint i = 100000;
gint i = 1000;
gint step = 100;

View file

@ -13,7 +13,6 @@
*/
#include <gst/gst.h>
#include <gst/gstprops.h>
#include <property.h>
GstElement *
@ -43,9 +42,9 @@ main (int argc, char *argv[])
GstElement *pipeline = NULL;
GstElement *tee, *src, *sink1, *sink2;
GstPad *tee_src1, *tee_src2;
GstCaps *src_caps = NULL;
GstCaps *sink_caps = NULL;
GstProps *props = NULL;
GstCaps2 *src_caps = NULL;
GstCaps2 *sink_caps = NULL;
GstStructure *structure = NULL;
GstPad *pad = NULL;
/* init */
@ -100,46 +99,36 @@ main (int argc, char *argv[])
/* now we try setting caps on the src pad */
/* FIXME: should we set to pause here ? */
src_caps = GST_CAPS_NEW (
"input audio",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"rate", GST_PROPS_INT (44100)
);
src_caps = gst_caps2_from_string ("audio/raw, format:s=\"int\", "
"rate:i=44100");
g_assert (src_caps != NULL);
g_print ("Setting caps on fakesrc's src pad\n");
pad = gst_element_get_pad (src, "src");
if ((gst_pad_try_set_caps (pad, src_caps)) <= 0)
{
if ((gst_pad_try_set_caps (pad, src_caps)) <= 0) {
g_print ("Could not set caps !\n");
}
/* now iterate and see if it proxies caps ok */
gst_bin_iterate (GST_BIN (pipeline));
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink1, "sink"));
props = gst_caps_get_props (sink_caps);
if (! (gst_props_has_property (props, "rate")))
{
structure = gst_caps2_get_nth_cap (sink_caps, 0);
if (structure != NULL && ! (gst_structure_has_field (structure, "rate"))) {
g_print ("Hm, rate has not been propagated to sink1.\n");
return 1;
}
else
{
} else {
int rate;
gst_props_get (props, "rate", &rate, NULL);
gst_structure_get_int (structure, "rate", &rate);
g_print ("Rate of pad on sink1 : %d\n", rate);
}
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink2, "sink"));
props = gst_caps_get_props (sink_caps);
if (! (gst_props_has_property (props, "rate")))
{
structure = gst_caps2_get_nth_cap (sink_caps, 0);
if (structure != NULL && ! (gst_structure_has_field (structure, "rate"))) {
g_print ("Hm, rate has not been propagated to sink2.\n");
return 1;
}
else
{
} else {
int rate;
gst_props_get (props, "rate", &rate, NULL);
gst_structure_get_int (structure, "rate", &rate);
g_print ("Rate of pad on sink2 : %d\n", rate);
}

View file

@ -1,3 +1,4 @@
include ../Rules
plugin_LTLIBRARIES = libtestplugin.la libtestplugin2.la

View file

@ -1,7 +1,7 @@
TESTS_ENVIRONMENT=\
G_DEBUG=fatal_warnings \
GST_PLUGIN_PATH=$(top_builddir) \
GST_PLUGIN_PATH=$(top_builddir)/gst:. \
GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml

View file

@ -171,8 +171,8 @@ gst_bstest_class_init (GstBsTestClass * klass)
}
static GstCaps *
gst_bstest_getcaps (GstPad *pad, GstCaps *caps)
static GstCaps2 *
gst_bstest_getcaps (GstPad *pad, const GstCaps2 *caps)
{
GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad));
GstPad *otherpad;

View file

@ -1,116 +1,63 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1),
GST_PROPS_INT (2)
)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS(
"video/mpeg, "
"mpegtype:int={1,2}"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1)
)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS(
"video/mpeg, "
"mpegtype:int={1}"
);
GST_CAPS_FACTORY (rawcaps,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YV12\", \"YUY2\"}, "
"width:int=[16,4096], "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps2,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12"))
),
"height", GST_PROPS_INT_RANGE (16, 256)
)
GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YUY2\"}, "
"height:int=[16,256]"
);
GST_CAPS_FACTORY (rawcaps3,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YV12\", \"YUY2\"}, "
"height:int=[16,4096]"
);
/* these caps aren't used yet
GST_CAPS_FACTORY (rawcaps4,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
#if 0
/* these caps aren't used yet */
GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YV12\", \"YUYV\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps5,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS(
"video/raw, "
"fourcc:fourcc={\"YUYV\", \"YUY2\"}, "
"height:int=[16,4096]"
);
*/
#endif
GST_CAPS_FACTORY(rawcaps6,
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','V'))
)
)
GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS(
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YUYV\""
);
GST_CAPS_FACTORY(rawcaps7,
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2'))
)
)
GstStaticCaps2 rawcaps7 = GST_STATIC_CAPS(
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YV12\""
);
int
@ -121,43 +68,53 @@ main (int argc, char *argv[])
gst_init (&argc, &argv);
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&mp1parsecaps),
gst_static_caps2_get (&rawcaps));
g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&mp1parsecaps),
gst_static_caps2_get (&sinkcaps));
g_print ("4 <-> 1 == %d (valid, subset)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&sinkcaps),
gst_static_caps2_get (&mp1parsecaps));
g_print ("1 <-> 4 == %d (invalid, superset)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps2));
g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps3));
g_print ("2 <-> 5 == %d (valid)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps3),
gst_static_caps2_get (&rawcaps));
g_print ("5 <-> 2 == %d (invalid)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps2),
gst_static_caps2_get (&rawcaps3));
g_print ("3 <-> 5 == %d (valid)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps2),
gst_static_caps2_get (&rawcaps));
g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps));
g_print ("2 <-> 2 == %d (valid, same caps)\n", testret);
ret = ret + (testret == TRUE) ? 0 : 1;
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps6), GST_CAPS_GET (rawcaps7));
testret = gst_caps2_is_always_compatible (gst_static_caps2_get (&rawcaps6),
gst_static_caps2_get (&rawcaps7));
g_print ("6 <-> 7 == %d (invalid, second caps doesn't fit)\n", testret);
ret = ret + (testret == FALSE) ? 0 : 1;

View file

@ -22,9 +22,8 @@
gint
main (gint argc, gchar *argv[])
{
GstCaps *caps;
GstProps *props;
GstPropsEntry *entry;
#if 0
GstCaps2 *caps;
gst_init (&argc, &argv);
@ -80,6 +79,7 @@ main (gint argc, gchar *argv[])
/* caps too */
g_assert (GST_CAPS_IS_FIXED (caps));
#endif
return 0;
}

View file

@ -1,44 +1,40 @@
#include <gst/gst.h>
GST_CAPS_FACTORY (rawcaps1,
GST_CAPS_NEW (
"raw1_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
),
GST_CAPS_NEW (
"raw1_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
)
GstStaticCaps2 rawcaps1 = GST_STATIC_CAPS(
"video/x-raw-yuv, "
"fourcc:fourcc=\"YUYV\", "
"height:int=640, "
"width:int=480, "
"framerate:float=30.0; "
"video/x-raw-yuv, "
"fourcc:fourcc=\"I420\", "
"height:int=640, "
"width:int=480, "
"framerate:float=30.0"
);
int
main (int argc, char *argv[])
{
GstCaps *caps1;
GstCaps *caps2;
GstCaps *caps;
GstCaps2 *caps1;
GstCaps2 *caps2;
GstCaps2 *caps;
gst_init (&argc, &argv);
caps1 = GST_CAPS_GET (rawcaps1);
caps2 = gst_caps_copy_1 (GST_CAPS_GET (rawcaps1));
caps1 = gst_caps2_copy( gst_static_caps2_get (&rawcaps1));
caps2 = gst_caps2_copy_1 (gst_static_caps2_get (&rawcaps1));
gst_caps_set(caps1, "height", GST_PROPS_INT(640));
gst_caps_set(caps1, "width", GST_PROPS_INT(480));
gst_caps_set(caps1, "framerate", GST_PROPS_FLOAT(30.0));
#if 0
gst_caps2_set(caps1, "height", GST_PROPS_INT(640));
gst_caps2_set(caps1, "width", GST_PROPS_INT(480));
gst_caps2_set(caps1, "framerate", GST_PROPS_FLOAT(30.0));
#endif
caps = gst_caps_intersect(caps1, caps2);
caps = gst_caps2_intersect(caps1, caps2);
g_print("caps %s\n", gst_caps_to_string(caps));
g_print("caps %s\n", gst_caps2_to_string(caps));
if(caps == NULL)return 1;
if (gst_caps2_is_empty (caps)) return 1;
return 0;
}

View file

@ -1,103 +1,65 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT_RANGE (20,40),
"foo2", GST_PROPS_INT_RANGE (20,40),
"foo3", GST_PROPS_INT_RANGE (10,20)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=[20,40], "
"foo2:int=[20,40], "
"foo3:int=[10,20]"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT (30),
"foo2", GST_PROPS_INT_RANGE (20,30),
"foo3", GST_PROPS_INT_RANGE (20,30)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=30, "
"foo2:int=[20,30], "
"foo3:int=[20,30]"
);
GST_CAPS_FACTORY (rawcaps,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,4096], "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps2,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
)
GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS (
"video/raw, "
"height:int=[16,256], "
"depth:int=16"
);
GST_CAPS_FACTORY (rawcaps3,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YUY2\", \"YV12\" }, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps4,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YUY2\",\"YV12\",\"YUYV\" }, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps5,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps5 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YUYV\",\"YUY2\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (rawcaps6,
GST_CAPS_NEW (
"raw6_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
),
GST_CAPS_NEW (
"raw6_sink_caps",
"video/raw",
"fourcc", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"height", GST_PROPS_INT (640),
"width", GST_PROPS_INT (480),
"framerate",GST_PROPS_FLOAT (30.0)
)
GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc=\"YUYV\", "
"height:int=640, "
"width:int=480, "
"framerate:double=30.0; "
"video/raw, "
"fourcc:fourcc=\"I420\", "
"height:int=640, "
"width:int=480, "
"framerate:double=30.0; "
);
int
@ -105,7 +67,7 @@ main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
GstCaps2 *caps;
gst_init (&argc, &argv);
@ -115,32 +77,36 @@ main (int argc, char *argv[])
/*
g_mem_chunk_info ();
for (i = 0; i<100000; i++) {
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4));
gst_caps_unref (caps);
caps = gst_caps2_intersect (gst_static_caps2_get (rawcaps3), GST_CAPS_GET (rawcaps4));
gst_caps2_unref (caps);
}
g_mem_chunk_info ();
*/
caps = gst_caps_intersect (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
caps = gst_caps2_intersect (gst_static_caps2_get (&sinkcaps),
gst_static_caps2_get (&mp1parsecaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps),
gst_static_caps2_get (&rawcaps2));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps4));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps3),
gst_static_caps2_get (&rawcaps4));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps5));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps3),
gst_static_caps2_get (&rawcaps5));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_intersect (GST_CAPS_GET (rawcaps6),
gst_caps_copy_1(GST_CAPS_GET (rawcaps6)));
caps = gst_caps2_intersect (gst_static_caps2_get (&rawcaps6),
gst_caps2_copy_1(gst_static_caps2_get (&rawcaps6)));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
xmlDocDump(stdout, doc);

View file

@ -1,87 +1,46 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"foo1", GST_PROPS_INT_RANGE (20,40),
"foo2", GST_PROPS_INT_RANGE (20,40),
"foo3", GST_PROPS_INT_RANGE (10,20)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS (
"video/mpeg, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"foo1:int=[20,40], "
"foo2:int=[20,40], "
"foo3:int=[10,20]"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"foo4", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS (
"video/mpeg, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"foo4:fourcc={\"YV12\",\"YUY2\"}"
);
GST_CAPS_FACTORY (rawcaps,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
)
)
GstStaticCaps2 rawcaps = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,4096], "
"height:int=[16,4096], "
"fourcc:fourcc={\"YV12\",\"YUY2\"}"
);
GST_CAPS_FACTORY (rawcaps2,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
),
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
)
GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,256], "
"height:int=16; "
"video/raw, "
"width:int=[16,256], "
"height:int=16"
);
GST_CAPS_FACTORY (rawcaps3,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
),
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 256),
"depth", GST_PROPS_INT (16)
),
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS (
"video/raw, "
"width:int=[16,256], "
"height:int=16; "
"video/raw, "
"width:int=[16,256], "
"height:int=16; "
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}"
"height:int=[16,4096]"
);
/* defined, not used
@ -116,32 +75,32 @@ main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
GstCaps2 *caps;
gst_init (&argc, &argv);
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
caps = gst_caps_normalize (GST_CAPS_GET (sinkcaps));
caps = gst_caps2_normalize (gst_static_caps2_get (&sinkcaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (mp1parsecaps));
caps = gst_caps2_normalize (gst_static_caps2_get (&mp1parsecaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (rawcaps));
caps = gst_caps2_normalize (gst_static_caps2_get (&rawcaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (rawcaps2));
caps = gst_caps2_normalize (gst_static_caps2_get (&rawcaps2));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
caps = gst_caps_normalize (GST_CAPS_GET (rawcaps3));
caps = gst_caps2_normalize (gst_static_caps2_get (&rawcaps3));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
xmlDocDump(stdout, doc);

View file

@ -1,104 +1,60 @@
#include <gst/gst.h>
#include <string.h>
GST_CAPS_FACTORY (caps1,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1),
GST_PROPS_INT (2)
)
)
GstStaticCaps2 caps1 = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int={1,2}"
);
GST_CAPS_FACTORY (caps2,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT (1)
)
)
GstStaticCaps2 caps2 = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int={1}"
);
GST_CAPS_FACTORY (caps3,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps3 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"width:int=[16,4096], "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (caps4,
GST_CAPS_NEW (
"raw_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12"))
),
"height", GST_PROPS_INT_RANGE (16, 256)
)
GstStaticCaps2 caps4 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc=\"YV12\", "
"height:int=[16,256]"
);
GST_CAPS_FACTORY (caps5,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps5 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUY2\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (caps6,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps6 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YV12\",\"YUYV\"}, "
"height:int=[16,4096]"
);
GST_CAPS_FACTORY (caps7,
GST_CAPS_NEW (
"raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")),
GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
GstStaticCaps2 caps7 = GST_STATIC_CAPS (
"video/raw, "
"fourcc:fourcc={\"YVYV\",\"YUY2\"}, "
"height:int=[16,4096]"
);
GstStaticCaps2 caps8 = GST_STATIC_CAPS (
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YUYV\""
);
GstStaticCaps2 caps9 = GST_STATIC_CAPS (
"video/raw, "
"format:fourcc=\"I420\"; "
"video/raw, "
"format:fourcc=\"YV12\""
);
GST_CAPS_FACTORY(caps8,
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"videotestsrc_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','V'))
)
)
GST_CAPS_FACTORY(caps9,
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0'))
),
GST_CAPS_NEW (
"xvideosink_sink",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2'))
)
)
static gint test = 0;
static gint failures = 0;
@ -114,21 +70,19 @@ static gint failures = 0;
} \
}G_STMT_END
static void
test_caps_func (GstCaps *caps)
test_caps_func (const GstCaps2 *caps)
{
gchar *str1, *str2;
gboolean ret = FALSE;
str1 = gst_caps_to_string (caps);
gst_caps_unref (caps);
caps = gst_caps_from_string (str1);
str1 = gst_caps2_to_string (caps);
caps = gst_caps2_from_string (str1);
if (!caps) {
g_print ("%3d, INFO : no caps from %s\n", test, str1);
TEST_END (ret);
return;
}
str2 = gst_caps_to_string (caps);
gst_caps_unref (caps);
str2 = gst_caps2_to_string (caps);
g_print ("%3d, INFO : %s <==> %s\n", test, str1, str2);
ret = strcmp (str1, str2) == 0;
g_free (str1);
@ -136,7 +90,7 @@ test_caps_func (GstCaps *caps)
TEST_END (ret);
}
static void
test_caps (GstCaps *caps)
test_caps (const GstCaps2 *caps)
{
TEST_START;
test_caps_func (caps);
@ -144,11 +98,11 @@ test_caps (GstCaps *caps)
static void
test_string (gchar *str)
{
GstCaps *caps;
GstCaps2 *caps;
TEST_START;
g_print ("%3d, INFO : checking %s\n", test, str);
caps = gst_caps_from_string (str);
caps = gst_caps2_from_string (str);
if (!caps) {
g_print ("%3d, INFO : no caps from %s\n", test, str);
TEST_FAIL;
@ -159,11 +113,11 @@ test_string (gchar *str)
static void
test_string_fail (gchar *str)
{
GstCaps *caps;
GstCaps2 *caps;
TEST_START;
g_print ("%3d, INFO : checking %s for failure\n", test, str);
caps = gst_caps_from_string (str);
caps = gst_caps2_from_string (str);
TEST_END (caps == NULL);
}
int
@ -173,18 +127,18 @@ main (int argc, char *argv[])
goto bla;
bla:
/* stupidity tests */
test_caps (gst_caps_new ("no_props", "audio/raw", NULL));
test_caps (gst_caps2_new_simple ("audio/raw", NULL));
/* all sorts of caps */
test_caps (GST_PAD_TEMPLATE_GET (caps1));
test_caps (GST_PAD_TEMPLATE_GET (caps2));
test_caps (GST_PAD_TEMPLATE_GET (caps3));
test_caps (GST_PAD_TEMPLATE_GET (caps4));
test_caps (GST_PAD_TEMPLATE_GET (caps5));
test_caps (GST_PAD_TEMPLATE_GET (caps6));
test_caps (GST_PAD_TEMPLATE_GET (caps7));
test_caps (GST_PAD_TEMPLATE_GET (caps8));
test_caps (GST_PAD_TEMPLATE_GET (caps9));
test_caps (gst_static_caps2_get (&caps1));
test_caps (gst_static_caps2_get (&caps2));
test_caps (gst_static_caps2_get (&caps3));
test_caps (gst_static_caps2_get (&caps4));
test_caps (gst_static_caps2_get (&caps5));
test_caps (gst_static_caps2_get (&caps6));
test_caps (gst_static_caps2_get (&caps7));
test_caps (gst_static_caps2_get (&caps8));
test_caps (gst_static_caps2_get (&caps9));
/* mime types */
test_string ("audio/raw");

View file

@ -1,26 +1,20 @@
#include <gst/gst.h>
/* these caps all have a non empty intersection */
GST_CAPS_FACTORY (sinkcaps,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT_RANGE (20,40),
"foo2", GST_PROPS_INT_RANGE (20,40),
"foo3", GST_PROPS_INT_RANGE (10,20)
)
GstStaticCaps2 sinkcaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=[20,40], "
"foo2:int=[20,40], "
"foo3:int=[10,20]"
);
GST_CAPS_FACTORY (mp1parsecaps,
GST_CAPS_NEW (
"mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_INT (1),
"foo1", GST_PROPS_INT (30),
"foo2", GST_PROPS_INT_RANGE (20,30),
"foo3", GST_PROPS_INT_RANGE (20,30)
)
GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS (
"video/mpeg, "
"mpegtype:int=1, "
"foo1:int=30, "
"foo2:int=[20,30], "
"foo3:int=[20,30]"
);
int
@ -28,16 +22,17 @@ main (int argc, char *argv[])
{
xmlDocPtr doc;
xmlNodePtr parent;
GstCaps *caps;
GstCaps2 *caps;
gst_init (&argc, &argv);
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
caps = gst_caps_union (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
caps = gst_caps2_union (gst_static_caps2_get (&sinkcaps),
gst_static_caps2_get (&mp1parsecaps));
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
gst_caps_save_thyself (caps, parent);
gst_caps2_save_thyself (caps, parent);
xmlDocDump(stdout, doc);

View file

@ -25,7 +25,7 @@ gint
main (gint argc, gchar *argv[])
{
GstElement *pipeline;
gint i = 10000;
gint i = 1000;
gint step = 100;
free (malloc(8)); /* -lefence */

View file

@ -28,7 +28,7 @@ gint
main (gint argc, gchar *argv[])
{
GstElement *pipeline;
gint i = 10000;
gint i = 1000;
gint step = 100;
free (malloc(8)); /* -lefence */

View file

@ -11,7 +11,7 @@ main (gint argc, gchar *argv[])
gst_init (&argc, &argv);
i = 10000;
i = 1000;
pipeline = gst_pipeline_new ("main_pipeline");

View file

@ -3,7 +3,7 @@
int main(int argc,char *argv[])
{
GstElement *bin, *element;
gint i = 100000;
gint i = 1000;
gint step = 100;

View file

@ -13,7 +13,6 @@
*/
#include <gst/gst.h>
#include <gst/gstprops.h>
#include <property.h>
GstElement *
@ -43,9 +42,9 @@ main (int argc, char *argv[])
GstElement *pipeline = NULL;
GstElement *tee, *src, *sink1, *sink2;
GstPad *tee_src1, *tee_src2;
GstCaps *src_caps = NULL;
GstCaps *sink_caps = NULL;
GstProps *props = NULL;
GstCaps2 *src_caps = NULL;
GstCaps2 *sink_caps = NULL;
GstStructure *structure = NULL;
GstPad *pad = NULL;
/* init */
@ -100,46 +99,36 @@ main (int argc, char *argv[])
/* now we try setting caps on the src pad */
/* FIXME: should we set to pause here ? */
src_caps = GST_CAPS_NEW (
"input audio",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"rate", GST_PROPS_INT (44100)
);
src_caps = gst_caps2_from_string ("audio/raw, format:s=\"int\", "
"rate:i=44100");
g_assert (src_caps != NULL);
g_print ("Setting caps on fakesrc's src pad\n");
pad = gst_element_get_pad (src, "src");
if ((gst_pad_try_set_caps (pad, src_caps)) <= 0)
{
if ((gst_pad_try_set_caps (pad, src_caps)) <= 0) {
g_print ("Could not set caps !\n");
}
/* now iterate and see if it proxies caps ok */
gst_bin_iterate (GST_BIN (pipeline));
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink1, "sink"));
props = gst_caps_get_props (sink_caps);
if (! (gst_props_has_property (props, "rate")))
{
structure = gst_caps2_get_nth_cap (sink_caps, 0);
if (structure != NULL && ! (gst_structure_has_field (structure, "rate"))) {
g_print ("Hm, rate has not been propagated to sink1.\n");
return 1;
}
else
{
} else {
int rate;
gst_props_get (props, "rate", &rate, NULL);
gst_structure_get_int (structure, "rate", &rate);
g_print ("Rate of pad on sink1 : %d\n", rate);
}
sink_caps = gst_pad_get_caps (gst_element_get_pad (sink2, "sink"));
props = gst_caps_get_props (sink_caps);
if (! (gst_props_has_property (props, "rate")))
{
structure = gst_caps2_get_nth_cap (sink_caps, 0);
if (structure != NULL && ! (gst_structure_has_field (structure, "rate"))) {
g_print ("Hm, rate has not been propagated to sink2.\n");
return 1;
}
else
{
} else {
int rate;
gst_props_get (props, "rate", &rate, NULL);
gst_structure_get_int (structure, "rate", &rate);
g_print ("Rate of pad on sink2 : %d\n", rate);
}

View file

@ -1,3 +1,4 @@
include ../Rules
plugin_LTLIBRARIES = libtestplugin.la libtestplugin2.la