mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 17:18:15 +00:00
update for activation changes
This commit is contained in:
parent
3233f09adf
commit
8fc2a21775
3 changed files with 55 additions and 56 deletions
|
@ -1783,10 +1783,8 @@ static GstFlowReturn gst_ogg_demux_chain (GstPad * pad, GstObject * parent,
|
|||
GstBuffer * buffer);
|
||||
static gboolean gst_ogg_demux_sink_activate (GstPad * sinkpad,
|
||||
GstObject * parent);
|
||||
static gboolean gst_ogg_demux_sink_activate_pull (GstPad * sinkpad,
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_ogg_demux_sink_activate_push (GstPad * sinkpad,
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_ogg_demux_sink_activate_mode (GstPad * sinkpad,
|
||||
GstObject * parent, GstPadMode mode, gboolean active);
|
||||
static GstStateChangeReturn gst_ogg_demux_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
|
||||
|
@ -1828,10 +1826,8 @@ gst_ogg_demux_init (GstOggDemux * ogg)
|
|||
gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_sink_event);
|
||||
gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain);
|
||||
gst_pad_set_activate_function (ogg->sinkpad, gst_ogg_demux_sink_activate);
|
||||
gst_pad_set_activatepull_function (ogg->sinkpad,
|
||||
gst_ogg_demux_sink_activate_pull);
|
||||
gst_pad_set_activatepush_function (ogg->sinkpad,
|
||||
gst_ogg_demux_sink_activate_push);
|
||||
gst_pad_set_activatemode_function (ogg->sinkpad,
|
||||
gst_ogg_demux_sink_activate_mode);
|
||||
gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
|
||||
|
||||
ogg->chain_lock = g_mutex_new ();
|
||||
|
@ -4327,51 +4323,46 @@ gst_ogg_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
|||
goto activate_push;
|
||||
|
||||
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
||||
return gst_pad_activate_pull (sinkpad, TRUE);
|
||||
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE);
|
||||
|
||||
activate_push:
|
||||
{
|
||||
GST_DEBUG_OBJECT (sinkpad, "activating push");
|
||||
return gst_pad_activate_push (sinkpad, TRUE);
|
||||
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* this function gets called when we activate ourselves in push mode.
|
||||
* We cannot seek (ourselves) in the stream */
|
||||
static gboolean
|
||||
gst_ogg_demux_sink_activate_push (GstPad * sinkpad, GstObject * parent,
|
||||
gboolean active)
|
||||
gst_ogg_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
||||
GstPadMode mode, gboolean active)
|
||||
{
|
||||
gboolean res;
|
||||
GstOggDemux *ogg;
|
||||
|
||||
ogg = GST_OGG_DEMUX (parent);
|
||||
|
||||
ogg->pullmode = FALSE;
|
||||
ogg->resync = FALSE;
|
||||
switch (mode) {
|
||||
case GST_PAD_MODE_PUSH:
|
||||
ogg->pullmode = FALSE;
|
||||
ogg->resync = FALSE;
|
||||
res = TRUE;
|
||||
break;
|
||||
case GST_PAD_MODE_PULL:
|
||||
if (active) {
|
||||
ogg->need_chains = TRUE;
|
||||
ogg->pullmode = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* this function gets called when we activate ourselves in pull mode.
|
||||
* We can perform random access to the resource and we start a task
|
||||
* to start reading */
|
||||
static gboolean
|
||||
gst_ogg_demux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
|
||||
gboolean active)
|
||||
{
|
||||
GstOggDemux *ogg;
|
||||
|
||||
ogg = GST_OGG_DEMUX (parent);
|
||||
|
||||
if (active) {
|
||||
ogg->need_chains = TRUE;
|
||||
ogg->pullmode = TRUE;
|
||||
|
||||
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
|
||||
sinkpad);
|
||||
} else {
|
||||
return gst_pad_stop_task (sinkpad);
|
||||
res = gst_pad_start_task (sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
|
||||
sinkpad);
|
||||
} else {
|
||||
res = gst_pad_stop_task (sinkpad);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
|
|
@ -293,8 +293,8 @@ static void gst_audio_encoder_set_property (GObject * object,
|
|||
static void gst_audio_encoder_get_property (GObject * object,
|
||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_audio_encoder_sink_activate_push (GstPad * pad,
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_audio_encoder_sink_activate_mode (GstPad * pad,
|
||||
GstObject * parent, GstPadMode mode, gboolean active);
|
||||
|
||||
static GstCaps *gst_audio_encoder_getcaps_default (GstAudioEncoder * enc,
|
||||
GstCaps * filter);
|
||||
|
@ -370,8 +370,8 @@ gst_audio_encoder_init (GstAudioEncoder * enc, GstAudioEncoderClass * bclass)
|
|||
GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_query));
|
||||
gst_pad_set_chain_function (enc->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_audio_encoder_chain));
|
||||
gst_pad_set_activatepush_function (enc->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_activate_push));
|
||||
gst_pad_set_activatemode_function (enc->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_audio_encoder_sink_activate_mode));
|
||||
gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
|
||||
|
||||
GST_DEBUG_OBJECT (enc, "sinkpad created");
|
||||
|
@ -1701,8 +1701,8 @@ gst_audio_encoder_activate (GstAudioEncoder * enc, gboolean active)
|
|||
|
||||
|
||||
static gboolean
|
||||
gst_audio_encoder_sink_activate_push (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
gst_audio_encoder_sink_activate_mode (GstPad * pad, GstObject * parent,
|
||||
GstPadMode mode, gboolean active)
|
||||
{
|
||||
gboolean result = TRUE;
|
||||
GstAudioEncoder *enc;
|
||||
|
|
|
@ -139,8 +139,8 @@ static GstFlowReturn gst_tag_demux_chain (GstPad * pad, GstObject * parent,
|
|||
static gboolean gst_tag_demux_sink_event (GstPad * pad, GstObject * parent,
|
||||
GstEvent * event);
|
||||
|
||||
static gboolean gst_tag_demux_src_activate_pull (GstPad * pad,
|
||||
GstObject * parent, gboolean active);
|
||||
static gboolean gst_tag_demux_src_activate_mode (GstPad * pad,
|
||||
GstObject * parent, GstPadMode mode, gboolean active);
|
||||
static GstFlowReturn gst_tag_demux_read_range (GstTagDemux * tagdemux,
|
||||
GstObject * parent, guint64 offset, guint length, GstBuffer ** buffer);
|
||||
|
||||
|
@ -311,8 +311,8 @@ gst_tag_demux_init (GstTagDemux * demux, GstTagDemuxClass * gclass)
|
|||
GST_DEBUG_FUNCPTR (gst_tag_demux_pad_query));
|
||||
gst_pad_set_event_function (demux->priv->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_tag_demux_srcpad_event));
|
||||
gst_pad_set_activatepull_function (demux->priv->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_tag_demux_src_activate_pull));
|
||||
gst_pad_set_activatemode_function (demux->priv->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_tag_demux_src_activate_mode));
|
||||
gst_pad_set_getrange_function (demux->priv->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_tag_demux_src_getrange));
|
||||
gst_pad_use_fixed_caps (demux->priv->srcpad);
|
||||
|
@ -1129,7 +1129,7 @@ gst_tag_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
|||
if (!pull_mode)
|
||||
goto activate_push;
|
||||
|
||||
if (!gst_pad_activate_pull (sinkpad, TRUE))
|
||||
if (!gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE))
|
||||
goto activate_push;
|
||||
|
||||
/* Look for tags at start and end of file */
|
||||
|
@ -1185,7 +1185,7 @@ gst_tag_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
|||
"probability of %u", caps, probability);
|
||||
|
||||
/* 4 - Deactivate pull mode */
|
||||
if (!gst_pad_activate_pull (sinkpad, FALSE)) {
|
||||
if (!gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, FALSE)) {
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
GST_DEBUG_OBJECT (demux, "Could not deactivate sinkpad after reading tags");
|
||||
|
@ -1210,8 +1210,8 @@ gst_tag_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
|||
* done, otherwise switch to push */
|
||||
ret = TRUE;
|
||||
if (!gst_pad_is_active (sinkpad)) {
|
||||
ret = gst_pad_activate_push (demux->priv->srcpad, TRUE);
|
||||
ret &= gst_pad_activate_push (sinkpad, TRUE);
|
||||
ret = gst_pad_activate_mode (demux->priv->srcpad, GST_PAD_MODE_PUSH, TRUE);
|
||||
ret &= gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
|
||||
}
|
||||
|
||||
done_activate:
|
||||
|
@ -1226,17 +1226,25 @@ activate_push:
|
|||
GST_DEBUG_OBJECT (demux, "No pull mode. Changing to push, but won't be "
|
||||
"able to read end tags");
|
||||
demux->priv->state = GST_TAG_DEMUX_READ_START_TAG;
|
||||
return gst_pad_activate_push (sinkpad, TRUE);
|
||||
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_tag_demux_src_activate_pull (GstPad * pad, GstObject * parent,
|
||||
gboolean active)
|
||||
gst_tag_demux_src_activate_mode (GstPad * pad, GstObject * parent,
|
||||
GstPadMode mode, gboolean active)
|
||||
{
|
||||
gboolean res = TRUE;
|
||||
GstTagDemux *demux = GST_TAG_DEMUX (parent);
|
||||
|
||||
return gst_pad_activate_pull (demux->priv->sinkpad, active);
|
||||
switch (mode) {
|
||||
case GST_PAD_MODE_PULL:
|
||||
res = gst_pad_activate_mode (demux->priv->sinkpad, mode, active);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
Loading…
Reference in a new issue