diff options
author | Matthew Waters <matthew@centricular.com> | 2016-06-28 13:51:22 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2016-06-29 18:04:28 +1000 |
commit | 989200820d43c78fb179d7984827800d83787390 (patch) | |
tree | 4e26370accaa68b3e7b96610aed3b518c57766f9 /sys | |
parent | 6958b7a0147334e6d02c30f6f236fbd7e1089081 (diff) |
glmemory: add the texture type to allocate to parameters
Rather than assuming something. e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/androidmedia/gstamcvideodec.c | 3 | ||||
-rw-r--r-- | sys/applemedia/iosurfacememory.c | 6 | ||||
-rw-r--r-- | sys/applemedia/iosurfacememory.h | 1 | ||||
-rw-r--r-- | sys/applemedia/videotexturecache.m | 15 |
4 files changed, 16 insertions, 9 deletions
diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c index 7c99be098..397b5857b 100644 --- a/sys/androidmedia/gstamcvideodec.c +++ b/sys/androidmedia/gstamcvideodec.c @@ -1354,7 +1354,8 @@ retry: (GST_GL_MEMORY_ALLOCATOR_NAME)); params = gst_gl_video_allocation_params_new (self->gl_context, NULL, - &state->info, 0, NULL, GST_GL_TEXTURE_TARGET_EXTERNAL_OES); + &state->info, 0, NULL, GST_GL_TEXTURE_TARGET_EXTERNAL_OES, + GST_VIDEO_GL_TEXTURE_TYPE_RGBA); self->oes_mem = (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_alloc, (GstGLAllocationParams *) params); diff --git a/sys/applemedia/iosurfacememory.c b/sys/applemedia/iosurfacememory.c index 694202c42..23f03f98d 100644 --- a/sys/applemedia/iosurfacememory.c +++ b/sys/applemedia/iosurfacememory.c @@ -160,6 +160,7 @@ static GstIOSurfaceMemory * _io_surface_memory_new (GstGLContext * context, IOSurfaceRef surface, GstGLTextureTarget target, + GstVideoGLTextureType tex_type, GstVideoInfo * info, guint plane, GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify) @@ -170,7 +171,7 @@ _io_surface_memory_new (GstGLContext * context, mem = g_new0 (GstIOSurfaceMemory, 1); gst_gl_memory_init (&mem->gl_mem, _io_surface_memory_allocator, NULL, context, - target, NULL, info, plane, valign, user_data, notify); + target, tex_type, NULL, info, plane, valign, user_data, notify); GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY); @@ -184,11 +185,12 @@ GstIOSurfaceMemory * gst_io_surface_memory_wrapped (GstGLContext * context, IOSurfaceRef surface, GstGLTextureTarget target, + GstVideoGLTextureType tex_type, GstVideoInfo * info, guint plane, GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify) { - return _io_surface_memory_new (context, surface, target, info, + return _io_surface_memory_new (context, surface, target, tex_type, info, plane, valign, user_data, notify); } diff --git a/sys/applemedia/iosurfacememory.h b/sys/applemedia/iosurfacememory.h index 5d0fbe84b..5d281acd0 100644 --- a/sys/applemedia/iosurfacememory.h +++ b/sys/applemedia/iosurfacememory.h @@ -53,6 +53,7 @@ GstIOSurfaceMemory * gst_io_surface_memory_wrapped (GstGLContext * context, IOSurfaceRef surface, GstGLTextureTarget target, + GstVideoGLTextureType tex_type, GstVideoInfo * info, guint plane, GstVideoAlignment *valign, diff --git a/sys/applemedia/videotexturecache.m b/sys/applemedia/videotexturecache.m index e1bdb64d2..13ff5884b 100644 --- a/sys/applemedia/videotexturecache.m +++ b/sys/applemedia/videotexturecache.m @@ -171,8 +171,8 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data) gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture)); params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx, NULL, &cache->input_info, 0, NULL, gl_target, - CVOpenGLESTextureGetName (texture), texture, - (GDestroyNotify) CFRelease); + GST_VIDEO_GL_TEXTURE_TYPE_RGBA, CVOpenGLESTextureGetName (texture), + texture, (GDestroyNotify) CFRelease); gst_buffer_replace_memory (output_buffer, 0, (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc, @@ -197,7 +197,7 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data) gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture)); params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx, - NULL, &cache->input_info, 0, NULL, gl_target, + NULL, &cache->input_info, 0, NULL, gl_target, textype, CVOpenGLESTextureGetName (texture), texture, (GDestroyNotify) CFRelease); @@ -219,7 +219,7 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data) gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture)); params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx, - NULL, &cache->input_info, 1, NULL, gl_target, + NULL, &cache->input_info, 1, NULL, gl_target, textype, CVOpenGLESTextureGetName (texture), texture, (GDestroyNotify) CFRelease); @@ -255,11 +255,14 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data) gst_buffer_copy_into (data->output_buffer, data->input_buffer, GST_BUFFER_COPY_ALL, 0, -1); for (int i = 0; i < GST_VIDEO_INFO_N_PLANES (&cache->input_info); i++) { GstIOSurfaceMemory *mem; + GstVideoGLTextureType tex_type = + gst_gl_texture_type_from_format (context, + GST_VIDEO_INFO_FORMAT (&cache->input_info), i); CFRetain (pixel_buf); mem = gst_io_surface_memory_wrapped (cache->ctx, - surface, GST_GL_TEXTURE_TARGET_RECTANGLE, &cache->input_info, - i, NULL, pixel_buf, (GDestroyNotify) CFRelease); + surface, GST_GL_TEXTURE_TARGET_RECTANGLE, tex_type, + &cache->input_info, i, NULL, pixel_buf, (GDestroyNotify) CFRelease); gst_buffer_replace_memory (data->output_buffer, i, (GstMemory *) mem); } |