add parent to activate functions

This commit is contained in:
Wim Taymans 2011-11-18 13:57:20 +01:00
parent 0a43cfedef
commit b7aa7bca52
7 changed files with 49 additions and 43 deletions

View 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) && 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-format-lost") ||
gst_event_has_name (event, "pulse-sink-changed"))) { 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); GST_PULSE_AUDIO_SINK_LOCK (pbin);
if (gst_event_has_name (event, "pulse-format-lost")) if (gst_event_has_name (event, "pulse-format-lost"))

View 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, static gboolean gst_avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad,
GstEvent * event); GstEvent * event);
static void gst_avi_demux_loop (GstPad * pad); 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, 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); gboolean active);
static gboolean gst_avi_demux_activate_push (GstPad * pad, gboolean active);
static GstFlowReturn gst_avi_demux_chain (GstPad * pad, GstObject * parent, static GstFlowReturn gst_avi_demux_chain (GstPad * pad, GstObject * parent,
GstBuffer * buf); GstBuffer * buf);
@ -5265,7 +5267,7 @@ abort_buffering:
} }
static gboolean static gboolean
gst_avi_demux_sink_activate (GstPad * sinkpad) gst_avi_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
{ {
GstQuery *query; GstQuery *query;
gboolean pull_mode; gboolean pull_mode;
@ -5294,9 +5296,10 @@ activate_push:
} }
static gboolean 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) { if (active) {
avi->streaming = FALSE; avi->streaming = FALSE;
@ -5308,9 +5311,9 @@ gst_avi_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
} }
static gboolean 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) { if (active) {
GST_DEBUG ("avi: activating push/chain function"); GST_DEBUG ("avi: activating push/chain function");

View 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, static void gst_rnd_buffer_size_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); 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, 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 void gst_rnd_buffer_size_loop (GstRndBufferSize * self);
static GstStateChangeReturn gst_rnd_buffer_size_change_state (GstElement * static GstStateChangeReturn gst_rnd_buffer_size_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
@ -215,7 +215,7 @@ gst_rnd_buffer_size_get_property (GObject * object, guint prop_id,
static gboolean static gboolean
gst_rnd_buffer_size_activate (GstPad * pad) gst_rnd_buffer_size_activate (GstPad * pad, GstObject * parent)
{ {
GstQuery *query; GstQuery *query;
gboolean pull_mode; gboolean pull_mode;
@ -245,9 +245,10 @@ no_pull:
static gboolean 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) { if (active) {
GST_INFO_OBJECT (self, "starting pull"); GST_INFO_OBJECT (self, "starting pull");

View file

@ -2799,7 +2799,7 @@ wrong_format:
/* If we can pull that's prefered */ /* If we can pull that's prefered */
static gboolean static gboolean
gst_flv_demux_sink_activate (GstPad * sinkpad) gst_flv_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
{ {
GstQuery *query; GstQuery *query;
gboolean pull_mode; gboolean pull_mode;
@ -2830,16 +2830,15 @@ activate_push:
/* This function gets called when we activate ourselves in push mode. /* This function gets called when we activate ourselves in push mode.
* We cannot seek (ourselves) in the stream */ * We cannot seek (ourselves) in the stream */
static gboolean 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; GstFlvDemux *demux;
demux = GST_FLV_DEMUX (gst_pad_get_parent (sinkpad)); demux = GST_FLV_DEMUX (parent);
demux->random_access = FALSE; demux->random_access = FALSE;
gst_object_unref (demux);
return TRUE; 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 * We can perform random access to the resource and we start a task
* to start reading */ * to start reading */
static gboolean 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; GstFlvDemux *demux;
demux = GST_FLV_DEMUX (gst_pad_get_parent (sinkpad)); demux = GST_FLV_DEMUX (parent);
if (active) { if (active) {
demux->random_access = TRUE; demux->random_access = TRUE;
gst_object_unref (demux);
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flv_demux_loop, return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flv_demux_loop,
sinkpad); sinkpad);
} else { } else {
demux->random_access = FALSE; demux->random_access = FALSE;
gst_object_unref (demux);
return gst_pad_stop_task (sinkpad); return gst_pad_stop_task (sinkpad);
} }
} }

View file

@ -400,9 +400,11 @@ static void gst_qtdemux_set_index (GstElement * element, GstIndex * index);
static GstIndex *gst_qtdemux_get_index (GstElement * element); static GstIndex *gst_qtdemux_get_index (GstElement * element);
static GstStateChangeReturn gst_qtdemux_change_state (GstElement * element, static GstStateChangeReturn gst_qtdemux_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static gboolean qtdemux_sink_activate (GstPad * sinkpad); static gboolean qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent);
static gboolean qtdemux_sink_activate_pull (GstPad * sinkpad, gboolean active); static gboolean qtdemux_sink_activate_pull (GstPad * sinkpad,
static gboolean qtdemux_sink_activate_push (GstPad * sinkpad, gboolean active); GstObject * parent, gboolean active);
static gboolean qtdemux_sink_activate_push (GstPad * sinkpad,
GstObject * parent, gboolean active);
static void gst_qtdemux_loop (GstPad * pad); static void gst_qtdemux_loop (GstPad * pad);
static GstFlowReturn gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, static GstFlowReturn gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent,
@ -4420,7 +4422,7 @@ no_moov:
} }
static gboolean static gboolean
qtdemux_sink_activate (GstPad * sinkpad) qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent)
{ {
GstQuery *query; GstQuery *query;
gboolean pull_mode; gboolean pull_mode;
@ -4449,9 +4451,10 @@ activate_push:
} }
static gboolean 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) { if (active) {
demux->pullbased = TRUE; demux->pullbased = TRUE;
@ -4463,9 +4466,10 @@ qtdemux_sink_activate_pull (GstPad * sinkpad, gboolean active)
} }
static gboolean 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; demux->pullbased = FALSE;

