output-selector: Notify when the active-pad property is changing
authorSebastian Dröge <sebastian@centricular.com>
Sat, 16 Jan 2016 09:47:36 +0000 (10:47 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Sat, 16 Jan 2016 09:47:36 +0000 (10:47 +0100)
plugins/elements/gstoutputselector.c

index beb4c70..c2b810b 100644 (file)
@@ -337,6 +337,7 @@ gst_output_selector_request_new_pad (GstElement * element,
   /* Set the first requested src pad as active by default */
   if (osel->active_srcpad == NULL) {
     osel->active_srcpad = srcpad;
+    g_object_notify (G_OBJECT (osel), "active-pad");
   }
   g_free (padname);
 
@@ -352,6 +353,12 @@ gst_output_selector_release_pad (GstElement * element, GstPad * pad)
 
   GST_DEBUG_OBJECT (osel, "releasing pad");
 
+  /* Disable active pad if it's the to be removed pad */
+  if (osel->active_srcpad == pad) {
+    osel->active_srcpad = NULL;
+    g_object_notify (G_OBJECT (osel), "active-pad");
+  }
+
   gst_pad_set_active (pad, FALSE);
 
   gst_element_remove_pad (GST_ELEMENT_CAST (osel), pad);
@@ -379,6 +386,7 @@ gst_output_selector_switch (GstOutputSelector * osel)
   /* Send SEGMENT event and latest buffer if switching succeeded
    * and we already have a valid segment configured */
   if (res) {
+    g_object_notify (G_OBJECT (osel), "active-pad");
     gst_pad_sticky_events_foreach (osel->sinkpad, forward_sticky_events,
         osel->active_srcpad);