summaryrefslogtreecommitdiff
path: root/sys/applemedia
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-06-28 13:51:22 +1000
committerMatthew Waters <matthew@centricular.com>2016-06-29 18:04:28 +1000
commit989200820d43c78fb179d7984827800d83787390 (patch)
tree4e26370accaa68b3e7b96610aed3b518c57766f9 /sys/applemedia
parent6958b7a0147334e6d02c30f6f236fbd7e1089081 (diff)
downloadgstreamer-plugins-bad-989200820d43c78fb179d7984827800d83787390.tar.gz
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/applemedia')
-rw-r--r--sys/applemedia/iosurfacememory.c6
-rw-r--r--sys/applemedia/iosurfacememory.h1
-rw-r--r--sys/applemedia/videotexturecache.m15
3 files changed, 14 insertions, 8 deletions
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);
}