diff options
author | Michael Smith <msmith@songbirdnest.com> | 2009-02-10 16:22:54 -0800 |
---|---|---|
committer | Michael Smith <msmith@songbirdnest.com> | 2009-02-10 16:23:54 -0800 |
commit | b4c2d8c1bb8c31a9f1d3f86ed92cbb6e1e12be2a (patch) | |
tree | 9e2fa444dda7591458ffd1b17260c0375440db7d | |
parent | ff2d0621f7d654511b6ddb06b5323799c343fe05 (diff) | |
download | gst-plugins-bad-b4c2d8c1bb8c31a9f1d3f86ed92cbb6e1e12be2a.tar.gz gst-plugins-bad-b4c2d8c1bb8c31a9f1d3f86ed92cbb6e1e12be2a.tar.bz2 gst-plugins-bad-b4c2d8c1bb8c31a9f1d3f86ed92cbb6e1e12be2a.zip |
input-selector: Activate and notify pad before processing events.
Events should trigger pad selection if we don't already have an
explicitly selected pad, so that events prior to first buffer don't get
lost.
-rw-r--r-- | gst/selector/gstinputselector.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gst/selector/gstinputselector.c b/gst/selector/gstinputselector.c index 165d1f60..7fc43686 100644 --- a/gst/selector/gstinputselector.c +++ b/gst/selector/gstinputselector.c @@ -342,17 +342,23 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event) gboolean forward = TRUE; GstInputSelector *sel; GstSelectorPad *selpad; + GstPad *active_sinkpad; + gboolean notify; sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad)); selpad = GST_SELECTOR_PAD_CAST (pad); - /* only forward if we are dealing with the active sinkpad */ - forward = gst_input_selector_is_active_sinkpad (sel, pad); + GST_INPUT_SELECTOR_LOCK (sel); + active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad, ¬ify); - /* forward all events in select_all mode by default */ - if (sel->select_all) { - forward = TRUE; - } + /* only forward if we are dealing with the active sinkpad or if select_all + * is enabled */ + if (pad != active_sinkpad && !sel->select_all) + forward = FALSE; + GST_INPUT_SELECTOR_UNLOCK (sel); + + if (notify) + g_object_notify (G_OBJECT (sel), "active-pad"); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_FLUSH_START: @@ -1037,8 +1043,7 @@ gst_input_selector_event (GstPad * pad, GstEvent * event) res = gst_pad_push_event (otherpad, event); gst_object_unref (otherpad); - } - else + } else gst_event_unref (event); return res; } |