summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlessandro Decina <alessandro.d@gmail.com>2015-11-10 14:21:33 +1100
committerAlessandro Decina <alessandro.d@gmail.com>2015-11-10 14:24:42 +1100
commit75ad1246a204b6e4e43cf41e9b7e65f5b0f64ea3 (patch)
tree2651778983d448edbc17f425f250f027af0cdbb0 /sys
parent8def19decb701e663b975704d153041064362300 (diff)
downloadgstreamer-plugins-bad-75ad1246a204b6e4e43cf41e9b7e65f5b0f64ea3.tar.gz
applemedia: fix vtdec texture sharing on ios 9.1
Use gst_gl_sized_gl_format_from_gl_format_type to get the format passed to CVOpenGLESTextureCacheCreateTextureFromImage. Before this change extracting the second texture from the pixel buffer was failing on ios 9.1.
Diffstat (limited to 'sys')
-rw-r--r--sys/applemedia/corevideotexturecache.m15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/applemedia/corevideotexturecache.m b/sys/applemedia/corevideotexturecache.m
index 4d9547a2b..706b6d68f 100644
--- a/sys/applemedia/corevideotexturecache.m
+++ b/sys/applemedia/corevideotexturecache.m
@@ -187,34 +187,37 @@ gl_mem_from_buffer (GstCoreVideoTextureCache * cache,
break;
case GST_VIDEO_FORMAT_NV12: {
GstVideoGLTextureType textype;
- GLenum texfmt;
+ GLenum texifmt, texfmt;
textype = gst_gl_texture_type_from_format (cache->ctx, GST_VIDEO_FORMAT_NV12, 0);
- texfmt = gst_gl_format_from_gl_texture_type (textype);
- gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
+ texifmt = gst_gl_format_from_gl_texture_type (textype);
+ texfmt = gst_gl_sized_gl_format_from_gl_format_type (cache->ctx, texifmt, GL_UNSIGNED_BYTE);
/* vtdec does NV12 on iOS when doing GLMemory */
if (CVOpenGLESTextureCacheCreateTextureFromImage (kCFAllocatorDefault,
- cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, texfmt,
+ cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, texifmt,
GST_VIDEO_INFO_WIDTH (&cache->input_info),
GST_VIDEO_INFO_HEIGHT (&cache->input_info),
texfmt, GL_UNSIGNED_BYTE, 0, &texture) != kCVReturnSuccess)
goto error;
+ gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
*mem1 = (GstMemory *) gst_gl_memory_wrapped_texture (cache->ctx,
CVOpenGLESTextureGetName (texture), gl_target,
&cache->input_info, 0, NULL, texture, (GDestroyNotify) CFRelease);
textype = gst_gl_texture_type_from_format (cache->ctx, GST_VIDEO_FORMAT_NV12, 1);
- texfmt = gst_gl_format_from_gl_texture_type (textype);
+ texifmt = gst_gl_format_from_gl_texture_type (textype);
+ texfmt = gst_gl_sized_gl_format_from_gl_format_type (cache->ctx, texifmt, GL_UNSIGNED_BYTE);
if (CVOpenGLESTextureCacheCreateTextureFromImage (kCFAllocatorDefault,
- cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, texfmt,
+ cache->cache, pixel_buf, NULL, GL_TEXTURE_2D, texifmt,
GST_VIDEO_INFO_WIDTH (&cache->input_info) / 2,
GST_VIDEO_INFO_HEIGHT (&cache->input_info) / 2,
texfmt, GL_UNSIGNED_BYTE, 1, &texture) != kCVReturnSuccess)
goto error;
+ gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
*mem2 = (GstMemory *) gst_gl_memory_wrapped_texture (cache->ctx,
CVOpenGLESTextureGetName (texture), gl_target,
&cache->input_info, 0, NULL, texture, (GDestroyNotify) CFRelease);