View 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, static gboolean gst_rtp_jitter_buffer_src_event (GstPad * pad,
GstObject * parent, GstEvent * event); GstObject * parent, GstEvent * event);
static gboolean gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, 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 void gst_rtp_jitter_buffer_loop (GstRtpJitterBuffer * jitterbuffer);
static gboolean gst_rtp_jitter_buffer_src_query (GstPad * pad, static gboolean gst_rtp_jitter_buffer_src_query (GstPad * pad,
GstObject * parent, GstQuery * query); GstObject * parent, GstQuery * query);
@ -882,12 +882,13 @@ gst_rtp_jitter_buffer_flush_stop (GstRtpJitterBuffer * jitterbuffer)
} }
static gboolean 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; gboolean result = TRUE;
GstRtpJitterBuffer *jitterbuffer = NULL; GstRtpJitterBuffer *jitterbuffer = NULL;
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad)); jitterbuffer = GST_RTP_JITTER_BUFFER (parent);
if (active) { if (active) {
/* allow data processing */ /* allow data processing */
@ -907,8 +908,6 @@ gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, gboolean active)
result = gst_pad_stop_task (pad); result = gst_pad_stop_task (pad);
} }
gst_object_unref (jitterbuffer);
return result; return result;
} }
@ -1069,7 +1068,8 @@ gst_rtp_jitter_buffer_sink_event (GstPad * pad, GstObject * parent,
break; break;
case GST_EVENT_FLUSH_STOP: case GST_EVENT_FLUSH_STOP:
ret = gst_pad_push_event (priv->srcpad, event); 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; break;
case GST_EVENT_EOS: case GST_EVENT_EOS:
{ {

View file

@ -63,9 +63,10 @@ GST_DEBUG_CATEGORY_STATIC (wavparse_debug);
static void gst_wavparse_dispose (GObject * object); 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, static gboolean gst_wavparse_sink_activate_pull (GstPad * sinkpad,
gboolean active); GstObject * parent, gboolean active);
static gboolean gst_wavparse_send_event (GstElement * element, static gboolean gst_wavparse_send_event (GstElement * element,
GstEvent * event); GstEvent * event);
static GstStateChangeReturn gst_wavparse_change_state (GstElement * element, static GstStateChangeReturn gst_wavparse_change_state (GstElement * element,
@ -2537,9 +2538,9 @@ gst_wavparse_srcpad_event (GstPad * pad, GstObject * parent, GstEvent * event)
} }
static gboolean 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; GstQuery *query;
gboolean pull_mode; gboolean pull_mode;
@ -2564,7 +2565,6 @@ gst_wavparse_sink_activate (GstPad * sinkpad)
GST_DEBUG_OBJECT (sinkpad, "activating pull"); GST_DEBUG_OBJECT (sinkpad, "activating pull");
wav->streaming = FALSE; wav->streaming = FALSE;
gst_object_unref (wav);
return gst_pad_activate_pull (sinkpad, TRUE); return gst_pad_activate_pull (sinkpad, TRUE);
activate_push: activate_push:
@ -2572,14 +2572,14 @@ activate_push:
GST_DEBUG_OBJECT (sinkpad, "activating push"); GST_DEBUG_OBJECT (sinkpad, "activating push");
wav->streaming = TRUE; wav->streaming = TRUE;
wav->adapter = gst_adapter_new (); wav->adapter = gst_adapter_new ();
gst_object_unref (wav);
return gst_pad_activate_push (sinkpad, TRUE); return gst_pad_activate_push (sinkpad, TRUE);
} }
} }
static gboolean 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 (active) {
/* if we have a scheduler we can start the task */ /* if we have a scheduler we can start the task */