X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsndfile_decoder.cc;h=49633dd1fad2e503b345bf078fa4c56e454b52c1;hb=d23f506680a0d833ee3915866961978e98e13741;hp=ff14543e19502a74e9f711ccd32416569d2f534d;hpb=bdbfd6b08856a445446bfd845f1c43109d184250;p=dcpomatic.git diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc index ff14543e1..49633dd1f 100644 --- a/src/lib/sndfile_decoder.cc +++ b/src/lib/sndfile_decoder.cc @@ -32,14 +32,14 @@ using std::min; using std::cout; using boost::shared_ptr; -SndfileDecoder::SndfileDecoder (shared_ptr c) +SndfileDecoder::SndfileDecoder (shared_ptr c, bool fast) : Sndfile (c) - , AudioDecoder (c) + , AudioDecoder (c, fast) , _done (0) , _remaining (_info.frames) , _deinterleave_buffer (0) { - + } SndfileDecoder::~SndfileDecoder () @@ -53,7 +53,7 @@ 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. */ @@ -61,7 +61,7 @@ SndfileDecoder::pass () sf_count_t const this_time = min (block, _remaining); int const channels = _sndfile_content->audio_stream()->channels (); - + shared_ptr data (new AudioBuffers (channels, this_time)); if (_sndfile_content->audio_stream()->channels() == 1) { @@ -84,7 +84,7 @@ SndfileDecoder::pass () } } } - + data->set_frames (this_time); audio (_sndfile_content->audio_stream (), data, ContentTime::from_frames (_done, _info.samplerate)); _done += this_time; @@ -98,6 +98,6 @@ SndfileDecoder::seek (ContentTime t, bool accurate) { AudioDecoder::seek (t, accurate); - _done = t.frames (_info.samplerate); + _done = t.frames_round (_info.samplerate); _remaining = _info.frames - _done; }