summaryrefslogtreecommitdiff
path: root/src/lib/sndfile_decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/sndfile_decoder.cc')
-rw-r--r--src/lib/sndfile_decoder.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc
index e10f4f568..1c651e614 100644
--- a/src/lib/sndfile_decoder.cc
+++ b/src/lib/sndfile_decoder.cc
@@ -45,7 +45,6 @@ SndfileDecoder::SndfileDecoder (shared_ptr<const Film> f, shared_ptr<const Sndfi
throw DecodeError (_("could not open audio file for reading"));
}
- _done = 0;
_remaining = _info.frames;
}
@@ -55,9 +54,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 +93,10 @@ SndfileDecoder::pass ()
}
data->set_frames (this_time);
- audio (data, _done);
- _done += this_time;
+ audio (data);
_remaining -= this_time;
+
+ return _remaining == 0;
}
int
@@ -101,7 +105,7 @@ SndfileDecoder::audio_channels () const
return _info.channels;
}
-AudioContent::Frame
+AudioFrame
SndfileDecoder::audio_length () const
{
return _info.frames;
@@ -113,8 +117,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);
+ AudioDecoder::seek (t, accurate);
+
+ _remaining = _info.frames - _done;
}