summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-03-01 23:36:22 +0000
committerCarl Hetherington <cth@carlh.net>2013-03-01 23:36:22 +0000
commitab1a666e724911c41dfe08fc96748b38ace839c1 (patch)
tree3b9bd2f9fe80156e5dfaf4e5cb72080e21ba9816 /src/lib/ffmpeg_decoder.cc
parentb1b3e2e30ce8152b03c9cd3502a00b1814c654ea (diff)
parentff950a024d0bfd892354d53e851c3915a68d2c89 (diff)
Merge.
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 8834f28ed..462db283a 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -199,7 +199,7 @@ FFmpegDecoder::setup_audio ()
void
FFmpegDecoder::setup_subtitle ()
{
- if (!_subtitle_stream) {
+ if (!_subtitle_stream || _subtitle_stream->id() >= int (_format_context->nb_streams)) {
return;
}
@@ -238,8 +238,10 @@ FFmpegDecoder::pass ()
int frame_finished;
- while (avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
- filter_and_emit_video (_frame);
+ if (_opt.decode_video) {
+ while (avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet) >= 0 && frame_finished) {
+ filter_and_emit_video (_frame);
+ }
}
if (_audio_stream && _opt.decode_audio) {
@@ -260,7 +262,7 @@ FFmpegDecoder::pass ()
shared_ptr<FFmpegAudioStream> ffa = dynamic_pointer_cast<FFmpegAudioStream> (_audio_stream);
- if (_packet.stream_index == _video_stream) {
+ if (_packet.stream_index == _video_stream && _opt.decode_video) {
int frame_finished;
int const r = avcodec_decode_video2 (_video_codec_context, _frame, &frame_finished, &_packet);
@@ -290,9 +292,9 @@ FFmpegDecoder::pass ()
was before this packet. Until then audio is thrown away.
*/
- if (_first_video && _first_video.get() <= source_pts_seconds) {
+ if ((_first_video && _first_video.get() <= source_pts_seconds) || !_opt.decode_video) {
- if (!_first_audio) {
+ if (!_first_audio && _opt.decode_video) {
_first_audio = source_pts_seconds;
/* This is our first audio frame, and if we've arrived here we must have had our