mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
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.
This commit is contained in:
parent
8def19decb
commit
75ad1246a2
1 changed files with 9 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue