applemedia: vtenc: accept UYVY on Mac
authorAlessandro Decina <alessandro.d@gmail.com>
Wed, 6 Jan 2016 00:40:38 +0000 (11:40 +1100)
committerAlessandro Decina <alessandro.d@gmail.com>
Wed, 6 Jan 2016 00:43:37 +0000 (11:43 +1100)
When doing GLMemory avfvideosrc negotiates UYVY. This change allows avfvideosrc
! tee name=t ! ... ! glimagesink t. ! ... ! gldownload ! vtenc_h264 ! ...
to do GLMemory and 0-copy with the encoder (with the CV meta).

sys/applemedia/vtenc.c

index f0af751..43366ea 100644 (file)
@@ -136,8 +136,13 @@ static void gst_pixel_buffer_release_cb (void *releaseRefCon,
     const void *planeAddresses[]);
 #endif
 
+#ifdef HAVE_IOS
 static GstStaticCaps sink_caps =
 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ NV12, I420 }"));
+#else
+static GstStaticCaps sink_caps =
+GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ UYVY, NV12, I420 }"));
+#endif
 
 static void
 gst_vtenc_base_init (GstVTEncClass * klass)
@@ -1164,6 +1169,9 @@ gst_vtenc_encode_frame (GstVTEnc * self, GstVideoCodecFrame * frame)
         case GST_VIDEO_FORMAT_NV12:
           pixel_format_type = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
           break;
+        case GST_VIDEO_FORMAT_UYVY:
+          pixel_format_type = kCVPixelFormatType_422YpCbCr8;
+          break;
         default:
           gst_vtenc_frame_free (vframe);
           goto cv_error;