X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsndfile_decoder.cc;h=49633dd1fad2e503b345bf078fa4c56e454b52c1;hb=526fd6de4c80a7ac9614a1cb0209efff7b171cd5;hp=2c47fcd9e9ca9ddff3946590dc9008d3ff8d8815;hpb=0a93237cb5e4642d3b698ff9b7d0cfae5401478c;p=dcpomatic.git diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc index 2c47fcd9e..49633dd1f 100644 --- a/src/lib/sndfile_decoder.cc +++ b/src/lib/sndfile_decoder.cc @@ -18,10 +18,6 @@ */ #include -#ifdef DCPOMATIC_WINDOWS -#include -#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1 -#endif #include #include "sndfile_content.h" #include "sndfile_decoder.h" @@ -36,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 () @@ -52,12 +48,12 @@ SndfileDecoder::~SndfileDecoder () } bool -SndfileDecoder::pass (PassReason) +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. */ @@ -65,7 +61,7 @@ SndfileDecoder::pass (PassReason) 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) { @@ -88,7 +84,7 @@ SndfileDecoder::pass (PassReason) } } } - + data->set_frames (this_time); audio (_sndfile_content->audio_stream (), data, ContentTime::from_frames (_done, _info.samplerate)); _done += this_time; @@ -102,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; }