1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 254f38fcaSMauro Carvalho Chehab 354f38fcaSMauro Carvalho Chehab.. _metadata: 454f38fcaSMauro Carvalho Chehab 554f38fcaSMauro Carvalho Chehab****************** 654f38fcaSMauro Carvalho ChehabMetadata Interface 754f38fcaSMauro Carvalho Chehab****************** 854f38fcaSMauro Carvalho Chehab 954f38fcaSMauro Carvalho ChehabMetadata refers to any non-image data that supplements video frames with 1054f38fcaSMauro Carvalho Chehabadditional information. This may include statistics computed over the image, 1154f38fcaSMauro Carvalho Chehabframe capture parameters supplied by the image source or device specific 1254f38fcaSMauro Carvalho Chehabparameters for specifying how the device processes images. This interface is 1354f38fcaSMauro Carvalho Chehabintended for transfer of metadata between the userspace and the hardware and 1454f38fcaSMauro Carvalho Chehabcontrol of that operation. 1554f38fcaSMauro Carvalho Chehab 1654f38fcaSMauro Carvalho ChehabThe metadata interface is implemented on video device nodes. The device can be 1754f38fcaSMauro Carvalho Chehabdedicated to metadata or can support both video and metadata as specified in its 1854f38fcaSMauro Carvalho Chehabreported capabilities. 1954f38fcaSMauro Carvalho Chehab 2054f38fcaSMauro Carvalho ChehabQuerying Capabilities 2154f38fcaSMauro Carvalho Chehab===================== 2254f38fcaSMauro Carvalho Chehab 2354f38fcaSMauro Carvalho ChehabDevice nodes supporting the metadata capture interface set the 2454f38fcaSMauro Carvalho Chehab``V4L2_CAP_META_CAPTURE`` flag in the ``device_caps`` field of the 2554f38fcaSMauro Carvalho Chehab:c:type:`v4l2_capability` structure returned by the :c:func:`VIDIOC_QUERYCAP` 2654f38fcaSMauro Carvalho Chehabioctl. That flag means the device can capture metadata to memory. Similarly, 2754f38fcaSMauro Carvalho Chehabdevice nodes supporting metadata output interface set the 2854f38fcaSMauro Carvalho Chehab``V4L2_CAP_META_OUTPUT`` flag in the ``device_caps`` field of 2954f38fcaSMauro Carvalho Chehab:c:type:`v4l2_capability` structure. That flag means the device can read 3054f38fcaSMauro Carvalho Chehabmetadata from memory. 3154f38fcaSMauro Carvalho Chehab 3254f38fcaSMauro Carvalho ChehabAt least one of the read/write or streaming I/O methods must be supported. 3354f38fcaSMauro Carvalho Chehab 3454f38fcaSMauro Carvalho Chehab 3554f38fcaSMauro Carvalho ChehabData Format Negotiation 3654f38fcaSMauro Carvalho Chehab======================= 3754f38fcaSMauro Carvalho Chehab 3854f38fcaSMauro Carvalho ChehabThe metadata device uses the :ref:`format` ioctls to select the capture format. 3954f38fcaSMauro Carvalho ChehabThe metadata buffer content format is bound to that selected format. In addition 4054f38fcaSMauro Carvalho Chehabto the basic :ref:`format` ioctls, the :c:func:`VIDIOC_ENUM_FMT` ioctl must be 4154f38fcaSMauro Carvalho Chehabsupported as well. 4254f38fcaSMauro Carvalho Chehab 4354f38fcaSMauro Carvalho ChehabTo use the :ref:`format` ioctls applications set the ``type`` field of the 4454f38fcaSMauro Carvalho Chehab:c:type:`v4l2_format` structure to ``V4L2_BUF_TYPE_META_CAPTURE`` or to 4554f38fcaSMauro Carvalho Chehab``V4L2_BUF_TYPE_META_OUTPUT`` and use the :c:type:`v4l2_meta_format` ``meta`` 4654f38fcaSMauro Carvalho Chehabmember of the ``fmt`` union as needed per the desired operation. Both drivers 4754f38fcaSMauro Carvalho Chehaband applications must set the remainder of the :c:type:`v4l2_format` structure 4854f38fcaSMauro Carvalho Chehabto 0. 4954f38fcaSMauro Carvalho Chehab 5054f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_meta_format 5154f38fcaSMauro Carvalho Chehab 52*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{1.4cm}|p{2.4cm}|p{13.5cm}| 5354f38fcaSMauro Carvalho Chehab 5454f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_meta_format 5554f38fcaSMauro Carvalho Chehab :header-rows: 0 5654f38fcaSMauro Carvalho Chehab :stub-columns: 0 5754f38fcaSMauro Carvalho Chehab :widths: 1 1 2 5854f38fcaSMauro Carvalho Chehab 5954f38fcaSMauro Carvalho Chehab * - __u32 6054f38fcaSMauro Carvalho Chehab - ``dataformat`` 6154f38fcaSMauro Carvalho Chehab - The data format, set by the application. This is a little endian 6254f38fcaSMauro Carvalho Chehab :ref:`four character code <v4l2-fourcc>`. V4L2 defines metadata formats 6354f38fcaSMauro Carvalho Chehab in :ref:`meta-formats`. 6454f38fcaSMauro Carvalho Chehab * - __u32 6554f38fcaSMauro Carvalho Chehab - ``buffersize`` 6654f38fcaSMauro Carvalho Chehab - Maximum buffer size in bytes required for data. The value is set by the 6754f38fcaSMauro Carvalho Chehab driver. 68