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.
This commit is contained in:
Nicolas Dufresne 2015-02-28 15:00:13 -05:00 committed by Tim-Philipp Müller
parent 0cbe42af24
commit b2aea709d0

View file

@ -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);