make sure props are really sorted before intersecting them.

Original commit message from CVS:
make sure props are really sorted before intersecting them.
And then intersect them correctly
This commit is contained in:
Benjamin Otte 2003-11-25 22:08:45 +00:00
parent 0ee999abcf
commit 387b7f7f5b

View file

@ -2391,7 +2391,16 @@ G_STMT_START { \
GST_PROPS_FLAG_UNSET ((props), GST_PROPS_FIXED); \
props->properties = g_list_prepend ((props)->properties, toadd); \
} G_STMT_END
static gint
compare_props_entry (gconstpointer one, gconstpointer two)
{
GstPropsEntry *a = (GstPropsEntry *) one;
GstPropsEntry *b = (GstPropsEntry *) two;
if (a->propid > b->propid) return 1;
if (a->propid < b->propid) return -1;
return 0;
}
/**
* gst_props_intersect:
* @props1: a property
@ -2417,6 +2426,9 @@ gst_props_intersect (GstProps *props1, GstProps *props2)
intersection = gst_props_empty_new ();
props1->properties = g_list_sort (props1->properties, compare_props_entry);
props2->properties = g_list_sort (props2->properties, compare_props_entry);
props1list = props1->properties;
props2list = props2->properties;
@ -2445,6 +2457,8 @@ gst_props_intersect (GstProps *props1, GstProps *props2)
entry2 = (GstPropsEntry *)props2list->data;
}
if (entry1->propid < entry2->propid)
continue;
/* at this point we are talking about the same property */
iprops = gst_props_entry_intersect (entry1, entry2);
if (!iprops) {