v4l2object: add support of NV16, NV61 and NV24 formats
authorAurélien Zanelli <aurelien.zanelli@parrot.com>
Fri, 13 Nov 2015 12:34:02 +0000 (13:34 +0100)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Fri, 13 Nov 2015 15:29:01 +0000 (10:29 -0500)
Mapped respectively to V4L2_PIX_FMT_NV16/V4L2_PIX_FMT_NV16M,
V4L2_PIX_FMT_NV61,V4L2_PIX_FMT_NV61M and V4L2_PIX_FMT_NV24 v4l2 formats.

https://bugzilla.gnome.org/show_bug.cgi?id=758058

sys/v4l2/gstv4l2object.c

index 17847e6..4a2acd3 100644 (file)
@@ -108,6 +108,11 @@ static const GstV4L2FormatDesc gst_v4l2_formats[] = {
   {V4L2_PIX_FMT_NV12MT, TRUE, GST_V4L2_RAW},
   {V4L2_PIX_FMT_NV21, TRUE, GST_V4L2_RAW},
   {V4L2_PIX_FMT_NV21M, TRUE, GST_V4L2_RAW},
+  {V4L2_PIX_FMT_NV16, TRUE, GST_V4L2_RAW},
+  {V4L2_PIX_FMT_NV16M, TRUE, GST_V4L2_RAW},
+  {V4L2_PIX_FMT_NV61, TRUE, GST_V4L2_RAW},
+  {V4L2_PIX_FMT_NV61M, TRUE, GST_V4L2_RAW},
+  {V4L2_PIX_FMT_NV24, TRUE, GST_V4L2_RAW},
 
   /*  The following formats are not defined in the V4L2 specification */
   {V4L2_PIX_FMT_YUV410, TRUE, GST_V4L2_RAW},
@@ -929,6 +934,11 @@ gst_v4l2_object_format_get_rank (const struct v4l2_fmtdesc *fmt)
     case V4L2_PIX_FMT_NV21M:   /* Same as NV21      */
     case V4L2_PIX_FMT_YYUV:    /* 16  YUV 4:2:2     */
     case V4L2_PIX_FMT_HI240:   /*  8  8-bit color   */
+    case V4L2_PIX_FMT_NV16:    /* 16  Y/CbCr 4:2:2  */
+    case V4L2_PIX_FMT_NV16M:   /* Same as NV16      */
+    case V4L2_PIX_FMT_NV61:    /* 16  Y/CrCb 4:2:2  */
+    case V4L2_PIX_FMT_NV61M:   /* Same as NV61      */
+    case V4L2_PIX_FMT_NV24:    /* 24  Y/CrCb 4:4:4  */
       rank = YUV_ODD_BASE_RANK;
       break;
 
@@ -1194,6 +1204,17 @@ gst_v4l2_object_v4l2fourcc_to_video_format (guint32 fourcc)
     case V4L2_PIX_FMT_YVYU:
       format = GST_VIDEO_FORMAT_YVYU;
       break;
+    case V4L2_PIX_FMT_NV16:
+    case V4L2_PIX_FMT_NV16M:
+      format = GST_VIDEO_FORMAT_NV16;
+      break;
+    case V4L2_PIX_FMT_NV61:
+    case V4L2_PIX_FMT_NV61M:
+      format = GST_VIDEO_FORMAT_NV61;
+      break;
+    case V4L2_PIX_FMT_NV24:
+      format = GST_VIDEO_FORMAT_NV24;
+      break;
     default:
       format = GST_VIDEO_FORMAT_UNKNOWN;
       break;
@@ -1259,6 +1280,11 @@ gst_v4l2_object_v4l2fourcc_to_bare_struct (guint32 fourcc)
     case V4L2_PIX_FMT_NV12MT:
     case V4L2_PIX_FMT_NV21:    /* 12  Y/CrCb 4:2:0  */
     case V4L2_PIX_FMT_NV21M:
+    case V4L2_PIX_FMT_NV16:    /* 16  Y/CbCr 4:2:2  */
+    case V4L2_PIX_FMT_NV16M:
+    case V4L2_PIX_FMT_NV61:    /* 16  Y/CrCb 4:2:2  */
+    case V4L2_PIX_FMT_NV61M:
+    case V4L2_PIX_FMT_NV24:    /* 24  Y/CrCb 4:4:4  */
     case V4L2_PIX_FMT_YVU410:
     case V4L2_PIX_FMT_YUV410:
     case V4L2_PIX_FMT_YUV420:  /* I420/IYUV */
@@ -1486,6 +1512,17 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
         fourcc = V4L2_PIX_FMT_NV21;
         fourcc_nc = V4L2_PIX_FMT_NV21M;
         break;
+      case GST_VIDEO_FORMAT_NV16:
+        fourcc = V4L2_PIX_FMT_NV16;
+        fourcc_nc = V4L2_PIX_FMT_NV16M;
+        break;
+      case GST_VIDEO_FORMAT_NV61:
+        fourcc = V4L2_PIX_FMT_NV61;
+        fourcc_nc = V4L2_PIX_FMT_NV61M;
+        break;
+      case GST_VIDEO_FORMAT_NV24:
+        fourcc = V4L2_PIX_FMT_NV24;
+        break;
       case GST_VIDEO_FORMAT_YVYU:
         fourcc = V4L2_PIX_FMT_YVYU;
         break;
@@ -2788,6 +2825,7 @@ gst_v4l2_object_extrapolate_stride (const GstVideoFormatInfo * finfo,
     case GST_VIDEO_FORMAT_NV12_64Z32:
     case GST_VIDEO_FORMAT_NV21:
     case GST_VIDEO_FORMAT_NV16:
+    case GST_VIDEO_FORMAT_NV61:
     case GST_VIDEO_FORMAT_NV24:
       estride = (plane == 0 ? 1 : 2) *
           GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride);