From bb1302b5333b3786baa128788ea99483500ee6a5 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 22 Apr 2004 23:50:46 +0000 Subject: [PATCH] gst/gstcaps.c: fix simplifying and subtracting not working correctly with optional properties solve assorted problems... Original commit message from CVS: * gst/gstcaps.c: (gst_caps_structure_subtract_field), (gst_caps_structure_subtract), (gst_caps_subtract), (gst_caps_structure_figure_out_union), (gst_caps_structure_simplify), (gst_caps_do_simplify): fix simplifying and subtracting not working correctly with optional properties solve assorted problems that make it now simplify ebven more * docs/gst/tmpl/gstcaps.sgml: * gst/gstcaps.h: make gst_caps_do_simplify return a bool to indicate if it simplified * testsuite/caps/simplify.c: (main): add more checks. The tests is quite a bit useless right now because the core is heavily simplifying itself. * testsuite/caps/caps.h: fix caps to contain all optional properties --- ChangeLog | 18 +++ docs/gst/tmpl/gstcaps.sgml | 1 + gst/gstcaps.c | 164 ++++++++++++++++++---------- gst/gstcaps.h | 2 +- tests/old/testsuite/caps/caps.h | 6 +- tests/old/testsuite/caps/simplify.c | 11 +- testsuite/caps/caps.h | 6 +- testsuite/caps/simplify.c | 11 +- 8 files changed, 152 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ce766b7dd..49cccf9216 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2004-04-23 Benjamin Otte + + * gst/gstcaps.c: (gst_caps_structure_subtract_field), + (gst_caps_structure_subtract), (gst_caps_subtract), + (gst_caps_structure_figure_out_union), + (gst_caps_structure_simplify), (gst_caps_do_simplify): + fix simplifying and subtracting not working correctly with optional + properties + solve assorted problems that make it now simplify ebven more + * docs/gst/tmpl/gstcaps.sgml: + * gst/gstcaps.h: + make gst_caps_do_simplify return a bool to indicate if it simplified + * testsuite/caps/simplify.c: (main): + add more checks. The tests is quite a bit useless right now because + the core is heavily simplifying itself. + * testsuite/caps/caps.h: + fix caps to contain all optional properties + 2004-04-22 Benjamin Otte * docs/gst/tmpl/gstcaps.sgml: diff --git a/docs/gst/tmpl/gstcaps.sgml b/docs/gst/tmpl/gstcaps.sgml index 353904bffe..4c43a70b20 100644 --- a/docs/gst/tmpl/gstcaps.sgml +++ b/docs/gst/tmpl/gstcaps.sgml @@ -373,6 +373,7 @@ Structure describing sets of media formats @caps: +@Returns: diff --git a/gst/gstcaps.c b/gst/gstcaps.c index b7da8906f0..cb1a940e60 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -900,7 +900,7 @@ gst_caps_intersect (const GstCaps * caps1, const GstCaps * caps2) typedef struct { const GstStructure *subtract_from; - GstCaps *put_into; + GSList *put_into; } SubtractionEntry; @@ -915,33 +915,46 @@ gst_caps_structure_subtract_field (GQuark field_id, GValue * value, GstStructure *structure; other = gst_structure_id_get_value (e->subtract_from, field_id); - if (!other) - return TRUE; + if (!other) { + return FALSE; + } if (!gst_value_subtract (&subtraction, other, value)) return TRUE; - structure = gst_structure_copy (e->subtract_from); if (gst_value_compare (&subtraction, other) == GST_VALUE_EQUAL) { - gst_caps_append_structure (e->put_into, structure); + g_value_unset (&subtraction); return FALSE; } else { + structure = gst_structure_copy (e->subtract_from); gst_structure_id_set_value (structure, field_id, &subtraction); g_value_unset (&subtraction); - gst_caps_append_structure (e->put_into, structure); + e->put_into = g_slist_prepend (e->put_into, structure); return TRUE; } } -static void -gst_caps_structure_subtract (GstCaps * into, const GstStructure * minuend, +static gboolean +gst_caps_structure_subtract (GSList ** into, const GstStructure * minuend, const GstStructure * subtrahend) { SubtractionEntry e; + gboolean ret; e.subtract_from = minuend; - e.put_into = into; + e.put_into = NULL; - gst_structure_foreach ((GstStructure *) subtrahend, + ret = gst_structure_foreach ((GstStructure *) subtrahend, gst_caps_structure_subtract_field, &e); + if (ret) { + *into = e.put_into; + } else { + GSList *walk; + + for (walk = e.put_into; walk; walk = g_slist_next (walk)) { + gst_structure_free (walk->data); + } + g_slist_free (e.put_into); + } + return ret; } GstCaps * @@ -979,7 +992,18 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend) for (j = 0; j < src->structs->len; j++) { min = gst_caps_get_structure (src, j); if (gst_structure_get_name_id (min) == gst_structure_get_name_id (sub)) { - gst_caps_structure_subtract (dest, min, sub); + GSList *list; + + if (gst_caps_structure_subtract (&list, min, sub)) { + GSList *walk; + + for (walk = list; walk; walk = g_slist_next (walk)) { + gst_caps_append_structure (dest, (GstStructure *) walk->data); + } + g_slist_free (list); + } else { + gst_caps_append_structure (dest, gst_structure_copy (min)); + } } else { gst_caps_append_structure (dest, gst_structure_copy (min)); } @@ -988,6 +1012,7 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend) return dest; } + gst_caps_do_simplify (dest); return dest; } @@ -1123,7 +1148,6 @@ gst_caps_simplify (const GstCaps * caps) return ret; } -/* need this here */ typedef struct { GQuark name; @@ -1132,15 +1156,18 @@ typedef struct } UnionField; -static G_GNUC_UNUSED gboolean +static gboolean gst_caps_structure_figure_out_union (GQuark field_id, GValue * value, gpointer user_data) { UnionField *u = user_data; const GValue *val = gst_structure_id_get_value (u->compare, field_id); - if (!val) - return TRUE; + if (!val) { + if (u->name) + g_value_unset (&u->value); + return FALSE; + } if (gst_value_compare (val, value) == GST_VALUE_EQUAL) return TRUE; if (u->name) { @@ -1152,40 +1179,52 @@ gst_caps_structure_figure_out_union (GQuark field_id, GValue * value, return TRUE; } -static GstStructure * -gst_caps_structure_simplify (const GstStructure * simplify, - GstStructure * compare) +static gboolean +gst_caps_structure_simplify (GstStructure ** result, + const GstStructure * simplify, GstStructure * compare) { - GstCaps *caps = gst_caps_new_empty (); - GstStructure *ret; + GSList *list; UnionField field = { 0, {0,}, NULL }; /* try to subtract to get a real subset */ - gst_caps_structure_subtract (caps, simplify, compare); - switch (gst_caps_get_size (caps)) { - case 0: - gst_caps_free (caps); - return NULL; - case 1: - ret = gst_structure_copy (gst_caps_get_structure (caps, 0)); - break; - default: - ret = gst_structure_copy (simplify); - break; + if (gst_caps_structure_subtract (&list, simplify, compare)) { + switch (g_slist_length (list)) { + case 0: + *result = NULL; + return TRUE; + case 1: + *result = list->data; + g_slist_free (list); + return TRUE; + default: + { + GSList *walk; + + for (walk = list; walk; walk = g_slist_next (walk)) { + gst_structure_free (walk->data); + } + g_slist_free (list); + break; + } + } } - gst_caps_free (caps); /* try to union both structs */ field.compare = compare; - if (gst_structure_foreach (ret, gst_caps_structure_figure_out_union, &field)) { - g_assert (field.name != 0); - gst_structure_id_set_value (compare, field.name, &field.value); - gst_structure_free (ret); + if (gst_structure_foreach ((GstStructure *) simplify, + gst_caps_structure_figure_out_union, &field)) { + gboolean ret = FALSE; + + if (gst_structure_n_fields (simplify) == gst_structure_n_fields (compare)) { + gst_structure_id_set_value (compare, field.name, &field.value); + *result = NULL; + ret = TRUE; + } g_value_unset (&field.value); - return NULL; + return ret; } - return ret; + return FALSE; } /** @@ -1196,50 +1235,63 @@ gst_caps_structure_simplify (const GstStructure * simplify, * same set of formats, but in a simpler form. Component structures that are * identical are merged. Component structures that have values that can be * merged are also merged. + * + * Returns: TRUE, if the caps could be simplified */ -void +gboolean gst_caps_do_simplify (GstCaps * caps) { GstStructure *simplify, *compare, *result; gint i, j, start; + gboolean changed = FALSE; - g_return_if_fail (caps != NULL); + g_return_val_if_fail (caps != NULL, FALSE); if (gst_caps_get_size (caps) < 2) - return; + return FALSE; g_ptr_array_sort (caps->structs, gst_caps_compare_structures); start = caps->structs->len - 1; for (i = caps->structs->len - 1; i >= 0; i--) { simplify = gst_caps_get_structure (caps, i); + if (gst_structure_get_name_id (simplify) != + gst_structure_get_name_id (gst_caps_get_structure (caps, start))) + start = i; for (j = start; j >= 0; j--) { - compare = gst_caps_get_structure (caps, j); if (j == i) continue; + compare = gst_caps_get_structure (caps, j); if (gst_structure_get_name_id (simplify) != gst_structure_get_name_id (compare)) { - start = j; break; } - result = gst_caps_structure_simplify (simplify, compare); + if (gst_caps_structure_simplify (&result, simplify, compare)) { #if 0 - g_print ("%s - %s = %s\n", - gst_structure_to_string (simplify), - gst_structure_to_string (compare), - result ? gst_structure_to_string (result) : "---"); + g_print ("%s - %s = %s\n", + gst_structure_to_string (simplify), + gst_structure_to_string (compare), + result ? gst_structure_to_string (result) : "---"); #endif - if (result) { - gst_structure_free (simplify); - g_ptr_array_index (caps->structs, i) = result; - simplify = result; - } else { - gst_caps_remove_structure (caps, i); - start--; - break; + if (result) { + gst_structure_free (simplify); + g_ptr_array_index (caps->structs, i) = result; + simplify = result; + } else { + gst_caps_remove_structure (caps, i); + start--; + break; + } + changed = TRUE; } } } + + if (!changed) + return FALSE; + + /* gst_caps_do_simplify (caps); */ + return TRUE; } #ifndef GST_DISABLE_LOADSAVE diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 525ce8d771..91162543e7 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -128,7 +128,7 @@ GstCaps * gst_caps_normalize (const G #ifndef GST_DISABLE_DEPRECATED GstCaps * gst_caps_simplify (const GstCaps *caps); #endif -void gst_caps_do_simplify (GstCaps *caps); +gboolean gst_caps_do_simplify (GstCaps *caps); #ifndef GST_DISABLE_LOADSAVE xmlNodePtr gst_caps_save_thyself (const GstCaps *caps, diff --git a/tests/old/testsuite/caps/caps.h b/tests/old/testsuite/caps/caps.h index e198dbe307..3024eeca9f 100644 --- a/tests/old/testsuite/caps/caps.h +++ b/tests/old/testsuite/caps/caps.h @@ -7,11 +7,11 @@ static const gchar *caps_list[] = { "audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)g726; audio/x-adpcm, layout=(string)g726", "video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)I420; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUY2; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y42B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUV9; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y41B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234", - "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]", - "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", + "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]", + "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", - "video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", + "video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", "ANY", "EMPTY" }; diff --git a/tests/old/testsuite/caps/simplify.c b/tests/old/testsuite/caps/simplify.c index ca70ca5869..99d5173d38 100644 --- a/tests/old/testsuite/caps/simplify.c +++ b/tests/old/testsuite/caps/simplify.c @@ -78,10 +78,11 @@ main (gint argc, gchar ** argv) check_caps (caps); if (!gst_caps_is_any (caps)) { for (j = 0; j < G_N_ELEMENTS (caps_list); j++) { + GstCaps *temp, *temp2; GstCaps *caps2 = gst_caps_from_string (caps_list[j]); /* subtraction */ - GstCaps *temp = gst_caps_subtract (caps, caps2); + temp = gst_caps_subtract (caps, caps2); g_print ("%2u - %2u ", i, j); check_caps (temp); @@ -92,8 +93,14 @@ main (gint argc, gchar ** argv) check_caps (temp); if (i == j) g_assert (gst_caps_get_size (caps) == gst_caps_get_size (temp)); + g_assert (gst_caps_is_subset (caps, temp)); + g_assert (gst_caps_is_subset (caps2, temp)); + /* appending (union without simplifying) */ + temp2 = gst_caps_copy (caps); + gst_caps_append (temp2, caps2); + g_assert (gst_caps_is_equal (temp, temp2)); + gst_caps_free (temp2); gst_caps_free (temp); - gst_caps_free (caps2); } } gst_caps_free (caps); diff --git a/testsuite/caps/caps.h b/testsuite/caps/caps.h index e198dbe307..3024eeca9f 100644 --- a/testsuite/caps/caps.h +++ b/testsuite/caps/caps.h @@ -7,11 +7,11 @@ static const gchar *caps_list[] = { "audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)g726; audio/x-adpcm, layout=(string)g726", "video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)I420; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUY2; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y42B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUV9; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y41B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234", - "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]", - "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", + "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]", + "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", - "video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", + "video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", "ANY", "EMPTY" }; diff --git a/testsuite/caps/simplify.c b/testsuite/caps/simplify.c index ca70ca5869..99d5173d38 100644 --- a/testsuite/caps/simplify.c +++ b/testsuite/caps/simplify.c @@ -78,10 +78,11 @@ main (gint argc, gchar ** argv) check_caps (caps); if (!gst_caps_is_any (caps)) { for (j = 0; j < G_N_ELEMENTS (caps_list); j++) { + GstCaps *temp, *temp2; GstCaps *caps2 = gst_caps_from_string (caps_list[j]); /* subtraction */ - GstCaps *temp = gst_caps_subtract (caps, caps2); + temp = gst_caps_subtract (caps, caps2); g_print ("%2u - %2u ", i, j); check_caps (temp); @@ -92,8 +93,14 @@ main (gint argc, gchar ** argv) check_caps (temp); if (i == j) g_assert (gst_caps_get_size (caps) == gst_caps_get_size (temp)); + g_assert (gst_caps_is_subset (caps, temp)); + g_assert (gst_caps_is_subset (caps2, temp)); + /* appending (union without simplifying) */ + temp2 = gst_caps_copy (caps); + gst_caps_append (temp2, caps2); + g_assert (gst_caps_is_equal (temp, temp2)); + gst_caps_free (temp2); gst_caps_free (temp); - gst_caps_free (caps2); } } gst_caps_free (caps);