add parent to activate functions
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 18 Nov 2011 12:57:20 +0000 (13:57 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 18 Nov 2011 12:57:20 +0000 (13:57 +0100)
ext/pulse/pulseaudiosink.c
gst/avi/gstavidemux.c
gst/debugutils/rndbuffersize.c
gst/flv/gstflvdemux.c
gst/isomp4/qtdemux.c
gst/rtpmanager/gstrtpjitterbuffer.c
gst/wavparse/gstwavparse.c

index 0a24875..1b9aa41 100644 (file)
@@ -711,7 +711,7 @@ gst_pulse_audio_sink_src_event (GstPad * pad, GstObject * parent,
   if (G_UNLIKELY (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_UPSTREAM) &&
       (gst_event_has_name (event, "pulse-format-lost") ||
           gst_event_has_name (event, "pulse-sink-changed"))) {
-    g_return_val_if_fail (pad->mode != GST_PAD_ACTIVATE_PULL, FALSE);
+    g_return_val_if_fail (pad->mode != GST_PAD_MODE_PULL, FALSE);
 
     GST_PULSE_AUDIO_SINK_LOCK (pbin);
     if (gst_event_has_name (event, "pulse-format-lost"))
index 6d063b1..585f488 100644 (file)
@@ -99,10 +99,12 @@ static gboolean gst_avi_demux_handle_seek (GstAviDemux * avi, GstPad * pad,
 static gboolean gst_avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad,
     GstEvent * event);
 static void gst_avi_demux_loop (GstPad * pad);
-static gboolean gst_avi_demux_sink_activate (GstPad * sinkpad);
+static gboolean gst_avi_demux_sink_activate (GstPad * sinkpad,
+    GstObject * parent);
 static gboolean gst_avi_demux_sink_activate_pull (GstPad * sinkpad,
+    GstObject * parent, gboolean active);
+static gboolean gst_avi_demux_activate_push (GstPad * pad, GstObject * parent,
     gboolean active);
-static gboolean gst_avi_demux_activate_push (GstPad * pad, gboolean active);
 static GstFlowReturn gst_avi_demux_chain (GstPad * pad, GstObject * parent,
     GstBuffer * buf);
 
@@ -5265,7 +5267,7 @@ abort_buffering:
 }
 
 static gboolean
-gst_avi_demux_sink_activate (GstPad * sinkpad)
+gst_avi_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
 {
   GstQuery *query;
   gboolean pull_mode;
@@ -5294,9 +5296,10 @@ activate_push:
 }
 
 static gboolean
-gst_avi_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
+gst_avi_demux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
+    gboolean active)
 {
-  GstAviDemux *avi = GST_AVI_DEMUX (GST_OBJECT_PARENT (sinkpad));
+  GstAviDemux *avi = GST_AVI_DEMUX (parent);
 
   if (active) {
     avi->streaming = FALSE;
@@ -5308,9 +5311,9 @@ gst_avi_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
 }
 
 static gboolean
-gst_avi_demux_activate_push (GstPad * pad, gboolean active)
+gst_avi_demux_activate_push (GstPad * pad, GstObject * parent, gboolean active)
 {
-  GstAviDemux *avi = GST_AVI_DEMUX (GST_OBJECT_PARENT (pad));
+  GstAviDemux *avi = GST_AVI_DEMUX (parent);
 
   if (active) {
     GST_DEBUG ("avi: activating push/chain function");
index 71463a6..02e2166 100644 (file)
@@ -85,9 +85,9 @@ static void gst_rnd_buffer_size_set_property (GObject * object, guint prop_id,
 static void gst_rnd_buffer_size_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static gboolean gst_rnd_buffer_size_activate (GstPad * pad);
+static gboolean gst_rnd_buffer_size_activate (GstPad * pad, GstObject * parent);
 static gboolean gst_rnd_buffer_size_activate_pull (GstPad * pad,
-    gboolean active);
+    GstObject * parent, gboolean active);
 static void gst_rnd_buffer_size_loop (GstRndBufferSize * self);
 static GstStateChangeReturn gst_rnd_buffer_size_change_state (GstElement *
     element, GstStateChange transition);
@@ -215,7 +215,7 @@ gst_rnd_buffer_size_get_property (GObject * object, guint prop_id,
 
 
 static gboolean
-gst_rnd_buffer_size_activate (GstPad * pad)
+gst_rnd_buffer_size_activate (GstPad * pad, GstObject * parent)
 {
   GstQuery *query;
   gboolean pull_mode;
@@ -245,9 +245,10 @@ no_pull:
 
 
 static gboolean
-gst_rnd_buffer_size_activate_pull (GstPad * pad, gboolean active)
+gst_rnd_buffer_size_activate_pull (GstPad * pad, GstObject * parent,
+    gboolean active)
 {
-  GstRndBufferSize *self = GST_RND_BUFFER_SIZE (GST_OBJECT_PARENT (pad));
+  GstRndBufferSize *self = GST_RND_BUFFER_SIZE (parent);
 
   if (active) {
     GST_INFO_OBJECT (self, "starting pull");
index 2e42982..56dc2d0 100644 (file)
@@ -2799,7 +2799,7 @@ wrong_format:
 
 /* If we can pull that's prefered */
 static gboolean
-gst_flv_demux_sink_activate (GstPad * sinkpad)
+gst_flv_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
 {
   GstQuery *query;
   gboolean pull_mode;
@@ -2830,16 +2830,15 @@ activate_push:
 /* This function gets called when we activate ourselves in push mode.
  * We cannot seek (ourselves) in the stream */
 static gboolean
-gst_flv_demux_sink_activate_push (GstPad * sinkpad, gboolean active)
+gst_flv_demux_sink_activate_push (GstPad * sinkpad, GstObject * parent,
+    gboolean active)
 {
   GstFlvDemux *demux;
 
-  demux = GST_FLV_DEMUX (gst_pad_get_parent (sinkpad));
+  demux = GST_FLV_DEMUX (parent);
 
   demux->random_access = FALSE;
 
-  gst_object_unref (demux);
-
   return TRUE;
 }
 
@@ -2847,20 +2846,19 @@ gst_flv_demux_sink_activate_push (GstPad * sinkpad, gboolean active)
  * We can perform  random access to the resource and we start a task
  * to start reading */
 static gboolean
-gst_flv_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
+gst_flv_demux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
+    gboolean active)
 {
   GstFlvDemux *demux;
 
-  demux = GST_FLV_DEMUX (gst_pad_get_parent (sinkpad));
+  demux = GST_FLV_DEMUX (parent);
 
   if (active) {
     demux->random_access = TRUE;
-    gst_object_unref (demux);
     return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flv_demux_loop,
         sinkpad);
   } else {
     demux->random_access = FALSE;
-    gst_object_unref (demux);
     return gst_pad_stop_task (sinkpad);
   }
 }
index 73a5493..a56d77a 100644 (file)
@@ -400,9 +400,11 @@ static void gst_qtdemux_set_index (GstElement * element, GstIndex * index);
 static GstIndex *gst_qtdemux_get_index (GstElement * element);
 static GstStateChangeReturn gst_qtdemux_change_state (GstElement * element,
     GstStateChange transition);
-static gboolean qtdemux_sink_activate (GstPad * sinkpad);
-static gboolean qtdemux_sink_activate_pull (GstPad * sinkpad, gboolean active);
-static gboolean qtdemux_sink_activate_push (GstPad * sinkpad, gboolean active);
+static gboolean qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent);
+static gboolean qtdemux_sink_activate_pull (GstPad * sinkpad,
+    GstObject * parent, gboolean active);
+static gboolean qtdemux_sink_activate_push (GstPad * sinkpad,
+    GstObject * parent, gboolean active);
 
 static void gst_qtdemux_loop (GstPad * pad);
 static GstFlowReturn gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent,
@@ -4420,7 +4422,7 @@ no_moov:
 }
 
 static gboolean
-qtdemux_sink_activate (GstPad * sinkpad)
+qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent)
 {
   GstQuery *query;
   gboolean pull_mode;
@@ -4449,9 +4451,10 @@ activate_push:
 }
 
 static gboolean
-qtdemux_sink_activate_pull (GstPad * sinkpad, gboolean active)
+qtdemux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
+    gboolean active)
 {
-  GstQTDemux *demux = GST_QTDEMUX (GST_PAD_PARENT (sinkpad));
+  GstQTDemux *demux = GST_QTDEMUX (parent);
 
   if (active) {
     demux->pullbased = TRUE;
@@ -4463,9 +4466,10 @@ qtdemux_sink_activate_pull (GstPad * sinkpad, gboolean active)
 }
 
 static gboolean
-qtdemux_sink_activate_push (GstPad * sinkpad, gboolean active)
+qtdemux_sink_activate_push (GstPad * sinkpad, GstObject * parent,
+    gboolean active)
 {
-  GstQTDemux *demux = GST_QTDEMUX (GST_PAD_PARENT (sinkpad));
+  GstQTDemux *demux = GST_QTDEMUX (parent);
 
   demux->pullbased = FALSE;
 
index eaad36f..8233284 100644 (file)
@@ -260,7 +260,7 @@ static gboolean gst_rtp_jitter_buffer_sink_query (GstPad * pad,
 static gboolean gst_rtp_jitter_buffer_src_event (GstPad * pad,
     GstObject * parent, GstEvent * event);
 static gboolean gst_rtp_jitter_buffer_src_activate_push (GstPad * pad,
-    gboolean active);
+    GstObject * parent, gboolean active);
 static void gst_rtp_jitter_buffer_loop (GstRtpJitterBuffer * jitterbuffer);
 static gboolean gst_rtp_jitter_buffer_src_query (GstPad * pad,
     GstObject * parent, GstQuery * query);
@@ -882,12 +882,13 @@ gst_rtp_jitter_buffer_flush_stop (GstRtpJitterBuffer * jitterbuffer)
 }
 
 static gboolean
-gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, gboolean active)
+gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, GstObject * parent,
+    gboolean active)
 {
   gboolean result = TRUE;
   GstRtpJitterBuffer *jitterbuffer = NULL;
 
-  jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
+  jitterbuffer = GST_RTP_JITTER_BUFFER (parent);
 
   if (active) {
     /* allow data processing */
@@ -907,8 +908,6 @@ gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, gboolean active)
     result = gst_pad_stop_task (pad);
   }
 
-  gst_object_unref (jitterbuffer);
-
   return result;
 }
 
@@ -1069,7 +1068,8 @@ gst_rtp_jitter_buffer_sink_event (GstPad * pad, GstObject * parent,
       break;
     case GST_EVENT_FLUSH_STOP:
       ret = gst_pad_push_event (priv->srcpad, event);
-      ret = gst_rtp_jitter_buffer_src_activate_push (priv->srcpad, TRUE);
+      ret =
+          gst_rtp_jitter_buffer_src_activate_push (priv->srcpad, parent, TRUE);
       break;
     case GST_EVENT_EOS:
     {
index 3bea339..62c609b 100644 (file)
@@ -63,9 +63,10 @@ GST_DEBUG_CATEGORY_STATIC (wavparse_debug);
 
 static void gst_wavparse_dispose (GObject * object);
 
-static gboolean gst_wavparse_sink_activate (GstPad * sinkpad);
+static gboolean gst_wavparse_sink_activate (GstPad * sinkpad,
+    GstObject * parent);
 static gboolean gst_wavparse_sink_activate_pull (GstPad * sinkpad,
-    gboolean active);
+    GstObject * parent, gboolean active);
 static gboolean gst_wavparse_send_event (GstElement * element,
     GstEvent * event);
 static GstStateChangeReturn gst_wavparse_change_state (GstElement * element,
@@ -2537,9 +2538,9 @@ gst_wavparse_srcpad_event (GstPad * pad, GstObject * parent, GstEvent * event)
 }
 
 static gboolean
-gst_wavparse_sink_activate (GstPad * sinkpad)
+gst_wavparse_sink_activate (GstPad * sinkpad, GstObject * parent)
 {
-  GstWavParse *wav = GST_WAVPARSE (gst_pad_get_parent (sinkpad));
+  GstWavParse *wav = GST_WAVPARSE (parent);
   GstQuery *query;
   gboolean pull_mode;
 
@@ -2564,7 +2565,6 @@ gst_wavparse_sink_activate (GstPad * sinkpad)
 
   GST_DEBUG_OBJECT (sinkpad, "activating pull");
   wav->streaming = FALSE;
-  gst_object_unref (wav);
   return gst_pad_activate_pull (sinkpad, TRUE);
 
 activate_push:
@@ -2572,14 +2572,14 @@ activate_push:
     GST_DEBUG_OBJECT (sinkpad, "activating push");
     wav->streaming = TRUE;
     wav->adapter = gst_adapter_new ();
-    gst_object_unref (wav);
     return gst_pad_activate_push (sinkpad, TRUE);
   }
 }
 
 
 static gboolean
-gst_wavparse_sink_activate_pull (GstPad * sinkpad, gboolean active)
+gst_wavparse_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
+    gboolean active)
 {
   if (active) {
     /* if we have a scheduler we can start the task */