diff options
Diffstat (limited to 'src/lib/sndfile_decoder.cc')
| -rw-r--r-- | src/lib/sndfile_decoder.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc index e10f4f568..432f73f0d 100644 --- a/src/lib/sndfile_decoder.cc +++ b/src/lib/sndfile_decoder.cc @@ -55,9 +55,13 @@ SndfileDecoder::~SndfileDecoder () delete[] _deinterleave_buffer; } -void +bool SndfileDecoder::pass () { + if (_remaining == 0) { + return true; + } + /* Do things in half second blocks as I think there may be limits to what FFmpeg (and in particular the resampler) can cope with. */ @@ -90,9 +94,11 @@ SndfileDecoder::pass () } data->set_frames (this_time); - audio (data, _done); + audio (data, _done * TIME_HZ / audio_frame_rate ()); _done += this_time; _remaining -= this_time; + + return true; } int @@ -113,8 +119,11 @@ SndfileDecoder::audio_frame_rate () const return _info.samplerate; } -bool -SndfileDecoder::done () const +void +SndfileDecoder::seek (ContentTime t, bool accurate) { - return _audio_position >= _sndfile_content->audio_length (); + Decoder::seek (t, accurate); + + _done = t * audio_frame_rate() / TIME_HZ; + _remaining = _info.frames - _done; } |
