v4l2codecs: Enable MediaTek MM21 (NV12_16L32S)
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 26 Jan 2022 18:39:40 +0000 (13:39 -0500)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sun, 20 Feb 2022 22:32:55 +0000 (22:32 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>

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

index ed3f757..28a12f4 100644 (file)
@@ -36,6 +36,7 @@ static struct FormatEntry format_map[] = {
   {V4L2_PIX_FMT_YUYV, 1, GST_VIDEO_FORMAT_YUY2, 8, 422},
   {V4L2_PIX_FMT_SUNXI_TILED_NV12, 1, GST_VIDEO_FORMAT_NV12_32L32, 8, 422},
   {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},
   {0,}
 };
 
@@ -82,6 +83,10 @@ set_stride (GstVideoInfo * info, gint plane, gint stride)
     ws = GST_VIDEO_FORMAT_INFO_TILE_WS (finfo);
     hs = GST_VIDEO_FORMAT_INFO_TILE_HS (finfo);
 
+    /* this only works for what we support, NV12 subsampled tiles */
+    if (GST_VIDEO_FORMAT_INFO_HAS_SUBTILES (finfo) && plane == 1)
+      hs -= 1;
+
     padded_height = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (finfo, plane,
         info->height);
     padded_height = GST_ROUND_UP_N (padded_height, 1 << hs);
index ef693b6..75cd814 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 }"
+#define GST_V4L2_DEFAULT_VIDEO_FORMATS "{ NV12, YUY2, NV12_4L4, NV12_32L32, NV12_16L32S }"
 
 gboolean   gst_v4l2_format_to_video_info (struct v4l2_format * fmt,
                                           GstVideoInfo * out_info);