summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2005-11-21 18:09:02 +0000
committerTim-Philipp Müller <tim@centricular.net>2005-11-21 18:09:02 +0000
commit3cbd39e022c47cabd8dca1657ea79759bc6b4615 (patch)
tree5faf3e4a96c908dae92513c9d9fadcaaaa8f7b45
parente594bf3649ed2daab507a9f79080ef3aaa484b52 (diff)
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.
-rw-r--r--ChangeLog19
-rw-r--r--ext/dv/gstdvdemux.c12
-rw-r--r--ext/flac/gstflacdec.c11
-rw-r--r--ext/flac/gstflacenc.c6
-rw-r--r--ext/ladspa/gstsignalprocessor.c22
-rw-r--r--gst/avi/gstavidemux.c4
-rw-r--r--gst/flx/gstflxdec.c27
-rw-r--r--gst/matroska/matroska-demux.c6
-rw-r--r--gst/wavparse/gstwavparse.c4
9 files changed, 40 insertions, 71 deletions
diff --git a/ChangeLog b/ChangeLog
index bba1eec4..73cdeb3c 100644
--- a/ChangeLog
+++ b/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):
diff --git a/ext/dv/gstdvdemux.c b/ext/dv/gstdvdemux.c
index 1408df8f..3786f522 100644
--- a/ext/dv/gstdvdemux.c
+++ b/ext/dv/gstdvdemux.c
@@ -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;
}
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index c609e2e5..af2c8dc6 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -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;
diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c
index 79f3de0b..360ff67b 100644
--- a/ext/flac/gstflacenc.c
+++ b/ext/flac/gstflacenc.c
@@ -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);
diff --git a/ext/ladspa/gstsignalprocessor.c b/ext/ladspa/gstsignalprocessor.c
index 25200d4f..9caf7b7b 100644
--- a/ext/ladspa/gstsignalprocessor.c
+++ b/ext/ladspa/gstsignalprocessor.c
@@ -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;
}
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
index 1bb27c28..d363d214 100644
--- a/gst/avi/gstavidemux.c
+++ b/gst/avi/gstavidemux.c
@@ -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;
diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c
index e3e4bcc8..0ca9fc48 100644
--- a/gst/flx/gstflxdec.c
+++ b/gst/flx/gstflxdec.c
@@ -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);
-
- g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_EOS ||
- GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT)
- GST_STREAM_LOCK (flxdec->srcpad);
+ GstFlxDec *flxdec;
+ gboolean ret;
- gst_pad_push_event (flxdec->srcpad, gst_event_ref (event));
+ 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_UNLOCK (flxdec->srcpad);
+ ret = gst_pad_push_event (flxdec->srcpad, event);
- return TRUE;
+ gst_object_unref (flxdec);
+ return ret;
}
static void
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 0b03e31e..a89587c1 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -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;
}
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c
index 59835d0b..8978e1de 100644
--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -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;