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
This commit is contained in:
Benjamin Otte 2004-04-22 23:50:46 +00:00
parent 1c0dbd87b9
commit bb1302b533
8 changed files with 152 additions and 67 deletions

View file

@ -1,3 +1,21 @@
2004-04-23 Benjamin Otte <otte@gnome.org>
* 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 <otte@gnome.org> 2004-04-22 Benjamin Otte <otte@gnome.org>
* docs/gst/tmpl/gstcaps.sgml: * docs/gst/tmpl/gstcaps.sgml:

View file

@ -373,6 +373,7 @@ Structure describing sets of media formats
</para> </para>
@caps: @caps:
@Returns:
<!-- ##### FUNCTION gst_caps_save_thyself ##### --> <!-- ##### FUNCTION gst_caps_save_thyself ##### -->

View file

@ -900,7 +900,7 @@ gst_caps_intersect (const GstCaps * caps1, const GstCaps * caps2)
typedef struct typedef struct
{ {
const GstStructure *subtract_from; const GstStructure *subtract_from;
GstCaps *put_into; GSList *put_into;
} }
SubtractionEntry; SubtractionEntry;
@ -915,33 +915,46 @@ gst_caps_structure_subtract_field (GQuark field_id, GValue * value,
GstStructure *structure; GstStructure *structure;
other = gst_structure_id_get_value (e->subtract_from, field_id); other = gst_structure_id_get_value (e->subtract_from, field_id);
if (!other) if (!other) {
return TRUE; return FALSE;
}
if (!gst_value_subtract (&subtraction, other, value)) if (!gst_value_subtract (&subtraction, other, value))
return TRUE; return TRUE;
structure = gst_structure_copy (e->subtract_from);
if (gst_value_compare (&subtraction, other) == GST_VALUE_EQUAL) { if (gst_value_compare (&subtraction, other) == GST_VALUE_EQUAL) {
gst_caps_append_structure (e->put_into, structure); g_value_unset (&subtraction);
return FALSE; return FALSE;
} else { } else {
structure = gst_structure_copy (e->subtract_from);
gst_structure_id_set_value (structure, field_id, &subtraction); gst_structure_id_set_value (structure, field_id, &subtraction);
g_value_unset (&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; return TRUE;
} }
} }
static void static gboolean
gst_caps_structure_subtract (GstCaps * into, const GstStructure * minuend, gst_caps_structure_subtract (GSList ** into, const GstStructure * minuend,
const GstStructure * subtrahend) const GstStructure * subtrahend)
{ {
SubtractionEntry e; SubtractionEntry e;
gboolean ret;
e.subtract_from = minuend; 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); 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 * GstCaps *
@ -979,7 +992,18 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend)
for (j = 0; j < src->structs->len; j++) { for (j = 0; j < src->structs->len; j++) {
min = gst_caps_get_structure (src, j); min = gst_caps_get_structure (src, j);
if (gst_structure_get_name_id (min) == gst_structure_get_name_id (sub)) { 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 { } else {
gst_caps_append_structure (dest, gst_structure_copy (min)); gst_caps_append_structure (dest, gst_structure_copy (min));
} }
@ -988,6 +1012,7 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend)
return dest; return dest;
} }
gst_caps_do_simplify (dest);
return dest; return dest;
} }
@ -1123,7 +1148,6 @@ gst_caps_simplify (const GstCaps * caps)
return ret; return ret;
} }
/* need this here */
typedef struct typedef struct
{ {
GQuark name; GQuark name;
@ -1132,15 +1156,18 @@ typedef struct
} }
UnionField; UnionField;
static G_GNUC_UNUSED gboolean static gboolean
gst_caps_structure_figure_out_union (GQuark field_id, GValue * value, gst_caps_structure_figure_out_union (GQuark field_id, GValue * value,
gpointer user_data) gpointer user_data)
{ {
UnionField *u = user_data; UnionField *u = user_data;
const GValue *val = gst_structure_id_get_value (u->compare, field_id); const GValue *val = gst_structure_id_get_value (u->compare, field_id);
if (!val) if (!val) {
return TRUE; if (u->name)
g_value_unset (&u->value);
return FALSE;
}
if (gst_value_compare (val, value) == GST_VALUE_EQUAL) if (gst_value_compare (val, value) == GST_VALUE_EQUAL)
return TRUE; return TRUE;
if (u->name) { if (u->name) {
@ -1152,40 +1179,52 @@ gst_caps_structure_figure_out_union (GQuark field_id, GValue * value,
return TRUE; return TRUE;
} }
static GstStructure * static gboolean
gst_caps_structure_simplify (const GstStructure * simplify, gst_caps_structure_simplify (GstStructure ** result,
GstStructure * compare) const GstStructure * simplify, GstStructure * compare)
{ {
GstCaps *caps = gst_caps_new_empty (); GSList *list;
GstStructure *ret;
UnionField field = { 0, {0,}, NULL }; UnionField field = { 0, {0,}, NULL };
/* try to subtract to get a real subset */ /* try to subtract to get a real subset */
gst_caps_structure_subtract (caps, simplify, compare); if (gst_caps_structure_subtract (&list, simplify, compare)) {
switch (gst_caps_get_size (caps)) { switch (g_slist_length (list)) {
case 0: case 0:
gst_caps_free (caps); *result = NULL;
return NULL; return TRUE;
case 1: case 1:
ret = gst_structure_copy (gst_caps_get_structure (caps, 0)); *result = list->data;
break; g_slist_free (list);
default: return TRUE;
ret = gst_structure_copy (simplify); default:
break; {
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 */ /* try to union both structs */
field.compare = compare; field.compare = compare;
if (gst_structure_foreach (ret, gst_caps_structure_figure_out_union, &field)) { if (gst_structure_foreach ((GstStructure *) simplify,
g_assert (field.name != 0); gst_caps_structure_figure_out_union, &field)) {
gst_structure_id_set_value (compare, field.name, &field.value); gboolean ret = FALSE;
gst_structure_free (ret);
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); 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 * same set of formats, but in a simpler form. Component structures that are
* identical are merged. Component structures that have values that can be * identical are merged. Component structures that have values that can be
* merged are also merged. * merged are also merged.
*
* Returns: TRUE, if the caps could be simplified
*/ */
void gboolean
gst_caps_do_simplify (GstCaps * caps) gst_caps_do_simplify (GstCaps * caps)
{ {
GstStructure *simplify, *compare, *result; GstStructure *simplify, *compare, *result;
gint i, j, start; 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) if (gst_caps_get_size (caps) < 2)
return; return FALSE;
g_ptr_array_sort (caps->structs, gst_caps_compare_structures); g_ptr_array_sort (caps->structs, gst_caps_compare_structures);
start = caps->structs->len - 1; start = caps->structs->len - 1;
for (i = caps->structs->len - 1; i >= 0; i--) { for (i = caps->structs->len - 1; i >= 0; i--) {
simplify = gst_caps_get_structure (caps, 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--) { for (j = start; j >= 0; j--) {
compare = gst_caps_get_structure (caps, j);
if (j == i) if (j == i)
continue; continue;
compare = gst_caps_get_structure (caps, j);
if (gst_structure_get_name_id (simplify) != if (gst_structure_get_name_id (simplify) !=
gst_structure_get_name_id (compare)) { gst_structure_get_name_id (compare)) {
start = j;
break; break;
} }
result = gst_caps_structure_simplify (simplify, compare); if (gst_caps_structure_simplify (&result, simplify, compare)) {
#if 0 #if 0
g_print ("%s - %s = %s\n", g_print ("%s - %s = %s\n",
gst_structure_to_string (simplify), gst_structure_to_string (simplify),
gst_structure_to_string (compare), gst_structure_to_string (compare),
result ? gst_structure_to_string (result) : "---"); result ? gst_structure_to_string (result) : "---");
#endif #endif
if (result) { if (result) {
gst_structure_free (simplify); gst_structure_free (simplify);
g_ptr_array_index (caps->structs, i) = result; g_ptr_array_index (caps->structs, i) = result;
simplify = result; simplify = result;
} else { } else {
gst_caps_remove_structure (caps, i); gst_caps_remove_structure (caps, i);
start--; start--;
break; break;
}
changed = TRUE;
} }
} }
} }
if (!changed)
return FALSE;
/* gst_caps_do_simplify (caps); */
return TRUE;
} }
#ifndef GST_DISABLE_LOADSAVE #ifndef GST_DISABLE_LOADSAVE

View file

@ -128,7 +128,7 @@ GstCaps * gst_caps_normalize (const G
#ifndef GST_DISABLE_DEPRECATED #ifndef GST_DISABLE_DEPRECATED
GstCaps * gst_caps_simplify (const GstCaps *caps); GstCaps * gst_caps_simplify (const GstCaps *caps);
#endif #endif
void gst_caps_do_simplify (GstCaps *caps); gboolean gst_caps_do_simplify (GstCaps *caps);
#ifndef GST_DISABLE_LOADSAVE #ifndef GST_DISABLE_LOADSAVE
xmlNodePtr gst_caps_save_thyself (const GstCaps *caps, xmlNodePtr gst_caps_save_thyself (const GstCaps *caps,

View file

@ -7,11 +7,11 @@
static const gchar *caps_list[] = { 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", "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, 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)[ 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 ]; 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)[ 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-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-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", "ANY",
"EMPTY" "EMPTY"
}; };

View file

@ -78,10 +78,11 @@ main (gint argc, gchar ** argv)
check_caps (caps); check_caps (caps);
if (!gst_caps_is_any (caps)) { if (!gst_caps_is_any (caps)) {
for (j = 0; j < G_N_ELEMENTS (caps_list); j++) { for (j = 0; j < G_N_ELEMENTS (caps_list); j++) {
GstCaps *temp, *temp2;
GstCaps *caps2 = gst_caps_from_string (caps_list[j]); GstCaps *caps2 = gst_caps_from_string (caps_list[j]);
/* subtraction */ /* subtraction */
GstCaps *temp = gst_caps_subtract (caps, caps2); temp = gst_caps_subtract (caps, caps2);
g_print ("%2u - %2u ", i, j); g_print ("%2u - %2u ", i, j);
check_caps (temp); check_caps (temp);
@ -92,8 +93,14 @@ main (gint argc, gchar ** argv)
check_caps (temp); check_caps (temp);
if (i == j) if (i == j)
g_assert (gst_caps_get_size (caps) == gst_caps_get_size (temp)); 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 (temp);
gst_caps_free (caps2);
} }
} }
gst_caps_free (caps); gst_caps_free (caps);

View file

@ -7,11 +7,11 @@
static const gchar *caps_list[] = { 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", "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, 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)[ 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 ]; 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)[ 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-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-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", "ANY",
"EMPTY" "EMPTY"
}; };

View file

@ -78,10 +78,11 @@ main (gint argc, gchar ** argv)
check_caps (caps); check_caps (caps);
if (!gst_caps_is_any (caps)) { if (!gst_caps_is_any (caps)) {
for (j = 0; j < G_N_ELEMENTS (caps_list); j++) { for (j = 0; j < G_N_ELEMENTS (caps_list); j++) {
GstCaps *temp, *temp2;
GstCaps *caps2 = gst_caps_from_string (caps_list[j]); GstCaps *caps2 = gst_caps_from_string (caps_list[j]);
/* subtraction */ /* subtraction */
GstCaps *temp = gst_caps_subtract (caps, caps2); temp = gst_caps_subtract (caps, caps2);
g_print ("%2u - %2u ", i, j); g_print ("%2u - %2u ", i, j);
check_caps (temp); check_caps (temp);
@ -92,8 +93,14 @@ main (gint argc, gchar ** argv)
check_caps (temp); check_caps (temp);
if (i == j) if (i == j)
g_assert (gst_caps_get_size (caps) == gst_caps_get_size (temp)); 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 (temp);
gst_caps_free (caps2);
} }
} }
gst_caps_free (caps); gst_caps_free (caps);