From 7af947c0c0a2917f86005a30350eb3ab361ef328 Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 14 Dec 2022 12:55:38 -0300 Subject: [PATCH] avcodec/libdav1d: honor the requested skip_frame level This allows dropping non-reference, non-intra, or non-key frames on supported libdav1d versions. Signed-off-by: James Almer --- libavcodec/libdav1d.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 2f151d2d1b..b43af03732 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -260,6 +260,15 @@ static av_cold int libdav1d_init(AVCodecContext *c) s.n_frame_threads, s.n_tile_threads); #endif +#if FF_DAV1D_VERSION_AT_LEAST(6,8) + if (c->skip_frame >= AVDISCARD_NONKEY) + s.decode_frame_type = DAV1D_DECODEFRAMETYPE_KEY; + else if (c->skip_frame >= AVDISCARD_NONINTRA) + s.decode_frame_type = DAV1D_DECODEFRAMETYPE_INTRA; + else if (c->skip_frame >= AVDISCARD_NONREF) + s.decode_frame_type = DAV1D_DECODEFRAMETYPE_REFERENCE; +#endif + res = libdav1d_parse_extradata(c); if (res < 0) return res;