summaryrefslogtreecommitdiff
path: root/sys/applemedia/videotexturecache.m
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-06-25 00:05:37 +1000
committerMatthew Waters <matthew@centricular.com>2016-06-29 18:04:28 +1000
commit9a325f4a0993e54694d93cd1a064c9bb477235f7 (patch)
tree6c2e29d340639d5c1376676296b3cbe31ad8a871 /sys/applemedia/videotexturecache.m
parent989200820d43c78fb179d7984827800d83787390 (diff)
downloadgstreamer-plugins-bad-9a325f4a0993e54694d93cd1a064c9bb477235f7.tar.gz
vtdec: add support for zerocopy decoding with GLES 3.x
It seems that Red/RG textures aren't supported anymore for zerocopy decoding with GLES 3.x. Instead use Luminance/Luminance Alpha textures which are.
Diffstat (limited to 'sys/applemedia/videotexturecache.m')
-rw-r--r--sys/applemedia/videotexturecache.m18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/applemedia/videotexturecache.m b/sys/applemedia/videotexturecache.m
index 13ff5884b..331bd9ba7 100644
--- a/sys/applemedia/videotexturecache.m
+++ b/sys/applemedia/videotexturecache.m
@@ -182,8 +182,15 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
case GST_VIDEO_FORMAT_NV12: {
GstVideoGLTextureType textype;
GLenum texifmt, texfmt;
-
- textype = gst_gl_texture_type_from_format (cache->ctx, GST_VIDEO_FORMAT_NV12, 0);
+ gint gl_major;
+
+ gst_gl_context_get_gl_version (context, &gl_major, NULL);
+ if (gl_major >= 3) {
+ /* apple went backwards when choosing a pixel format for this */
+ textype = GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE;
+ } else {
+ textype = gst_gl_texture_type_from_format (cache->ctx, GST_VIDEO_FORMAT_NV12, 0);
+ }
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);
@@ -206,7 +213,12 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
(GstGLAllocationParams *) params));
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- textype = gst_gl_texture_type_from_format (cache->ctx, GST_VIDEO_FORMAT_NV12, 1);
+ if (gl_major >= 3) {
+ /* apple went backwards when choosing a pixel format for this */
+ textype = GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA;
+ } else {
+ textype = gst_gl_texture_type_from_format (cache->ctx, GST_VIDEO_FORMAT_NV12, 0);
+ }
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);