89 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2 3.. _metadata:4 5******************6Metadata Interface7******************8 9Metadata refers to any non-image data that supplements video frames with10additional information. This may include statistics computed over the image,11frame capture parameters supplied by the image source or device specific12parameters for specifying how the device processes images. This interface is13intended for transfer of metadata between the userspace and the hardware and14control of that operation.15 16The metadata interface is implemented on video device nodes. The device can be17dedicated to metadata or can support both video and metadata as specified in its18reported capabilities.19 20Querying Capabilities21=====================22 23Device nodes supporting the metadata capture interface set the24``V4L2_CAP_META_CAPTURE`` flag in the ``device_caps`` field of the25:c:type:`v4l2_capability` structure returned by the :c:func:`VIDIOC_QUERYCAP`26ioctl. That flag means the device can capture metadata to memory. Similarly,27device nodes supporting metadata output interface set the28``V4L2_CAP_META_OUTPUT`` flag in the ``device_caps`` field of29:c:type:`v4l2_capability` structure. That flag means the device can read30metadata from memory.31 32At least one of the read/write or streaming I/O methods must be supported.33 34 35Data Format Negotiation36=======================37 38The metadata device uses the :ref:`format` ioctls to select the capture format.39The metadata buffer content format is bound to that selected format. In addition40to the basic :ref:`format` ioctls, the :c:func:`VIDIOC_ENUM_FMT` ioctl must be41supported as well.42 43To use the :ref:`format` ioctls applications set the ``type`` field of the44:c:type:`v4l2_format` structure to ``V4L2_BUF_TYPE_META_CAPTURE`` or to45``V4L2_BUF_TYPE_META_OUTPUT`` and use the :c:type:`v4l2_meta_format` ``meta``46member of the ``fmt`` union as needed per the desired operation. Both drivers47and applications must set the remainder of the :c:type:`v4l2_format` structure48to 0.49 50Devices that capture metadata by line have the struct v4l2_fmtdesc51``V4L2_FMT_FLAG_META_LINE_BASED`` flag set for :c:func:`VIDIOC_ENUM_FMT`. Such52devices can typically also :ref:`capture image data <capture>`. This primarily53involves devices that receive the data from a different devices such as a camera54sensor.55 56.. c:type:: v4l2_meta_format57 58.. tabularcolumns:: |p{1.4cm}|p{2.4cm}|p{13.5cm}|59 60.. flat-table:: struct v4l2_meta_format61 :header-rows: 062 :stub-columns: 063 :widths: 1 1 264 65 * - __u3266 - ``dataformat``67 - The data format, set by the application. This is a little endian68 :ref:`four character code <v4l2-fourcc>`. V4L2 defines metadata formats69 in :ref:`meta-formats`.70 * - __u3271 - ``buffersize``72 - Maximum buffer size in bytes required for data. The value is set by the73 driver.74 * - __u3275 - ``width``76 - Width of a line of metadata in Data Units. Valid when77 :c:type`v4l2_fmtdesc` flag ``V4L2_FMT_FLAG_META_LINE_BASED`` is set,78 otherwise zero. See :c:func:`VIDIOC_ENUM_FMT`.79 * - __u3280 - ``height``81 - Number of rows of metadata. Valid when :c:type`v4l2_fmtdesc` flag82 ``V4L2_FMT_FLAG_META_LINE_BASED`` is set, otherwise zero. See83 :c:func:`VIDIOC_ENUM_FMT`.84 * - __u3285 - ``bytesperline``86 - Offset in bytes between the beginning of two consecutive lines. Valid87 when :c:type`v4l2_fmtdesc` flag ``V4L2_FMT_FLAG_META_LINE_BASED`` is88 set, otherwise zero. See :c:func:`VIDIOC_ENUM_FMT`.89