mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
Revert "rsvgdec: Fix uses of librsvg functions deprecated since 2.52"
This reverts commit b8db473955
.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6726>
This commit is contained in:
parent
83694a1094
commit
49f9a1e224
2 changed files with 5 additions and 39 deletions
|
@ -145,12 +145,8 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer,
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
RsvgHandle *handle;
|
RsvgHandle *handle;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
#if LIBRSVG_MAJOR_VERSION > (2) || (LIBRSVG_MAJOR_VERSION == (2) && LIBRSVG_MINOR_VERSION > (52))
|
RsvgDimensionData dimension;
|
||||||
RsvgRectangle viewport;
|
|
||||||
#else
|
|
||||||
gdouble scalex, scaley;
|
gdouble scalex, scaley;
|
||||||
#endif
|
|
||||||
GstRsvgDimension dimension;
|
|
||||||
GstMapInfo minfo;
|
GstMapInfo minfo;
|
||||||
GstVideoFrame vframe;
|
GstVideoFrame vframe;
|
||||||
GstVideoCodecState *output_state;
|
GstVideoCodecState *output_state;
|
||||||
|
@ -167,12 +163,8 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer,
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
return GST_FLOW_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);
|
rsvg_handle_get_dimensions (handle, &dimension);
|
||||||
#endif
|
|
||||||
|
|
||||||
output_state = gst_video_decoder_get_output_state (decoder);
|
output_state = gst_video_decoder_get_output_state (decoder);
|
||||||
if ((output_state == NULL)
|
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_pad_peer_query_caps (GST_VIDEO_DECODER_SRC_PAD (rsvg), templ_caps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (rsvg,
|
GST_DEBUG_OBJECT (rsvg,
|
||||||
"Trying to negotiate for SVG resolution %" G_GUINT64_FORMAT "x %"
|
"Trying to negotiate for SVG resolution %ux%u with downstream caps %"
|
||||||
G_GUINT64_FORMAT " with downstream caps %" GST_PTR_FORMAT,
|
GST_PTR_FORMAT, dimension.width, dimension.height, peer_caps);
|
||||||
(guint64) dimension.width, (guint64) dimension.height, peer_caps);
|
|
||||||
|
|
||||||
source_caps = gst_caps_make_writable (g_steal_pointer (&templ_caps));
|
source_caps = gst_caps_make_writable (g_steal_pointer (&templ_caps));
|
||||||
gst_caps_set_simple (source_caps, "width", G_TYPE_INT, dimension.width,
|
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_operator (cr, CAIRO_OPERATOR_OVER);
|
||||||
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
|
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;
|
scalex = scaley = 1.0;
|
||||||
if (GST_VIDEO_INFO_WIDTH (&output_state->info) != dimension.width) {
|
if (GST_VIDEO_INFO_WIDTH (&output_state->info) != dimension.width) {
|
||||||
scalex =
|
scalex =
|
||||||
|
@ -301,7 +277,6 @@ gst_rsvg_decode_image (GstRsvgDec * rsvg, GstBuffer * buffer,
|
||||||
|
|
||||||
cairo_scale (cr, scalex, scaley);
|
cairo_scale (cr, scalex, scaley);
|
||||||
rsvg_handle_render_cairo (handle, cr);
|
rsvg_handle_render_cairo (handle, cr);
|
||||||
#endif
|
|
||||||
|
|
||||||
g_object_unref (handle);
|
g_object_unref (handle);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
|
|
@ -44,15 +44,6 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstRsvgDec GstRsvgDec;
|
typedef struct _GstRsvgDec GstRsvgDec;
|
||||||
typedef struct _GstRsvgDecClass GstRsvgDecClass;
|
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
|
struct _GstRsvgDec
|
||||||
{
|
{
|
||||||
GstVideoDecoder decoder;
|
GstVideoDecoder decoder;
|
||||||
|
@ -66,7 +57,7 @@ struct _GstRsvgDec
|
||||||
guint64 frame_count;
|
guint64 frame_count;
|
||||||
|
|
||||||
GstVideoCodecState *input_state;
|
GstVideoCodecState *input_state;
|
||||||
GstRsvgDimension dimension;
|
RsvgDimensionData dimension;
|
||||||
|
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
gboolean need_newsegment;
|
gboolean need_newsegment;
|
||||||
|
|
Loading…
Reference in a new issue