diff --git a/ChangeLog b/ChangeLog index 71f9339f58..eec5fc4bd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-07-08 Tim-Philipp Müller + + * 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 * docs/libs/gst-plugins-base-libs-sections.txt: diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index 0025c5ff93..19bcba3c54 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -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 */