From e21525b74842656954b60fc3175202bdc42186c5 Mon Sep 17 00:00:00 2001 From: Rajmohan Mani Date: Tue, 8 Jan 2019 10:00:17 -0800 Subject: Add meta-data output support The V4L2_BUF_TYPE_META_OUTPUT mirrors the V4L2_BUF_TYPE_META_CAPTURE with the exception that it is an OUTPUT type. The use case for this is to pass buffers to the device that are not image data but metadata. The formats, just as the metadata capture formats, are typically device specific and highly structured. Signed-off-by: Rajmohan Mani Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- yavta.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/yavta.c b/yavta.c index c7986bd..3f4e381 100644 --- a/yavta.c +++ b/yavta.c @@ -92,7 +92,8 @@ static bool video_is_mplane(struct device *dev) static bool video_is_meta(struct device *dev) { - return dev->type == V4L2_BUF_TYPE_META_CAPTURE; + return dev->type == V4L2_BUF_TYPE_META_CAPTURE || + dev->type == V4L2_BUF_TYPE_META_OUTPUT; } static bool video_is_capture(struct device *dev) @@ -105,7 +106,8 @@ static bool video_is_capture(struct device *dev) static bool video_is_output(struct device *dev) { return dev->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE || - dev->type == V4L2_BUF_TYPE_VIDEO_OUTPUT; + dev->type == V4L2_BUF_TYPE_VIDEO_OUTPUT || + dev->type == V4L2_BUF_TYPE_META_OUTPUT; } static struct { @@ -120,6 +122,7 @@ static struct { { V4L2_BUF_TYPE_VIDEO_OUTPUT, 1, "Video output mplanes", "output", }, { V4L2_BUF_TYPE_VIDEO_OVERLAY, 0, "Video overlay", "overlay" }, { V4L2_BUF_TYPE_META_CAPTURE, 1, "Meta-data capture", "meta-capture", }, + { V4L2_BUF_TYPE_META_OUTPUT, 1, "Meta-data output", "meta-output", }, }; static int v4l2_buf_type_from_string(const char *str) @@ -410,12 +413,14 @@ static int video_querycap(struct device *dev, unsigned int *capabilities) V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_OUTPUT); - has_meta = caps & V4L2_CAP_META_CAPTURE; + has_meta = caps & (V4L2_CAP_META_CAPTURE | + V4L2_CAP_META_OUTPUT); has_capture = caps & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_META_CAPTURE); has_output = caps & (V4L2_CAP_VIDEO_OUTPUT_MPLANE | - V4L2_CAP_VIDEO_OUTPUT); + V4L2_CAP_VIDEO_OUTPUT | + V4L2_CAP_META_OUTPUT); has_mplane = caps & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE); @@ -444,6 +449,8 @@ static int cap_get_buf_type(unsigned int capabilities) return V4L2_BUF_TYPE_VIDEO_OUTPUT; } else if (capabilities & V4L2_CAP_META_CAPTURE) { return V4L2_BUF_TYPE_META_CAPTURE; + } else if (capabilities & V4L2_CAP_META_OUTPUT) { + return V4L2_BUF_TYPE_META_OUTPUT; } else { printf("Device supports neither capture nor output.\n"); return -EINVAL; @@ -2195,6 +2202,7 @@ int main(int argc, char *argv[]) video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_OVERLAY); video_enum_formats(&dev, V4L2_BUF_TYPE_META_CAPTURE); + video_enum_formats(&dev, V4L2_BUF_TYPE_META_OUTPUT); } if (do_enum_inputs) { -- cgit v1.2.3