diff options
author | Rajmohan Mani <rajmohan.mani@intel.com> | 2019-01-08 10:00:17 -0800 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-01-08 23:25:20 +0200 |
commit | e21525b74842656954b60fc3175202bdc42186c5 (patch) | |
tree | 9714487a7ba72ead0df78d117fcc4eb5e1930f4d | |
parent | b5b3cca6758656fd51c1766e10ec1cf82f81f206 (diff) |
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 <rajmohan.mani@intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | yavta.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -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) { |