X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_examiner.cc;h=32b60e0cba53e61009019c5bd217fe57c8766304;hb=2913a26dd799a6cda6f1b94415167362106318dc;hp=d439b0eb68ba54e27b3ce779071d3096c6967177;hpb=75820f6fe6d1d2de7546694c6c875c24b40478bf;p=dcpomatic.git diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index d439b0eb6..32b60e0cb 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -62,7 +62,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptrnb_streams; ++i) { AVStream* s = _format_context->streams[i]; - if (s->codec->codec_type == AVMEDIA_TYPE_AUDIO) { + if (s->codec->codec_type == AVMEDIA_TYPE_AUDIO && s->codec->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. @@ -73,7 +73,6 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptrduration != AV_NOPTS_VALUE); - DCPOMATIC_ASSERT (s->codec->codec); DCPOMATIC_ASSERT (s->codec->codec->name); _audio_streams.push_back ( @@ -151,7 +150,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptr= PULLDOWN_CHECK_FRAMES) { + if (_first_video && got_all_audio && temporal_reference.size() >= (PULLDOWN_CHECK_FRAMES * 2)) { /* All done */ break; } @@ -177,8 +176,6 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c, shared_ptr= PULLDOWN_CHECK_FRAMES) { + if (_first_video && !_need_video_length && temporal_reference.size() >= (PULLDOWN_CHECK_FRAMES * 2)) { return; } @@ -220,7 +217,7 @@ FFmpegExaminer::video_packet (AVCodecContext* context, string& temporal_referenc _format_context->streams[_video_stream.get()] ).get_value_or (ContentTime ()).frames_round (video_frame_rate().get ()); } - if (temporal_reference.size() < PULLDOWN_CHECK_FRAMES) { + if (temporal_reference.size() < (PULLDOWN_CHECK_FRAMES * 2)) { temporal_reference += (_frame->top_field_first ? "T" : "B"); temporal_reference += (_frame->repeat_pict ? "3" : "2"); }