[vlc-devel] [PATCH 1/2] videotoolbox: force decoder output to nv12

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Fri Jul 7 19:31:46 CEST 2017


The CoreImage filters do not accept UYUV color space while NV12 works just
fine.
---
 modules/codec/videotoolbox.m | 4 ++++
 modules/codec/vt_utils.c     | 6 +-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 7806bd7843..36e0b35776 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -695,6 +695,10 @@ static int StartVideoToolbox(decoder_t *p_dec)
                      kCVPixelBufferBytesPerRowAlignmentKey,
                      i_video_width * 2);
 
+    /* force NV12 */
+    cfdict_set_int32(p_sys->destinationPixelBufferAttributes, kCVPixelBufferPixelFormatTypeKey,
+                     kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange);
+
     /* setup decoder callback record */
     VTDecompressionOutputCallbackRecord decoderCallbackRecord;
     decoderCallbackRecord.decompressionOutputCallback = DecoderCallback;
diff --git a/modules/codec/vt_utils.c b/modules/codec/vt_utils.c
index 3faf8598dd..9bab10fec3 100644
--- a/modules/codec/vt_utils.c
+++ b/modules/codec/vt_utils.c
@@ -198,13 +198,9 @@ cvpxpool_create(const video_format_t *fmt, unsigned count)
     switch (fmt->i_chroma)
     {
         case VLC_CODEC_CVPX_UYVY:
-            cvpx_format = kCVPixelFormatType_422YpCbCr8;
-            break;
         case VLC_CODEC_CVPX_NV12:
-            cvpx_format = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
-            break;
         case VLC_CODEC_CVPX_I420:
-            cvpx_format = kCVPixelFormatType_420YpCbCr8Planar;
+            cvpx_format = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
             break;
         case VLC_CODEC_CVPX_BGRA:
             cvpx_format = kCVPixelFormatType_32BGRA;
-- 
2.13.1



More information about the vlc-devel mailing list