input-selector: send notify::active signal for input-selector pads.

https://bugzilla.gnome.org/show_bug.cgi?id=701319
This commit is contained in:
Brendan Long 2013-05-31 09:39:55 -06:00 committed by Sebastian Dröge
parent bab1122a93
commit f0a3d8bb09

View file

@ -456,13 +456,19 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
GST_DEBUG_OBJECT (selpad, "received event %" GST_PTR_FORMAT, event); GST_DEBUG_OBJECT (selpad, "received event %" GST_PTR_FORMAT, event);
GST_INPUT_SELECTOR_LOCK (sel); GST_INPUT_SELECTOR_LOCK (sel);
prev_active_sinkpad = sel->active_sinkpad; prev_active_sinkpad =
sel->active_sinkpad ? gst_object_ref (sel->active_sinkpad) : NULL;
active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad); active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
GST_INPUT_SELECTOR_UNLOCK (sel); GST_INPUT_SELECTOR_UNLOCK (sel);
if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) { if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) {
if (prev_active_sinkpad)
g_object_notify (G_OBJECT (prev_active_sinkpad), "active");
g_object_notify (G_OBJECT (active_sinkpad), "active");
g_object_notify (G_OBJECT (sel), "active-pad"); g_object_notify (G_OBJECT (sel), "active-pad");
} }
if (prev_active_sinkpad)
gst_object_unref (prev_active_sinkpad);
GST_INPUT_SELECTOR_LOCK (sel); GST_INPUT_SELECTOR_LOCK (sel);
active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad); active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
@ -922,7 +928,7 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GstInputSelector *sel; GstInputSelector *sel;
GstFlowReturn res; GstFlowReturn res;
GstPad *active_sinkpad; GstPad *active_sinkpad;
GstPad *prev_active_sinkpad; GstPad *prev_active_sinkpad = NULL;
GstSelectorPad *selpad; GstSelectorPad *selpad;
GstClockTime start_time; GstClockTime start_time;
@ -942,7 +948,8 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GST_LOG_OBJECT (pad, "getting active pad"); GST_LOG_OBJECT (pad, "getting active pad");
prev_active_sinkpad = sel->active_sinkpad; prev_active_sinkpad =
sel->active_sinkpad ? gst_object_ref (sel->active_sinkpad) : NULL;
active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad); active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
/* In sync mode wait until the active pad has advanced /* In sync mode wait until the active pad has advanced
@ -1025,8 +1032,14 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GST_INPUT_SELECTOR_UNLOCK (sel); GST_INPUT_SELECTOR_UNLOCK (sel);
if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) { if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) {
if (prev_active_sinkpad)
g_object_notify (G_OBJECT (prev_active_sinkpad), "active");
g_object_notify (G_OBJECT (active_sinkpad), "active");
g_object_notify (G_OBJECT (sel), "active-pad"); g_object_notify (G_OBJECT (sel), "active-pad");
} }
if (prev_active_sinkpad)
gst_object_unref (prev_active_sinkpad);
prev_active_sinkpad = NULL;
/* if we have a pending events, push them now */ /* if we have a pending events, push them now */
if (G_UNLIKELY (prev_active_sinkpad != active_sinkpad if (G_UNLIKELY (prev_active_sinkpad != active_sinkpad
@ -1072,6 +1085,11 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GST_INPUT_SELECTOR_UNLOCK (sel); GST_INPUT_SELECTOR_UNLOCK (sel);
done: done:
if (prev_active_sinkpad)
gst_object_unref (prev_active_sinkpad);
prev_active_sinkpad = NULL;
return res; return res;
/* dropped buffers */ /* dropped buffers */