glmemory: use GstVideoInfo everywhere

Simplifies a lot of the calling code

https://bugzilla.gnome.org/show_bug.cgi?id=733717
This commit is contained in:
Matthew Waters 2014-07-31 14:07:29 +10:00 committed by Tim-Philipp Müller
parent 84a50aefe1
commit c216799b20
6 changed files with 137 additions and 106 deletions

View file

@ -1204,21 +1204,30 @@ _do_convert (GstGLContext * context, GstGLColorConvert * convert)
for (j = 0; j < c_info->out_n_textures; j++) {
GstGLMemory *out_tex =
(GstGLMemory *) gst_buffer_peek_memory (convert->outbuf, j);
gint mem_width, mem_height;
if (!gst_is_gl_memory ((GstMemory *) out_tex)) {
res = FALSE;
goto out;
}
mem_width = gst_gl_memory_get_texture_width (out_tex);
mem_height = gst_gl_memory_get_texture_height (out_tex);
if (out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|| out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA
|| out_width != out_tex->width || out_height != out_tex->height) {
|| out_width != mem_width || out_height != mem_height) {
/* Luminance formats are not color renderable */
/* renderering to a framebuffer only renders the intersection of all
* the attachments i.e. the smallest attachment size */
GstVideoInfo temp_info;
gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA, out_width,
out_height);
if (!convert->priv->out_tex[j])
convert->priv->out_tex[j] =
(GstGLMemory *) gst_gl_memory_alloc (context,
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, out_width, out_height, out_width);
(GstGLMemory *) gst_gl_memory_alloc (context, &temp_info, 0);
} else {
convert->priv->out_tex[j] = out_tex;
}
@ -1244,11 +1253,16 @@ out:
for (j--; j >= 0; j--) {
GstGLMemory *out_tex =
(GstGLMemory *) gst_buffer_peek_memory (convert->outbuf, j);
gint mem_width, mem_height;
gst_memory_unmap ((GstMemory *) convert->priv->out_tex[j], &out_info[j]);
mem_width = gst_gl_memory_get_texture_width (out_tex);
mem_height = gst_gl_memory_get_texture_height (out_tex);
if (out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|| out_tex->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA
|| out_width != out_tex->width || out_height != out_tex->height) {
|| out_width != mem_width || out_height != mem_height) {
GstMapInfo to_info, from_info;
if (!gst_memory_map ((GstMemory *) convert->priv->out_tex[j], &from_info,
@ -1266,8 +1280,8 @@ out:
continue;
}
gst_gl_memory_copy_into_texture (convert->priv->out_tex[j],
out_tex->tex_id, out_tex->tex_type, out_tex->width, out_tex->height,
out_tex->stride, FALSE);
out_tex->tex_id, out_tex->tex_type, mem_width, mem_height,
GST_VIDEO_INFO_PLANE_STRIDE (&out_tex->info, out_tex->plane), FALSE);
gst_memory_unmap ((GstMemory *) convert->priv->out_tex[j], &from_info);
gst_memory_unmap ((GstMemory *) out_tex, &to_info);
} else {

View file

@ -223,11 +223,17 @@ _gst_gl_download_perform_with_data_unlocked (GstGLDownload * download,
g_return_val_if_fail (data[i] != NULL, FALSE);
}
if (!download->priv->in_tex[0])
if (!download->priv->in_tex[0]) {
GstVideoInfo temp_info;
gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA,
GST_VIDEO_INFO_WIDTH (&download->info),
GST_VIDEO_INFO_HEIGHT (&download->info));
download->priv->in_tex[0] =
gst_gl_memory_wrapped_texture (download->context, texture_id,
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&download->info),
GST_VIDEO_INFO_HEIGHT (&download->info), NULL, NULL);
&temp_info, 0, NULL, NULL);
}
download->priv->in_tex[0]->tex_id = texture_id;

View file

