diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-10-16 14:38:44 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-10-16 14:38:44 +0100 |
| commit | 9e025d3f85f9d6d855b3d5e6c90bca0eac3a3d49 (patch) | |
| tree | afc3e4a093a357bc7144a554c139e71b05fca9c5 /src/lib/ffmpeg_decoder.cc | |
| parent | e7811b466eff496db7f63842df2fa4a4410afe14 (diff) | |
Avoid decoding other packets when looking for subs.
The "accumulation" of, for example, video data when we are looking
for audio data is an *optimisation* to reduce the number of seeks.
It should not be necessary for correctness (the output should be right
even if we never kept anything except what we were looking for).
Doing this accumulation is not always an optimisation; sometimes not
doing it is better. Avoiding it when going back for subtitles is one
of these cases.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 72a3d02b4..ee9d9eecb 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -89,7 +89,7 @@ FFmpegDecoder::flush () } bool -FFmpegDecoder::pass () +FFmpegDecoder::pass (PassReason reason) { int r = av_read_frame (_format_context, &_packet); @@ -112,11 +112,11 @@ FFmpegDecoder::pass () int const si = _packet.stream_index; shared_ptr<const FFmpegContent> fc = _ffmpeg_content; - if (si == _video_stream && !_ignore_video) { + if (si == _video_stream && !_ignore_video && reason != PASS_REASON_SUBTITLE) { decode_video_packet (); } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index (_format_context, si)) { decode_subtitle_packet (); - } else { + } else if (reason != PASS_REASON_SUBTITLE) { decode_audio_packet (); } |
