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)
This commit is contained in:
Niklas Haas 2022-01-07 07:24:35 +01:00 committed by Niklas Haas
parent 0e5f7b48d2
commit 88047f7654
1 changed files with 13 additions and 0 deletions

View File

@ -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");