Merge remote-tracking branch 'origin/master' into 2.0
[dcpomatic.git] / src / lib / audio_decoder.cc
index 3d5698dfe52a63b21fac0166224d82ec3cc0c71c..f425cf2808cfbf70d53f3ff2bf097a24ab0ba035 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "i18n.h"
 
-using std::stringstream;
 using std::list;
 using std::pair;
 using std::cout;
@@ -168,6 +167,12 @@ AudioDecoder::audio (shared_ptr<const AudioBuffers> data, ContentTime time)
 
        assert (_audio_position.get() >= (_decoded_audio.frame + _decoded_audio.audio->frames()));
 
+       add (data);
+}
+
+void
+AudioDecoder::add (shared_ptr<const AudioBuffers> data)
+{
        /* Resize _decoded_audio to fit the new data */
        int new_size = 0;
        if (_decoded_audio.audio->frames() == 0) {
@@ -196,7 +201,6 @@ AudioDecoder::audio (shared_ptr<const AudioBuffers> data, ContentTime time)
        }
 }
 
-/* XXX: called? */
 void
 AudioDecoder::flush ()
 {
@@ -204,13 +208,10 @@ AudioDecoder::flush ()
                return;
        }
 
-       /*
        shared_ptr<const AudioBuffers> b = _resampler->flush ();
        if (b) {
-               _pending.push_back (shared_ptr<DecodedAudio> (new DecodedAudio (b, _audio_position.get ())));
-               _audio_position = _audio_position.get() + b->frames ();
+               add (b);
        }
-       */
 }
 
 void