ext/flac/gstflacdec.*: Handle segment seeks that include the end of the file as stop point properly: when the decoder...

Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flac_dec_loop):
* ext/flac/gstflacdec.h:
Handle segment seeks that include the end of the file as stop point
properly: when the decoder hits EOS we want to send a SEGMENT_DONE
message instead of an EOS event in case we're in segment seek
mode (fixes #340699).
This commit is contained in:
Tim-Philipp Müller 2006-05-06 09:01:34 +00:00
parent be7d42b548
commit 9f6377ff0d
3 changed files with 43 additions and 14 deletions

View file

@ -1,3 +1,12 @@
2006-05-06 Tim-Philipp Müller <tim at centricular dot net>
* ext/flac/gstflacdec.c: (gst_flac_dec_loop):
* ext/flac/gstflacdec.h:
Handle segment seeks that include the end of the file as stop point
properly: when the decoder hits EOS we want to send a SEGMENT_DONE
message instead of an EOS event in case we're in segment seek
mode (fixes #340699).
2006-05-05 Maciej Katafiasz <mathrick@freedesktop.org>
* ext/cairo/gsttextoverlay.c:

View file

@ -792,22 +792,15 @@ analyze_state:
if (flacdec->segment.stop != -1 &&
flacdec->segment.last_stop > 0 &&
flacdec->segment.last_stop >= flacdec->segment.stop) {
gint64 stop_time;
GST_DEBUG_OBJECT (flacdec, "reached end of the configured segment");
if ((flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) == 0)
if ((flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) == 0) {
goto eos_and_pause;
} else {
goto segment_done_and_pause;
}
GST_DEBUG_OBJECT (flacdec, "posting SEGMENT_DONE message");
stop_time = gst_util_uint64_scale_int (flacdec->segment.stop,
GST_SECOND, flacdec->sample_rate);
gst_element_post_message (GST_ELEMENT (flacdec),
gst_message_new_segment_done (GST_OBJECT (flacdec),
GST_FORMAT_TIME, stop_time));
goto pause;
g_assert_not_reached ();
}
return;
@ -816,6 +809,16 @@ analyze_state:
case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:{
GST_DEBUG_OBJECT (flacdec, "EOS");
FLAC__seekable_stream_decoder_reset (flacdec->decoder);
if ((flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0) {
if (flacdec->segment.duration > 0) {
flacdec->segment.stop = flacdec->segment.duration;
} else {
flacdec->segment.stop = flacdec->segment.last_stop;
}
goto segment_done_and_pause;
}
goto eos_and_pause;
}
@ -837,6 +840,23 @@ analyze_state:
return;
segment_done_and_pause:
{
gint64 stop_time;
stop_time = gst_util_uint64_scale_int (flacdec->segment.stop,
GST_SECOND, flacdec->sample_rate);
GST_DEBUG_OBJECT (flacdec, "posting SEGMENT_DONE message, stop time %"
GST_TIME_FORMAT, GST_TIME_ARGS (stop_time));
gst_element_post_message (GST_ELEMENT (flacdec),
gst_message_new_segment_done (GST_OBJECT (flacdec),
GST_FORMAT_TIME, stop_time));
goto pause;
}
eos_and_pause:
{
GST_DEBUG_OBJECT (flacdec, "sending EOS event");

View file

@ -30,9 +30,9 @@ G_BEGIN_DECLS
#define GST_TYPE_FLAC_DEC gst_flac_dec_get_type()
#define GST_FLAC_DEC(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, GST_TYPE_FLAC_DEC, GstFlacDec)
#define GST_FLAC_DEC_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, GST_TYPE_FLAC_DEC, GstFlacDec)
#define GST_FLAC_DEC_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, GST_TYPE_FLAC_DEC, GstFlacDecClass)
#define GST_IS_FLAC_DEC(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, GST_TYPE_FLAC_DEC)
#define GST_IS_FLAC_DEC_CLASS(obj) G_TYPE_CHECK_CLASS_TYPE(klass, GST_TYPE_FLAC_DEC)
#define GST_IS_FLAC_DEC_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE(klass, GST_TYPE_FLAC_DEC)
typedef struct _GstFlacDec GstFlacDec;
typedef struct _GstFlacDecClass GstFlacDecClass;