void
AudioDecoder::audio (shared_ptr<const AudioBuffers> data, AudioContent::Frame frame)
{
- /* XXX: no-one's calling _resampler->flush() again */
-
if (_resampler) {
data = _resampler->run (data);
}
Audio (data, _audio_position);
_audio_position = frame + data->frames ();
}
+
+void
+AudioDecoder::flush ()
+{
+ if (_resampler) {
+ _resampler->flush ();
+ }
+}
protected:
+ void flush ();
+
void audio (boost::shared_ptr<const AudioBuffers>, AudioContent::Frame);
/** Frame index of next emission (post resampling) */
AudioContent::Frame _audio_position;
* cause the object to emit some data.
*/
virtual void pass () = 0;
-
virtual bool done () const = 0;
protected:
+ virtual void flush () {};
+
/** The Film that we are decoding in */
boost::weak_ptr<const Film> _film;
};
if (_subtitle_codec_context) {
avcodec_close (_subtitle_codec_context);
}
-}
+}
+
+void
+FFmpegDecoder::flush ()
+{
+ /* Get any remaining frames */
+
+ _packet.data = 0;
+ _packet.size = 0;
+
+ /* XXX: should we reset _packet.data and size after each *_decode_* call? */
+
+ if (_decode_video) {
+ while (decode_video_packet ()) {}
+ }
+
+ if (_ffmpeg_content->audio_stream() && _decode_audio) {
+ decode_audio_packet ();
+ }
+
+ AudioDecoder::flush ();
+
+ /* Stop us being asked for any more data */
+ _video_position = _ffmpeg_content->video_length ();
+ _audio_position = _ffmpeg_content->audio_length ();
+}
void
FFmpegDecoder::pass ()
film->log()->log (String::compose (N_("error on av_read_frame (%1) (%2)"), buf, r));
}
- /* Get any remaining frames */
-
- _packet.data = 0;
- _packet.size = 0;
-
- /* XXX: should we reset _packet.data and size after each *_decode_* call? */
-
- if (_decode_video) {
- while (decode_video_packet ()) {}
- }
-
- if (_ffmpeg_content->audio_stream() && _decode_audio) {
- decode_audio_packet ();
- }
-
- /* Stop us being asked for any more data */
- _video_position = _ffmpeg_content->video_length ();
- _audio_position = _ffmpeg_content->audio_length ();
+ flush ();
return;
}