diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2006-04-20 18:02:07 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2006-04-20 18:02:07 +0000 |
commit | af701d80d58617a18d2295344a40a64d9ffa80d2 (patch) | |
tree | b9c64a93bff3929324c8c4c99ff16f6561b2e091 | |
parent | 13058bdf4c58921caa3e2635c371055c5d454def (diff) | |
download | gst-plugins-bad-af701d80d58617a18d2295344a40a64d9ffa80d2.tar.gz gst-plugins-bad-af701d80d58617a18d2295344a40a64d9ffa80d2.tar.bz2 gst-plugins-bad-af701d80d58617a18d2295344a40a64d9ffa80d2.zip |
ext/musepack/gstmusepackdec.c: Add support for segment seeks.
Original commit message from CVS:
* ext/musepack/gstmusepackdec.c:
(gst_musepackdec_handle_seek_event), (gst_musepackdec_loop):
Add support for segment seeks.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/musepack/gstmusepackdec.c | 41 |
2 files changed, 43 insertions, 4 deletions
@@ -1,3 +1,9 @@ +2006-04-20 Tim-Philipp Müller <tim at centricular dot net> + + * ext/musepack/gstmusepackdec.c: + (gst_musepackdec_handle_seek_event), (gst_musepackdec_loop): + Add support for segment seeks. + 2006-04-20 Edgard Lima <edgard.lima@indt.org.br> * sys/v4l2/gstv4l2src.c: diff --git a/ext/musepack/gstmusepackdec.c b/ext/musepack/gstmusepackdec.c index 8172aa8f..bb302cac 100644 --- a/ext/musepack/gstmusepackdec.c +++ b/ext/musepack/gstmusepackdec.c @@ -224,7 +224,13 @@ gst_musepackdec_handle_seek_event (GstMusepackDec * dec, GstEvent * event) if (!mpc_decoder_seek_sample (dec->d, segment.start)) goto failed; - /* FIXME: support segment seeks */ + if ((flags & GST_SEEK_FLAG_SEGMENT) == GST_SEEK_FLAG_SEGMENT) { + GST_DEBUG_OBJECT (dec, "posting SEGMENT_START message"); + + gst_element_post_message (GST_ELEMENT (dec), + gst_message_new_segment_start (GST_OBJECT (dec), GST_FORMAT_TIME, + gst_util_uint64_scale_int (segment.start, GST_SECOND, dec->rate))); + } if (flush) { gst_pad_push_event (dec->srcpad, gst_event_new_flush_stop ()); @@ -493,9 +499,7 @@ gst_musepackdec_loop (GstPad * sinkpad) GST_ELEMENT_ERROR (musepackdec, STREAM, DECODE, (NULL), (NULL)); goto pause_task; } else if (num_samples == 0) { - GST_DEBUG_OBJECT (musepackdec, "EOS"); - gst_pad_push_event (musepackdec->srcpad, gst_event_new_eos ()); - goto pause_task; + goto eos_and_pause; } GST_BUFFER_SIZE (out) = num_samples * bitspersample; @@ -518,8 +522,37 @@ gst_musepackdec_loop (GstPad * sinkpad) goto pause_task; } + /* check if we're at the end of a configured segment */ + if (musepackdec->segment.stop != -1 && + musepackdec->segment.last_stop >= musepackdec->segment.stop) { + gint64 stop_time; + + GST_DEBUG_OBJECT (musepackdec, "Reached end of configured segment"); + + if ((musepackdec->segment.flags & GST_SEEK_FLAG_SEGMENT) == 0) + goto eos_and_pause; + + GST_DEBUG_OBJECT (musepackdec, "Posting SEGMENT_DONE message"); + + stop_time = gst_util_uint64_scale_int (musepackdec->segment.stop, + GST_SECOND, samplerate); + + gst_element_post_message (GST_ELEMENT (musepackdec), + gst_message_new_segment_done (GST_OBJECT (musepackdec), + GST_FORMAT_TIME, stop_time)); + + goto pause_task; + } + return; +eos_and_pause: + { + GST_DEBUG_OBJECT (musepackdec, "sending EOS event"); + gst_pad_push_event (musepackdec->srcpad, gst_event_new_eos ()); + /* fall through to pause */ + } + pause_task: { GST_DEBUG_OBJECT (musepackdec, "Pausing task"); |