From edd3c007ea9613b48cb37955abf8f9bd21cdd7a7 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Sun, 16 Aug 2015 18:13:12 +0200 Subject: [PATCH] glupload: Recalculate offset and size in raw upload As we only expose the mapped portion of the frame into the GL memory object (and not the original padding) we need to re-calculate the size and offset. --- gst-libs/gst/gl/gstglupload.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index 9261914105..0addca1128 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -714,6 +714,8 @@ static struct RawUploadFrame * _raw_upload_frame_new (struct RawUpload *raw, GstBuffer * buffer) { struct RawUploadFrame *frame; + GstVideoInfo *info; + gint i; if (!buffer) return NULL; @@ -728,6 +730,14 @@ _raw_upload_frame_new (struct RawUpload *raw, GstBuffer * buffer) } raw->upload->priv->in_info = frame->frame.info; + info = &raw->upload->priv->in_info; + + /* Recalculate the offsets (and size) */ + info->size = 0; + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) { + info->offset[i] = info->size; + info->size += gst_gl_get_plane_data_size (info, NULL, i); + } return frame; }