@ -48,6 +48,10 @@
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
#define GL_MEM_WIDTH(gl_mem) _get_plane_width (&gl_mem->info, gl_mem->plane)
#define GL_MEM_HEIGHT(gl_mem) _get_plane_height (&gl_mem->info, gl_mem->plane)
#define GL_MEM_STRIDE(gl_mem) GST_VIDEO_INFO_PLANE_STRIDE (&gl_mem->info, gl_mem->plane)
GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
#define GST_CAT_DEFUALT GST_CAT_GL_MEMORY
@ -400,11 +404,11 @@ _upload_memory (GstGLContext * context, GstGLMemory * gl_mem)
}
GST_CAT_LOG (GST_CAT_GL_MEMORY, "upload for texture id:%u, %ux%u",
gl_mem->tex_id, gl_mem->width, gl_mem->height);
gl_mem->tex_id, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem));
gl->BindTexture (GL_TEXTURE_2D, gl_mem->tex_id);
gl->TexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, gl_mem->width, gl_mem->height,
gl_format, gl_type, gl_mem->data);
gl->TexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, gl_mem->tex_width,
GL_MEM_HEIGHT (gl_mem), gl_format, gl_type, gl_mem->data);
/* Reset to default values */
if (USING_OPENGL (context) || USING_GLES3 (context)) {
@ -426,6 +430,7 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
gl_mem->tex_scaling[0] = 1.0f;
gl_mem->tex_scaling[1] = 1.0f;
gl_mem->unpack_length = 1;
gl_mem->tex_width = GL_MEM_WIDTH (gl_mem);
n_gl_bytes = _gl_texture_type_n_bytes (gl_mem->tex_type);
if (n_gl_bytes == 0) {
@ -435,19 +440,21 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
}
if (USING_OPENGL (gl_mem->context) || USING_GLES3 (gl_mem->context)) {
gl_mem->unpack_length = gl_mem->stride / n_gl_bytes;
gl_mem->unpack_length = GL_MEM_STRIDE (gl_mem) / n_gl_bytes;
} else if (USING_GLES2 (gl_mem->context)) {
guint j = 8;
while (j >= n_gl_bytes) {
/* GST_ROUND_UP_j(gl_mem->width * n_gl_bytes) */
guint round_up_j = ((gl_mem->width * n_gl_bytes) + j - 1) & ~(j - 1);
/* GST_ROUND_UP_j(GL_MEM_WIDTH (gl_mem) * n_gl_bytes) */
guint round_up_j =
((GL_MEM_WIDTH (gl_mem) * n_gl_bytes) + j - 1) & ~(j - 1);
if (round_up_j == gl_mem->stride) {
if (round_up_j == GL_MEM_STRIDE (gl_mem)) {
GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based on width "
"(with plane width:%u, plane stride:%u and pixel stride:%u. "
"RU%u(%u*%u) = %u)", j, gl_mem->width, gl_mem->stride, n_gl_bytes,
j, gl_mem->width, n_gl_bytes, round_up_j);
"RU%u(%u*%u) = %u)", j, GL_MEM_WIDTH (gl_mem),
GL_MEM_STRIDE (gl_mem), n_gl_bytes, j, GL_MEM_WIDTH (gl_mem),
n_gl_bytes, round_up_j);
gl_mem->unpack_length = j;
break;
@ -462,19 +469,20 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
j = 8;
while (j >= n_gl_bytes) {
/* GST_ROUND_UP_j(gl_mem->stride) */
guint round_up_j = ((gl_mem->stride) + j - 1) & ~(j - 1);
/* GST_ROUND_UP_j((GL_MEM_STRIDE (gl_mem)) */
guint round_up_j = ((GL_MEM_STRIDE (gl_mem)) + j - 1) & ~(j - 1);
if (round_up_j == gl_mem->stride) {
if (round_up_j == (GL_MEM_STRIDE (gl_mem))) {
GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based on "
"stride (with plane stride:%u and pixel stride:%u. "
"RU%u(%u) = %u)", j, gl_mem->stride, n_gl_bytes, j,
gl_mem->stride, round_up_j);
"RU%u(%u) = %u)", j, GL_MEM_STRIDE (gl_mem), n_gl_bytes, j,
GL_MEM_STRIDE (gl_mem), round_up_j);
gl_mem->unpack_length = j;
gl_mem->tex_scaling[0] =
(gfloat) (gl_mem->width * n_gl_bytes) / (gfloat) gl_mem->stride;
gl_mem->width = gl_mem->stride / n_gl_bytes;
(gfloat) (GL_MEM_WIDTH (gl_mem) * n_gl_bytes) /
(gfloat) GL_MEM_STRIDE (gl_mem);
gl_mem->tex_width = GL_MEM_STRIDE (gl_mem) / n_gl_bytes;
break;
}
j >>= 1;
@ -484,7 +492,8 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
GST_CAT_ERROR
(GST_CAT_GL_MEMORY, "Failed to find matching alignment. Image may "
"look corrupted. plane width:%u, plane stride:%u and pixel "
"stride:%u", gl_mem->width, gl_mem->stride, n_gl_bytes);
"stride:%u", GL_MEM_WIDTH (gl_mem), GL_MEM_STRIDE (gl_mem),
n_gl_bytes);
}
}
}
@ -537,8 +546,8 @@ _download_memory (GstGLContext * context, GstGLMemory * gl_mem)
if (!gst_gl_context_check_framebuffer_status (context))
goto fbo_error;
gl->ReadPixels (0, 0, gl_mem->width, gl_mem->height, format, type,
gl_mem->data);
gl->ReadPixels (0, 0, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem), format,
type, gl_mem->data);
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
@ -552,21 +561,24 @@ error:
static void
_gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
GstGLContext * context, GstVideoGLTextureType tex_type, gint width,
gint height, gint stride, gpointer user_data, GDestroyNotify notify)
GstGLContext * context, GstVideoInfo * info, guint plane,
gpointer user_data, GDestroyNotify notify)
{
gsize maxsize;
maxsize = stride * height;
maxsize =
GST_VIDEO_INFO_PLANE_STRIDE (info, plane) * _get_plane_height (info,
plane);
gst_memory_init (GST_MEMORY_CAST (mem), GST_MEMORY_FLAG_NO_SHARE,
allocator, parent, maxsize, 0, 0, maxsize);
mem->context = gst_object_ref (context);
mem->tex_type = tex_type;
mem->width = width;
mem->height = height;
mem->stride = stride;
mem->tex_type =
gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (info),
plane);
mem->info = *info;
mem->plane = plane;
mem->notify = notify;
mem->user_data = user_data;
mem->data_wrapped = FALSE;
@ -575,25 +587,26 @@ _gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
_calculate_unpack_length (mem);
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture memory:%p format:%u "
"dimensions:%ux%u", mem, tex_type, width, height);
"dimensions:%ux%u", mem, mem->tex_type, mem->tex_width,
GL_MEM_HEIGHT (mem));
}
static GstGLMemory *
_gl_mem_new (GstAllocator * allocator, GstMemory * parent,
GstGLContext * context, GstVideoGLTextureType tex_type, gint width,
gint height, gint stride, gpointer user_data, GDestroyNotify notify)
GstGLContext * context, GstVideoInfo * info, guint plane,
gpointer user_data, GDestroyNotify notify)
{
GstGLMemory *mem;
GenTexture data = { 0, };
mem = g_slice_new0 (GstGLMemory);
_gl_mem_init (mem, allocator, parent, context, tex_type, width, height,
stride, user_data, notify);
_gl_mem_init (mem, allocator, parent, context, info, plane, user_data,
notify);
data.width = mem->width;
data.height = mem->height;
data.gl_format = _gst_gl_format_from_gl_texture_type (tex_type);
data.width = mem->tex_width;
data.height = GL_MEM_HEIGHT (mem);
data.gl_format = _gst_gl_format_from_gl_texture_type (mem->tex_type);
data.gl_type = GL_UNSIGNED_BYTE;
if (tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
if (mem->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
data.gl_type = GL_UNSIGNED_SHORT_5_6_5;
gst_gl_context_thread_add (context,
@ -705,7 +718,7 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
goto error;
}
in_size = src->height * src->stride;
in_size = GL_MEM_HEIGHT (src) * GL_MEM_STRIDE (src);
out_size = out_height * out_stride;
if (copy_params->respecify) {
@ -770,13 +783,14 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
gl->GenBuffers (1, &src->pbo);
GST_TRACE ("copying texture data with size of %u*%u*%u",
_gl_format_type_n_bytes (in_gl_format, in_gl_type), src->width,
src->height);
_gl_format_type_n_bytes (in_gl_format, in_gl_type), src->tex_width,
GL_MEM_HEIGHT (src));
/* copy tex */
gl->BindBuffer (GL_PIXEL_PACK_BUFFER, src->pbo);
gl->BufferData (GL_PIXEL_PACK_BUFFER, in_size, NULL, GL_STREAM_COPY);
gl->ReadPixels (0, 0, src->width, src->height, in_gl_format, in_gl_type, 0);
gl->ReadPixels (0, 0, src->tex_width, GL_MEM_HEIGHT (src), in_gl_format,
in_gl_type, 0);
gl->BindBuffer (GL_PIXEL_PACK_BUFFER, 0);
gl->BindBuffer (GL_PIXEL_UNPACK_BUFFER, src->pbo);
@ -822,8 +836,8 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
GstGLMemory *dest;
if (GST_GL_MEMORY_FLAG_IS_SET (src, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
dest = _gl_mem_new (src->mem.allocator, NULL, src->context, src->tex_type,
src->width, src->height, src->stride, NULL, NULL);
dest = _gl_mem_new (src->mem.allocator, NULL, src->context, &src->info,
src->plane, NULL, NULL);
dest->data = g_malloc (src->mem.maxsize);
memcpy (dest->data, src->data, src->mem.maxsize);
GST_GL_MEMORY_FLAG_SET (dest, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
@ -833,16 +847,16 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
copy_params.src = src;
copy_params.tex_id = 0;
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.out_width = src->tex_width;
copy_params.out_height = GL_MEM_HEIGHT (src);
copy_params.out_stride = GL_MEM_STRIDE (src);
copy_params.respecify = FALSE;
gst_gl_context_thread_add (src->context, _gl_mem_copy_thread, &copy_params);
dest = g_slice_new0 (GstGLMemory);
_gl_mem_init (dest, src->mem.allocator, NULL, src->context, src->tex_type,
src->width, src->height, src->stride, NULL, NULL);
_gl_mem_init (dest, src->mem.allocator, NULL, src->context, &src->info,
src->plane, NULL, NULL);
if (!copy_params.result) {
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
@ -966,15 +980,12 @@ gst_gl_memory_copy_into_texture (GstGLMemory * gl_mem, guint tex_id,
GstGLMemory *
gst_gl_memory_wrapped_texture (GstGLContext * context, guint texture_id,
GstVideoGLTextureType tex_type, gint width, gint height, gpointer user_data,
GDestroyNotify notify)
GstVideoInfo * info, guint plane, gpointer user_data, GDestroyNotify notify)
{
GstGLMemory *mem;
guint n_gl_bytes = _gl_texture_type_n_bytes (tex_type);
mem = g_slice_new0 (GstGLMemory);
_gl_mem_init (mem, _gl_allocator, NULL, context, tex_type, width, height,
width * n_gl_bytes, NULL, NULL);
_gl_mem_init (mem, _gl_allocator, NULL, context, info, plane, NULL, NULL);
mem->tex_id = texture_id;
mem->texture_wrapped = TRUE;
@ -998,13 +1009,11 @@ gst_gl_memory_wrapped_texture (GstGLContext * context, guint texture_id,
* from @context
*/
GstMemory *
gst_gl_memory_alloc (GstGLContext * context, GstVideoGLTextureType tex_type,
gint width, gint height, gint stride)
gst_gl_memory_alloc (GstGLContext * context, GstVideoInfo * info, guint plane)
{
GstGLMemory *mem;
mem = _gl_mem_new (_gl_allocator, NULL, context, tex_type, width, height,
stride, NULL, NULL);
mem = _gl_mem_new (_gl_allocator, NULL, context, info, plane, NULL, NULL);
mem->data = g_malloc (mem->mem.maxsize);
if (mem->data == NULL) {
@ -1027,14 +1036,14 @@ gst_gl_memory_alloc (GstGLContext * context, GstVideoGLTextureType tex_type,
* from @context and contents specified by @data
*/
GstGLMemory *
gst_gl_memory_wrapped (GstGLContext * context, GstVideoGLTextureType tex_type,
gint width, gint height, gint stride, gpointer data, gpointer user_data,
GDestroyNotify notify)
gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo * info, guint plane,
gpointer data, gpointer user_data, GDestroyNotify notify)
{
GstGLMemory *mem;
mem = _gl_mem_new (_gl_allocator, NULL, context, tex_type, width, height,
stride, user_data, notify);
mem =
_gl_mem_new (_gl_allocator, NULL, context, info, plane, user_data,
notify);
mem->data = data;
mem->data_wrapped = TRUE;
@ -1044,6 +1053,22 @@ gst_gl_memory_wrapped (GstGLContext * context, GstVideoGLTextureType tex_type,
return mem;
}
gint
gst_gl_memory_get_texture_width (GstGLMemory * gl_mem)
{
g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
return gl_mem->tex_width;
}
gint
gst_gl_memory_get_texture_height (GstGLMemory * gl_mem)
{
g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
return _get_plane_height (&gl_mem->info, gl_mem->plane);
}
G_DEFINE_TYPE (GstGLAllocator, gst_gl_allocator, GST_TYPE_ALLOCATOR);
static void
@ -1120,19 +1145,12 @@ gst_gl_memory_setup_buffer (GstGLContext * context, GstVideoInfo * info,
GstBuffer * buffer)
{
GstGLMemory *gl_mem[GST_VIDEO_MAX_PLANES] = { NULL, };
GstVideoGLTextureType tex_type;
guint n_mem, i;
n_mem = GST_VIDEO_INFO_N_PLANES (info);
for (i = 0; i < n_mem; i++) {
tex_type =
gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (info),
i);
gl_mem[i] =
(GstGLMemory *) gst_gl_memory_alloc (context, tex_type,
_get_plane_width (info, i), _get_plane_height (info, i),
GST_VIDEO_INFO_PLANE_STRIDE (info, i));
gl_mem[i] = (GstGLMemory *) gst_gl_memory_alloc (context, info, i);
gst_buffer_append_memory (buffer, (GstMemory *) gl_mem[i]);
}
@ -1161,17 +1179,11 @@ gst_gl_memory_setup_wrapped (GstGLContext * context, GstVideoInfo * info,
gpointer data[GST_VIDEO_MAX_PLANES],
GstGLMemory * textures[GST_VIDEO_MAX_PLANES])
{
GstVideoGLTextureType tex_type;
gint i;
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) {
tex_type =
gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (info),
i);
textures[i] = (GstGLMemory *) gst_gl_memory_wrapped (context, tex_type,
_get_plane_width (info, i), _get_plane_height (info, i),
GST_VIDEO_INFO_PLANE_STRIDE (info, i), data[i], NULL, NULL);
textures[i] = (GstGLMemory *) gst_gl_memory_wrapped (context, info, i,
data[i], NULL, NULL);
}
return TRUE;

View file

@ -85,9 +85,8 @@ struct _GstGLMemory
GstGLContext *context;
guint tex_id;
GstVideoGLTextureType tex_type;
gint width;
gint height;
gint stride;
GstVideoInfo info;
guint plane;
gfloat tex_scaling[2];
/* <private> */
@ -100,6 +99,7 @@ struct _GstGLMemory
gpointer user_data;
guint pbo;
guint unpack_length;
guint tex_width;
gpointer _gst_reserved[GST_PADDING];
};
@ -151,19 +151,15 @@ struct _GstGLMemory
void gst_gl_memory_init (void);
gboolean gst_is_gl_memory (GstMemory * mem);
GstMemory * gst_gl_memory_alloc (GstGLContext * context, GstVideoGLTextureType tex_type,
gint width, gint height, gint stride);
GstGLMemory * gst_gl_memory_wrapped (GstGLContext * context, GstVideoGLTextureType tex_type,
gint width, gint height, gint stride,
gpointer data, gpointer user_data,
GDestroyNotify notify);
GstMemory * gst_gl_memory_alloc (GstGLContext * context, GstVideoInfo * info, guint plane);
GstGLMemory * gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo * info, guint plane,
gpointer data, gpointer user_data, GDestroyNotify notify);
GstGLMemory * gst_gl_memory_wrapped_texture (GstGLContext * context, guint texture_id,
GstVideoGLTextureType tex_type,
gint width, gint height,
GstVideoInfo * info, guint plane,
gpointer user_data, GDestroyNotify notify);
gboolean gst_gl_memory_copy_into_texture (GstGLMemory *gl_mem, guint tex_id,
GstVideoGLTextureType tex_type,
GstVideoGLTextureType tex_type,
gint width, gint height, gint stride,
gboolean respecify);
@ -173,6 +169,9 @@ gboolean gst_gl_memory_setup_wrapped (GstGLContext * context, GstVideoInfo
gpointer data[GST_VIDEO_MAX_PLANES],
GstGLMemory *textures[GST_VIDEO_MAX_PLANES]);
gint gst_gl_memory_get_texture_width (GstGLMemory * gl_mem);
gint gst_gl_memory_get_texture_height (GstGLMemory * gl_mem);
GstVideoGLTextureType gst_gl_texture_type_from_format (GstGLContext *context, GstVideoFormat v_format, guint plane);
/**

View file

@ -491,8 +491,7 @@ _init_upload (GstGLUpload * upload)
&out_info);
upload->out_tex = gst_gl_memory_wrapped_texture (upload->context, 0,
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),
GST_VIDEO_INFO_HEIGHT (&upload->in_info), NULL, NULL);
&out_info, 0, NULL, NULL);
upload->initted = TRUE;

View file

@ -219,12 +219,11 @@ _perform_with_gl_memory (GstGLUploadMeta * upload, GstVideoGLTextureUploadMeta *
GST_GL_MEMORY_FLAG_SET (in_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD);
} else {
GstGLMemory *out_mem;
gint mem_width, mem_height;
if (!upload->priv->out_tex[i])
upload->priv->out_tex[i] = gst_gl_memory_wrapped_texture (upload->context,
texture_id[i], meta->texture_type[i],
GST_VIDEO_INFO_WIDTH (&upload->info),
GST_VIDEO_INFO_HEIGHT (&upload->info), NULL, NULL);
texture_id[i], &upload->info, i, NULL, NULL);
out_mem = upload->priv->out_tex[i];
@ -233,8 +232,12 @@ _perform_with_gl_memory (GstGLUploadMeta * upload, GstVideoGLTextureUploadMeta *
GST_GL_MEMORY_FLAG_SET (out_mem, GST_GL_MEMORY_FLAG_NEED_DOWNLOAD);
}
mem_width = gst_gl_memory_get_texture_width (out_mem);
mem_height = gst_gl_memory_get_texture_height (out_mem);
if (!(res = gst_gl_memory_copy_into_texture (in_mem, out_mem->tex_id,
out_mem->tex_type, out_mem->width, out_mem->height, out_mem->stride,
out_mem->tex_type, mem_width, mem_height,
GST_VIDEO_INFO_PLANE_STRIDE (&out_mem->info, out_mem->plane),
FALSE)))
break;
}
@ -253,9 +256,7 @@ _perform_with_data_unlocked (GstGLUploadMeta * upload,
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->info); i++) {
if (!upload->priv->in_tex[i])
upload->priv->in_tex[i] = gst_gl_memory_wrapped (upload->context,
meta->texture_type[i], GST_VIDEO_INFO_WIDTH (&upload->info),
GST_VIDEO_INFO_HEIGHT (&upload->info),
GST_VIDEO_INFO_PLANE_STRIDE (&upload->info, i), data[i], NULL, NULL);
&upload->info, i, data[i], NULL, NULL);
upload->priv->in_tex[i]->data = data[i];
}