glupload: add crop meta support in dmafd uploader
get video crop meta from input buffer and update video info
upstream status: pending
https://bugzilla.gnome.org/show_bug.cgi?id=787616
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
index fa4884a..7a54b63 100644
--- a/gst-libs/gst/gl/gstglupload.c
+++ b/gst-libs/gst/gl/gstglupload.c
@@ -583,6 +583,7 @@
GstVideoInfo *in_info = &dmabuf->upload->priv->in_info;
guint n_planes = GST_VIDEO_INFO_N_PLANES (in_info);
GstVideoMeta *meta;
+ GstVideoCropMeta *crop;
guint n_mem;
guint mems_idx[GST_VIDEO_MAX_PLANES];
gsize mems_skip[GST_VIDEO_MAX_PLANES];
@@ -591,6 +592,7 @@
n_mem = gst_buffer_n_memory (buffer);
meta = gst_buffer_get_video_meta (buffer);
+ crop = gst_buffer_get_video_crop_meta(buffer);
/* dmabuf upload is only supported with EGL contexts. */
if (gst_gl_context_get_gl_platform (dmabuf->upload->context) !=
@@ -620,6 +622,15 @@
}
}
+ if (crop) {
+ in_info->width = MIN (crop->width, in_info->width);
+ in_info->height = MIN (crop->height, in_info->height);
+
+ GST_DEBUG_OBJECT (dmabuf->upload, "got crop meta (%d)x(%d)",
+ in_info->width, in_info->height);
+ gst_buffer_remove_meta (buffer, (GstMeta *)crop);
+ }
+
if (dmabuf->params)
gst_gl_allocation_params_free ((GstGLAllocationParams *) dmabuf->params);
if (!(dmabuf->params =