From b2aea709d0dad1707070b6d5a6832ad56614a03c Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Sat, 28 Feb 2015 15:00:13 -0500 Subject: [PATCH] glmemory: Support offset when downloading Make sure we support offset and video alignment when downloading too. This is currently not used (plane_start is always 0), but it makes the code correct if we want to use that later. --- gst-libs/gst/gl/gstglmemory.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index 0aca76a503..e134d162ad 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -655,7 +655,7 @@ _download_memory (GstGLContext * context, GstGLMemory * gl_mem) gl->GetTexImage (gl_mem->tex_target, 0, format, type, gl_mem->data); gl->BindTexture (gl_mem->tex_target, 0); } else if (gl_mem->transfer_pbo && CONTEXT_SUPPORTS_PBO_DOWNLOAD (context)) { - gsize size; + gsize size, plane_start; gpointer map_data = NULL; size = gst_gl_get_plane_data_size (&gl_mem->info, &gl_mem->valign, @@ -671,7 +671,8 @@ _download_memory (GstGLContext * context, GstGLMemory * gl_mem) } /* FIXME: COPY! use glMapBuffer + glSync everywhere to remove this */ - memcpy (gl_mem->data, map_data, size); + plane_start = _find_plane_frame_start (gl_mem); + memcpy ((guint8 *) gl_mem->data + plane_start, map_data, size); gl->UnmapBuffer (GL_PIXEL_PACK_BUFFER); gl->BindBuffer (GL_PIXEL_PACK_BUFFER, 0);