gst/gstutils.c: Handle RESYNC correctly in _proxy_getcaps.

Original commit message from CVS:
* gst/gstutils.c: (gst_pad_proxy_getcaps):
Handle RESYNC correctly in _proxy_getcaps.
This commit is contained in:
Wim Taymans 2006-08-23 10:59:47 +00:00
parent ef9253d99c
commit ca915c1969
3 changed files with 38 additions and 10 deletions

View file

@ -1,3 +1,8 @@
2006-08-23 Wim Taymans <wim@fluendo.com>
* gst/gstutils.c: (gst_pad_proxy_getcaps):
Handle RESYNC correctly in _proxy_getcaps.
2006-08-21 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstxml.c: (gst_xml_dispose), (gst_xml_parse_file),

2
common

@ -1 +1 @@
Subproject commit e9ea99f6e89d7e1af3a0a859bfeb0ed6ecf2e3a9
Subproject commit d287125f93da692bc25d53b0b7b0e2f90424a212

View file

@ -2432,18 +2432,40 @@ gst_pad_proxy_getcaps (GstPad * pad)
if (element == NULL)
return NULL;
iter = gst_element_iterate_pads (element);
/* value to hold the return, by default it holds ANY, the ref is taken by
* the GValue. */
g_value_init (&ret, G_TYPE_POINTER);
g_value_set_pointer (&ret, gst_caps_new_any ());
res = gst_iterator_fold (iter, (GstIteratorFoldFunction) intersect_caps_func,
iter = gst_element_iterate_pads (element);
while (1) {
res =
gst_iterator_fold (iter, (GstIteratorFoldFunction) intersect_caps_func,
&ret, pad);
switch (res) {
case GST_ITERATOR_RESYNC:
/* unref any value stored */
if ((caps = g_value_get_pointer (&ret)))
gst_caps_unref (caps);
/* need to reset the result again to ANY */
g_value_set_pointer (&ret, gst_caps_new_any ());
gst_iterator_resync (iter);
break;
case GST_ITERATOR_DONE:
/* all pads iterated, return collected value */
goto done;
default:
/* iterator returned _ERROR or premature end with _OK,
* mark an error and exit */
if ((caps = g_value_get_pointer (&ret)))
gst_caps_unref (caps);
g_value_set_pointer (&ret, NULL);
goto error;
}
}
done:
gst_iterator_free (iter);
if (res != GST_ITERATOR_DONE)
goto pads_changed;
gst_object_unref (element);
caps = g_value_get_pointer (&ret);
@ -2455,10 +2477,11 @@ gst_pad_proxy_getcaps (GstPad * pad)
return intersected;
/* ERRORS */
pads_changed:
error:
{
g_warning ("Pad list changed during capsnego for element %s",
g_warning ("Pad list returned error on element %s",
GST_ELEMENT_NAME (element));
gst_iterator_free (iter);
gst_object_unref (element);
return NULL;
}