mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-13 01:35:30 +00:00
gst/gstiterator.c (gst_iterator_find_custom)
Original commit message from CVS: 2005-03-03 Andy Wingo <wingo@pobox.com> * gst/gstiterator.c (gst_iterator_find_custom) (gst_iterator_foreach, gst_iterator_fold): Never free the iterator. * gst/elements/gsttee.c (gst_tee_handle_buffer): * gst/gstutils.c (gst_pad_proxy_setcaps, gst_pad_proxy_getcaps): Always free the iterator. * check/gst/gstbus.c (pull_messages): Use public gst_message_get_structure().
This commit is contained in:
parent
9a14160bee
commit
bffbacfaae
7 changed files with 25 additions and 34 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,5 +1,16 @@
|
|||
2005-03-03 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* gst/gstiterator.c (gst_iterator_find_custom)
|
||||
(gst_iterator_foreach, gst_iterator_fold): Never free the
|
||||
iterator.
|
||||
|
||||
* gst/elements/gsttee.c (gst_tee_handle_buffer):
|
||||
* gst/gstutils.c (gst_pad_proxy_setcaps, gst_pad_proxy_getcaps):
|
||||
Always free the iterator.
|
||||
|
||||
* check/gst/gstbus.c (pull_messages): Use public
|
||||
gst_message_get_structure().
|
||||
|
||||
* tools/gst-launch.c: Update to use the new message-parsing API.
|
||||
|
||||
* tools/gst-md5sum.c: Update to new spiffy poll API. Not that
|
||||
|
|
|
@ -46,13 +46,6 @@ pound_bus_with_messages (gpointer data)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* temporary hack until all messages are backed by structures */
|
||||
static const GstStructure *
|
||||
gst_message_get_structure (GstMessage * m)
|
||||
{
|
||||
return m->message_data.structure.structure;
|
||||
}
|
||||
|
||||
static void
|
||||
pull_messages ()
|
||||
{
|
||||
|
|
|
@ -298,8 +298,8 @@ gst_tee_handle_buffer (GstTee * tee, GstBuffer * buffer)
|
|||
|
||||
res = gst_iterator_fold (iter, (GstIteratorFoldFunction) gst_tee_do_push,
|
||||
&ret, &data);
|
||||
if (res != GST_ITERATOR_DONE)
|
||||
gst_iterator_free (iter);
|
||||
gst_iterator_free (iter);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
/* no need to unset gvalue */
|
||||
|
|
|
@ -422,7 +422,7 @@ gst_iterator_filter (GstIterator * it, GCompareFunc func, gpointer user_data)
|
|||
* will cause fold to return GST_ITERATOR_ERROR or GST_ITERATOR_RESYNC as
|
||||
* appropriate.
|
||||
*
|
||||
* The iterator will only be freed if fold returns GST_ITERATOR_DONE.
|
||||
* The iterator will not be freed.
|
||||
*
|
||||
* Returns: A #GstIteratorResult, as described above.
|
||||
*
|
||||
|
@ -441,22 +441,18 @@ gst_iterator_fold (GstIterator * iter, GstIteratorFoldFunction func,
|
|||
case GST_ITERATOR_OK:
|
||||
/* fixme: is there a way to ref/unref items? */
|
||||
if (!func (item, ret, user_data))
|
||||
goto fold_interrupted;
|
||||
goto fold_done;
|
||||
else
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
case GST_ITERATOR_ERROR:
|
||||
goto fold_interrupted;
|
||||
goto fold_done;
|
||||
case GST_ITERATOR_DONE:
|
||||
goto fold_done;
|
||||
}
|
||||
}
|
||||
|
||||
fold_interrupted:
|
||||
return result;
|
||||
|
||||
fold_done:
|
||||
gst_iterator_free (iter);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -482,8 +478,8 @@ foreach_fold_func (gpointer item, GValue * unused, ForeachFoldData * data)
|
|||
* Iterate over all element of @it and call the given function for
|
||||
* each element.
|
||||
*
|
||||
* Returns: the result call to gst_iterator_fold(). If the result is not
|
||||
* GST_ITERATOR_DONE, the iterator is not freed.
|
||||
* Returns: the result call to gst_iterator_fold(). The iterator will not be
|
||||
* freed.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
|
@ -525,8 +521,7 @@ find_custom_fold_func (gpointer item, GValue * ret, FindCustomFoldData * data)
|
|||
* Find the first element in @it that matches the compare function.
|
||||
* The compare function should return 0 when the element is found.
|
||||
*
|
||||
* Will free the iterator when finished, regardless of whether an item is found
|
||||
* or not.
|
||||
* The iterator will not be freed.
|
||||
*
|
||||
* Returns: The element in the iterator that matches the compare
|
||||
* function or NULL when no element matched.
|
||||
|
@ -549,9 +544,6 @@ gst_iterator_find_custom (GstIterator * iter, GCompareFunc func,
|
|||
gst_iterator_fold (iter, (GstIteratorFoldFunction) find_custom_fold_func,
|
||||
&ret, &data);
|
||||
|
||||
if (res != GST_ITERATOR_DONE)
|
||||
gst_iterator_free (iter);
|
||||
|
||||
/* no need to unset, it's just a pointer */
|
||||
return g_value_get_pointer (&ret);
|
||||
}
|
||||
|
|
|
@ -1697,10 +1697,11 @@ gst_pad_proxy_getcaps (GstPad * pad)
|
|||
|
||||
res = gst_iterator_fold (iter, (GstIteratorFoldFunction) intersect_caps_func,
|
||||
&ret, pad);
|
||||
gst_iterator_free (iter);
|
||||
|
||||
if (res != GST_ITERATOR_DONE) {
|
||||
g_warning ("Pad list changed during capsnego for element %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
gst_iterator_free (iter);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1768,10 +1769,11 @@ gst_pad_proxy_setcaps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
res = gst_iterator_fold (iter, (GstIteratorFoldFunction) link_fold_func,
|
||||
&ret, &data);
|
||||
gst_iterator_free (iter);
|
||||
|
||||
if (res != GST_ITERATOR_DONE) {
|
||||
g_warning ("Pad list changed during proxy_pad_link for element %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
gst_iterator_free (iter);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,8 +298,8 @@ gst_tee_handle_buffer (GstTee * tee, GstBuffer * buffer)
|
|||
|
||||
res = gst_iterator_fold (iter, (GstIteratorFoldFunction) gst_tee_do_push,
|
||||
&ret, &data);
|
||||
if (res != GST_ITERATOR_DONE)
|
||||
gst_iterator_free (iter);
|
||||
gst_iterator_free (iter);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
/* no need to unset gvalue */
|
||||
|
|
|
@ -46,13 +46,6 @@ pound_bus_with_messages (gpointer data)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* temporary hack until all messages are backed by structures */
|
||||
static const GstStructure *
|
||||
gst_message_get_structure (GstMessage * m)
|
||||
{
|
||||
return m->message_data.structure.structure;
|
||||
}
|
||||
|
||||
static void
|
||||
pull_messages ()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue