From e1eb5e2d92cbe2d072c95837c031762af1cc8239 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 21 Dec 2003 22:04:45 +0000 Subject: [PATCH] Fixes to get 'make check' working again. Original commit message from CVS: Fixes to get 'make check' working again. --- gst/gstcaps2.c | 13 ++++-- gst/gstpad.c | 4 +- gst/gstvalue.c | 3 +- tests/old/testsuite/bytestream/gstbstest.c | 2 +- tests/old/testsuite/caps/compatibility.c | 34 +++++++------- tests/old/testsuite/caps/intersection.c | 52 +++++++++++----------- tests/old/testsuite/caps/normalisation.c | 38 ++++++++-------- tests/old/testsuite/caps2/Makefile.am | 2 +- tests/old/testsuite/elements/tee.c | 9 +++- testsuite/bytestream/gstbstest.c | 2 +- testsuite/caps/compatibility.c | 34 +++++++------- testsuite/caps/intersection.c | 52 +++++++++++----------- testsuite/caps/normalisation.c | 38 ++++++++-------- testsuite/caps2/Makefile.am | 2 +- testsuite/elements/tee.c | 9 +++- 15 files changed, 157 insertions(+), 137 deletions(-) diff --git a/gst/gstcaps2.c b/gst/gstcaps2.c index be1e4cfc3e..ae7dd5a16d 100644 --- a/gst/gstcaps2.c +++ b/gst/gstcaps2.c @@ -600,6 +600,9 @@ gchar *gst_caps2_to_string (const GstCaps2 *caps) /* FIXME does this leak? */ + if (caps == NULL) { + return g_strdup("NULL"); + } if(gst_caps2_is_any(caps)){ return g_strdup("ANY"); } @@ -688,13 +691,17 @@ static void _gst_caps2_value_init (GValue *value) static void _gst_caps2_value_free (GValue *value) { - gst_caps2_free (value->data[0].v_pointer); + if (value->data[0].v_pointer) gst_caps2_free (value->data[0].v_pointer); } static void _gst_caps2_value_copy (const GValue *src, GValue *dest) { - gst_caps2_free (dest->data[0].v_pointer); - dest->data[0].v_pointer = gst_caps2_copy (src->data[0].v_pointer); + if (dest->data[0].v_pointer) { + gst_caps2_free (dest->data[0].v_pointer); + dest->data[0].v_pointer = gst_caps2_copy (src->data[0].v_pointer); + } else { + dest->data[0].v_pointer = NULL; + } } static gpointer _gst_caps2_value_peek_pointer (const GValue *value) diff --git a/gst/gstpad.c b/gst/gstpad.c index 9ac5c8b397..ab7e3d0857 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2689,7 +2689,9 @@ gst_pad_template_dispose (GObject *object) GstPadTemplate *templ = GST_PAD_TEMPLATE (object); g_free (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ)); - gst_caps2_free (GST_PAD_TEMPLATE_CAPS (templ)); + if (GST_PAD_TEMPLATE_CAPS (templ)) { + gst_caps2_free (GST_PAD_TEMPLATE_CAPS (templ)); + } G_OBJECT_CLASS (padtemplate_parent_class)->dispose (object); } diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 5baf724505..a2cc7e19d6 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -806,7 +806,8 @@ gst_value_intersect_list (GValue *dest, const GValue *value1, const GValue *valu } else { GValue temp = {0, }; - g_value_copy (&temp, dest); + g_value_init (&temp, G_VALUE_TYPE(dest)); + g_value_copy (dest, &temp); g_value_unset (dest); gst_value_list_concat (dest, &temp, &intersection); } diff --git a/tests/old/testsuite/bytestream/gstbstest.c b/tests/old/testsuite/bytestream/gstbstest.c index b47a0ffc32..b3264f5631 100644 --- a/tests/old/testsuite/bytestream/gstbstest.c +++ b/tests/old/testsuite/bytestream/gstbstest.c @@ -172,7 +172,7 @@ gst_bstest_class_init (GstBsTestClass * klass) } static GstCaps2 * -gst_bstest_getcaps (GstPad *pad, const GstCaps2 *caps) +gst_bstest_getcaps (GstPad *pad) { GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad)); GstPad *otherpad; diff --git a/tests/old/testsuite/caps/compatibility.c b/tests/old/testsuite/caps/compatibility.c index 0d31a84fd5..500267dbce 100644 --- a/tests/old/testsuite/caps/compatibility.c +++ b/tests/old/testsuite/caps/compatibility.c @@ -3,60 +3,60 @@ /* these caps all have a non empty intersection */ GstStaticCaps2 sinkcaps = GST_STATIC_CAPS( "video/mpeg, " - "mpegtype:int=(1,2)" + "mpegtype=(int)[1,2]" ); GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS( "video/mpeg, " - "mpegtype:int=(1)" + "mpegtype=(int)1" ); GstStaticCaps2 rawcaps = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YV12\", \"YUY2\"), " - "width:int=[16,4096], " - "height:int=[16,4096]" + "fourcc=(fourcc){YV12,YUY2}, " + "width=(int)[16,4096], " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YUY2\"), " - "height:int=[16,256]" + "fourcc=(fourcc)YUY2, " + "height=(int)[16,256]" ); GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YV12\", \"YUY2\"), " - "height:int=[16,4096]" + "fourcc=(fourcc){YV12,YUY2}, " + "height=(int)[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]" + "fourcc=(fourcc){\"YV12\", \"YUYV\"}, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YUYV\", \"YUY2\"), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUYV\", \"YUY2\"}, " + "height=(int)[16,4096]" ); #endif GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS( "video/raw, " - "format:fourcc=\"I420\"; " + "format=(fourcc)\"I420\"; " "video/raw, " - "format:fourcc=\"YUYV\"" + "format=(fourcc)\"YUYV\"" ); GstStaticCaps2 rawcaps7 = GST_STATIC_CAPS( "video/raw, " - "format:fourcc=\"I420\"; " + "format=(fourcc)\"I420\"; " "video/raw, " - "format:fourcc=\"YV12\"" + "format=(fourcc)\"YV12\"" ); diff --git a/tests/old/testsuite/caps/intersection.c b/tests/old/testsuite/caps/intersection.c index c13edfe3ca..536042b8cf 100644 --- a/tests/old/testsuite/caps/intersection.c +++ b/tests/old/testsuite/caps/intersection.c @@ -3,63 +3,63 @@ /* these caps all have a non empty intersection */ GstStaticCaps2 sinkcaps = GST_STATIC_CAPS ( "video/mpeg, " - "mpegtype:int=1, " - "foo1:int=[20,40], " - "foo2:int=[20,40], " - "foo3:int=[10,20]" + "mpegtype=(int)1, " + "foo1=(int)[20,40], " + "foo2=(int)[20,40], " + "foo3=(int)[10,20]" ); GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS ( "video/mpeg, " - "mpegtype:int=1, " - "foo1:int=30, " - "foo2:int=[20,30], " - "foo3:int=[20,30]" + "mpegtype=(int)1, " + "foo1=(int)30, " + "foo2=(int)[20,30], " + "foo3=(int)[20,30]" ); GstStaticCaps2 rawcaps = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,4096], " - "height:int=[16,4096]" + "width=(int)[16,4096], " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS ( "video/raw, " - "height:int=[16,256], " - "depth:int=16" + "height=(int)[16,256], " + "depth=(int)16" ); GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=(\"YUY2\", \"YV12\" ), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUY2\", \"YV12\" }, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=(\"YUY2\",\"YV12\",\"YUYV\" ), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUY2\",\"YV12\",\"YUYV\" }, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps5 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=(\"YUYV\",\"YUY2\"), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUYV\",\"YUY2\"}, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=\"YUYV\", " - "height:int=640, " - "width:int=480, " - "framerate:double=30.0; " + "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; " + "fourcc=(fourcc)\"I420\", " + "height=(int)640, " + "width=(int)480, " + "framerate=(double)30.0" ); int diff --git a/tests/old/testsuite/caps/normalisation.c b/tests/old/testsuite/caps/normalisation.c index 59bf468382..3aab16964f 100644 --- a/tests/old/testsuite/caps/normalisation.c +++ b/tests/old/testsuite/caps/normalisation.c @@ -3,44 +3,44 @@ /* these caps all have a non empty intersection */ GstStaticCaps2 sinkcaps = GST_STATIC_CAPS ( "video/mpeg, " - "fourcc:fourcc={\"YV12\",\"YUY2\"}, " - "foo1:int=[20,40], " - "foo2:int=[20,40], " - "foo3:int=[10,20]" + "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " + "foo1=(int)[20,40], " + "foo2=(int)[20,40], " + "foo3=(int)[10,20]" ); GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS ( "video/mpeg, " - "fourcc:fourcc={\"YV12\",\"YUY2\"}, " - "foo4:fourcc={\"YV12\",\"YUY2\"}" + "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " + "foo4=(fourcc){\"YV12\",\"YUY2\"}" ); GstStaticCaps2 rawcaps = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,4096], " - "height:int=[16,4096], " - "fourcc:fourcc={\"YV12\",\"YUY2\"}" + "width=(int)[16,4096], " + "height=(int)[16,4096], " + "fourcc=(fourcc){\"YV12\",\"YUY2\"}" ); GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,256], " - "height:int=16; " + "width=(int)[16,256], " + "height=(int)16; " "video/raw, " - "width:int=[16,256], " - "height:int=16" + "width=(int)[16,256], " + "height=(int)16" ); GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,256], " - "height:int=16; " + "width=(int)[16,256], " + "height=(int)16; " "video/raw, " - "width:int=[16,256], " - "height:int=16; " + "width=(int)[16,256], " + "height=(int)16; " "video/raw, " - "fourcc:fourcc={\"YV12\",\"YUY2\"}" - "height:int=[16,4096]" + "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " + "height=(int)[16,4096]" ); /* defined, not used diff --git a/tests/old/testsuite/caps2/Makefile.am b/tests/old/testsuite/caps2/Makefile.am index c6b4aa8364..aed6e2bc96 100644 --- a/tests/old/testsuite/caps2/Makefile.am +++ b/tests/old/testsuite/caps2/Makefile.am @@ -2,7 +2,7 @@ include ../Rules tests_pass = \ - value_compare value_intersect caps structure + value_compare value_intersect caps tests_fail = diff --git a/tests/old/testsuite/elements/tee.c b/tests/old/testsuite/elements/tee.c index ca82f3cc11..3faf35401b 100644 --- a/tests/old/testsuite/elements/tee.c +++ b/tests/old/testsuite/elements/tee.c @@ -112,8 +112,13 @@ main (int argc, char *argv[]) /* 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")); - structure = gst_caps2_get_nth_cap (sink_caps, 0); - if (structure != NULL && ! (gst_structure_has_field (structure, "rate"))) { + if (sink_caps && gst_caps2_is_fixed (sink_caps)) { + structure = gst_caps2_get_nth_cap (sink_caps, 0); + }else { + structure = NULL; + g_print ("sink_caps is not fixed\n"); + } + if (structure == NULL || !(gst_structure_has_field (structure, "rate"))) { g_print ("Hm, rate has not been propagated to sink1.\n"); return 1; } else { diff --git a/testsuite/bytestream/gstbstest.c b/testsuite/bytestream/gstbstest.c index b47a0ffc32..b3264f5631 100644 --- a/testsuite/bytestream/gstbstest.c +++ b/testsuite/bytestream/gstbstest.c @@ -172,7 +172,7 @@ gst_bstest_class_init (GstBsTestClass * klass) } static GstCaps2 * -gst_bstest_getcaps (GstPad *pad, const GstCaps2 *caps) +gst_bstest_getcaps (GstPad *pad) { GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad)); GstPad *otherpad; diff --git a/testsuite/caps/compatibility.c b/testsuite/caps/compatibility.c index 0d31a84fd5..500267dbce 100644 --- a/testsuite/caps/compatibility.c +++ b/testsuite/caps/compatibility.c @@ -3,60 +3,60 @@ /* these caps all have a non empty intersection */ GstStaticCaps2 sinkcaps = GST_STATIC_CAPS( "video/mpeg, " - "mpegtype:int=(1,2)" + "mpegtype=(int)[1,2]" ); GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS( "video/mpeg, " - "mpegtype:int=(1)" + "mpegtype=(int)1" ); GstStaticCaps2 rawcaps = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YV12\", \"YUY2\"), " - "width:int=[16,4096], " - "height:int=[16,4096]" + "fourcc=(fourcc){YV12,YUY2}, " + "width=(int)[16,4096], " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YUY2\"), " - "height:int=[16,256]" + "fourcc=(fourcc)YUY2, " + "height=(int)[16,256]" ); GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YV12\", \"YUY2\"), " - "height:int=[16,4096]" + "fourcc=(fourcc){YV12,YUY2}, " + "height=(int)[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]" + "fourcc=(fourcc){\"YV12\", \"YUYV\"}, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS( "video/raw, " - "fourcc:fourcc=(\"YUYV\", \"YUY2\"), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUYV\", \"YUY2\"}, " + "height=(int)[16,4096]" ); #endif GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS( "video/raw, " - "format:fourcc=\"I420\"; " + "format=(fourcc)\"I420\"; " "video/raw, " - "format:fourcc=\"YUYV\"" + "format=(fourcc)\"YUYV\"" ); GstStaticCaps2 rawcaps7 = GST_STATIC_CAPS( "video/raw, " - "format:fourcc=\"I420\"; " + "format=(fourcc)\"I420\"; " "video/raw, " - "format:fourcc=\"YV12\"" + "format=(fourcc)\"YV12\"" ); diff --git a/testsuite/caps/intersection.c b/testsuite/caps/intersection.c index c13edfe3ca..536042b8cf 100644 --- a/testsuite/caps/intersection.c +++ b/testsuite/caps/intersection.c @@ -3,63 +3,63 @@ /* these caps all have a non empty intersection */ GstStaticCaps2 sinkcaps = GST_STATIC_CAPS ( "video/mpeg, " - "mpegtype:int=1, " - "foo1:int=[20,40], " - "foo2:int=[20,40], " - "foo3:int=[10,20]" + "mpegtype=(int)1, " + "foo1=(int)[20,40], " + "foo2=(int)[20,40], " + "foo3=(int)[10,20]" ); GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS ( "video/mpeg, " - "mpegtype:int=1, " - "foo1:int=30, " - "foo2:int=[20,30], " - "foo3:int=[20,30]" + "mpegtype=(int)1, " + "foo1=(int)30, " + "foo2=(int)[20,30], " + "foo3=(int)[20,30]" ); GstStaticCaps2 rawcaps = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,4096], " - "height:int=[16,4096]" + "width=(int)[16,4096], " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS ( "video/raw, " - "height:int=[16,256], " - "depth:int=16" + "height=(int)[16,256], " + "depth=(int)16" ); GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=(\"YUY2\", \"YV12\" ), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUY2\", \"YV12\" }, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps4 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=(\"YUY2\",\"YV12\",\"YUYV\" ), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUY2\",\"YV12\",\"YUYV\" }, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps5 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=(\"YUYV\",\"YUY2\"), " - "height:int=[16,4096]" + "fourcc=(fourcc){\"YUYV\",\"YUY2\"}, " + "height=(int)[16,4096]" ); GstStaticCaps2 rawcaps6 = GST_STATIC_CAPS ( "video/raw, " - "fourcc:fourcc=\"YUYV\", " - "height:int=640, " - "width:int=480, " - "framerate:double=30.0; " + "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; " + "fourcc=(fourcc)\"I420\", " + "height=(int)640, " + "width=(int)480, " + "framerate=(double)30.0" ); int diff --git a/testsuite/caps/normalisation.c b/testsuite/caps/normalisation.c index 59bf468382..3aab16964f 100644 --- a/testsuite/caps/normalisation.c +++ b/testsuite/caps/normalisation.c @@ -3,44 +3,44 @@ /* these caps all have a non empty intersection */ GstStaticCaps2 sinkcaps = GST_STATIC_CAPS ( "video/mpeg, " - "fourcc:fourcc={\"YV12\",\"YUY2\"}, " - "foo1:int=[20,40], " - "foo2:int=[20,40], " - "foo3:int=[10,20]" + "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " + "foo1=(int)[20,40], " + "foo2=(int)[20,40], " + "foo3=(int)[10,20]" ); GstStaticCaps2 mp1parsecaps = GST_STATIC_CAPS ( "video/mpeg, " - "fourcc:fourcc={\"YV12\",\"YUY2\"}, " - "foo4:fourcc={\"YV12\",\"YUY2\"}" + "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " + "foo4=(fourcc){\"YV12\",\"YUY2\"}" ); GstStaticCaps2 rawcaps = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,4096], " - "height:int=[16,4096], " - "fourcc:fourcc={\"YV12\",\"YUY2\"}" + "width=(int)[16,4096], " + "height=(int)[16,4096], " + "fourcc=(fourcc){\"YV12\",\"YUY2\"}" ); GstStaticCaps2 rawcaps2 = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,256], " - "height:int=16; " + "width=(int)[16,256], " + "height=(int)16; " "video/raw, " - "width:int=[16,256], " - "height:int=16" + "width=(int)[16,256], " + "height=(int)16" ); GstStaticCaps2 rawcaps3 = GST_STATIC_CAPS ( "video/raw, " - "width:int=[16,256], " - "height:int=16; " + "width=(int)[16,256], " + "height=(int)16; " "video/raw, " - "width:int=[16,256], " - "height:int=16; " + "width=(int)[16,256], " + "height=(int)16; " "video/raw, " - "fourcc:fourcc={\"YV12\",\"YUY2\"}" - "height:int=[16,4096]" + "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " + "height=(int)[16,4096]" ); /* defined, not used diff --git a/testsuite/caps2/Makefile.am b/testsuite/caps2/Makefile.am index c6b4aa8364..aed6e2bc96 100644 --- a/testsuite/caps2/Makefile.am +++ b/testsuite/caps2/Makefile.am @@ -2,7 +2,7 @@ include ../Rules tests_pass = \ - value_compare value_intersect caps structure + value_compare value_intersect caps tests_fail = diff --git a/testsuite/elements/tee.c b/testsuite/elements/tee.c index ca82f3cc11..3faf35401b 100644 --- a/testsuite/elements/tee.c +++ b/testsuite/elements/tee.c @@ -112,8 +112,13 @@ main (int argc, char *argv[]) /* 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")); - structure = gst_caps2_get_nth_cap (sink_caps, 0); - if (structure != NULL && ! (gst_structure_has_field (structure, "rate"))) { + if (sink_caps && gst_caps2_is_fixed (sink_caps)) { + structure = gst_caps2_get_nth_cap (sink_caps, 0); + }else { + structure = NULL; + g_print ("sink_caps is not fixed\n"); + } + if (structure == NULL || !(gst_structure_has_field (structure, "rate"))) { g_print ("Hm, rate has not been propagated to sink1.\n"); return 1; } else {