mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
Update for stream lock API changes: don't take stream log in sink event handlers any longer and change GST_STREAM_LOC...
Original commit message from CVS: * ext/dv/gstdvdemux.c: (gst_dvdemux_handle_sink_event): * ext/flac/gstflacdec.c: (gst_flacdec_loop), (gst_flacdec_src_event): * ext/flac/gstflacenc.c: (gst_flacenc_sink_event): * ext/ladspa/gstsignalprocessor.c: (gst_signal_processor_event), (gst_signal_processor_getrange), (gst_signal_processor_chain): * gst/avi/gstavidemux.c: (gst_avi_demux_handle_seek): * gst/flx/gstflxdec.c: (gst_flxdec_src_event_handler), (gst_flxdec_sink_event_handler): * gst/matroska/matroska-demux.c: (gst_matroska_demux_handle_seek_event): * gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek): Update for stream lock API changes: don't take stream log in sink event handlers any longer and change GST_STREAM_LOCK to GST_PAD_STREAM_LOCK. Don't leak references in flxdec event functions.
This commit is contained in:
parent
e594bf3649
commit
3cbd39e022
9 changed files with 40 additions and 71 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2005-11-21 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* ext/dv/gstdvdemux.c: (gst_dvdemux_handle_sink_event):
|
||||
* ext/flac/gstflacdec.c: (gst_flacdec_loop),
|
||||
(gst_flacdec_src_event):
|
||||
* ext/flac/gstflacenc.c: (gst_flacenc_sink_event):
|
||||
* ext/ladspa/gstsignalprocessor.c: (gst_signal_processor_event),
|
||||
(gst_signal_processor_getrange), (gst_signal_processor_chain):
|
||||
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_seek):
|
||||
* gst/flx/gstflxdec.c: (gst_flxdec_src_event_handler),
|
||||
(gst_flxdec_sink_event_handler):
|
||||
* gst/matroska/matroska-demux.c:
|
||||
(gst_matroska_demux_handle_seek_event):
|
||||
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek):
|
||||
Update for stream lock API changes: don't take stream log
|
||||
in sink event handlers any longer and change GST_STREAM_LOCK
|
||||
to GST_PAD_STREAM_LOCK. Don't leak references in flxdec event
|
||||
functions.
|
||||
|
||||
2005-11-21 Michael Smith <msmith@fluendo.com>
|
||||
|
||||
* gst/auparse/gstauparse.c: (gst_auparse_dispose):
|
||||
|
|
|
@ -596,25 +596,16 @@ gst_dvdemux_handle_sink_event (GstPad * pad, GstEvent * event)
|
|||
* to the peer which will be unblocked by forwarding the
|
||||
* event.*/
|
||||
res = gst_dvdemux_send_event (dvdemux, event);
|
||||
|
||||
/* and wait till streaming stops, not strictly needed as
|
||||
* the peer calling us will do the same. */
|
||||
GST_STREAM_LOCK (pad);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
case GST_EVENT_FLUSH_STOP:
|
||||
GST_STREAM_LOCK (pad);
|
||||
gst_adapter_clear (dvdemux->adapter);
|
||||
GST_DEBUG ("cleared adapter");
|
||||
res = gst_dvdemux_send_event (dvdemux, event);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
case GST_EVENT_NEWSEGMENT:
|
||||
{
|
||||
GstFormat format;
|
||||
|
||||
GST_STREAM_LOCK (pad);
|
||||
|
||||
/* parse byte start and stop positions */
|
||||
gst_event_parse_newsegment (event, NULL, NULL, &format,
|
||||
&dvdemux->start_byte, &dvdemux->stop_byte, NULL);
|
||||
|
@ -622,19 +613,16 @@ gst_dvdemux_handle_sink_event (GstPad * pad, GstEvent * event)
|
|||
/* and queue a DISCONT before sending the next set of buffers */
|
||||
dvdemux->need_discont = TRUE;
|
||||
gst_event_unref (event);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_EOS:
|
||||
default:
|
||||
GST_STREAM_LOCK (pad);
|
||||
/* flush any pending data */
|
||||
gst_dvdemux_flush (dvdemux);
|
||||
/* forward event */
|
||||
res = gst_dvdemux_send_event (dvdemux, event);
|
||||
/* and clear the adapter */
|
||||
gst_adapter_clear (dvdemux->adapter);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -527,8 +527,6 @@ gst_flacdec_loop (GstPad * sinkpad)
|
|||
|
||||
flacdec = GST_FLACDEC (GST_OBJECT_PARENT (sinkpad));
|
||||
|
||||
GST_STREAM_LOCK (sinkpad);
|
||||
|
||||
GST_DEBUG ("flacdec: entering loop");
|
||||
if (flacdec->init) {
|
||||
GST_DEBUG ("flacdec: initializing decoder");
|
||||
|
@ -563,7 +561,6 @@ analyze_state:
|
|||
case FLAC__SEEKABLE_STREAM_DECODER_OK:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_SEEKING:
|
||||
GST_DEBUG ("flacdec: everything ok");
|
||||
GST_STREAM_UNLOCK (sinkpad);
|
||||
return;
|
||||
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:{
|
||||
|
@ -577,8 +574,6 @@ analyze_state:
|
|||
|
||||
GST_DEBUG ("pausing");
|
||||
gst_pad_pause_task (sinkpad);
|
||||
|
||||
GST_STREAM_UNLOCK (sinkpad);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -602,8 +597,6 @@ analyze_state:
|
|||
|
||||
GST_DEBUG ("pausing");
|
||||
gst_pad_pause_task (sinkpad);
|
||||
|
||||
GST_STREAM_UNLOCK (sinkpad);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -765,7 +758,7 @@ gst_flacdec_src_event (GstPad * pad, GstEvent * event)
|
|||
GST_DEBUG ("Initializing seek");
|
||||
g_print ("Grab seek lock\n");
|
||||
gst_pad_push_event (flacdec->srcpad, gst_event_new_flush_start ());
|
||||
GST_STREAM_LOCK (flacdec->sinkpad);
|
||||
GST_PAD_STREAM_LOCK (flacdec->sinkpad);
|
||||
g_print ("Got seek lock\n");
|
||||
gst_pad_push_event (flacdec->srcpad, gst_event_new_flush_stop ());
|
||||
GST_DEBUG ("Ready");
|
||||
|
@ -773,7 +766,7 @@ gst_flacdec_src_event (GstPad * pad, GstEvent * event)
|
|||
flacdec->seek_value = pos;
|
||||
gst_pad_start_task (flacdec->sinkpad,
|
||||
(GstTaskFunction) gst_flacdec_loop, flacdec->sinkpad);
|
||||
GST_STREAM_UNLOCK (flacdec->sinkpad);
|
||||
GST_PAD_STREAM_UNLOCK (flacdec->sinkpad);
|
||||
} else
|
||||
res = FALSE;
|
||||
break;
|
||||
|
|
|
@ -600,7 +600,6 @@ gst_flacenc_sink_event (GstPad * pad, GstEvent * event)
|
|||
GstFormat format;
|
||||
gint64 start, stream_time;
|
||||
|
||||
GST_STREAM_LOCK (pad);
|
||||
if (flacenc->offset == 0) {
|
||||
gst_event_parse_newsegment (event, NULL, NULL, &format, &start, NULL,
|
||||
&stream_time);
|
||||
|
@ -623,14 +622,11 @@ gst_flacenc_sink_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
gst_event_unref (event);
|
||||
/* don't push it downstream, we'll generate our own via seek to 0 */
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_EOS:
|
||||
GST_STREAM_LOCK (pad);
|
||||
FLAC__seekable_stream_encoder_finish (flacenc->encoder);
|
||||
ret = gst_pad_event_default (pad, event);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
case GST_EVENT_TAG:
|
||||
if (flacenc->tags) {
|
||||
|
@ -639,9 +635,7 @@ gst_flacenc_sink_event (GstPad * pad, GstEvent * event)
|
|||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
GST_STREAM_LOCK (pad);
|
||||
ret = gst_pad_event_default (pad, event);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
default:
|
||||
ret = gst_pad_event_default (pad, event);
|
||||
|
|
|
@ -287,7 +287,6 @@ gst_signal_processor_event (GstPad * pad, GstEvent * event)
|
|||
{
|
||||
GstSignalProcessor *self;
|
||||
GstSignalProcessorClass *bclass;
|
||||
gboolean ret = FALSE;
|
||||
gboolean unlock;
|
||||
|
||||
self = GST_SIGNAL_PROCESSOR (GST_PAD_PARENT (pad));
|
||||
|
@ -296,20 +295,7 @@ gst_signal_processor_event (GstPad * pad, GstEvent * event)
|
|||
if (bclass->event)
|
||||
bclass->event (self, event);
|
||||
|
||||
unlock = FALSE;
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_FLUSH_STOP:
|
||||
case GST_EVENT_EOS:
|
||||
GST_STREAM_LOCK (pad);
|
||||
unlock = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ret = gst_pad_event_default (pad, event);
|
||||
if (unlock)
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -476,8 +462,6 @@ gst_signal_processor_getrange (GstPad * pad, guint64 offset,
|
|||
|
||||
self = GST_SIGNAL_PROCESSOR (GST_PAD_PARENT (pad));
|
||||
|
||||
GST_STREAM_LOCK (pad);
|
||||
|
||||
if (spad->pen) {
|
||||
*buffer = spad->pen;
|
||||
spad->pen = NULL;
|
||||
|
@ -497,8 +481,6 @@ gst_signal_processor_getrange (GstPad * pad, guint64 offset,
|
|||
}
|
||||
}
|
||||
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -547,8 +529,6 @@ gst_signal_processor_chain (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
self = GST_SIGNAL_PROCESSOR (GST_PAD_PARENT (pad));
|
||||
|
||||
GST_STREAM_LOCK (pad);
|
||||
|
||||
gst_signal_processor_pen_buffer (self, pad, buffer);
|
||||
|
||||
if (self->pending_in == 0) {
|
||||
|
@ -557,8 +537,6 @@ gst_signal_processor_chain (GstPad * pad, GstBuffer * buffer)
|
|||
gst_signal_processor_do_pushes (self);
|
||||
}
|
||||
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
|
||||
return self->state;
|
||||
}
|
||||
|
||||
|
|
|
@ -1995,7 +1995,7 @@ gst_avi_demux_handle_seek (GstAviDemux * avi, gboolean update)
|
|||
} else
|
||||
gst_pad_pause_task (avi->sinkpad);
|
||||
|
||||
GST_STREAM_LOCK (avi->sinkpad);
|
||||
GST_PAD_STREAM_LOCK (avi->sinkpad);
|
||||
|
||||
/* fill current_entry according to flags and update */
|
||||
if (update) {
|
||||
|
@ -2043,7 +2043,7 @@ gst_avi_demux_handle_seek (GstAviDemux * avi, gboolean update)
|
|||
gst_pad_start_task (avi->sinkpad, (GstTaskFunction) gst_avi_demux_loop,
|
||||
avi->sinkpad);
|
||||
|
||||
GST_STREAM_UNLOCK (avi->sinkpad);
|
||||
GST_PAD_STREAM_UNLOCK (avi->sinkpad);
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
|
|
@ -176,32 +176,29 @@ static gboolean
|
|||
gst_flxdec_src_event_handler (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
GstFlxDec *flxdec = (GstFlxDec *) gst_pad_get_parent (pad);
|
||||
|
||||
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
|
||||
gboolean ret;
|
||||
|
||||
/* TODO: implement the seek and other event handling */
|
||||
|
||||
return gst_pad_push_event (flxdec->sinkpad, event);
|
||||
ret = gst_pad_push_event (flxdec->sinkpad, event);
|
||||
|
||||
gst_object_unref (flxdec);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_flxdec_sink_event_handler (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
GstFlxDec *flxdec = (GstFlxDec *) gst_pad_get_parent (pad);
|
||||
GstFlxDec *flxdec;
|
||||
gboolean ret;
|
||||
|
||||
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
|
||||
flxdec = GST_FLXDEC (gst_pad_get_parent (pad));
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS ||
|
||||
GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT)
|
||||
GST_STREAM_LOCK (flxdec->srcpad);
|
||||
ret = gst_pad_push_event (flxdec->srcpad, event);
|
||||
|
||||
gst_pad_push_event (flxdec->srcpad, gst_event_ref (event));
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS ||
|
||||
GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT)
|
||||
GST_STREAM_UNLOCK (flxdec->srcpad);
|
||||
|
||||
return TRUE;
|
||||
gst_object_unref (flxdec);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1102,7 +1102,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
|
|||
/* now grab the stream lock so that streaming cannot continue, for
|
||||
* non flushing seeks when the element is in PAUSED this could block
|
||||
* forever. */
|
||||
GST_STREAM_LOCK (demux->sinkpad);
|
||||
GST_PAD_STREAM_LOCK (demux->sinkpad);
|
||||
|
||||
GST_OBJECT_LOCK (demux);
|
||||
|
||||
|
@ -1188,7 +1188,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
|
|||
demux->sinkpad);
|
||||
|
||||
/* streaming can continue now */
|
||||
GST_STREAM_UNLOCK (demux->sinkpad);
|
||||
GST_PAD_STREAM_UNLOCK (demux->sinkpad);
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
@ -1198,7 +1198,7 @@ seek_error:
|
|||
* function again so that things can continue from where they left off? */
|
||||
GST_DEBUG ("Got a seek error");
|
||||
GST_OBJECT_UNLOCK (demux);
|
||||
GST_STREAM_UNLOCK (demux->sinkpad);
|
||||
GST_PAD_STREAM_UNLOCK (demux->sinkpad);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -718,7 +718,7 @@ gst_wavparse_handle_seek (GstWavParse * wav, gboolean update)
|
|||
else
|
||||
gst_pad_pause_task (wav->sinkpad);
|
||||
|
||||
GST_STREAM_LOCK (wav->sinkpad);
|
||||
GST_PAD_STREAM_LOCK (wav->sinkpad);
|
||||
|
||||
if (update) {
|
||||
wav->offset = wav->segment_start + wav->datastart;
|
||||
|
@ -749,7 +749,7 @@ gst_wavparse_handle_seek (GstWavParse * wav, gboolean update)
|
|||
gst_pad_start_task (wav->sinkpad, (GstTaskFunction) gst_wavparse_loop,
|
||||
wav->sinkpad);
|
||||
|
||||
GST_STREAM_UNLOCK (wav->sinkpad);
|
||||
GST_PAD_STREAM_UNLOCK (wav->sinkpad);
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue