diff options
author | Bastien Nocera <hadess@hadess.net> | 2022-03-08 14:34:08 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2022-03-09 17:49:33 +0100 |
commit | 64f5876daf584905596950b8c4de063ed672b350 (patch) | |
tree | bbc3b92ce825ca2685640460a1724fd4cec46a3c /src/gst | |
parent | 610ca0e95cf1e77bd4b84b5c17e27a1c524344ff (diff) | |
download | totem-64f5876daf584905596950b8c4de063ed672b350.tar.gz |
gst: Remove support for cropping videos
We also don't use this feature.
Diffstat (limited to 'src/gst')
-rw-r--r-- | src/gst/totem-gst-pixbuf-helpers.c | 61 |
1 files changed, 6 insertions, 55 deletions
diff --git a/src/gst/totem-gst-pixbuf-helpers.c b/src/gst/totem-gst-pixbuf-helpers.c index c6c4d6d11..2a0476429 100644 --- a/src/gst/totem-gst-pixbuf-helpers.c +++ b/src/gst/totem-gst-pixbuf-helpers.c @@ -35,7 +35,6 @@ #include <gst/tag/tag.h> #include <gst/video/video-format.h> -#include <gst/video/gstvideometa.h> static void destroy_pixbuf (guchar *pix, gpointer data) @@ -79,27 +78,15 @@ create_element (const gchar * factory_name, GstElement ** element, static GstElement * build_convert_frame_pipeline (GstElement ** src_element, GstElement ** sink_element, const GstCaps * from_caps, - GstVideoCropMeta * cmeta, const GstCaps * to_caps, GError ** err) + const GstCaps * to_caps, GError ** err) { - GstElement *vcrop = NULL, *csp = NULL, *csp2 = NULL, *vscale = NULL; + GstElement *csp = NULL, *vscale = NULL; GstElement *src = NULL, *sink = NULL, *pipeline; - GstVideoInfo info; GError *error = NULL; if (!caps_are_raw (to_caps)) goto no_pipeline; - if (cmeta) { - if (!create_element ("videocrop", &vcrop, &error)) { - g_error_free (error); - g_warning - ("build_convert_frame_pipeline: Buffer has crop metadata but videocrop element is not found. Cropping will be disabled"); - } else { - if (!create_element ("videoconvert", &csp2, &error)) - goto no_elements; - } - } - /* videoscale is here to correct for the pixel-aspect-ratio for us */ GST_DEBUG ("creating elements"); if (!create_element ("appsrc", &src, &error) || @@ -117,42 +104,14 @@ build_convert_frame_pipeline (GstElement ** src_element, GST_DEBUG ("adding elements"); gst_bin_add_many (GST_BIN (pipeline), src, csp, vscale, sink, NULL); - if (vcrop) - gst_bin_add_many (GST_BIN (pipeline), vcrop, csp2, NULL); /* set caps */ g_object_set (src, "caps", from_caps, NULL); - if (vcrop) { - gst_video_info_from_caps (&info, from_caps); - g_object_set (vcrop, "left", cmeta->x, NULL); - g_object_set (vcrop, "top", cmeta->y, NULL); - g_object_set (vcrop, "right", GST_VIDEO_INFO_WIDTH (&info) - cmeta->width, - NULL); - g_object_set (vcrop, "bottom", - GST_VIDEO_INFO_HEIGHT (&info) - cmeta->height, NULL); - GST_DEBUG ("crop meta [x,y,width,height]: %d %d %d %d", cmeta->x, cmeta->y, - cmeta->width, cmeta->height); - } g_object_set (sink, "caps", to_caps, NULL); - /* FIXME: linking is still way too expensive, profile this properly */ - if (vcrop) { - GST_DEBUG ("linking src->csp2"); - if (!gst_element_link_pads (src, "src", csp2, "sink")) - goto link_failed; - - GST_DEBUG ("linking csp2->vcrop"); - if (!gst_element_link_pads (csp2, "src", vcrop, "sink")) - goto link_failed; - - GST_DEBUG ("linking vcrop->csp"); - if (!gst_element_link_pads (vcrop, "src", csp, "sink")) - goto link_failed; - } else { - GST_DEBUG ("linking src->csp"); - if (!gst_element_link_pads (src, "src", csp, "sink")) - goto link_failed; - } + GST_DEBUG ("linking src->csp"); + if (!gst_element_link_pads (src, "src", csp, "sink")) + goto link_failed; GST_DEBUG ("linking csp->vscale"); if (!gst_element_link_pads_full (csp, "src", vscale, "sink", @@ -176,12 +135,8 @@ no_elements: { if (src) gst_object_unref (src); - if (vcrop) - gst_object_unref (vcrop); if (csp) gst_object_unref (csp); - if (csp2) - gst_object_unref (csp2); if (vscale) gst_object_unref (vscale); if (sink) @@ -196,11 +151,7 @@ no_elements: no_pipeline: { gst_object_unref (src); - if (vcrop) - gst_object_unref (vcrop); gst_object_unref (csp); - if (csp2) - gst_object_unref (csp2); gst_object_unref (vscale); gst_object_unref (sink); @@ -273,7 +224,7 @@ totem_gst_video_convert_sample (GstSample * sample, const GstCaps * to_caps, pipeline = build_convert_frame_pipeline (&src, &sink, from_caps, - gst_buffer_get_video_crop_meta (buf), to_caps_copy, &err); + to_caps_copy, &err); if (!pipeline) goto no_pipeline; |