diff options
author | Luciana Fujii Pontello <luciana@fujii.eti.br> | 2011-01-26 11:49:48 -0200 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2011-02-09 13:42:06 +0200 |
commit | 2522a672a9a841a44ff4e0b20c7372092fd61010 (patch) | |
tree | fba2fb885bbfeb2fefca30f0e144784e26b91107 | |
parent | f96dab44cf2391c30abf76f5598e0f8557c7d549 (diff) |
camerabin: Events with select-all in input-selector
When select-all was set, input-selector wasn't handling upstream events.
Now input-selector forwards the event to all of its sink pads. This
changes the input-selector internal to camerabin until it is replaced
with a better solution.
-rw-r--r-- | gst/camerabin/gstinputselector.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gst/camerabin/gstinputselector.c b/gst/camerabin/gstinputselector.c index 75ecab1d2..ef4e23637 100644 --- a/gst/camerabin/gstinputselector.c +++ b/gst/camerabin/gstinputselector.c @@ -1076,15 +1076,54 @@ gst_input_selector_event (GstPad * pad, GstEvent * event) { gboolean res = FALSE; GstPad *otherpad; + GstInputSelector *sel; + GstIterator *iter; + gboolean done; + gpointer nextpad; + sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad)); otherpad = gst_input_selector_get_linked_pad (pad, TRUE); if (otherpad) { res = gst_pad_push_event (otherpad, event); gst_object_unref (otherpad); + } else if (sel->select_all) { + + /* If select-all is set, we should push the event to all pads. + * The result will be TRUE if the push works for any of the pads, even if a + * push fails. This is coherent with the way camerabin uses input-selector, + * but might not be for other uses of it. */ + + iter = gst_element_iterate_sink_pads (GST_ELEMENT (sel)); + + done = FALSE; + while (!done) { + switch (gst_iterator_next (iter, &nextpad)) { + case GST_ITERATOR_OK: + res |= gst_pad_push_event (nextpad, gst_event_ref (event)); + gst_object_unref (nextpad); + break; + case GST_ITERATOR_RESYNC: + gst_iterator_resync (iter); + break; + case GST_ITERATOR_ERROR: + GST_WARNING_OBJECT (sel, + "Wrong parameters when retrieving sink pads"); + done = TRUE; + break; + case GST_ITERATOR_DONE: + done = TRUE; + break; + } + } + gst_event_unref (event); + gst_iterator_free (iter); } else gst_event_unref (event); + + gst_object_unref (sel); + return res; } |