Tidying.
[dcpomatic.git] / src / lib / ffmpeg_examiner.cc
index 632508e0ed3670f0e9fa89272751d4d1a9a28dec..bd6a9b20d475b6b23a7781a735bf52f09b19281e 100644 (file)
@@ -69,7 +69,8 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
 
        for (uint32_t i = 0; i < _format_context->nb_streams; ++i) {
                auto s = _format_context->streams[i];
-               if (s->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+               auto codec = _codec_context[i] ? _codec_context[i]->codec : nullptr;
+               if (s->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && codec) {
 
                        /* This is a hack; sometimes it seems that _audio_codec_context->channel_layout isn't set up,
                           so bodge it here.  No idea why we should have to do this.
@@ -79,10 +80,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
                                s->codecpar->channel_layout = av_get_default_channel_layout (s->codecpar->channels);
                        }
 
-                       auto codec = _codec_context[i]->codec;
-
                        DCPOMATIC_ASSERT (_format_context->duration != AV_NOPTS_VALUE);
-                       DCPOMATIC_ASSERT (codec);
                        DCPOMATIC_ASSERT (codec->name);
 
                        _audio_streams.push_back (