v4l2codecs: Add P010 pixel format
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Tue, 24 May 2022 08:40:26 +0000 (10:40 +0200)
committerBenjamin Gaignard <benjamin.gaignard@collabora.com>
Mon, 13 Jun 2022 14:44:29 +0000 (16:44 +0200)
Copy V4L2_PIX_FMT_P010 define from linux header.
V4L2_PIX_FMT_P010 is the little endian definition of P010 so map
it GST_VIDEO_FORMAT_P010_10LE.
Add it v4l2 default video formats to allows v4l2 decoders to
enumerate and use it.

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

subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c
subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.h
subprojects/gst-plugins-bad/sys/v4l2codecs/linux/videodev2.h

index 0f5fa30..8b79287 100644 (file)
@@ -38,6 +38,7 @@ static struct FormatEntry format_map[] = {
   {V4L2_PIX_FMT_NV12_4L4, 1, GST_VIDEO_FORMAT_NV12_4L4, 8, 420},
   {V4L2_PIX_FMT_MM21, 2, GST_VIDEO_FORMAT_NV12_16L32S, 8, 420},
   {V4L2_PIX_FMT_YUV420M, 3, GST_VIDEO_FORMAT_I420, 8, 420},
+  {V4L2_PIX_FMT_P010, 1, GST_VIDEO_FORMAT_P010_10LE, 16, 420},
   {0,}
 };
 
index b360440..b579248 100644 (file)
@@ -24,7 +24,7 @@
 #include <gst/video/video.h>
 #include "linux/videodev2.h"
 
-#define GST_V4L2_DEFAULT_VIDEO_FORMATS "{ NV12, YUY2, NV12_4L4, NV12_32L32, NV12_16L32S, I420 }"
+#define GST_V4L2_DEFAULT_VIDEO_FORMATS "{ NV12, YUY2, NV12_4L4, NV12_32L32, NV12_16L32S, I420, P010_10LE}"
 
 gboolean   gst_v4l2_format_to_video_info (struct v4l2_format * fmt,
                                           GstVideoInfo * out_info);
index 2ecc8cf..ff813e1 100644 (file)
@@ -595,6 +595,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_NV61    v4l2_fourcc('N', 'V', '6', '1') /* 16  Y/CrCb 4:2:2  */
 #define V4L2_PIX_FMT_NV24    v4l2_fourcc('N', 'V', '2', '4') /* 24  Y/CbCr 4:4:4  */
 #define V4L2_PIX_FMT_NV42    v4l2_fourcc('N', 'V', '4', '2') /* 24  Y/CrCb 4:4:4  */
+#define V4L2_PIX_FMT_P010    v4l2_fourcc('P', '0', '1', '0') /* 24  Y/CbCr 4:2:0 10-bit per component */
 
 /* two non contiguous planes - one Y, one Cr + Cb interleaved  */
 #define V4L2_PIX_FMT_NV12M   v4l2_fourcc('N', 'M', '1', '2') /* 12  Y/CbCr 4:2:0  */