1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

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.
This commit is contained in:
Lynne
2025-11-05 20:25:31 +01:00
parent cbc6134a4a
commit e93e2a5be1

View File

@@ -185,7 +185,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
const int data_size, AVCodecContext *avctx) const int data_size, AVCodecContext *avctx)
{ {
int hdr_size, width, height, flags; int hdr_size, width, height, flags, dimensions_changed = 0;
int version; int version;
const uint8_t *ptr; const uint8_t *ptr;
enum AVPixelFormat pix_fmt; 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); avctx->width, avctx->height, width, height);
if ((ret = ff_set_dimensions(avctx, width, height)) < 0) if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
return ret; return ret;
dimensions_changed = 1;
} }
ctx->frame_type = (buf[12] >> 2) & 3; 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) #define HWACCEL_MAX (CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL + CONFIG_PRORES_VULKAN_HWACCEL)
#if HWACCEL_MAX #if HWACCEL_MAX
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;