X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Fcheck%2Fgst%2Fgstcaps.c;h=a0090a2a97a7d133a8f229c0f6a3c9fff93add84;hb=67931bfded47e1b8fe733161b5f30af45dd26dc0;hp=ab18800fec912ee7800abb476687269f742763ea;hpb=e01b5c0f46ddb4324dabed730cb54742b254b2ea;p=platform%2Fupstream%2Fgstreamer.git diff --git a/tests/check/gst/gstcaps.c b/tests/check/gst/gstcaps.c index ab18800..a0090a2 100644 --- a/tests/check/gst/gstcaps.c +++ b/tests/check/gst/gstcaps.c @@ -59,7 +59,7 @@ GST_START_TEST (test_double_append) GstCaps *c1; c1 = gst_caps_new_any (); - s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL); + s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL); gst_caps_append_structure (c1, s1); ASSERT_CRITICAL (gst_caps_append_structure (c1, s1)); @@ -75,7 +75,7 @@ GST_START_TEST (test_mutability) gint ret; c1 = gst_caps_new_any (); - s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL); + s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL); gst_structure_set (s1, "rate", G_TYPE_INT, 48000, NULL); gst_caps_append_structure (c1, s1); gst_structure_set (s1, "rate", G_TYPE_INT, 22500, NULL); @@ -100,7 +100,7 @@ GST_END_TEST; GST_START_TEST (test_static_caps) { - static GstStaticCaps scaps = GST_STATIC_CAPS ("audio/x-raw-int,rate=44100"); + static GstStaticCaps scaps = GST_STATIC_CAPS ("audio/x-raw,rate=44100"); GstCaps *caps1; GstCaps *caps2; @@ -125,142 +125,92 @@ GST_START_TEST (test_static_caps) GST_END_TEST; static const gchar non_simple_caps_string[] = - "video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)[ 1/100, 100 ], " - "width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw-yuv, " - "format=(fourcc)YUY2, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " - "height=(int)[ 16, 4096 ]; video/x-raw-rgb, bpp=(int)8, depth=(int)8, " - "endianness=(int)1234, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " - "height=(int)[ 16, 4096 ]; video/x-raw-yuv, " - "format=(fourcc){ I420, YUY2, YV12 }, width=(int)[ 16, 4096 ], " + "video/x-raw, format=(string)I420, framerate=(fraction)[ 1/100, 100 ], " + "width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw, " + "format=(string)YUY2, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " + "height=(int)[ 16, 4096 ]; video/x-raw, format=(string)RGB8_PALETTED, " + "framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " + "height=(int)[ 16, 4096 ]; video/x-raw, " + "format=(string){ I420, YUY2, YV12 }, width=(int)[ 16, 4096 ], " "height=(int)[ 16, 4096 ], framerate=(fraction)[ 1/100, 100 ]"; static gboolean -check_fourcc_list (const GValue * format_value) +check_string_list (const GValue * format_value) { - const GValue *fourcc_value; + const GValue *string_value; + gboolean got_rgb8 = FALSE; gboolean got_yv12 = FALSE; gboolean got_i420 = FALSE; gboolean got_yuy2 = FALSE; - guint32 fourcc; - - fourcc_value = gst_value_list_get_value (format_value, 0); - fail_unless (fourcc_value != NULL); - fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value)); - fourcc = gst_value_get_fourcc (fourcc_value); - fail_unless (fourcc != 0); - got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420")); - got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2")); - got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12")); - - fourcc_value = gst_value_list_get_value (format_value, 1); - fail_unless (fourcc_value != NULL); - fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value)); - fourcc = gst_value_get_fourcc (fourcc_value); - fail_unless (fourcc != 0); - got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420")); - got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2")); - got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12")); - - fourcc_value = gst_value_list_get_value (format_value, 2); - fail_unless (fourcc_value != NULL); - fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value)); - fourcc = gst_value_get_fourcc (fourcc_value); - fail_unless (fourcc != 0); - got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420")); - got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2")); - got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12")); - - return (got_i420 && got_yuy2 && got_yv12); + const gchar *string; + + string_value = gst_value_list_get_value (format_value, 0); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + string_value = gst_value_list_get_value (format_value, 1); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + string_value = gst_value_list_get_value (format_value, 2); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + string_value = gst_value_list_get_value (format_value, 3); + fail_unless (string_value != NULL); + fail_unless (G_VALUE_HOLDS_STRING (string_value)); + string = g_value_get_string (string_value); + fail_unless (string != NULL); + got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED")); + got_i420 = got_i420 || (g_str_equal (string, "I420")); + got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2")); + got_yv12 = got_yv12 || (g_str_equal (string, "YV12")); + + return (got_rgb8 && got_i420 && got_yuy2 && got_yv12); } GST_START_TEST (test_simplify) { - GstStructure *s1, *s2; - gboolean did_simplify; + GstStructure *s1; GstCaps *caps; caps = gst_caps_from_string (non_simple_caps_string); fail_unless (caps != NULL, "gst_caps_from_string (non_simple_caps_string) failed"); - did_simplify = gst_caps_do_simplify (caps); - fail_unless (did_simplify == TRUE, - "gst_caps_do_simplify() should have worked"); + caps = gst_caps_simplify (caps); + fail_unless (caps != NULL, "gst_caps_simplify() should have worked"); /* check simplified caps, should be: * - * video/x-raw-rgb, bpp=(int)8, depth=(int)8, endianness=(int)1234, - * framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], - * height=(int)[ 16, 4096 ]; - * video/x-raw-yuv, format=(fourcc){ YV12, YUY2, I420 }, + * video/x-raw, format=(string){ RGB8_PALETTED, YV12, YUY2, I420 }, * width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], * framerate=(fraction)[ 1/100, 100 ] */ - fail_unless (gst_caps_get_size (caps) == 2); + GST_DEBUG ("simplyfied %" GST_PTR_FORMAT, caps); + fail_unless (gst_caps_get_size (caps) == 1); s1 = gst_caps_get_structure (caps, 0); - s2 = gst_caps_get_structure (caps, 1); fail_unless (s1 != NULL); - fail_unless (s2 != NULL); - - if (!gst_structure_has_name (s1, "video/x-raw-rgb")) { - GstStructure *tmp; - - tmp = s1; - s1 = s2; - s2 = tmp; - } - - fail_unless (gst_structure_has_name (s1, "video/x-raw-rgb")); - { - const GValue *framerate_value; - const GValue *width_value; - const GValue *height_value; - const GValue *val_fps; - GValue test_fps = { 0, }; - gint bpp, depth, endianness; - gint min_width, max_width; - gint min_height, max_height; - - fail_unless (gst_structure_get_int (s1, "bpp", &bpp)); - fail_unless (bpp == 8); - - fail_unless (gst_structure_get_int (s1, "depth", &depth)); - fail_unless (depth == 8); - - fail_unless (gst_structure_get_int (s1, "endianness", &endianness)); - fail_unless (endianness == G_LITTLE_ENDIAN); - - g_value_init (&test_fps, GST_TYPE_FRACTION); - framerate_value = gst_structure_get_value (s1, "framerate"); - fail_unless (framerate_value != NULL); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (framerate_value)); - - val_fps = gst_value_get_fraction_range_min (framerate_value); - gst_value_set_fraction (&test_fps, 1, 100); - fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); - - val_fps = gst_value_get_fraction_range_max (framerate_value); - gst_value_set_fraction (&test_fps, 100, 1); - fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); - - g_value_unset (&test_fps); - - width_value = gst_structure_get_value (s1, "width"); - fail_unless (width_value != NULL); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (width_value)); - min_width = gst_value_get_int_range_min (width_value); - max_width = gst_value_get_int_range_max (width_value); - fail_unless (min_width == 16 && max_width == 4096); - - height_value = gst_structure_get_value (s1, "height"); - fail_unless (height_value != NULL); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (height_value)); - min_height = gst_value_get_int_range_min (height_value); - max_height = gst_value_get_int_range_max (height_value); - fail_unless (min_height == 16 && max_height == 4096); - } - fail_unless (gst_structure_has_name (s2, "video/x-raw-yuv")); + fail_unless (gst_structure_has_name (s1, "video/x-raw")); { const GValue *framerate_value; const GValue *format_value; @@ -271,14 +221,14 @@ GST_START_TEST (test_simplify) gint min_width, max_width; gint min_height, max_height; - format_value = gst_structure_get_value (s2, "format"); + format_value = gst_structure_get_value (s1, "format"); fail_unless (format_value != NULL); fail_unless (GST_VALUE_HOLDS_LIST (format_value)); - fail_unless (gst_value_list_get_size (format_value) == 3); - fail_unless (check_fourcc_list (format_value) == TRUE); + fail_unless (gst_value_list_get_size (format_value) == 4); + fail_unless (check_string_list (format_value) == TRUE); g_value_init (&test_fps, GST_TYPE_FRACTION); - framerate_value = gst_structure_get_value (s2, "framerate"); + framerate_value = gst_structure_get_value (s1, "framerate"); fail_unless (framerate_value != NULL); fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (framerate_value)); @@ -292,14 +242,14 @@ GST_START_TEST (test_simplify) g_value_unset (&test_fps); - width_value = gst_structure_get_value (s2, "width"); + width_value = gst_structure_get_value (s1, "width"); fail_unless (width_value != NULL); fail_unless (GST_VALUE_HOLDS_INT_RANGE (width_value)); min_width = gst_value_get_int_range_min (width_value); max_width = gst_value_get_int_range_max (width_value); fail_unless (min_width == 16 && max_width == 4096); - height_value = gst_structure_get_value (s2, "height"); + height_value = gst_structure_get_value (s1, "height"); fail_unless (height_value != NULL); fail_unless (GST_VALUE_HOLDS_INT_RANGE (height_value)); min_height = gst_value_get_int_range_min (height_value); @@ -320,7 +270,7 @@ GST_START_TEST (test_truncate) fail_unless (caps != NULL, "gst_caps_from_string (non_simple_caps_string) failed"); fail_unless_equals_int (gst_caps_get_size (caps), 4); - gst_caps_truncate (caps); + caps = gst_caps_truncate (caps); fail_unless_equals_int (gst_caps_get_size (caps), 1); gst_caps_unref (caps); } @@ -331,24 +281,23 @@ GST_START_TEST (test_subset) { GstCaps *c1, *c2; - c1 = gst_caps_from_string ("video/x-raw-yuv; video/x-raw-rgb"); - c2 = gst_caps_from_string ("video/x-raw-yuv, format=(fourcc)YUY2"); + c1 = gst_caps_from_string ("video/x-raw; video/x-raw"); + c2 = gst_caps_from_string ("video/x-raw, format=(string)YUY2"); fail_unless (gst_caps_is_subset (c2, c1)); fail_if (gst_caps_is_subset (c1, c2)); gst_caps_unref (c1); gst_caps_unref (c2); c1 = gst_caps_from_string - ("audio/x-raw-int, channels=(int)[ 1, 2 ], rate=(int)44100"); - c2 = gst_caps_from_string - ("audio/x-raw-int, channels=(int)1, rate=(int)44100"); + ("audio/x-raw, channels=(int)[ 1, 2 ], rate=(int)44100"); + c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1, rate=(int)44100"); fail_unless (gst_caps_is_subset (c2, c1)); fail_if (gst_caps_is_subset (c1, c2)); gst_caps_unref (c1); gst_caps_unref (c2); - c1 = gst_caps_from_string ("audio/x-raw-int, channels=(int) {1}"); - c2 = gst_caps_from_string ("audio/x-raw-int, channels=(int)1"); + c1 = gst_caps_from_string ("audio/x-raw, channels=(int) {1}"); + c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1"); fail_unless (gst_caps_is_subset (c2, c1)); fail_unless (gst_caps_is_subset (c1, c2)); fail_unless (gst_caps_is_equal (c1, c2)); @@ -356,9 +305,9 @@ GST_START_TEST (test_subset) gst_caps_unref (c2); c1 = gst_caps_from_string - ("audio/x-raw-int, rate=(int)44100, channels=(int)3, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)false"); + ("audio/x-raw, rate=(int)44100, channels=(int)3, format=(string)U16_LE"); c2 = gst_caps_from_string - ("audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int)16, depth=(int)[ 1, 16 ], signed=(boolean){ true, false }"); + ("audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], format=(string){ S16_LE, U16_LE }"); fail_unless (gst_caps_is_subset (c1, c2)); fail_if (gst_caps_is_subset (c2, c1)); gst_caps_unref (c1); @@ -372,36 +321,36 @@ GST_START_TEST (test_merge_fundamental) GstCaps *c1, *c2; /* ANY + specific = ANY */ - c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100"); + c1 = gst_caps_from_string ("audio/x-raw,rate=44100"); c2 = gst_caps_new_any (); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 0, NULL); fail_unless (gst_caps_is_any (c2), NULL); gst_caps_unref (c2); /* specific + ANY = ANY */ - c2 = gst_caps_from_string ("audio/x-raw-int,rate=44100"); + c2 = gst_caps_from_string ("audio/x-raw,rate=44100"); c1 = gst_caps_new_any (); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 0, NULL); fail_unless (gst_caps_is_any (c2), NULL); gst_caps_unref (c2); /* EMPTY + specific = specific */ - c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100"); + c1 = gst_caps_from_string ("audio/x-raw,rate=44100"); c2 = gst_caps_new_empty (); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); fail_if (gst_caps_is_empty (c2), NULL); gst_caps_unref (c2); /* specific + EMPTY = specific */ - c2 = gst_caps_from_string ("audio/x-raw-int,rate=44100"); + c2 = gst_caps_from_string ("audio/x-raw,rate=44100"); c1 = gst_caps_new_empty (); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); fail_if (gst_caps_is_empty (c2), NULL); @@ -415,48 +364,48 @@ GST_START_TEST (test_merge_same) GstCaps *c1, *c2, *test; /* this is the same */ - c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1"); - c2 = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1"); - gst_caps_merge (c2, c1); + c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); + c2 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); - test = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1"); + test = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (test); gst_caps_unref (c2); /* and so is this */ - c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1"); - c2 = gst_caps_from_string ("audio/x-raw-int,channels=1,rate=44100"); - gst_caps_merge (c2, c1); + c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1"); + c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); gst_caps_unref (c2); c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AABB"); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); gst_caps_unref (c2); c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AABB"); c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); gst_caps_unref (c2); c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); c2 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); gst_caps_unref (c2); c1 = gst_caps_from_string ("video/x-foo, data=(buffer)AA"); c2 = gst_caps_from_string ("video/x-bar, data=(buffer)AA"); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); gst_caps_unref (c2); @@ -469,146 +418,144 @@ GST_START_TEST (test_merge_subset) GstCaps *c1, *c2, *test; /* the 2nd is already covered */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=1"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=1"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]"); + test = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); /* here it is not */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=1,rate=44100"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2],rate=44100"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels=[1,2],rate=44100"); + test = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); /* second one was already contained in the first one */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,3]"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,3]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels=[1,3]"); + test = gst_caps_from_string ("audio/x-raw,channels=[1,3]"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); /* second one was already contained in the first one */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]"); + test = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); /* second one was already contained in the first one */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=[2,4]"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[2,4]"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]"); + test = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); /* second one was already contained in the first one */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=[2,3]"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[2,3]"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]"); + test = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); /* these caps cannot be merged */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=[2,3]"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=[2,3]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,4]"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); test = gst_caps_from_string - ("audio/x-raw-int,channels=[2,3];audio/x-raw-int,channels=[1,4]"); + ("audio/x-raw,channels=[2,3];audio/x-raw,channels=[1,4]"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); /* these caps cannot be merged */ - c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,3]"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]"); + c1 = gst_caps_from_string ("audio/x-raw,channels=[1,3]"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); test = gst_caps_from_string - ("audio/x-raw-int,channels=[1,2];audio/x-raw-int,channels=[1,3]"); + ("audio/x-raw,channels=[1,2];audio/x-raw,channels=[1,3]"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); - c2 = gst_caps_from_string ("audio/x-raw-int,channels={1,2}"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels={1,2,3,4}"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}"); + c1 = gst_caps_from_string ("audio/x-raw,channels={1,2,3,4}"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels={1,2};" - "audio/x-raw-int,channels={1,2,3,4}"); + test = gst_caps_from_string ("audio/x-raw,channels={1,2};" + "audio/x-raw,channels={1,2,3,4}"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); - c2 = gst_caps_from_string ("audio/x-raw-int,channels={1,2}"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels={1,3}"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}"); + c1 = gst_caps_from_string ("audio/x-raw,channels={1,3}"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels={1,2};" - "audio/x-raw-int,channels={1,3}"); + test = gst_caps_from_string ("audio/x-raw,channels={1,2};" + "audio/x-raw,channels={1,3}"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); - c2 = gst_caps_from_string - ("video/x-raw-yuv, framerate=(fraction){ 15/2, 5/1 }"); - c1 = gst_caps_from_string - ("video/x-raw-yuv, framerate=(fraction){ 15/1, 5/1 }"); + c2 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/2, 5/1 }"); + c1 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/1, 5/1 }"); test = gst_caps_copy (c1); - gst_caps_merge (c2, c1); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_is_subset (test, c2)); gst_caps_unref (test); gst_caps_unref (c2); - c2 = gst_caps_from_string ("audio/x-raw-int"); - c1 = gst_caps_from_string ("audio/x-raw-int,channels=1"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw"); + c1 = gst_caps_from_string ("audio/x-raw,channels=1"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 1, NULL); - test = gst_caps_from_string ("audio/x-raw-int"); + test = gst_caps_from_string ("audio/x-raw"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); - c2 = gst_caps_from_string ("audio/x-raw-int,channels=1"); - c1 = gst_caps_from_string ("audio/x-raw-int"); - gst_caps_merge (c2, c1); + c2 = gst_caps_from_string ("audio/x-raw,channels=1"); + c1 = gst_caps_from_string ("audio/x-raw"); + c2 = gst_caps_merge (c2, c1); GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2); fail_unless (gst_caps_get_size (c2) == 2, NULL); - test = gst_caps_from_string ("audio/x-raw-int,channels=1; audio/x-raw-int"); + test = gst_caps_from_string ("audio/x-raw,channels=1; audio/x-raw"); fail_unless (gst_caps_is_equal (c2, test)); gst_caps_unref (c2); gst_caps_unref (test); @@ -623,14 +570,14 @@ GST_START_TEST (test_intersect) /* field not specified = any value possible, so the intersection * should keep fields which are only part of one set of caps */ - c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20"); - c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420"); + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw,format=(string)I420"); ci1 = gst_caps_intersect (c2, c1); GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); fail_unless (gst_caps_get_size (ci1) == 1, NULL); s = gst_caps_get_structure (ci1, 0); - fail_unless (gst_structure_has_name (s, "video/x-raw-yuv")); + fail_unless (gst_structure_has_name (s, "video/x-raw")); fail_unless (gst_structure_get_value (s, "format") != NULL); fail_unless (gst_structure_get_value (s, "width") != NULL); @@ -639,7 +586,7 @@ GST_START_TEST (test_intersect) GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2); fail_unless (gst_caps_get_size (ci2) == 1, NULL); s = gst_caps_get_structure (ci2, 0); - fail_unless (gst_structure_has_name (s, "video/x-raw-yuv")); + fail_unless (gst_structure_has_name (s, "video/x-raw")); fail_unless (gst_structure_get_value (s, "format") != NULL); fail_unless (gst_structure_get_value (s, "width") != NULL); @@ -653,8 +600,8 @@ GST_START_TEST (test_intersect) /* ========== */ - c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20"); - c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=30"); + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=30"); ci1 = gst_caps_intersect (c2, c1); GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); @@ -675,8 +622,8 @@ GST_START_TEST (test_intersect) /* ========== */ - c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20"); - c1 = gst_caps_from_string ("video/x-raw-rgb,format=(fourcc)I420,width=20"); + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw2,format=(string)I420,width=20"); ci1 = gst_caps_intersect (c2, c1); GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); @@ -697,14 +644,14 @@ GST_START_TEST (test_intersect) /* ========== */ - c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20"); - c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,height=30"); + c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20"); + c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,height=30"); ci1 = gst_caps_intersect (c2, c1); GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1); fail_unless (gst_caps_get_size (ci1) == 1, NULL); s = gst_caps_get_structure (ci1, 0); - fail_unless (gst_structure_has_name (s, "video/x-raw-yuv")); + fail_unless (gst_structure_has_name (s, "video/x-raw")); fail_unless (gst_structure_get_value (s, "format") != NULL); fail_unless (gst_structure_get_value (s, "width") != NULL); fail_unless (gst_structure_get_value (s, "height") != NULL); @@ -714,7 +661,7 @@ GST_START_TEST (test_intersect) GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2); fail_unless (gst_caps_get_size (ci2) == 1, NULL); s = gst_caps_get_structure (ci2, 0); - fail_unless (gst_structure_has_name (s, "video/x-raw-yuv")); + fail_unless (gst_structure_has_name (s, "video/x-raw")); fail_unless (gst_structure_get_value (s, "format") != NULL); fail_unless (gst_structure_get_value (s, "height") != NULL); fail_unless (gst_structure_get_value (s, "width") != NULL); @@ -735,14 +682,14 @@ GST_START_TEST (test_intersect2) GstCaps *caps1, *caps2, *icaps; /* tests array subtraction */ - caps1 = gst_caps_from_string ("audio/x-raw-float, " + caps1 = gst_caps_from_string ("audio/x-raw, " "channel-positions=(int)< " "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }>"); - caps2 = gst_caps_from_string ("audio/x-raw-float, " + caps2 = gst_caps_from_string ("audio/x-raw, " "channel-positions=(int)< 1, 2, 3, 4, 5, 6 >"); icaps = gst_caps_intersect (caps1, caps2); GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps); @@ -855,9 +802,9 @@ GST_START_TEST (test_intersect_duplication) GstCaps *c1, *c2, *test; c1 = gst_caps_from_string - ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]"); + ("audio/x-raw, format=(string)S16_LE, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]"); c2 = gst_caps_from_string - ("audio/x-raw-int, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)[ 1, 16 ], rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }"); + ("audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]"); test = gst_caps_intersect_full (c1, c2, GST_CAPS_INTERSECT_FIRST); fail_unless_equals_int (gst_caps_get_size (test), 1); @@ -892,7 +839,6 @@ GST_START_TEST (test_normalize) fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); } - gst_caps_unref (in); gst_caps_unref (out); gst_caps_unref (norm); @@ -911,7 +857,6 @@ GST_START_TEST (test_normalize) fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); } - gst_caps_unref (in); gst_caps_unref (out); gst_caps_unref (norm); @@ -929,7 +874,6 @@ GST_START_TEST (test_normalize) fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); } - gst_caps_unref (in); gst_caps_unref (out); gst_caps_unref (norm); }