diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-02-21 09:51:34 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-02-21 09:51:34 +0000 |
| commit | 79d60a7d5ec3e7a978887dc358b169bce7fd4bce (patch) | |
| tree | 6f90b80b83e338874d3ab50b66b5587dd151e438 /src/lib/ffmpeg_decoder.cc | |
| parent | f6b38ba26dbcce6210c8b9474c36b965d1f8a957 (diff) | |
Small cleanup.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index c3709166e..587c79495 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -516,15 +516,19 @@ FFmpegDecoder::setup_subtitle () { boost::mutex::scoped_lock lm (_mutex); - if (!_ffmpeg_content->subtitle_stream() || _ffmpeg_content->subtitle_stream()->index (_format_context) >= int (_format_context->nb_streams)) { + if (!_ffmpeg_content->subtitle_stream()) { return; } _subtitle_codec_context = _ffmpeg_content->subtitle_stream()->stream(_format_context)->codec; + if (_subtitle_codec_context == 0) { + throw DecodeError (N_("could not find subtitle stream")); + } + _subtitle_codec = avcodec_find_decoder (_subtitle_codec_context->codec_id); if (_subtitle_codec == 0) { - throw DecodeError (_("could not find subtitle decoder")); + throw DecodeError (N_("could not find subtitle decoder")); } if (avcodec_open2 (_subtitle_codec_context, _subtitle_codec, 0) < 0) { |
