gst-libs/gst/audio/gstbaseaudiosink.c: Quick hack to make audiosinks stop at EOS when operating in pull-mode; needs t...

Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_callback):
Quick hack to make audiosinks stop at EOS when operating in
pull-mode; needs to be fixed properly some day.
This commit is contained in:
Tim-Philipp Müller 2007-07-08 13:07:38 +00:00
parent e59bb29af4
commit 8a499651b9
2 changed files with 24 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2007-07-08 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_callback):
Quick hack to make audiosinks stop at EOS when operating in
pull-mode; needs to be fixed properly some day.
2007-07-06 Stefan Kost <ensonic@users.sf.net>
* docs/libs/gst-plugins-base-libs-sections.txt:

View file

@ -1191,8 +1191,13 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
GST_LOG_OBJECT (basesink, "pulling %d bytes offset %" G_GUINT64_FORMAT
" to fill audio buffer", len, basesink->offset);
ret = gst_pad_pull_range (basesink->sinkpad, basesink->offset, len, &buf);
if (ret != GST_FLOW_OK)
goto error;
if (ret != GST_FLOW_OK) {
if (ret == GST_FLOW_UNEXPECTED)
goto eos;
else
goto error;
}
if (len != GST_BUFFER_SIZE (buf)) {
GST_INFO_OBJECT (basesink, "short read pulling from sink pad: %d<%d",
@ -1212,6 +1217,16 @@ error:
ret);
return;
}
eos:
{
/* FIXME: this is not quite correct; we'll be called endlessly until
* the sink gets shut down; maybe we should set a flag somewhere, or
* set segment.stop and segment.duration to the last sample or so */
GST_DEBUG_OBJECT (sink, "EOS");
gst_element_post_message (GST_ELEMENT_CAST (sink),
gst_message_new_eos (GST_OBJECT_CAST (sink)));
gst_base_audio_sink_drain (sink);
}
}
/* should be called with the LOCK */