Tweak class declaration.
[dcpomatic.git] / src / lib / ffmpeg_decoder.cc
index 32903a20eb8995d4a2c2847f3b8b2d10e037afc5..604864a148ffa88fa9875381948a3309b49c5595 100644 (file)
@@ -112,11 +112,10 @@ FFmpegDecoder::flush ()
 
        if (audio) {
                decode_audio_packet ();
-               audio->flush ();
        }
 }
 
-void
+bool
 FFmpegDecoder::pass ()
 {
        int r = av_read_frame (_format_context, &_packet);
@@ -134,7 +133,7 @@ FFmpegDecoder::pass ()
                }
 
                flush ();
-               return;
+               return true;
        }
 
        int const si = _packet.stream_index;
@@ -149,6 +148,7 @@ FFmpegDecoder::pass ()
        }
 
        av_packet_unref (&_packet);
+       return false;
 }
 
 /** @param data pointer to array of pointers to buffers.
@@ -298,6 +298,8 @@ FFmpegDecoder::bytes_per_audio_sample (shared_ptr<FFmpegAudioStream> stream) con
 void
 FFmpegDecoder::seek (ContentTime time, bool accurate)
 {
+       Decoder::seek (time, accurate);
+
        /* If we are doing an `accurate' seek, we need to use pre-roll, as
           we don't really know what the seek will give us.
        */
@@ -396,7 +398,7 @@ FFmpegDecoder::decode_audio_packet ()
                        if (ct < ContentTime ()) {
                                /* Discard audio data that comes before time 0 */
                                Frame const remove = min (int64_t (data->frames()), (-ct).frames_ceil(double((*stream)->frame_rate ())));
-                               data->move (remove, 0, data->frames() - remove);
+                               data->move (data->frames() - remove, remove, 0);
                                data->set_frames (data->frames() - remove);
                                ct += ContentTime::from_frames (remove, (*stream)->frame_rate ());
                        }