-/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
-
/*
Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
boost::mutex FFmpegDecoder::_mutex;
-FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> f, shared_ptr<const FFmpegContent> c, bool video, bool audio, bool subtitles)
+FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> f, shared_ptr<const FFmpegContent> c, bool video, bool audio)
: Decoder (f)
, VideoDecoder (f, c)
, AudioDecoder (f, c)
, _subtitle_codec (0)
, _decode_video (video)
, _decode_audio (audio)
- , _decode_subtitles (subtitles)
{
setup_general ();
setup_video ();
decode_video_packet ();
} else if (_ffmpeg_content->audio_stream() && _packet.stream_index == _ffmpeg_content->audio_stream()->id && _decode_audio) {
decode_audio_packet ();
- } else if (_ffmpeg_content->subtitle_stream() && _packet.stream_index == _ffmpeg_content->subtitle_stream()->id && _decode_subtitles) {
+ } else if (_ffmpeg_content->subtitle_stream() && _packet.stream_index == _ffmpeg_content->subtitle_stream()->id) {
int got_subtitle;
AVSubtitle sub;
}
avsubtitle_free (&sub);
}
- } else {
- cout << "[ffmpeg] other packet.\n";
}
av_free_packet (&_packet);
void
FFmpegDecoder::seek_back ()
{
- if (next() < (2.5 * TIME_HZ / video_frame_rate())) {
+ if (position() < (2.5 * TIME_HZ / video_frame_rate())) {
return;
}
- do_seek (next() - 2.5 * TIME_HZ / video_frame_rate(), true, true);
+ do_seek (position() - 2.5 * TIME_HZ / video_frame_rate(), true, true);
VideoDecoder::seek_back ();
}
void
FFmpegDecoder::seek_forward ()
{
- if (next() >= (_ffmpeg_content->length() - 0.5 * TIME_HZ / video_frame_rate())) {
+ if (position() >= (_ffmpeg_content->length() - 0.5 * TIME_HZ / video_frame_rate())) {
return;
}
- do_seek (next() - 0.5 * TIME_HZ / video_frame_rate(), true, true);
+ do_seek (position() - 0.5 * TIME_HZ / video_frame_rate(), true, true);
VideoDecoder::seek_forward ();
}
);
assert (_audio_codec_context->channels == _ffmpeg_content->audio_channels());
- audio (deinterleave_audio (_frame->data, data_size), source_pts_seconds);
+ audio (deinterleave_audio (_frame->data, data_size), source_pts_seconds * TIME_HZ);
}
copy_packet.data += decode_result;
}
Time
-FFmpegDecoder::next () const
+FFmpegDecoder::position () const
{
if (_decode_video && _decode_audio && _audio_codec_context) {
return min (_next_video, _next_audio);