From: Carl Hetherington Date: Tue, 10 May 2016 23:31:31 +0000 (+0100) Subject: Fix crash with no video. X-Git-Tag: v2.8.4~20 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=cffb00d2625747e77a89a2cbed3e51ce04196aad Fix crash with no video. --- diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 32c2dee8b..fdbdd4eb5 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -276,12 +276,19 @@ FFmpegContent::technical_summary () const string filt = Filter::ffmpeg_string (_filters); - return Content::technical_summary() + " - " - + video->technical_summary() + " - " - + audio->technical_summary() + " - " - + String::compose ( - "ffmpeg: audio %1 subtitle %2 filters %3", as, ss, filt - ); + string s = Content::technical_summary (); + + if (video) { + s += " - " + video->technical_summary (); + } + + if (audio) { + s += " - " + audio->technical_summary (); + } + + return s + String::compose ( + "ffmpeg: audio %1 subtitle %2 filters %3", as, ss, filt + ); } void diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 14c2e63e2..195167d4b 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -111,10 +111,12 @@ FFmpegDecoder::flush () /* XXX: should we reset _packet.data and size after each *_decode_* call? */ - while (decode_video_packet ()) {} + while (video && decode_video_packet ()) {} - decode_audio_packet (); - audio->flush (); + if (audio) { + decode_audio_packet (); + audio->flush (); + } } bool