[vlc-devel] [PATCH] videotoolbox: fix HEVC 10bits on iOS 14

Thomas Guillem thomas at gllm.fr
Mon Sep 28 15:27:35 CEST 2020


iOS 14 adds support for 10bits YUV output. Unfortunately, it can only be
rendered with Metal, so force BGRA output for now (waiting for a
possible MetalAngle integration?).
---
 modules/codec/videotoolbox.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/codec/videotoolbox.c b/modules/codec/videotoolbox.c
index 02e009a42dd..673fc21dd2d 100644
--- a/modules/codec/videotoolbox.c
+++ b/modules/codec/videotoolbox.c
@@ -180,12 +180,16 @@ static void HXXXGetBestChroma(decoder_t *p_dec)
     {
         if (i_depth_luma == 8 && i_depth_chroma == 8)
             p_sys->i_cvpx_format = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
-#if !TARGET_OS_IPHONE
-        /* Not for iOS since there is no 10bits textures with the old iOS
-         * openGLES version, and therefore no P010 shaders */
         else if (i_depth_luma == 10 && i_depth_chroma == 10 && deviceSupportsHEVC())
+        {
+#if !TARGET_OS_IPHONE
             p_sys->i_cvpx_format = kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange;
+#else
+            /* Force BGRA output (and let VT handle the tone mapping) on iOS
+             * since the old openGLES version can't handle 16 bit textures. */
+            p_sys->i_cvpx_format = kCVPixelFormatType_32BGRA;
 #endif
+        }
     }
 }
 
-- 
2.28.0



More information about the vlc-devel mailing list