mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
update for activation changes
This commit is contained in:
parent
6e4fb21331
commit
f8e988a94c
6 changed files with 167 additions and 159 deletions
|
@ -101,10 +101,8 @@ static gboolean gst_avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad,
|
||||||
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);
|
GstObject * parent);
|
||||||
static gboolean gst_avi_demux_sink_activate_pull (GstPad * sinkpad,
|
static gboolean gst_avi_demux_sink_activate_mode (GstPad * sinkpad,
|
||||||
GstObject * parent, gboolean active);
|
GstObject * parent, GstPadMode mode, gboolean active);
|
||||||
static gboolean gst_avi_demux_activate_push (GstPad * pad, GstObject * parent,
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -176,10 +174,8 @@ gst_avi_demux_init (GstAviDemux * avi)
|
||||||
avi->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
|
avi->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
|
||||||
gst_pad_set_activate_function (avi->sinkpad,
|
gst_pad_set_activate_function (avi->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_avi_demux_sink_activate));
|
GST_DEBUG_FUNCPTR (gst_avi_demux_sink_activate));
|
||||||
gst_pad_set_activatepull_function (avi->sinkpad,
|
gst_pad_set_activatemode_function (avi->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_avi_demux_sink_activate_pull));
|
GST_DEBUG_FUNCPTR (gst_avi_demux_sink_activate_mode));
|
||||||
gst_pad_set_activatepush_function (avi->sinkpad,
|
|
||||||
GST_DEBUG_FUNCPTR (gst_avi_demux_activate_push));
|
|
||||||
gst_pad_set_chain_function (avi->sinkpad,
|
gst_pad_set_chain_function (avi->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_avi_demux_chain));
|
GST_DEBUG_FUNCPTR (gst_avi_demux_chain));
|
||||||
gst_pad_set_event_function (avi->sinkpad,
|
gst_pad_set_event_function (avi->sinkpad,
|
||||||
|
@ -5286,55 +5282,46 @@ gst_avi_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
||||||
goto activate_push;
|
goto activate_push;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
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:
|
activate_push:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (sinkpad, "activating 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_avi_demux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
|
gst_avi_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
||||||
gboolean active)
|
GstPadMode mode, gboolean active)
|
||||||
{
|
{
|
||||||
|
gboolean res;
|
||||||
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
||||||
|
|
||||||
if (active) {
|
switch (mode) {
|
||||||
avi->streaming = FALSE;
|
case GST_PAD_MODE_PULL:
|
||||||
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_avi_demux_loop,
|
if (active) {
|
||||||
sinkpad);
|
avi->streaming = FALSE;
|
||||||
} else {
|
res = gst_pad_start_task (sinkpad, (GstTaskFunction) gst_avi_demux_loop,
|
||||||
return gst_pad_stop_task (sinkpad);
|
sinkpad);
|
||||||
|
} else {
|
||||||
|
res = gst_pad_stop_task (sinkpad);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GST_PAD_MODE_PUSH:
|
||||||
|
if (active) {
|
||||||
|
GST_DEBUG ("avi: activating push/chain function");
|
||||||
|
avi->streaming = TRUE;
|
||||||
|
} else {
|
||||||
|
GST_DEBUG ("avi: deactivating push/chain function");
|
||||||
|
}
|
||||||
|
res = TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
res = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
return res;
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_avi_demux_activate_push (GstPad * pad, GstObject * parent, gboolean active)
|
|
||||||
{
|
|
||||||
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
|
||||||
|
|
||||||
if (active) {
|
|
||||||
GST_DEBUG ("avi: activating push/chain function");
|
|
||||||
avi->streaming = TRUE;
|
|
||||||
#if 0
|
|
||||||
/* create index for some push based seeking if not provided */
|
|
||||||
GST_OBJECT_LOCK (avi);
|
|
||||||
if (!avi->element_index) {
|
|
||||||
GST_DEBUG_OBJECT (avi, "creating index");
|
|
||||||
avi->element_index = gst_index_factory_make ("memindex");
|
|
||||||
}
|
|
||||||
GST_OBJECT_UNLOCK (avi);
|
|
||||||
/* object lock might be taken again */
|
|
||||||
gst_index_get_writer_id (avi->element_index, GST_OBJECT_CAST (avi),
|
|
||||||
&avi->index_id);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
GST_DEBUG ("avi: deactivating push/chain function");
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -86,8 +86,8 @@ 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, GstObject * parent);
|
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_mode (GstPad * pad,
|
||||||
GstObject * parent, gboolean active);
|
GstObject * parent, GstPadMode mode, 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);
|
||||||
|
@ -145,8 +145,8 @@ gst_rnd_buffer_size_init (GstRndBufferSize * self)
|
||||||
self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
||||||
gst_pad_set_activate_function (self->sinkpad,
|
gst_pad_set_activate_function (self->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate));
|
GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate));
|
||||||
gst_pad_set_activatepull_function (self->sinkpad,
|
gst_pad_set_activatemode_function (self->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate_pull));
|
GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate_mode));
|
||||||
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
|
||||||
|
|
||||||
self->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
self->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
||||||
|
@ -234,7 +234,7 @@ gst_rnd_buffer_size_activate (GstPad * pad, GstObject * parent)
|
||||||
goto no_pull;
|
goto no_pull;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pad, "activating pull");
|
GST_DEBUG_OBJECT (pad, "activating pull");
|
||||||
return gst_pad_activate_pull (pad, TRUE);
|
return gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, TRUE);
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_pull:
|
no_pull:
|
||||||
|
@ -246,19 +246,29 @@ no_pull:
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rnd_buffer_size_activate_pull (GstPad * pad, GstObject * parent,
|
gst_rnd_buffer_size_activate_mode (GstPad * pad, GstObject * parent,
|
||||||
gboolean active)
|
GstPadMode mode, gboolean active)
|
||||||
{
|
{
|
||||||
|
gboolean res;
|
||||||
GstRndBufferSize *self = GST_RND_BUFFER_SIZE (parent);
|
GstRndBufferSize *self = GST_RND_BUFFER_SIZE (parent);
|
||||||
|
|
||||||
if (active) {
|
switch (mode) {
|
||||||
GST_INFO_OBJECT (self, "starting pull");
|
case GST_PAD_MODE_PULL:
|
||||||
return gst_pad_start_task (pad, (GstTaskFunction) gst_rnd_buffer_size_loop,
|
if (active) {
|
||||||
self);
|
GST_INFO_OBJECT (self, "starting pull");
|
||||||
} else {
|
res =
|
||||||
GST_INFO_OBJECT (self, "stopping pull");
|
gst_pad_start_task (pad, (GstTaskFunction) gst_rnd_buffer_size_loop,
|
||||||
return gst_pad_stop_task (pad);
|
self);
|
||||||
|
} else {
|
||||||
|
GST_INFO_OBJECT (self, "stopping pull");
|
||||||
|
res = gst_pad_stop_task (pad);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
res = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2818,49 +2818,44 @@ gst_flv_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
||||||
goto activate_push;
|
goto activate_push;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
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:
|
activate_push:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (sinkpad, "activating 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
|
static gboolean
|
||||||
gst_flv_demux_sink_activate_push (GstPad * sinkpad, GstObject * parent,
|
gst_flv_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
||||||
gboolean active)
|
GstPadMode mode, gboolean active)
|
||||||
{
|
{
|
||||||
|
gboolean res;
|
||||||
GstFlvDemux *demux;
|
GstFlvDemux *demux;
|
||||||
|
|
||||||
demux = GST_FLV_DEMUX (parent);
|
demux = GST_FLV_DEMUX (parent);
|
||||||
|
|
||||||
demux->random_access = FALSE;
|
switch (mode) {
|
||||||
|
case GST_PAD_MODE_PUSH:
|
||||||
return TRUE;
|
demux->random_access = FALSE;
|
||||||
}
|
res = TRUE;
|
||||||
|
break;
|
||||||
/* this function gets called when we activate ourselves in pull mode.
|
case GST_PAD_MODE_PULL:
|
||||||
* We can perform random access to the resource and we start a task
|
if (active) {
|
||||||
* to start reading */
|
demux->random_access = TRUE;
|
||||||
static gboolean
|
res = gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flv_demux_loop,
|
||||||
gst_flv_demux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
|
sinkpad);
|
||||||
gboolean active)
|
} else {
|
||||||
{
|
demux->random_access = FALSE;
|
||||||
GstFlvDemux *demux;
|
res = gst_pad_stop_task (sinkpad);
|
||||||
|
}
|
||||||
demux = GST_FLV_DEMUX (parent);
|
break;
|
||||||
|
default:
|
||||||
if (active) {
|
res = FALSE;
|
||||||
demux->random_access = TRUE;
|
break;
|
||||||
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flv_demux_loop,
|
|
||||||
sinkpad);
|
|
||||||
} else {
|
|
||||||
demux->random_access = FALSE;
|
|
||||||
return gst_pad_stop_task (sinkpad);
|
|
||||||
}
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -3243,10 +3238,8 @@ gst_flv_demux_init (GstFlvDemux * demux)
|
||||||
GST_DEBUG_FUNCPTR (gst_flv_demux_chain));
|
GST_DEBUG_FUNCPTR (gst_flv_demux_chain));
|
||||||
gst_pad_set_activate_function (demux->sinkpad,
|
gst_pad_set_activate_function (demux->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_flv_demux_sink_activate));
|
GST_DEBUG_FUNCPTR (gst_flv_demux_sink_activate));
|
||||||
gst_pad_set_activatepull_function (demux->sinkpad,
|
gst_pad_set_activatemode_function (demux->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_flv_demux_sink_activate_pull));
|
GST_DEBUG_FUNCPTR (gst_flv_demux_sink_activate_mode));
|
||||||
gst_pad_set_activatepush_function (demux->sinkpad,
|
|
||||||
GST_DEBUG_FUNCPTR (gst_flv_demux_sink_activate_push));
|
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
|
||||||
|
|
||||||
|
|
|
@ -401,10 +401,8 @@ 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, GstObject * parent);
|
static gboolean qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent);
|
||||||
static gboolean qtdemux_sink_activate_pull (GstPad * sinkpad,
|
static gboolean qtdemux_sink_activate_mode (GstPad * sinkpad,
|
||||||
GstObject * parent, gboolean active);
|
GstObject * parent, GstPadMode mode, 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,
|
||||||
|
@ -476,10 +474,8 @@ gst_qtdemux_init (GstQTDemux * qtdemux)
|
||||||
qtdemux->sinkpad =
|
qtdemux->sinkpad =
|
||||||
gst_pad_new_from_static_template (&gst_qtdemux_sink_template, "sink");
|
gst_pad_new_from_static_template (&gst_qtdemux_sink_template, "sink");
|
||||||
gst_pad_set_activate_function (qtdemux->sinkpad, qtdemux_sink_activate);
|
gst_pad_set_activate_function (qtdemux->sinkpad, qtdemux_sink_activate);
|
||||||
gst_pad_set_activatepull_function (qtdemux->sinkpad,
|
gst_pad_set_activatemode_function (qtdemux->sinkpad,
|
||||||
qtdemux_sink_activate_pull);
|
qtdemux_sink_activate_mode);
|
||||||
gst_pad_set_activatepush_function (qtdemux->sinkpad,
|
|
||||||
qtdemux_sink_activate_push);
|
|
||||||
gst_pad_set_chain_function (qtdemux->sinkpad, gst_qtdemux_chain);
|
gst_pad_set_chain_function (qtdemux->sinkpad, gst_qtdemux_chain);
|
||||||
gst_pad_set_event_function (qtdemux->sinkpad, gst_qtdemux_handle_sink_event);
|
gst_pad_set_event_function (qtdemux->sinkpad, gst_qtdemux_handle_sink_event);
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (qtdemux), qtdemux->sinkpad);
|
gst_element_add_pad (GST_ELEMENT_CAST (qtdemux), qtdemux->sinkpad);
|
||||||
|
@ -4441,39 +4437,41 @@ qtdemux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
||||||
goto activate_push;
|
goto activate_push;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
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:
|
activate_push:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (sinkpad, "activating 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
qtdemux_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
|
qtdemux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
||||||
gboolean active)
|
GstPadMode mode, gboolean active)
|
||||||
{
|
{
|
||||||
|
gboolean res;
|
||||||
GstQTDemux *demux = GST_QTDEMUX (parent);
|
GstQTDemux *demux = GST_QTDEMUX (parent);
|
||||||
|
|
||||||
if (active) {
|
switch (mode) {
|
||||||
demux->pullbased = TRUE;
|
case GST_PAD_MODE_PUSH:
|
||||||
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_qtdemux_loop,
|
demux->pullbased = FALSE;
|
||||||
sinkpad);
|
res = TRUE;
|
||||||
} else {
|
break;
|
||||||
return gst_pad_stop_task (sinkpad);
|
case GST_PAD_MODE_PULL:
|
||||||
|
if (active) {
|
||||||
|
demux->pullbased = TRUE;
|
||||||
|
res = gst_pad_start_task (sinkpad, (GstTaskFunction) gst_qtdemux_loop,
|
||||||
|
sinkpad);
|
||||||
|
} else {
|
||||||
|
res = gst_pad_stop_task (sinkpad);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
res = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
return res;
|
||||||
|
|
||||||
static gboolean
|
|
||||||
qtdemux_sink_activate_push (GstPad * sinkpad, GstObject * parent,
|
|
||||||
gboolean active)
|
|
||||||
{
|
|
||||||
GstQTDemux *demux = GST_QTDEMUX (parent);
|
|
||||||
|
|
||||||
demux->pullbased = FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
|
|
|
@ -259,8 +259,8 @@ static gboolean gst_rtp_jitter_buffer_sink_query (GstPad * pad,
|
||||||
/* srcpad overrides */
|
/* srcpad overrides */
|
||||||
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_mode (GstPad * pad,
|
||||||
GstObject * parent, gboolean active);
|
GstObject * parent, GstPadMode mode, 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);
|
||||||
|
@ -475,8 +475,8 @@ gst_rtp_jitter_buffer_init (GstRtpJitterBuffer * jitterbuffer)
|
||||||
gst_pad_new_from_static_template (&gst_rtp_jitter_buffer_src_template,
|
gst_pad_new_from_static_template (&gst_rtp_jitter_buffer_src_template,
|
||||||
"src");
|
"src");
|
||||||
|
|
||||||
gst_pad_set_activatepush_function (priv->srcpad,
|
gst_pad_set_activatemode_function (priv->srcpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_src_activate_push));
|
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_src_activate_mode));
|
||||||
gst_pad_set_query_function (priv->srcpad,
|
gst_pad_set_query_function (priv->srcpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_src_query));
|
GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_src_query));
|
||||||
gst_pad_set_event_function (priv->srcpad,
|
gst_pad_set_event_function (priv->srcpad,
|
||||||
|
@ -882,32 +882,38 @@ gst_rtp_jitter_buffer_flush_stop (GstRtpJitterBuffer * jitterbuffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, GstObject * parent,
|
gst_rtp_jitter_buffer_src_activate_mode (GstPad * pad, GstObject * parent,
|
||||||
gboolean active)
|
GstPadMode mode, gboolean active)
|
||||||
{
|
{
|
||||||
gboolean result = TRUE;
|
gboolean result;
|
||||||
GstRtpJitterBuffer *jitterbuffer = NULL;
|
GstRtpJitterBuffer *jitterbuffer = NULL;
|
||||||
|
|
||||||
jitterbuffer = GST_RTP_JITTER_BUFFER (parent);
|
jitterbuffer = GST_RTP_JITTER_BUFFER (parent);
|
||||||
|
|
||||||
if (active) {
|
switch (mode) {
|
||||||
/* allow data processing */
|
case GST_PAD_MODE_PUSH:
|
||||||
gst_rtp_jitter_buffer_flush_stop (jitterbuffer);
|
if (active) {
|
||||||
|
/* allow data processing */
|
||||||
|
gst_rtp_jitter_buffer_flush_stop (jitterbuffer);
|
||||||
|
|
||||||
/* start pushing out buffers */
|
/* start pushing out buffers */
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "Starting task on srcpad");
|
GST_DEBUG_OBJECT (jitterbuffer, "Starting task on srcpad");
|
||||||
gst_pad_start_task (jitterbuffer->priv->srcpad,
|
result = gst_pad_start_task (jitterbuffer->priv->srcpad,
|
||||||
(GstTaskFunction) gst_rtp_jitter_buffer_loop, jitterbuffer);
|
(GstTaskFunction) gst_rtp_jitter_buffer_loop, jitterbuffer);
|
||||||
} else {
|
} else {
|
||||||
/* make sure all data processing stops ASAP */
|
/* make sure all data processing stops ASAP */
|
||||||
gst_rtp_jitter_buffer_flush_start (jitterbuffer);
|
gst_rtp_jitter_buffer_flush_start (jitterbuffer);
|
||||||
|
|
||||||
/* NOTE this will hardlock if the state change is called from the src pad
|
/* NOTE this will hardlock if the state change is called from the src pad
|
||||||
* task thread because we will _join() the thread. */
|
* task thread because we will _join() the thread. */
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "Stopping task on srcpad");
|
GST_DEBUG_OBJECT (jitterbuffer, "Stopping task on srcpad");
|
||||||
result = gst_pad_stop_task (pad);
|
result = gst_pad_stop_task (pad);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,7 +1075,8 @@ gst_rtp_jitter_buffer_sink_event (GstPad * pad, GstObject * parent,
|
||||||
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 =
|
ret =
|
||||||
gst_rtp_jitter_buffer_src_activate_push (priv->srcpad, parent, TRUE);
|
gst_rtp_jitter_buffer_src_activate_mode (priv->srcpad, parent,
|
||||||
|
GST_PAD_MODE_PUSH, TRUE);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,8 +65,8 @@ 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);
|
GstObject * parent);
|
||||||
static gboolean gst_wavparse_sink_activate_pull (GstPad * sinkpad,
|
static gboolean gst_wavparse_sink_activate_mode (GstPad * sinkpad,
|
||||||
GstObject * parent, gboolean active);
|
GstObject * parent, GstPadMode mode, 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,
|
||||||
|
@ -192,8 +192,8 @@ gst_wavparse_init (GstWavParse * wavparse)
|
||||||
gst_pad_new_from_static_template (&sink_template_factory, "sink");
|
gst_pad_new_from_static_template (&sink_template_factory, "sink");
|
||||||
gst_pad_set_activate_function (wavparse->sinkpad,
|
gst_pad_set_activate_function (wavparse->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_wavparse_sink_activate));
|
GST_DEBUG_FUNCPTR (gst_wavparse_sink_activate));
|
||||||
gst_pad_set_activatepull_function (wavparse->sinkpad,
|
gst_pad_set_activatemode_function (wavparse->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_wavparse_sink_activate_pull));
|
GST_DEBUG_FUNCPTR (gst_wavparse_sink_activate_mode));
|
||||||
gst_pad_set_chain_function (wavparse->sinkpad,
|
gst_pad_set_chain_function (wavparse->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_wavparse_chain));
|
GST_DEBUG_FUNCPTR (gst_wavparse_chain));
|
||||||
gst_pad_set_event_function (wavparse->sinkpad,
|
gst_pad_set_event_function (wavparse->sinkpad,
|
||||||
|
@ -2565,30 +2565,43 @@ gst_wavparse_sink_activate (GstPad * sinkpad, GstObject * parent)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
||||||
wav->streaming = FALSE;
|
wav->streaming = FALSE;
|
||||||
return gst_pad_activate_pull (sinkpad, TRUE);
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE);
|
||||||
|
|
||||||
activate_push:
|
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 ();
|
||||||
return gst_pad_activate_push (sinkpad, TRUE);
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_wavparse_sink_activate_pull (GstPad * sinkpad, GstObject * parent,
|
gst_wavparse_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
||||||
gboolean active)
|
GstPadMode mode, gboolean active)
|
||||||
{
|
{
|
||||||
if (active) {
|
gboolean res;
|
||||||
/* if we have a scheduler we can start the task */
|
|
||||||
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_wavparse_loop,
|
switch (mode) {
|
||||||
sinkpad);
|
case GST_PAD_MODE_PUSH:
|
||||||
} else {
|
res = TRUE;
|
||||||
return gst_pad_stop_task (sinkpad);
|
break;
|
||||||
|
case GST_PAD_MODE_PULL:
|
||||||
|
if (active) {
|
||||||
|
/* if we have a scheduler we can start the task */
|
||||||
|
res = gst_pad_start_task (sinkpad, (GstTaskFunction) gst_wavparse_loop,
|
||||||
|
sinkpad);
|
||||||
|
} else {
|
||||||
|
res = gst_pad_stop_task (sinkpad);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
res = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_wavparse_change_state (GstElement * element, GstStateChange transition)
|
gst_wavparse_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
Loading…
Reference in a new issue