diff options
-rw-r--r-- | gst-libs/gst/gl/gstglcolorconvert.c | 9 | ||||
-rw-r--r-- | gst-libs/gst/gl/gstglmemory.c | 18 | ||||
-rw-r--r-- | gst-libs/gst/gl/gstglmemory.h | 3 | ||||
-rw-r--r-- | gst-libs/gst/gl/gstglupload.c | 2 |
4 files changed, 19 insertions, 13 deletions
diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 8b0e3136d..eb8143fbd 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -775,7 +775,7 @@ _YUV_to_RGB (GstGLContext * context, GstGLColorConvert * convert) GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA, GST_VIDEO_INFO_WIDTH (&convert->in_info), GST_VIDEO_INFO_HEIGHT (&convert->in_info), - GST_VIDEO_INFO_WIDTH (&convert->in_info)); + GST_VIDEO_INFO_PLANE_STRIDE (&convert->in_info, 0)); break; case GST_VIDEO_FORMAT_NV12: info->frag_prog = g_strdup_printf (frag_NV12_NV21_to_RGB, 'r', 'a', @@ -801,7 +801,7 @@ _YUV_to_RGB (GstGLContext * context, GstGLColorConvert * convert) GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA, GST_VIDEO_INFO_WIDTH (&convert->in_info), GST_VIDEO_INFO_HEIGHT (&convert->in_info), - GST_VIDEO_INFO_WIDTH (&convert->in_info)); + GST_VIDEO_INFO_PLANE_STRIDE (&convert->in_info, 0)); break; default: break; @@ -1238,7 +1238,7 @@ _do_convert (GstGLContext * context, GstGLColorConvert * convert) GST_MAP_WRITE | GST_MAP_GL); gst_gl_memory_copy_into_texture (convert->priv->out_temp[i], gl_mem->tex_id, gl_mem->tex_type, gl_mem->width, gl_mem->height, - FALSE); + gl_mem->stride, FALSE); gst_memory_unmap ((GstMemory *) gl_mem, &to_info); gst_memory_unmap ((GstMemory *) convert->priv->out_temp[i], &from_info); } else { @@ -1287,7 +1287,8 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert) if (convert->priv->scratch) { gst_gl_memory_copy_into_texture (convert->in_tex[0], convert->priv->scratch->tex_id, convert->priv->scratch->tex_type, - convert->priv->scratch->width, convert->priv->scratch->height, TRUE); + convert->priv->scratch->width, convert->priv->scratch->height, + convert->priv->scratch->stride, TRUE); } gl->BindFramebuffer (GL_FRAMEBUFFER, convert->fbo); diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index a63e4034b..8d3d65d00 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -76,6 +76,7 @@ typedef struct GstGLMemory *src; GstVideoGLTextureType out_format; guint out_width, out_height; + guint out_stride; gboolean respecify; /* inout */ guint tex_id; @@ -603,7 +604,7 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data) GstGLMemory *src; guint tex_id; GLuint fboId; - gsize out_width, out_height; + gsize out_width, out_height, out_stride; GLuint out_gl_format, out_gl_type; GLuint in_gl_format, in_gl_type; gsize in_size, out_size; @@ -613,6 +614,7 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data) tex_id = copy_params->tex_id; out_width = copy_params->out_width; out_height = copy_params->out_height; + out_stride = copy_params->out_stride; gl = src->context->gl_vtable; out_gl_format = _gst_gl_format_from_gl_texture_type (copy_params->out_format); @@ -630,10 +632,8 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data) goto error; } - in_size = _gl_format_type_n_bytes (in_gl_format, in_gl_type) * src->width * - src->height; - out_size = _gl_format_type_n_bytes (out_gl_format, out_gl_type) * out_width * - out_height; + in_size = src->height * src->stride; + out_size = out_height * out_stride; if (copy_params->respecify) { if (in_size != out_size) { @@ -754,6 +754,7 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size) copy_params.out_format = src->tex_type; copy_params.out_width = src->width; copy_params.out_height = src->height; + copy_params.out_stride = src->height; copy_params.respecify = FALSE; gst_gl_context_thread_add (src->context, _gl_mem_copy_thread, ©_params); @@ -839,9 +840,10 @@ _gl_mem_free (GstAllocator * allocator, GstMemory * mem) * gst_gl_memory_copy_into_texture: * @gl_mem:a #GstGLMemory * @tex_id:OpenGL texture id - * @tex_type: a #GstVIdeoGLTextureType + * @tex_type: a #GstVideoGLTextureType * @width: width of @tex_id * @height: height of @tex_id + * @stride: stride of the backing texture data * @respecify: whether to copy the data or copy per texel * * Copies @gl_mem into the texture specfified by @tex_id. The format of @tex_id @@ -862,7 +864,8 @@ _gl_mem_free (GstAllocator * allocator, GstMemory * mem) */ gboolean gst_gl_memory_copy_into_texture (GstGLMemory * gl_mem, guint tex_id, - GstVideoGLTextureType tex_type, gint width, gint height, gboolean respecify) + GstVideoGLTextureType tex_type, gint width, gint height, gint stride, + gboolean respecify) { GstGLMemoryCopyParams copy_params; @@ -871,6 +874,7 @@ gst_gl_memory_copy_into_texture (GstGLMemory * gl_mem, guint tex_id, copy_params.out_format = tex_type; copy_params.out_width = width; copy_params.out_height = height; + copy_params.out_stride = stride; copy_params.respecify = respecify; gst_gl_context_thread_add (gl_mem->context, _gl_mem_copy_thread, diff --git a/gst-libs/gst/gl/gstglmemory.h b/gst-libs/gst/gl/gstglmemory.h index bd898eb37..559e62d82 100644 --- a/gst-libs/gst/gl/gstglmemory.h +++ b/gst-libs/gst/gl/gstglmemory.h @@ -162,7 +162,8 @@ GstGLMemory * gst_gl_memory_wrapped_texture (GstGLContext * context, guint textu gboolean gst_gl_memory_copy_into_texture (GstGLMemory *gl_mem, guint tex_id, GstVideoGLTextureType tex_type, - gint width, gint height, gboolean respecify); + gint width, gint height, gint stride, + gboolean respecify); gboolean gst_gl_memory_setup_buffer (GstGLContext * context, GstVideoInfo * info, GstBuffer * buffer); diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index 1e4c65e59..aa7dbdcfc 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -237,7 +237,7 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer, upload->out_tex = (GstGLMemory *) gst_gl_memory_alloc (upload->context, GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info), GST_VIDEO_INFO_HEIGHT (&upload->in_info), - GST_VIDEO_INFO_WIDTH (&upload->in_info)); + GST_VIDEO_INFO_PLANE_STRIDE (&upload->in_info, 0)); GST_LOG_OBJECT (upload, "Attempting upload with GstGLMemory"); for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->in_info); i++) { |