From 88047f7654f4b83ad9c4dc9e0a21221e7b380ee0 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Fri, 7 Jan 2022 07:24:35 +0100 Subject: [PATCH] demux_lavf: properly forward dovi config record This needs to be forwarded from the AVStream to the AVPacket itself, so that it reaches the decoder. There exists an FFmpeg function for this, we just need to call it. (Also add some logging) --- demux/demux_lavf.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 775f355a0c..3a1283cb33 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -36,6 +36,10 @@ #include #include +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 43, 100) +#include +#endif + #include "common/msg.h" #include "common/tags.h" #include "common/av_common.h" @@ -725,6 +729,15 @@ static void handle_new_stream(demuxer_t *demuxer, int i) sh->codec->rotate = (((int)(-r) % 360) + 360) % 360; } +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 43, 100) + if ((sd = av_stream_get_side_data(st, AV_PKT_DATA_DOVI_CONF, NULL))) { + const AVDOVIDecoderConfigurationRecord *cfg = (void *) sd; + MP_VERBOSE(demuxer, "Found Dolby Vision config record: profile " + "%d level %d\n", cfg->dv_profile, cfg->dv_level); + av_format_inject_global_side_data(avfc); + } +#endif + // This also applies to vfw-muxed mkv, but we can't detect these easily. sh->codec->avi_dts = matches_avinputformat_name(priv, "avi");