avcodec/librsvgdec: fix compilation with librsvg 2.50.3
authorAndrey Semashev <andrey.semashev@gmail.com>
Mon, 1 Sep 2025 22:07:05 +0000 (01:07 +0300)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 21 Nov 2025 19:56:58 +0000 (20:56 +0100)
This fixes compilation with librsvg 2.50.3: error: viewport undeclared

This was a regression since commit
86ed68420d3b60439d0b7767c53d0fdc1deb7277.

Fixes #10722.

Reviewed-by: Leo Izen <leo.izen@gmail.com>
(cherry picked from commit 9ee7796c540ce9cec3fdff0dd246de842228707b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/librsvgdec.c

index c328fbc774237d3375772ea58d75a799958eac94..f0566eb5d8542dea19fa0bf92cf7dd4b1c82264d 100644 (file)
@@ -90,8 +90,6 @@ static int librsvg_decode_frame(AVCodecContext *avctx, AVFrame *frame,
         goto end;
 
     avctx->pix_fmt = AV_PIX_FMT_RGB32;
-    viewport.width = dimensions.width;
-    viewport.height = dimensions.height;
 
     ret = ff_get_buffer(avctx, frame, 0);
     if (ret < 0)
@@ -116,6 +114,8 @@ static int librsvg_decode_frame(AVCodecContext *avctx, AVFrame *frame,
     cairo_restore(crender);
 
 #if LIBRSVG_MAJOR_VERSION > 2 || LIBRSVG_MAJOR_VERSION == 2 && LIBRSVG_MINOR_VERSION >= 52
+    viewport.width = dimensions.width;
+    viewport.height = dimensions.height;
     gret = rsvg_handle_render_document(handle, crender, &viewport, &error);
 #else
     cairo_scale(crender, dimensions.width / (double)unscaled_dimensions.width,