summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-24 01:52:23 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-24 01:52:23 +0000
commit8bef34f672815c3c9b4236d06fdee8dfd0bffbc2 (patch)
treed37c47bf3ccb308f7a2959be0c2ef9c0e7ec9575 /src/lib/ffmpeg_decoder.cc
parentc3da7c64f01420447dbab7f5c2ea42ff1b911cc5 (diff)
Various joining fixes.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index be3247537..5a1b78762 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -63,7 +63,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> f, shared_ptr<const FFmpegC
, VideoDecoder (f, c)
, AudioDecoder (f, c)
, SubtitleDecoder (f)
- , FFmpeg (c, false)
+ , FFmpeg (c)
, _subtitle_codec_context (0)
, _subtitle_codec (0)
, _decode_video (video)
@@ -171,12 +171,14 @@ FFmpegDecoder::pass ()
shared_ptr<const Film> film = _film.lock ();
assert (film);
+
+ int const si = _packet.stream_index;
- if (_packet.stream_index == _video_stream && _decode_video) {
+ if (si == _video_stream && _decode_video) {
decode_video_packet ();
- } else if (_ffmpeg_content->audio_stream() && _packet.stream_index == _ffmpeg_content->audio_stream()->id && _decode_audio) {
+ } else if (_ffmpeg_content->audio_stream() && si == _ffmpeg_content->audio_stream()->index (_format_context) && _decode_audio) {
decode_audio_packet ();
- } else if (_ffmpeg_content->subtitle_stream() && _packet.stream_index == _ffmpeg_content->subtitle_stream()->id && film->with_subtitles ()) {
+ } else if (_ffmpeg_content->subtitle_stream() && si == _ffmpeg_content->subtitle_stream()->index (_format_context) && film->with_subtitles ()) {
decode_subtitle_packet ();
}
@@ -511,11 +513,11 @@ FFmpegDecoder::setup_subtitle ()
{
boost::mutex::scoped_lock lm (_mutex);
- if (!_ffmpeg_content->subtitle_stream() || _ffmpeg_content->subtitle_stream()->id >= int (_format_context->nb_streams)) {
+ if (!_ffmpeg_content->subtitle_stream() || _ffmpeg_content->subtitle_stream()->index (_format_context) >= int (_format_context->nb_streams)) {
return;
}
- _subtitle_codec_context = _format_context->streams[_ffmpeg_content->subtitle_stream()->id]->codec;
+ _subtitle_codec_context = _ffmpeg_content->subtitle_stream()->stream(_format_context)->codec;
_subtitle_codec = avcodec_find_decoder (_subtitle_codec_context->codec_id);
if (_subtitle_codec == 0) {