X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsndfile_decoder.cc;h=3af683c570a89b21a59cf6fd68d8a9f6d37d3fb7;hb=e0c59417c6a52dbd853114fbc0f88c6d8c1dd276;hp=8374abbe9a0ec7a68c88a12baca5e38bbc29b4ee;hpb=bba1bd9b08eb78bda8cdf7fa1393f3eeb2a504d9;p=dcpomatic.git diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc index 8374abbe9..3af683c57 100644 --- a/src/lib/sndfile_decoder.cc +++ b/src/lib/sndfile_decoder.cc @@ -40,7 +40,7 @@ SndfileDecoder::SndfileDecoder (shared_ptr f, shared_ptrfile().string().c_str(), SFM_READ, &_info); + _sndfile = sf_open (_sndfile_content->path(0).string().c_str(), SFM_READ, &_info); if (!_sndfile) { throw DecodeError (_("could not open audio file for reading")); } @@ -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. */ @@ -93,6 +97,8 @@ SndfileDecoder::pass () audio (data, _done); _done += this_time; _remaining -= this_time; + + return true; } int @@ -113,8 +119,10 @@ 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); + + /* XXX */ }