summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-01-07 07:24:35 +0100
committerNiklas Haas <github-daiK1o@haasn.dev>2022-01-09 13:06:27 +0100
commit88047f7654f4b83ad9c4dc9e0a21221e7b380ee0 (patch)
tree99083f34e6a582ec0d370b0e86e7c850b8c71d67
parent0e5f7b48d277887591cf7fa7c1bc37a34db13530 (diff)
downloadmpv-88047f7654f4b83ad9c4dc9e0a21221e7b380ee0.tar.bz2
mpv-88047f7654f4b83ad9c4dc9e0a21221e7b380ee0.tar.xz
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)
-rw-r--r--demux/demux_lavf.c13
1 files changed, 13 insertions, 0 deletions
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 <libavutil/display.h>
#include <libavutil/opt.h>
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 43, 100)
+#include <libavutil/dovi_meta.h>
+#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");