Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
[dcpomatic.git] / src / lib / sndfile_decoder.cc
index 68b60c7ac1c8330b523a87d71863dc9b29be03eb..ac01e0da87c99bf23fbc23da0b7ad4fc4a5eb4f9 100644 (file)
@@ -32,14 +32,14 @@ using std::min;
 using std::cout;
 using boost::shared_ptr;
 
-SndfileDecoder::SndfileDecoder (shared_ptr<const SndfileContent> c)
+SndfileDecoder::SndfileDecoder (shared_ptr<const SndfileContent> c, bool fast)
        : Sndfile (c)
-       , AudioDecoder (c)
+       , AudioDecoder (c, fast)
        , _done (0)
        , _remaining (_info.frames)
        , _deinterleave_buffer (0)
 {
-       
+
 }
 
 SndfileDecoder::~SndfileDecoder ()
@@ -48,12 +48,12 @@ SndfileDecoder::~SndfileDecoder ()
 }
 
 bool
-SndfileDecoder::pass (PassReason)
+SndfileDecoder::pass (PassReason, bool)
 {
        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 (PassReason)
        sf_count_t const this_time = min (block, _remaining);
 
        int const channels = _sndfile_content->audio_stream()->channels ();
-       
+
        shared_ptr<AudioBuffers> data (new AudioBuffers (channels, this_time));
 
        if (_sndfile_content->audio_stream()->channels() == 1) {
@@ -84,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;
@@ -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;
 }