From e93e2a5be195b0846d667519385db970bacffcce Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 5 Nov 2025 20:25:31 +0100 Subject: [PATCH] prores: call ff_get_format if width and height change The issue is that hardware decoders may have some state they depend on, which would get broken if the dimensions change. --- libavcodec/proresdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c index 40c15a0c85..5c6b505527 100644 --- a/libavcodec/proresdec.c +++ b/libavcodec/proresdec.c @@ -185,7 +185,7 @@ static av_cold int decode_init(AVCodecContext *avctx) static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, const int data_size, AVCodecContext *avctx) { - int hdr_size, width, height, flags; + int hdr_size, width, height, flags, dimensions_changed = 0; int version; const uint8_t *ptr; enum AVPixelFormat pix_fmt; @@ -214,6 +214,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, avctx->width, avctx->height, width, height); if ((ret = ff_set_dimensions(avctx, width, height)) < 0) return ret; + dimensions_changed = 1; } ctx->frame_type = (buf[12] >> 2) & 3; @@ -250,7 +251,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, } } - if (pix_fmt != ctx->pix_fmt) { + if (pix_fmt != ctx->pix_fmt || dimensions_changed) { #define HWACCEL_MAX (CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL + CONFIG_PRORES_VULKAN_HWACCEL) #if HWACCEL_MAX enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;