applemedia: Fix pixel format for I420
authorL. E. Segovia <amy@amyspark.me>
Tue, 15 Aug 2023 21:45:56 +0000 (21:45 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 18 Sep 2023 19:42:22 +0000 (19:42 +0000)
In Intel Macs, using full range 8-bit 4:2:0 YCbCr results in a failure on
initialization. I've validated this to be the correct pixel format with FFmpeg:

https://github.com/FFmpeg/FFmpeg/blob/8653dcaf7d665b15b40ea9a560c8171b0914a882/libavutil/hwcontext_videotoolbox.c#L45

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5203>

subprojects/gst-plugins-bad/sys/applemedia/coremediabuffer.c
subprojects/gst-plugins-bad/sys/applemedia/corevideobuffer.c

index 70877d7..2bdebb6 100644 (file)
@@ -123,6 +123,8 @@ static GstVideoFormat
 gst_core_media_buffer_get_video_format (OSType format)
 {
   switch (format) {
+    case kCVPixelFormatType_420YpCbCr8Planar:
+      return GST_VIDEO_FORMAT_I420;
     case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
       return GST_VIDEO_FORMAT_NV12;
     case kCVPixelFormatType_422YpCbCr8_yuvs:
index f154efc..409c6ac 100644 (file)
@@ -216,6 +216,8 @@ static GstVideoFormat
 gst_core_video_get_video_format (OSType format)
 {
   switch (format) {
+    case kCVPixelFormatType_420YpCbCr8Planar:
+      return GST_VIDEO_FORMAT_I420;
     case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
       return GST_VIDEO_FORMAT_NV12;
     case kCVPixelFormatType_422YpCbCr8_yuvs: