playbin: Fix iterate internal linked pads functions for the stream selectors
This now used the new gst_iterator_new_single() function and as a side effect fixes bug #592864.
This commit is contained in:
parent
72f3587f04
commit
67a0ef9b3a
@ -319,71 +319,21 @@ gst_selector_pad_reset (GstSelectorPad * pad)
|
|||||||
|
|
||||||
/* strictly get the linked pad from the sinkpad. If the pad is active we return
|
/* strictly get the linked pad from the sinkpad. If the pad is active we return
|
||||||
* the srcpad else we return NULL */
|
* the srcpad else we return NULL */
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GstIterator parent;
|
|
||||||
|
|
||||||
GstPad *pad;
|
|
||||||
gboolean start;
|
|
||||||
} GstSelectorIterator;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_free (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstSelectorIterator *sit = (GstSelectorIterator *) it;
|
|
||||||
|
|
||||||
gst_object_unref (sit->pad);
|
|
||||||
g_free (it);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorResult
|
|
||||||
_iterate_next (GstIterator * it, gpointer * result)
|
|
||||||
{
|
|
||||||
GstSelectorIterator *sit = (GstSelectorIterator *) it;
|
|
||||||
|
|
||||||
if (sit->start) {
|
|
||||||
GstPad *res = gst_input_selector_get_linked_pad (sit->pad, TRUE);
|
|
||||||
|
|
||||||
*result = res;
|
|
||||||
sit->start = FALSE;
|
|
||||||
return res ? GST_ITERATOR_OK : GST_ITERATOR_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
return GST_ITERATOR_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorItem
|
|
||||||
_iterate_item (GstIterator * it, gpointer item)
|
|
||||||
{
|
|
||||||
return GST_ITERATOR_ITEM_PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_resync (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstSelectorIterator *sit = (GstSelectorIterator *) it;
|
|
||||||
|
|
||||||
sit->start = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIterator *
|
static GstIterator *
|
||||||
gst_selector_pad_iterate_linked_pads (GstPad * pad)
|
gst_selector_pad_iterate_linked_pads (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstInputSelector *sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
GstInputSelector *sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
||||||
GstSelectorIterator *it = (GstSelectorIterator *)
|
GstPad *otherpad;
|
||||||
gst_iterator_new (sizeof (GstSelectorIterator),
|
GstIterator *it;
|
||||||
GST_TYPE_PAD,
|
|
||||||
sel->lock,
|
|
||||||
&GST_ELEMENT_CAST (sel)->pads_cookie,
|
|
||||||
_iterate_next, _iterate_item, _iterate_resync, _iterate_free);
|
|
||||||
|
|
||||||
it->pad = gst_object_ref (pad);
|
otherpad = gst_input_selector_get_linked_pad (pad, TRUE);
|
||||||
it->start = TRUE;
|
it = gst_iterator_new_single (GST_TYPE_PAD, otherpad,
|
||||||
|
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
||||||
|
|
||||||
|
gst_object_unref (otherpad);
|
||||||
gst_object_unref (sel);
|
gst_object_unref (sel);
|
||||||
|
|
||||||
return (GstIterator *) it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -679,71 +679,22 @@ gst_stream_selector_activate_sinkpad (GstStreamSelector * sel, GstPad * pad)
|
|||||||
return active_sinkpad;
|
return active_sinkpad;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GstIterator parent;
|
|
||||||
|
|
||||||
GstPad *pad;
|
|
||||||
gboolean start;
|
|
||||||
} GstSelectorIterator;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_free (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstSelectorIterator *sit = (GstSelectorIterator *) it;
|
|
||||||
|
|
||||||
gst_object_unref (sit->pad);
|
|
||||||
g_free (it);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorResult
|
|
||||||
_iterate_next (GstIterator * it, gpointer * result)
|
|
||||||
{
|
|
||||||
GstSelectorIterator *sit = (GstSelectorIterator *) it;
|
|
||||||
|
|
||||||
if (sit->start) {
|
|
||||||
GstPad *res = gst_stream_selector_get_linked_pad (sit->pad, TRUE);
|
|
||||||
|
|
||||||
*result = res;
|
|
||||||
sit->start = FALSE;
|
|
||||||
return res ? GST_ITERATOR_OK : GST_ITERATOR_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*result = NULL;
|
|
||||||
return GST_ITERATOR_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIteratorItem
|
|
||||||
_iterate_item (GstIterator * it, gpointer item)
|
|
||||||
{
|
|
||||||
return GST_ITERATOR_ITEM_PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_iterate_resync (GstIterator * it)
|
|
||||||
{
|
|
||||||
GstSelectorIterator *sit = (GstSelectorIterator *) it;
|
|
||||||
|
|
||||||
sit->start = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstIterator *
|
static GstIterator *
|
||||||
gst_stream_selector_pad_iterate_linked_pads (GstPad * pad)
|
gst_stream_selector_pad_iterate_linked_pads (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
|
GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
|
||||||
GstSelectorIterator *it = (GstSelectorIterator *)
|
GstPad *otherpad;
|
||||||
gst_iterator_new (sizeof (GstSelectorIterator),
|
GstIterator *ret;
|
||||||
GST_TYPE_PAD,
|
|
||||||
GST_OBJECT_CAST (sel)->lock,
|
|
||||||
&GST_ELEMENT_CAST (sel)->pads_cookie,
|
|
||||||
_iterate_next, _iterate_item, _iterate_resync, _iterate_free);
|
|
||||||
|
|
||||||
it->pad = gst_object_ref (pad);
|
otherpad = gst_stream_selector_get_linked_pad (pad, TRUE);
|
||||||
it->start = TRUE;
|
ret =
|
||||||
|
gst_iterator_new_single (GST_TYPE_PAD, otherpad,
|
||||||
|
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
||||||
|
|
||||||
|
gst_object_unref (otherpad);
|
||||||
gst_object_unref (sel);
|
gst_object_unref (sel);
|
||||||
|
|
||||||
return (GstIterator *) it;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPad *
|
static GstPad *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user