#include "ffmpeg_decoder.h"
#include "filter_graph.h"
#include "audio_buffers.h"
+#include "ffmpeg_content.h"
#include "i18n.h"
FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> f, shared_ptr<const FFmpegContent> c, bool video, bool audio)
: Decoder (f)
, VideoDecoder (f, c)
- , AudioDecoder (f)
+ , AudioDecoder (f, c)
, SubtitleDecoder (f)
- , FFmpeg (c)
+ , FFmpeg (c, false)
, _subtitle_codec_context (0)
, _subtitle_codec (0)
, _decode_video (video)
_video_pts_offset = _audio_pts_offset = - min (c->first_video().get(), c->audio_stream()->first_audio.get());
} else if (have_video) {
_video_pts_offset = - c->first_video().get();
+ } else if (have_audio) {
+ _audio_pts_offset = - c->audio_stream()->first_audio.get();
}
/* Now adjust both so that the video pts starts on a frame */
}
if (_packet.stream_index != _video_stream) {
+ av_free_packet (&_packet);
continue;
}
/* Where we are in the source, in seconds */
double const pts = av_q2d (_format_context->streams[copy_packet.stream_index]->time_base)
* av_frame_get_best_effort_timestamp(_frame) + _audio_pts_offset;
-
+
if (pts > 0) {
/* Emit some silence */
shared_ptr<AudioBuffers> silence (