From 49f9a1e2241939e7e02163c39d565a54039d96e0 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 24 Apr 2024 00:51:23 +0530 Subject: [PATCH] Revert "rsvgdec: Fix uses of librsvg functions deprecated since 2.52" This reverts commit b8db4739551401c653f2ae55f39d1ab77e3a5ef5. Part-of: --- .../gst-plugins-bad/ext/rsvg/gstrsvgdec.c | 33 +++---------------- .../gst-plugins-bad/ext/rsvg/gstrsvgdec.h | 11 +------ 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.c b/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.c index ba22a57cdc..6a9f6527d1 100644 --- a/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.c +++ b/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.c @@ -145,12 +145,8 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer, cairo_surface_t *surface; RsvgHandle *handle; GError *error = NULL; -#if LIBRSVG_MAJOR_VERSION > (2) || (LIBRSVG_MAJOR_VERSION == (2) && LIBRSVG_MINOR_VERSION > (52)) - RsvgRectangle viewport; -#else + RsvgDimensionData dimension; gdouble scalex, scaley; -#endif - GstRsvgDimension dimension; GstMapInfo minfo; GstVideoFrame vframe; GstVideoCodecState *output_state; @@ -167,12 +163,8 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer, g_error_free (error); return GST_FLOW_ERROR; } -#if LIBRSVG_MAJOR_VERSION > (2) || (LIBRSVG_MAJOR_VERSION == (2) && LIBRSVG_MINOR_VERSION > (52)) - rsvg_handle_get_intrinsic_size_in_pixels (handle, &dimension.width, - &dimension.height); -#else + rsvg_handle_get_dimensions (handle, &dimension); -#endif output_state = gst_video_decoder_get_output_state (decoder); if ((output_state == NULL) @@ -188,9 +180,8 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer, gst_pad_peer_query_caps (GST_VIDEO_DECODER_SRC_PAD (rsvg), templ_caps); GST_DEBUG_OBJECT (rsvg, - "Trying to negotiate for SVG resolution %" G_GUINT64_FORMAT "x %" - G_GUINT64_FORMAT " with downstream caps %" GST_PTR_FORMAT, - (guint64) dimension.width, (guint64) dimension.height, peer_caps); + "Trying to negotiate for SVG resolution %ux%u with downstream caps %" + GST_PTR_FORMAT, dimension.width, dimension.height, peer_caps); source_caps = gst_caps_make_writable (g_steal_pointer (&templ_caps)); gst_caps_set_simple (source_caps, "width", G_TYPE_INT, dimension.width, @@ -272,21 +263,6 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer, cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); -#if LIBRSVG_MAJOR_VERSION > (2) || (LIBRSVG_MAJOR_VERSION == (2) && LIBRSVG_MINOR_VERSION > (52)) - viewport.x = 0; - viewport.y = 0; - viewport.width = GST_VIDEO_INFO_WIDTH (&output_state->info); - viewport.height = GST_VIDEO_INFO_HEIGHT (&output_state->info); - if (!rsvg_handle_render_document (handle, cr, &viewport, &error)) { - GST_ERROR_OBJECT (rsvg, "Failed to render SVG image: %s", error->message); - g_error_free (error); - g_object_unref (handle); - cairo_destroy (cr); - cairo_surface_destroy (surface); - gst_video_codec_state_unref (output_state); - return GST_FLOW_ERROR; - } -#else scalex = scaley = 1.0; if (GST_VIDEO_INFO_WIDTH (&output_state->info) != dimension.width) { scalex = @@ -301,7 +277,6 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer, cairo_scale (cr, scalex, scaley); rsvg_handle_render_cairo (handle, cr); -#endif g_object_unref (handle); cairo_destroy (cr); diff --git a/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.h b/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.h index 2c90776b48..33a875789b 100644 --- a/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.h +++ b/subprojects/gst-plugins-bad/ext/rsvg/gstrsvgdec.h @@ -44,15 +44,6 @@ G_BEGIN_DECLS typedef struct _GstRsvgDec GstRsvgDec; typedef struct _GstRsvgDecClass GstRsvgDecClass; -#if LIBRSVG_MAJOR_VERSION > (2) || (LIBRSVG_MAJOR_VERSION == (2) && LIBRSVG_MINOR_VERSION > (52)) -typedef struct -{ - gdouble width, height; -} GstRsvgDimension; -#else -typedef RsvgDimensionData GstRsvgDimension; -#endif - struct _GstRsvgDec { GstVideoDecoder decoder; @@ -66,7 +57,7 @@ struct _GstRsvgDec guint64 frame_count; GstVideoCodecState *input_state; - GstRsvgDimension dimension; + RsvgDimensionData dimension; GstSegment segment; gboolean need_newsegment;