sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftargetA/translations/zh_CN/userspace-api/media/v4l/dev-stateless-decodermodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetA/translations/zh_TW/userspace-api/media/v4l/dev-stateless-decodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetA/translations/it_IT/userspace-api/media/v4l/dev-stateless-decodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetA/translations/ja_JP/userspace-api/media/v4l/dev-stateless-decodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetA/translations/ko_KR/userspace-api/media/v4l/dev-stateless-decodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftargetA/translations/sp_SP/userspace-api/media/v4l/dev-stateless-decodermodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh[/var/lib/git/docbuild/linux/Documentation/userspace-api/media/v4l/dev-stateless-decoder.rsthKubhtarget)}(h.. _stateless_decoder:h]h}(h]h ]h"]h$]h&]refidstateless-decoderuh1hhKhhhhhhubhsection)}(hhh](htitle)}(h2Memory-to-memory Stateless Video Decoder Interfaceh]h2Memory-to-memory Stateless Video Decoder Interface}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hX(A stateless decoder is a decoder that works without retaining any kind of state between processed frames. This means that each frame is decoded independently of any previous and future frames, and that the client is responsible for maintaining the decoding state and providing it to the decoder with each decoding request. This is in contrast to the stateful video decoder interface, where the hardware and driver maintain the decoding state and all the client has to do is to provide the raw encoded stream and dequeue decoded frames in display order.h]hX(A stateless decoder is a decoder that works without retaining any kind of state between processed frames. This means that each frame is decoded independently of any previous and future frames, and that the client is responsible for maintaining the decoding state and providing it to the decoder with each decoding request. This is in contrast to the stateful video decoder interface, where the hardware and driver maintain the decoding state and all the client has to do is to provide the raw encoded stream and dequeue decoded frames in display order.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXcThis section describes how user-space ("the client") is expected to communicate with stateless decoders in order to successfully decode an encoded stream. Compared to stateful codecs, the decoder/client sequence is simpler, but the cost of this simplicity is extra complexity in the client which is responsible for maintaining a consistent decoding state.h]hXgThis section describes how user-space (“the client”) is expected to communicate with stateless decoders in order to successfully decode an encoded stream. Compared to stateful codecs, the decoder/client sequence is simpler, but the cost of this simplicity is extra complexity in the client which is responsible for maintaining a consistent decoding state.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hStateless decoders make use of the :ref:`media-request-api`. A stateless decoder must expose the ``V4L2_BUF_CAP_SUPPORTS_REQUESTS`` capability on its ``OUTPUT`` queue when :c:func:`VIDIOC_REQBUFS` or :c:func:`VIDIOC_CREATE_BUFS` are invoked.h](h#Stateless decoders make use of the }(hhhhhNhNubh)}(h:ref:`media-request-api`h]hinline)}(hhh]hmedia-request-api}(hjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhhubah}(h]h ]h"]h$]h&]refdoc-userspace-api/media/v4l/dev-stateless-decoder refdomainjreftyperef refexplicitrefwarn reftargetmedia-request-apiuh1hhhhKhhubh&. A stateless decoder must expose the }(hhhhhNhNubhliteral)}(h"``V4L2_BUF_CAP_SUPPORTS_REQUESTS``h]hV4L2_BUF_CAP_SUPPORTS_REQUESTS}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hhubh capability on its }(hhhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hhubh queue when }(hhhhhNhNubh)}(h:c:func:`VIDIOC_REQBUFS`h]j')}(hjNh]hVIDIOC_REQBUFS()}(hjPhhhNhNubah}(h]h ](j cc-funceh"]h$]h&]uh1j&hjLubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_REQBUFSuh1hhhhKhhubh or }(hhhhhNhNubh)}(h:c:func:`VIDIOC_CREATE_BUFS`h]j')}(hjrh]hVIDIOC_CREATE_BUFS()}(hjthhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjpubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_CREATE_BUFSuh1hhhhKhhubh are invoked.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXIDepending on the encoded formats supported by the decoder, a single decoded frame may be the result of several decode requests (for instance, H.264 streams with multiple slices per frame). Decoders that support such formats must also expose the ``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF`` capability on their ``OUTPUT`` queue.h](hDepending on the encoded formats supported by the decoder, a single decoded frame may be the result of several decode requests (for instance, H.264 streams with multiple slices per frame). Decoders that support such formats must also expose the }(hjhhhNhNubj')}(h.``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF``h]h*V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh capability on their }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hQuerying capabilitiesh]hQuerying capabilities}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK$ubhenumerated_list)}(hhh](h list_item)}(hXTo enumerate the set of coded formats supported by the decoder, the client calls :c:func:`VIDIOC_ENUM_FMT` on the ``OUTPUT`` queue. * The driver must always return the full set of supported ``OUTPUT`` formats, irrespective of the format currently set on the ``CAPTURE`` queue. * Simultaneously, the driver must restrain the set of values returned by codec-specific capability controls (such as H.264 profiles) to the set actually supported by the hardware. h](h)}(hTo enumerate the set of coded formats supported by the decoder, the client calls :c:func:`VIDIOC_ENUM_FMT` on the ``OUTPUT`` queue.h](hQTo enumerate the set of coded formats supported by the decoder, the client calls }(hjhhhNhNubh)}(h:c:func:`VIDIOC_ENUM_FMT`h]j')}(hjh]hVIDIOC_ENUM_FMT()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_ENUM_FMTuh1hhhhK&hjubh on the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK&hjubh bullet_list)}(hhh](j)}(hThe driver must always return the full set of supported ``OUTPUT`` formats, irrespective of the format currently set on the ``CAPTURE`` queue. h]h)}(hThe driver must always return the full set of supported ``OUTPUT`` formats, irrespective of the format currently set on the ``CAPTURE`` queue.h](h8The driver must always return the full set of supported }(hj3hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj3ubh: formats, irrespective of the format currently set on the }(hj3hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj3ubh queue.}(hj3hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK)hj/ubah}(h]h ]h"]h$]h&]uh1jhj,ubj)}(hSimultaneously, the driver must restrain the set of values returned by codec-specific capability controls (such as H.264 profiles) to the set actually supported by the hardware. h]h)}(hSimultaneously, the driver must restrain the set of values returned by codec-specific capability controls (such as H.264 profiles) to the set actually supported by the hardware.h]hSimultaneously, the driver must restrain the set of values returned by codec-specific capability controls (such as H.264 profiles) to the set actually supported by the hardware.}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hjkubah}(h]h ]h"]h$]h&]uh1jhj,ubeh}(h]h ]h"]h$]h&]bullet*uh1j*hhhK)hjubeh}(h]h ]h"]h$]h&]uh1jhjhhhNhNubj)}(hXTo enumerate the set of supported raw formats, the client calls :c:func:`VIDIOC_ENUM_FMT` on the ``CAPTURE`` queue. * The driver must return only the formats supported for the format currently active on the ``OUTPUT`` queue. * Depending on the currently set ``OUTPUT`` format, the set of supported raw formats may depend on the value of some codec-dependent controls. The client is responsible for making sure that these controls are set before querying the ``CAPTURE`` queue. Failure to do so will result in the default values for these controls being used, and a returned set of formats that may not be usable for the media the client is trying to decode. h](h)}(hsTo enumerate the set of supported raw formats, the client calls :c:func:`VIDIOC_ENUM_FMT` on the ``CAPTURE`` queue.h](h@To enumerate the set of supported raw formats, the client calls }(hjhhhNhNubh)}(h:c:func:`VIDIOC_ENUM_FMT`h]j')}(hjh]hVIDIOC_ENUM_FMT()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_ENUM_FMTuh1hhhhK0hjubh on the }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK0hjubj+)}(hhh](j)}(hkThe driver must return only the formats supported for the format currently active on the ``OUTPUT`` queue. h]h)}(hjThe driver must return only the formats supported for the format currently active on the ``OUTPUT`` queue.h](hYThe driver must return only the formats supported for the format currently active on the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK3hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hXDepending on the currently set ``OUTPUT`` format, the set of supported raw formats may depend on the value of some codec-dependent controls. The client is responsible for making sure that these controls are set before querying the ``CAPTURE`` queue. Failure to do so will result in the default values for these controls being used, and a returned set of formats that may not be usable for the media the client is trying to decode. h]h)}(hXDepending on the currently set ``OUTPUT`` format, the set of supported raw formats may depend on the value of some codec-dependent controls. The client is responsible for making sure that these controls are set before querying the ``CAPTURE`` queue. Failure to do so will result in the default values for these controls being used, and a returned set of formats that may not be usable for the media the client is trying to decode.h](hDepending on the currently set }(hj hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh format, the set of supported raw formats may depend on the value of some codec-dependent controls. The client is responsible for making sure that these controls are set before querying the }(hj hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh queue. Failure to do so will result in the default values for these controls being used, and a returned set of formats that may not be usable for the media the client is trying to decode.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK6hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jjuh1j*hhhK3hjubeh}(h]h ]h"]h$]h&]uh1jhjhhhNhNubj)}(hThe client may use :c:func:`VIDIOC_ENUM_FRAMESIZES` to detect supported resolutions for a given format, passing desired pixel format in :c:type:`v4l2_frmsizeenum`'s ``pixel_format``. h]h)}(hThe client may use :c:func:`VIDIOC_ENUM_FRAMESIZES` to detect supported resolutions for a given format, passing desired pixel format in :c:type:`v4l2_frmsizeenum`'s ``pixel_format``.h](hThe client may use }(hjQhhhNhNubh)}(h :c:func:`VIDIOC_ENUM_FRAMESIZES`h]j')}(hj[h]hVIDIOC_ENUM_FRAMESIZES()}(hj]hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjYubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_ENUM_FRAMESIZESuh1hhhhK=hjQubhU to detect supported resolutions for a given format, passing desired pixel format in }(hjQhhhNhNubh)}(h:c:type:`v4l2_frmsizeenum`h]j')}(hj~h]hv4l2_frmsizeenum}(hjhhhNhNubah}(h]h ](j jZc-typeeh"]h$]h&]uh1j&hj|ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypetype refexplicitrefwarnj v4l2_frmsizeenumuh1hhhhK=hjQubh’s }(hjQhhhNhNubj')}(h``pixel_format``h]h pixel_format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjQubh.}(hjQhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK=hjMubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hSupported profiles and levels for the current ``OUTPUT`` format, if applicable, may be queried using their respective controls via :c:func:`VIDIOC_QUERYCTRL`. h]h)}(hSupported profiles and levels for the current ``OUTPUT`` format, if applicable, may be queried using their respective controls via :c:func:`VIDIOC_QUERYCTRL`.h](h.Supported profiles and levels for the current }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhK format, if applicable, may be queried using their respective controls via }(hjhhhNhNubh)}(h:c:func:`VIDIOC_QUERYCTRL`h]j')}(hjh]hVIDIOC_QUERYCTRL()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_QUERYCTRLuh1hhhhKAhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKAhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1jhjhhhhhK&ubeh}(h]querying-capabilitiesah ]h"]querying capabilitiesah$]h&]uh1hhhhhhhhK$ubh)}(hhh](h)}(hInitializationh]hInitialization}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKFubj)}(hhh](j)}(hXSet the coded format on the ``OUTPUT`` queue via :c:func:`VIDIOC_S_FMT`. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``pixelformat`` a coded pixel format. ``width``, ``height`` coded width and height parsed from the stream. other fields follow standard semantics. .. note:: Changing the ``OUTPUT`` format may change the currently set ``CAPTURE`` format. The driver will derive a new ``CAPTURE`` format from the ``OUTPUT`` format being set, including resolution, colorimetry parameters, etc. If the client needs a specific ``CAPTURE`` format, it must adjust it afterwards. h](h)}(hHSet the coded format on the ``OUTPUT`` queue via :c:func:`VIDIOC_S_FMT`.h](hSet the coded format on the }(hj5hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj5ubh queue via }(hj5hhhNhNubh)}(h:c:func:`VIDIOC_S_FMT`h]j')}(hjQh]hVIDIOC_S_FMT()}(hjShhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjOubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj  VIDIOC_S_FMTuh1hhhhKHhj5ubh.}(hj5hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKHhj1ubj+)}(hhh]j)}(h**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``pixelformat`` a coded pixel format. ``width``, ``height`` coded width and height parsed from the stream. other fields follow standard semantics. h](h)}(h**Required fields:**h]hstrong)}(hjh]hRequired fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKJhj{ubhdefinition_list)}(hhh](hdefinition_list_item)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](hterm)}(h``type``h]j')}(hjh]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhKMhjubh definition)}(hhh]h)}(h6a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.h](ha }(hjhhhNhNubj')}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh enum appropriate for }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKMhjubj)}(h&``pixelformat`` a coded pixel format. h](j)}(h``pixelformat``h]j')}(hjh]h pixelformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhKPhjubj)}(hhh]h)}(ha coded pixel format.h]ha coded pixel format.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKPhjubj)}(hE``width``, ``height`` coded width and height parsed from the stream. h](j)}(h``width``, ``height``h](j')}(h ``width``h]hwidth}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj;ubh, }(hj;hhhNhNubj')}(h ``height``h]hheight}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj;ubeh}(h]h ]h"]h$]h&]uh1jhhhKShj7ubj)}(hhh]h)}(h.coded width and height parsed from the stream.h]h.coded width and height parsed from the stream.}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShjeubah}(h]h ]h"]h$]h&]uh1jhj7ubeh}(h]h ]h"]h$]h&]uh1jhhhKShjubj)}(h(other fields follow standard semantics. h](j)}(h other fieldsh]h other fields}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKVhjubj)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKVhjubeh}(h]h ]h"]h$]h&]uh1jhj{ubeh}(h]h ]h"]h$]h&]uh1jhjxubah}(h]h ]h"]h$]h&]jjuh1j*hhhKJhj1ubhnote)}(hX)Changing the ``OUTPUT`` format may change the currently set ``CAPTURE`` format. The driver will derive a new ``CAPTURE`` format from the ``OUTPUT`` format being set, including resolution, colorimetry parameters, etc. If the client needs a specific ``CAPTURE`` format, it must adjust it afterwards.h]h)}(hX)Changing the ``OUTPUT`` format may change the currently set ``CAPTURE`` format. The driver will derive a new ``CAPTURE`` format from the ``OUTPUT`` format being set, including resolution, colorimetry parameters, etc. If the client needs a specific ``CAPTURE`` format, it must adjust it afterwards.h](h Changing the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh% format may change the currently set }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh& format. The driver will derive a new }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh format from the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhe format being set, including resolution, colorimetry parameters, etc. If the client needs a specific }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh& format, it must adjust it afterwards.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKZhjubah}(h]h ]h"]h$]h&]uh1jhj1ubeh}(h]h ]h"]h$]h&]uh1jhj.hhhNhNubj)}(hCall :c:func:`VIDIOC_S_EXT_CTRLS` to set all the controls (parsed headers, etc.) required by the ``OUTPUT`` format to enumerate the ``CAPTURE`` formats. h]h)}(hCall :c:func:`VIDIOC_S_EXT_CTRLS` to set all the controls (parsed headers, etc.) required by the ``OUTPUT`` format to enumerate the ``CAPTURE`` formats.h](hCall }(hjAhhhNhNubh)}(h:c:func:`VIDIOC_S_EXT_CTRLS`h]j')}(hjKh]hVIDIOC_S_EXT_CTRLS()}(hjMhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjIubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_S_EXT_CTRLSuh1hhhhK`hjAubh@ to set all the controls (parsed headers, etc.) required by the }(hjAhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjAubh format to enumerate the }(hjAhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjAubh formats.}(hjAhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK`hj=ubah}(h]h ]h"]h$]h&]uh1jhj.hhhhhNubj)}(hXCall :c:func:`VIDIOC_G_FMT` for ``CAPTURE`` queue to get the format for the destination buffers parsed/decoded from the bytestream. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. * **Returned fields:** ``width``, ``height`` frame buffer resolution for the decoded frames. ``pixelformat`` pixel format for decoded frames. ``num_planes`` (for _MPLANE ``type`` only) number of planes for pixelformat. ``sizeimage``, ``bytesperline`` as per standard semantics; matching frame buffer format. .. note:: The value of ``pixelformat`` may be any pixel format supported for the ``OUTPUT`` format, based on the hardware capabilities. It is suggested that the driver chooses the preferred/optimal format for the current configuration. For example, a YUV format may be preferred over an RGB format, if an additional conversion step would be required for RGB. h](h)}(hCall :c:func:`VIDIOC_G_FMT` for ``CAPTURE`` queue to get the format for the destination buffers parsed/decoded from the bytestream.h](hCall }(hjhhhNhNubh)}(h:c:func:`VIDIOC_G_FMT`h]j')}(hjh]hVIDIOC_G_FMT()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj  VIDIOC_G_FMTuh1hhhhKchjubh for }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhX queue to get the format for the destination buffers parsed/decoded from the bytestream.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKchjubj+)}(hhh](j)}(h[**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](h)}(h**Required fields:**h]j)}(hjh]hRequired fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKfhjubj)}(hhh]j)}(hA``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](j)}(h``type``h]j')}(hj h]htype}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhKihjubj)}(hhh]h)}(h7a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``.h](ha }(hj"hhhNhNubj')}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj"ubh enum appropriate for }(hj"hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj"ubh.}(hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKihjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKihjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hXF**Returned fields:** ``width``, ``height`` frame buffer resolution for the decoded frames. ``pixelformat`` pixel format for decoded frames. ``num_planes`` (for _MPLANE ``type`` only) number of planes for pixelformat. ``sizeimage``, ``bytesperline`` as per standard semantics; matching frame buffer format. h](h)}(h**Returned fields:**h]j)}(hjrh]hReturned fields:}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1jhjpubah}(h]h ]h"]h$]h&]uh1hhhhKkhjlubj)}(hhh](j)}(hF``width``, ``height`` frame buffer resolution for the decoded frames. h](j)}(h``width``, ``height``h](j')}(h ``width``h]hwidth}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh, }(hjhhhNhNubj')}(h ``height``h]hheight}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubeh}(h]h ]h"]h$]h&]uh1jhhhKnhjubj)}(hhh]h)}(h/frame buffer resolution for the decoded frames.h]h/frame buffer resolution for the decoded frames.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKnhjubj)}(h1``pixelformat`` pixel format for decoded frames. h](j)}(h``pixelformat``h]j')}(hjh]h pixelformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhKqhjubj)}(hhh]h)}(h pixel format for decoded frames.h]h pixel format for decoded frames.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKqhjubj)}(hM``num_planes`` (for _MPLANE ``type`` only) number of planes for pixelformat. h](j)}(h*``num_planes`` (for _MPLANE ``type`` only)h](j')}(h``num_planes``h]h num_planes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh (for _MPLANE }(hjhhhNhNubj')}(h``type``h]htype}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh only)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKthj ubj)}(hhh]h)}(h!number of planes for pixelformat.h]h!number of planes for pixelformat.}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthj?ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhKthjubj)}(hY``sizeimage``, ``bytesperline`` as per standard semantics; matching frame buffer format. h](j)}(h``sizeimage``, ``bytesperline``h](j')}(h ``sizeimage``h]h sizeimage}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj`ubh, }(hj`hhhNhNubj')}(h``bytesperline``h]h bytesperline}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj`ubeh}(h]h ]h"]h$]h&]uh1jhhhKwhj\ubj)}(hhh]h)}(h8as per standard semantics; matching frame buffer format.h]h8as per standard semantics; matching frame buffer format.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKwhjubah}(h]h ]h"]h$]h&]uh1jhj\ubeh}(h]h ]h"]h$]h&]uh1jhhhKwhjubeh}(h]h ]h"]h$]h&]uh1jhjlubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jjuh1j*hhhKfhjubj)}(hX\The value of ``pixelformat`` may be any pixel format supported for the ``OUTPUT`` format, based on the hardware capabilities. It is suggested that the driver chooses the preferred/optimal format for the current configuration. For example, a YUV format may be preferred over an RGB format, if an additional conversion step would be required for RGB.h]h)}(hX\The value of ``pixelformat`` may be any pixel format supported for the ``OUTPUT`` format, based on the hardware capabilities. It is suggested that the driver chooses the preferred/optimal format for the current configuration. For example, a YUV format may be preferred over an RGB format, if an additional conversion step would be required for RGB.h](h The value of }(hjhhhNhNubj')}(h``pixelformat``h]h pixelformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh+ may be any pixel format supported for the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhX  format, based on the hardware capabilities. It is suggested that the driver chooses the preferred/optimal format for the current configuration. For example, a YUV format may be preferred over an RGB format, if an additional conversion step would be required for RGB.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK{hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhj.hhhNhNubj)}(hX*[optional]* Enumerate ``CAPTURE`` formats via :c:func:`VIDIOC_ENUM_FMT` on the ``CAPTURE`` queue. The client may use this ioctl to discover which alternative raw formats are supported for the current ``OUTPUT`` format and select one of them via :c:func:`VIDIOC_S_FMT`. .. note:: The driver will return only formats supported for the currently selected ``OUTPUT`` format and currently set controls, even if more formats may be supported by the decoder in general. For example, a decoder may support YUV and RGB formats for resolutions 1920x1088 and lower, but only YUV for higher resolutions (due to hardware limitations). After setting a resolution of 1920x1088 or lower as the ``OUTPUT`` format, :c:func:`VIDIOC_ENUM_FMT` may return a set of YUV and RGB pixel formats, but after setting a resolution higher than 1920x1088, the driver will not return RGB pixel formats, since they are unsupported for this resolution. h](h)}(hX *[optional]* Enumerate ``CAPTURE`` formats via :c:func:`VIDIOC_ENUM_FMT` on the ``CAPTURE`` queue. The client may use this ioctl to discover which alternative raw formats are supported for the current ``OUTPUT`` format and select one of them via :c:func:`VIDIOC_S_FMT`.h](hemphasis)}(h *[optional]*h]h [optional]}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j hjubh Enumerate }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh formats via }(hjhhhNhNubh)}(h:c:func:`VIDIOC_ENUM_FMT`h]j')}(hj+ h]hVIDIOC_ENUM_FMT()}(hj- hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hj) ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_ENUM_FMTuh1hhhhKhjubh on the }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjL hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhn queue. The client may use this ioctl to discover which alternative raw formats are supported for the current }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj^ hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh# format and select one of them via }(hjhhhNhNubh)}(h:c:func:`VIDIOC_S_FMT`h]j')}(hjr h]hVIDIOC_S_FMT()}(hjt hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjp ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj  VIDIOC_S_FMTuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hXThe driver will return only formats supported for the currently selected ``OUTPUT`` format and currently set controls, even if more formats may be supported by the decoder in general. For example, a decoder may support YUV and RGB formats for resolutions 1920x1088 and lower, but only YUV for higher resolutions (due to hardware limitations). After setting a resolution of 1920x1088 or lower as the ``OUTPUT`` format, :c:func:`VIDIOC_ENUM_FMT` may return a set of YUV and RGB pixel formats, but after setting a resolution higher than 1920x1088, the driver will not return RGB pixel formats, since they are unsupported for this resolution.h](h)}(hThe driver will return only formats supported for the currently selected ``OUTPUT`` format and currently set controls, even if more formats may be supported by the decoder in general.h](hIThe driver will return only formats supported for the currently selected }(hj hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubhd format and currently set controls, even if more formats may be supported by the decoder in general.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubh)}(hXFor example, a decoder may support YUV and RGB formats for resolutions 1920x1088 and lower, but only YUV for higher resolutions (due to hardware limitations). After setting a resolution of 1920x1088 or lower as the ``OUTPUT`` format, :c:func:`VIDIOC_ENUM_FMT` may return a set of YUV and RGB pixel formats, but after setting a resolution higher than 1920x1088, the driver will not return RGB pixel formats, since they are unsupported for this resolution.h](hFor example, a decoder may support YUV and RGB formats for resolutions 1920x1088 and lower, but only YUV for higher resolutions (due to hardware limitations). After setting a resolution of 1920x1088 or lower as the }(hj hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh format, }(hj hhhNhNubh)}(h:c:func:`VIDIOC_ENUM_FMT`h]j')}(hj h]hVIDIOC_ENUM_FMT()}(hj hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_ENUM_FMTuh1hhhhKhj ubh may return a set of YUV and RGB pixel formats, but after setting a resolution higher than 1920x1088, the driver will not return RGB pixel formats, since they are unsupported for this resolution.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhj.hhhNhNubj)}(hX*[optional]* Choose a different ``CAPTURE`` format than suggested via :c:func:`VIDIOC_S_FMT` on ``CAPTURE`` queue. It is possible for the client to choose a different format than selected/suggested by the driver in :c:func:`VIDIOC_G_FMT`. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``pixelformat`` a raw pixel format. ``width``, ``height`` frame buffer resolution of the decoded stream; typically unchanged from what was returned with :c:func:`VIDIOC_G_FMT`, but it may be different if the hardware supports composition and/or scaling. After performing this step, the client must perform step 3 again in order to obtain up-to-date information about the buffers size and layout. h](h)}(h*[optional]* Choose a different ``CAPTURE`` format than suggested via :c:func:`VIDIOC_S_FMT` on ``CAPTURE`` queue. It is possible for the client to choose a different format than selected/suggested by the driver in :c:func:`VIDIOC_G_FMT`.h](j )}(h *[optional]*h]h [optional]}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j hj ubh Choose a different }(hj hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj& hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh format than suggested via }(hj hhhNhNubh)}(h:c:func:`VIDIOC_S_FMT`h]j')}(hj: h]hVIDIOC_S_FMT()}(hj< hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hj8 ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj  VIDIOC_S_FMTuh1hhhhKhj ubh on }(hj hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj[ hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubhl queue. It is possible for the client to choose a different format than selected/suggested by the driver in }(hj hhhNhNubh)}(h:c:func:`VIDIOC_G_FMT`h]j')}(hjo h]hVIDIOC_G_FMT()}(hjq hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjm ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj  VIDIOC_G_FMTuh1hhhhKhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubh block_quote)}(hXz* **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``pixelformat`` a raw pixel format. ``width``, ``height`` frame buffer resolution of the decoded stream; typically unchanged from what was returned with :c:func:`VIDIOC_G_FMT`, but it may be different if the hardware supports composition and/or scaling. h]j+)}(hhh]j)}(hXh**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``pixelformat`` a raw pixel format. ``width``, ``height`` frame buffer resolution of the decoded stream; typically unchanged from what was returned with :c:func:`VIDIOC_G_FMT`, but it may be different if the hardware supports composition and/or scaling. h](h)}(h**Required fields:**h]j)}(hj h]hRequired fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubj)}(hhh](j)}(hA``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](j)}(h``type``h]j')}(hj h]htype}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj)}(hhh]h)}(h7a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``.h](ha }(hj hhhNhNubj')}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh enum appropriate for }(hj hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj ubj)}(h$``pixelformat`` a raw pixel format. h](j)}(h``pixelformat``h]j')}(hj h]h pixelformat}(hj! hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj)}(hhh]h)}(ha raw pixel format.h]ha raw pixel format.}(hj7 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4 ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj ubj)}(h``width``, ``height`` frame buffer resolution of the decoded stream; typically unchanged from what was returned with :c:func:`VIDIOC_G_FMT`, but it may be different if the hardware supports composition and/or scaling. h](j)}(h``width``, ``height``h](j')}(h ``width``h]hwidth}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjU ubh, }(hjU hhhNhNubj')}(h ``height``h]hheight}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjU ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjQ ubj)}(hhh]h)}(hframe buffer resolution of the decoded stream; typically unchanged from what was returned with :c:func:`VIDIOC_G_FMT`, but it may be different if the hardware supports composition and/or scaling.h](h_frame buffer resolution of the decoded stream; typically unchanged from what was returned with }(hj hhhNhNubh)}(h:c:func:`VIDIOC_G_FMT`h]j')}(hj h]hVIDIOC_G_FMT()}(hj hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj  VIDIOC_G_FMTuh1hhhhKhj ubhN, but it may be different if the hardware supports composition and/or scaling.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjQ ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]jjuh1j*hhhKhj ubah}(h]h ]h"]h$]h&]uh1j hhhKhj ubh)}(hAfter performing this step, the client must perform step 3 again in order to obtain up-to-date information about the buffers size and layout.h]hAfter performing this step, the client must perform step 3 again in order to obtain up-to-date information about the buffers size and layout.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubeh}(h]h ]h"]h$]h&]uh1jhj.hhhhhNubj)}(hXAllocate source (bytestream) buffers via :c:func:`VIDIOC_REQBUFS` on ``OUTPUT`` queue. * **Required fields:** ``count`` requested number of buffers to allocate; greater than zero. ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``memory`` follows standard semantics. * **Returned fields:** ``count`` actual number of buffers allocated. * If required, the driver will adjust ``count`` to be equal or bigger to the minimum of required number of ``OUTPUT`` buffers for the given format and requested count. The client must check this value after the ioctl returns to get the actual number of buffers allocated. h](h)}(hVAllocate source (bytestream) buffers via :c:func:`VIDIOC_REQBUFS` on ``OUTPUT`` queue.h](h)Allocate source (bytestream) buffers via }(hj hhhNhNubh)}(h:c:func:`VIDIOC_REQBUFS`h]j')}(hj h]hVIDIOC_REQBUFS()}(hj hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_REQBUFSuh1hhhhKhj ubh on }(hj hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh queue.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubj )}(hXE* **Required fields:** ``count`` requested number of buffers to allocate; greater than zero. ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``memory`` follows standard semantics. * **Returned fields:** ``count`` actual number of buffers allocated. * If required, the driver will adjust ``count`` to be equal or bigger to the minimum of required number of ``OUTPUT`` buffers for the given format and requested count. The client must check this value after the ioctl returns to get the actual number of buffers allocated. h]j+)}(hhh](j)}(h**Required fields:** ``count`` requested number of buffers to allocate; greater than zero. ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``memory`` follows standard semantics. h](h)}(h**Required fields:**h]j)}(hj? h]hRequired fields:}(hjA hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj= ubah}(h]h ]h"]h$]h&]uh1hhhhKhj9 ubj)}(hhh](j)}(hF``count`` requested number of buffers to allocate; greater than zero. h](j)}(h ``count``h]j')}(hj] h]hcount}(hj_ hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj[ ubah}(h]h ]h"]h$]h&]uh1jhhhKhjW ubj)}(hhh]h)}(h;requested number of buffers to allocate; greater than zero.h]h;requested number of buffers to allocate; greater than zero.}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjr ubah}(h]h ]h"]h$]h&]uh1jhjW ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjT ubj)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](j)}(h``type``h]j')}(hj h]htype}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj)}(hhh]h)}(h6a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.h](ha }(hj hhhNhNubj')}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh enum appropriate for }(hj hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjT ubj)}(h'``memory`` follows standard semantics. h](j)}(h ``memory``h]j')}(hj h]hmemory}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]uh1jhhhKhj ubj)}(hhh]h)}(hfollows standard semantics.h]hfollows standard semantics.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjT ubeh}(h]h ]h"]h$]h&]uh1jhj9 ubeh}(h]h ]h"]h$]h&]uh1jhj6 ubj)}(hH**Returned fields:** ``count`` actual number of buffers allocated. h](h)}(h**Returned fields:**h]j)}(hj5 h]hReturned fields:}(hj7 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj3 ubah}(h]h ]h"]h$]h&]uh1hhhhKhj/ ubj)}(hhh]j)}(h.``count`` actual number of buffers allocated. h](j)}(h ``count``h]j')}(hjS h]hcount}(hjU hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjQ ubah}(h]h ]h"]h$]h&]uh1jhhhKhjM ubj)}(hhh]h)}(h#actual number of buffers allocated.h]h#actual number of buffers allocated.}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjh ubah}(h]h ]h"]h$]h&]uh1jhjM ubeh}(h]h ]h"]h$]h&]uh1jhhhKhjJ ubah}(h]h ]h"]h$]h&]uh1jhj/ ubeh}(h]h ]h"]h$]h&]uh1jhj6 ubj)}(hXIf required, the driver will adjust ``count`` to be equal or bigger to the minimum of required number of ``OUTPUT`` buffers for the given format and requested count. The client must check this value after the ioctl returns to get the actual number of buffers allocated. h]h)}(hX If required, the driver will adjust ``count`` to be equal or bigger to the minimum of required number of ``OUTPUT`` buffers for the given format and requested count. The client must check this value after the ioctl returns to get the actual number of buffers allocated.h](h$If required, the driver will adjust }(hj hhhNhNubj')}(h ``count``h]hcount}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh< to be equal or bigger to the minimum of required number of }(hj hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh buffers for the given format and requested count. The client must check this value after the ioctl returns to get the actual number of buffers allocated.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj6 ubeh}(h]h ]h"]h$]h&]jjuh1j*hhhKhj2 ubah}(h]h ]h"]h$]h&]uh1j hhhKhj ubeh}(h]h ]h"]h$]h&]uh1jhj.hhhhhNubj)}(hXAllocate destination (raw format) buffers via :c:func:`VIDIOC_REQBUFS` on the ``CAPTURE`` queue. * **Required fields:** ``count`` requested number of buffers to allocate; greater than zero. The client is responsible for deducing the minimum number of buffers required for the stream to be properly decoded (taking e.g. reference frames into account) and pass an equal or bigger number. ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``memory`` follows standard semantics. ``V4L2_MEMORY_USERPTR`` is not supported for ``CAPTURE`` buffers. * **Returned fields:** ``count`` adjusted to allocated number of buffers, in case the codec requires more buffers than requested. * The driver must adjust count to the minimum of required number of ``CAPTURE`` buffers for the current format, stream configuration and requested count. The client must check this value after the ioctl returns to get the number of buffers allocated. h](h)}(h`Allocate destination (raw format) buffers via :c:func:`VIDIOC_REQBUFS` on the ``CAPTURE`` queue.h](h.Allocate destination (raw format) buffers via }(hj hhhNhNubh)}(h:c:func:`VIDIOC_REQBUFS`h]j')}(hj h]hVIDIOC_REQBUFS()}(hj hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hj ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_REQBUFSuh1hhhhKhj ubh on the }(hj hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj ubh queue.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubj )}(hX* **Required fields:** ``count`` requested number of buffers to allocate; greater than zero. The client is responsible for deducing the minimum number of buffers required for the stream to be properly decoded (taking e.g. reference frames into account) and pass an equal or bigger number. ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``memory`` follows standard semantics. ``V4L2_MEMORY_USERPTR`` is not supported for ``CAPTURE`` buffers. * **Returned fields:** ``count`` adjusted to allocated number of buffers, in case the codec requires more buffers than requested. * The driver must adjust count to the minimum of required number of ``CAPTURE`` buffers for the current format, stream configuration and requested count. The client must check this value after the ioctl returns to get the number of buffers allocated. h]j+)}(hhh](j)}(hX**Required fields:** ``count`` requested number of buffers to allocate; greater than zero. The client is responsible for deducing the minimum number of buffers required for the stream to be properly decoded (taking e.g. reference frames into account) and pass an equal or bigger number. ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``memory`` follows standard semantics. ``V4L2_MEMORY_USERPTR`` is not supported for ``CAPTURE`` buffers. h](h)}(h**Required fields:**h]j)}(hj3h]hRequired fields:}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj1ubah}(h]h ]h"]h$]h&]uh1hhhhKhj-ubj)}(hhh](j)}(hX ``count`` requested number of buffers to allocate; greater than zero. The client is responsible for deducing the minimum number of buffers required for the stream to be properly decoded (taking e.g. reference frames into account) and pass an equal or bigger number. h](j)}(h ``count``h]j')}(hjQh]hcount}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjOubah}(h]h ]h"]h$]h&]uh1jhhhKhjKubj)}(hhh]h)}(hrequested number of buffers to allocate; greater than zero. The client is responsible for deducing the minimum number of buffers required for the stream to be properly decoded (taking e.g. reference frames into account) and pass an equal or bigger number.h]hrequested number of buffers to allocate; greater than zero. The client is responsible for deducing the minimum number of buffers required for the stream to be properly decoded (taking e.g. reference frames into account) and pass an equal or bigger number.}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjfubah}(h]h ]h"]h$]h&]uh1jhjKubeh}(h]h ]h"]h$]h&]uh1jhhhKhjHubj)}(hA``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](j)}(h``type``h]j')}(hjh]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(hhh]h)}(h7a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``.h](ha }(hjhhhNhNubj')}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh enum appropriate for }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjHubj)}(hi``memory`` follows standard semantics. ``V4L2_MEMORY_USERPTR`` is not supported for ``CAPTURE`` buffers. h](j)}(h ``memory``h]j')}(hjh]hmemory}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(hhh]h)}(h]follows standard semantics. ``V4L2_MEMORY_USERPTR`` is not supported for ``CAPTURE`` buffers.h](hfollows standard semantics. }(hjhhhNhNubj')}(h``V4L2_MEMORY_USERPTR``h]hV4L2_MEMORY_USERPTR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh is not supported for }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffers.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjHubeh}(h]h ]h"]h$]h&]uh1jhj-ubeh}(h]h ]h"]h$]h&]uh1jhj*ubj)}(h**Returned fields:** ``count`` adjusted to allocated number of buffers, in case the codec requires more buffers than requested. h](h)}(h**Returned fields:**h]j)}(hjMh]hReturned fields:}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjKubah}(h]h ]h"]h$]h&]uh1hhhhKhjGubj)}(hhh]j)}(hk``count`` adjusted to allocated number of buffers, in case the codec requires more buffers than requested. h](j)}(h ``count``h]j')}(hjkh]hcount}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjiubah}(h]h ]h"]h$]h&]uh1jhhhKhjeubj)}(hhh]h)}(h`adjusted to allocated number of buffers, in case the codec requires more buffers than requested.h]h`adjusted to allocated number of buffers, in case the codec requires more buffers than requested.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjeubeh}(h]h ]h"]h$]h&]uh1jhhhKhjbubah}(h]h ]h"]h$]h&]uh1jhjGubeh}(h]h ]h"]h$]h&]uh1jhj*ubj)}(hThe driver must adjust count to the minimum of required number of ``CAPTURE`` buffers for the current format, stream configuration and requested count. The client must check this value after the ioctl returns to get the number of buffers allocated. h]h)}(hThe driver must adjust count to the minimum of required number of ``CAPTURE`` buffers for the current format, stream configuration and requested count. The client must check this value after the ioctl returns to get the number of buffers allocated.h](hBThe driver must adjust count to the minimum of required number of }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffers for the current format, stream configuration and requested count. The client must check this value after the ioctl returns to get the number of buffers allocated.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj*ubeh}(h]h ]h"]h$]h&]jjuh1j*hhhKhj&ubah}(h]h ]h"]h$]h&]uh1j hhhKhj ubeh}(h]h ]h"]h$]h&]uh1jhj.hhhhhNubj)}(hqAllocate requests (likely one per ``OUTPUT`` buffer) via :c:func:`MEDIA_IOC_REQUEST_ALLOC` on the media device. h]j)}(hhh]j)}(hpAllocate requests (likely one per ``OUTPUT`` buffer) via :c:func:`MEDIA_IOC_REQUEST_ALLOC` on the media device. h](j)}(h8Allocate requests (likely one per ``OUTPUT`` buffer) viah](h"Allocate requests (likely one per }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffer) via}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjubj)}(hhh]h)}(h6:c:func:`MEDIA_IOC_REQUEST_ALLOC` on the media device.h](h)}(h!:c:func:`MEDIA_IOC_REQUEST_ALLOC`h]j')}(hjh]hMEDIA_IOC_REQUEST_ALLOC()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj MEDIA_IOC_REQUEST_ALLOCuh1hhhhKhjubh on the media device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhj.hhhNhNubj)}(hZStart streaming on both ``OUTPUT`` and ``CAPTURE`` queues via :c:func:`VIDIOC_STREAMON`. h]j)}(hhh]j)}(hYStart streaming on both ``OUTPUT`` and ``CAPTURE`` queues via :c:func:`VIDIOC_STREAMON`. h](j)}(h=Start streaming on both ``OUTPUT`` and ``CAPTURE`` queues viah](hStart streaming on both }(hjchhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjcubh and }(hjchhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjcubh queues via}(hjchhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhj_ubj)}(hhh]h)}(h:c:func:`VIDIOC_STREAMON`.h](h)}(h:c:func:`VIDIOC_STREAMON`h]j')}(hjh]hVIDIOC_STREAMON()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_STREAMONuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj_ubeh}(h]h ]h"]h$]h&]uh1jhhhKhj\ubah}(h]h ]h"]h$]h&]uh1jhjXubah}(h]h ]h"]h$]h&]uh1jhj.hhhNhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhjhhhhhKHubeh}(h]initializationah ]h"]initializationah$]h&]uh1hhhhhhhhKFubh)}(hhh](h)}(hDecodingh]hDecoding}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hqFor each frame, the client is responsible for submitting at least one request to which the following is attached:h]hqFor each frame, the client is responsible for submitting at least one request to which the following is attached:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj+)}(hhh](j)}(hXThe amount of encoded data expected by the codec for its current configuration, as a buffer submitted to the ``OUTPUT`` queue. Typically, this corresponds to one frame worth of encoded data, but some formats may allow (or require) different amounts per unit.h]h)}(hXThe amount of encoded data expected by the codec for its current configuration, as a buffer submitted to the ``OUTPUT`` queue. Typically, this corresponds to one frame worth of encoded data, but some formats may allow (or require) different amounts per unit.h](hmThe amount of encoded data expected by the codec for its current configuration, as a buffer submitted to the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue. Typically, this corresponds to one frame worth of encoded data, but some formats may allow (or require) different amounts per unit.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubj)}(h|All the metadata needed to decode the submitted encoded data, in the form of controls relevant to the format being decoded. h]h)}(h{All the metadata needed to decode the submitted encoded data, in the form of controls relevant to the format being decoded.h]h{All the metadata needed to decode the submitted encoded data, in the form of controls relevant to the format being decoded.}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj7ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1j*hhhKhjhhubh)}(hXThe amount of data and contents of the source ``OUTPUT`` buffer, as well as the controls that must be set on the request, depend on the active coded pixel format and might be affected by codec-specific extended controls, as stated in documentation of each format.h](h.The amount of data and contents of the source }(hjUhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjUubh buffer, as well as the controls that must be set on the request, depend on the active coded pixel format and might be affected by codec-specific extended controls, as stated in documentation of each format.}(hjUhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXIf there is a possibility that the decoded frame will require one or more decode requests after the current one in order to be produced, then the client must set the ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag on the ``OUTPUT`` buffer. This will result in the (potentially partially) decoded ``CAPTURE`` buffer not being made available for dequeueing, and reused for the next decode request if the timestamp of the next ``OUTPUT`` buffer has not changed.h](hIf there is a possibility that the decoded frame will require one or more decode requests after the current one in order to be produced, then the client must set the }(hjuhhhNhNubj')}(h&``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF``h]h"V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjuubh flag on the }(hjuhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjuubhA buffer. This will result in the (potentially partially) decoded }(hjuhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjuubhu buffer not being made available for dequeueing, and reused for the next decode request if the timestamp of the next }(hjuhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjuubh buffer has not changed.}(hjuhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hCA typical frame would thus be decoded using the following sequence:h]hCA typical frame would thus be decoded using the following sequence:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hhh](j)}(hXQueue an ``OUTPUT`` buffer containing one unit of encoded bytestream data for the decoding request, using :c:func:`VIDIOC_QBUF`. * **Required fields:** ``index`` index of the buffer being queued. ``type`` type of the buffer. ``bytesused`` number of bytes taken by the encoded data frame in the buffer. ``flags`` the ``V4L2_BUF_FLAG_REQUEST_FD`` flag must be set. Additionally, if we are not sure that the current decode request is the last one needed to produce a fully decoded frame, then ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` must also be set. ``request_fd`` must be set to the file descriptor of the decoding request. ``timestamp`` must be set to a unique value per frame. This value will be propagated into the decoded frame's buffer and can also be used to use this frame as the reference of another. If using multiple decode requests per frame, then the timestamps of all the ``OUTPUT`` buffers for a given frame must be identical. If the timestamp changes, then the currently held ``CAPTURE`` buffer will be made available for dequeuing and the current request will work on a new ``CAPTURE`` buffer. h](h)}(hQueue an ``OUTPUT`` buffer containing one unit of encoded bytestream data for the decoding request, using :c:func:`VIDIOC_QBUF`.h](h Queue an }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhW buffer containing one unit of encoded bytestream data for the decoding request, using }(hjhhhNhNubh)}(h:c:func:`VIDIOC_QBUF`h]j')}(hjh]h VIDIOC_QBUF()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj  VIDIOC_QBUFuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubj )}(hX?* **Required fields:** ``index`` index of the buffer being queued. ``type`` type of the buffer. ``bytesused`` number of bytes taken by the encoded data frame in the buffer. ``flags`` the ``V4L2_BUF_FLAG_REQUEST_FD`` flag must be set. Additionally, if we are not sure that the current decode request is the last one needed to produce a fully decoded frame, then ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` must also be set. ``request_fd`` must be set to the file descriptor of the decoding request. ``timestamp`` must be set to a unique value per frame. This value will be propagated into the decoded frame's buffer and can also be used to use this frame as the reference of another. If using multiple decode requests per frame, then the timestamps of all the ``OUTPUT`` buffers for a given frame must be identical. If the timestamp changes, then the currently held ``CAPTURE`` buffer will be made available for dequeuing and the current request will work on a new ``CAPTURE`` buffer. h]j+)}(hhh]j)}(hX**Required fields:** ``index`` index of the buffer being queued. ``type`` type of the buffer. ``bytesused`` number of bytes taken by the encoded data frame in the buffer. ``flags`` the ``V4L2_BUF_FLAG_REQUEST_FD`` flag must be set. Additionally, if we are not sure that the current decode request is the last one needed to produce a fully decoded frame, then ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` must also be set. ``request_fd`` must be set to the file descriptor of the decoding request. ``timestamp`` must be set to a unique value per frame. This value will be propagated into the decoded frame's buffer and can also be used to use this frame as the reference of another. If using multiple decode requests per frame, then the timestamps of all the ``OUTPUT`` buffers for a given frame must be identical. If the timestamp changes, then the currently held ``CAPTURE`` buffer will be made available for dequeuing and the current request will work on a new ``CAPTURE`` buffer. h](h)}(h**Required fields:**h]j)}(hj0h]hRequired fields:}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubah}(h]h ]h"]h$]h&]uh1hhhhMhj*ubj)}(hhh](j)}(h,``index`` index of the buffer being queued. h](j)}(h ``index``h]j')}(hjNh]hindex}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjLubah}(h]h ]h"]h$]h&]uh1jhhhMhjHubj)}(hhh]h)}(h!index of the buffer being queued.h]h!index of the buffer being queued.}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jhjHubeh}(h]h ]h"]h$]h&]uh1jhhhMhjEubj)}(h``type`` type of the buffer. h](j)}(h``type``h]j')}(hjh]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhMhjubj)}(hhh]h)}(htype of the buffer.h]htype of the buffer.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMhjEubj)}(hM``bytesused`` number of bytes taken by the encoded data frame in the buffer. h](j)}(h ``bytesused``h]j')}(hjh]h bytesused}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhM hjubj)}(hhh]h)}(h>number of bytes taken by the encoded data frame in the buffer.h]h>number of bytes taken by the encoded data frame in the buffer.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhM hjEubj)}(h``flags`` the ``V4L2_BUF_FLAG_REQUEST_FD`` flag must be set. Additionally, if we are not sure that the current decode request is the last one needed to produce a fully decoded frame, then ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` must also be set. h](j)}(h ``flags``h]j')}(hjh]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhMhjubj)}(hhh]h)}(hthe ``V4L2_BUF_FLAG_REQUEST_FD`` flag must be set. Additionally, if we are not sure that the current decode request is the last one needed to produce a fully decoded frame, then ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` must also be set.h](hthe }(hjhhhNhNubj')}(h``V4L2_BUF_FLAG_REQUEST_FD``h]hV4L2_BUF_FLAG_REQUEST_FD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh flag must be set. Additionally, if we are not sure that the current decode request is the last one needed to produce a fully decoded frame, then }(hjhhhNhNubj')}(h&``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF``h]h"V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh must also be set.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMhjEubj)}(hK``request_fd`` must be set to the file descriptor of the decoding request. h](j)}(h``request_fd``h]j')}(hjRh]h request_fd}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjPubah}(h]h ]h"]h$]h&]uh1jhhhMhjLubj)}(hhh]h)}(h;must be set to the file descriptor of the decoding request.h]h;must be set to the file descriptor of the decoding request.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjgubah}(h]h ]h"]h$]h&]uh1jhjLubeh}(h]h ]h"]h$]h&]uh1jhhhMhjEubj)}(hX``timestamp`` must be set to a unique value per frame. This value will be propagated into the decoded frame's buffer and can also be used to use this frame as the reference of another. If using multiple decode requests per frame, then the timestamps of all the ``OUTPUT`` buffers for a given frame must be identical. If the timestamp changes, then the currently held ``CAPTURE`` buffer will be made available for dequeuing and the current request will work on a new ``CAPTURE`` buffer. h](j)}(h ``timestamp``h]j')}(hjh]h timestamp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhMhjubj)}(hhh]h)}(hXmust be set to a unique value per frame. This value will be propagated into the decoded frame's buffer and can also be used to use this frame as the reference of another. If using multiple decode requests per frame, then the timestamps of all the ``OUTPUT`` buffers for a given frame must be identical. If the timestamp changes, then the currently held ``CAPTURE`` buffer will be made available for dequeuing and the current request will work on a new ``CAPTURE`` buffer.h](hmust be set to a unique value per frame. This value will be propagated into the decoded frame’s buffer and can also be used to use this frame as the reference of another. If using multiple decode requests per frame, then the timestamps of all the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh` buffers for a given frame must be identical. If the timestamp changes, then the currently held }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhX buffer will be made available for dequeuing and the current request will work on a new }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffer.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMhjEubeh}(h]h ]h"]h$]h&]uh1jhj*ubeh}(h]h ]h"]h$]h&]uh1jhj'ubah}(h]h ]h"]h$]h&]jjuh1j*hhhMhj#ubah}(h]h ]h"]h$]h&]uh1j hhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hXMSet the codec-specific controls for the decoding request, using :c:func:`VIDIOC_S_EXT_CTRLS`. * **Required fields:** ``which`` must be ``V4L2_CTRL_WHICH_REQUEST_VAL``. ``request_fd`` must be set to the file descriptor of the decoding request. other fields other fields are set as usual when setting controls. The ``controls`` array must contain all the codec-specific controls required to decode a frame. .. note:: It is possible to specify the controls in different invocations of :c:func:`VIDIOC_S_EXT_CTRLS`, or to overwrite a previously set control, as long as ``request_fd`` and ``which`` are properly set. The controls state at the moment of request submission is the one that will be considered. .. note:: The order in which steps 1 and 2 take place is interchangeable. h](h)}(h]Set the codec-specific controls for the decoding request, using :c:func:`VIDIOC_S_EXT_CTRLS`.h](h@Set the codec-specific controls for the decoding request, using }(hjhhhNhNubh)}(h:c:func:`VIDIOC_S_EXT_CTRLS`h]j')}(hjh]hVIDIOC_S_EXT_CTRLS()}(hj hhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_S_EXT_CTRLSuh1hhhhMhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubj )}(hX^* **Required fields:** ``which`` must be ``V4L2_CTRL_WHICH_REQUEST_VAL``. ``request_fd`` must be set to the file descriptor of the decoding request. other fields other fields are set as usual when setting controls. The ``controls`` array must contain all the codec-specific controls required to decode a frame. h]j+)}(hhh]j)}(hXL**Required fields:** ``which`` must be ``V4L2_CTRL_WHICH_REQUEST_VAL``. ``request_fd`` must be set to the file descriptor of the decoding request. other fields other fields are set as usual when setting controls. The ``controls`` array must contain all the codec-specific controls required to decode a frame. h](h)}(h**Required fields:**h]j)}(hjRh]hRequired fields:}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1jhjPubah}(h]h ]h"]h$]h&]uh1hhhhM"hjLubj)}(hhh](j)}(h3``which`` must be ``V4L2_CTRL_WHICH_REQUEST_VAL``. h](j)}(h ``which``h]j')}(hjph]hwhich}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjnubah}(h]h ]h"]h$]h&]uh1jhhhM%hjjubj)}(hhh]h)}(h(must be ``V4L2_CTRL_WHICH_REQUEST_VAL``.h](hmust be }(hjhhhNhNubj')}(h``V4L2_CTRL_WHICH_REQUEST_VAL``h]hV4L2_CTRL_WHICH_REQUEST_VAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM%hjubah}(h]h ]h"]h$]h&]uh1jhjjubeh}(h]h ]h"]h$]h&]uh1jhhhM%hjgubj)}(hK``request_fd`` must be set to the file descriptor of the decoding request. h](j)}(h``request_fd``h]j')}(hjh]h request_fd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]uh1jhhhM(hjubj)}(hhh]h)}(h;must be set to the file descriptor of the decoding request.h]h;must be set to the file descriptor of the decoding request.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM(hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhM(hjgubj)}(hother fields other fields are set as usual when setting controls. The ``controls`` array must contain all the codec-specific controls required to decode a frame. h](j)}(h other fieldsh]h other fields}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhM-hjubj)}(hhh]h)}(hother fields are set as usual when setting controls. The ``controls`` array must contain all the codec-specific controls required to decode a frame.h](h9other fields are set as usual when setting controls. The }(hjhhhNhNubj')}(h ``controls``h]hcontrols}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhO array must contain all the codec-specific controls required to decode a frame.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM+hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhM-hjgubeh}(h]h ]h"]h$]h&]uh1jhjLubeh}(h]h ]h"]h$]h&]uh1jhjIubah}(h]h ]h"]h$]h&]jjuh1j*hhhM"hjEubah}(h]h ]h"]h$]h&]uh1j hhhM"hjubj)}(hXIt is possible to specify the controls in different invocations of :c:func:`VIDIOC_S_EXT_CTRLS`, or to overwrite a previously set control, as long as ``request_fd`` and ``which`` are properly set. The controls state at the moment of request submission is the one that will be considered.h]h)}(hXIt is possible to specify the controls in different invocations of :c:func:`VIDIOC_S_EXT_CTRLS`, or to overwrite a previously set control, as long as ``request_fd`` and ``which`` are properly set. The controls state at the moment of request submission is the one that will be considered.h](hCIt is possible to specify the controls in different invocations of }(hjIhhhNhNubh)}(h:c:func:`VIDIOC_S_EXT_CTRLS`h]j')}(hjSh]hVIDIOC_S_EXT_CTRLS()}(hjUhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjQubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_S_EXT_CTRLSuh1hhhhM1hjIubh7, or to overwrite a previously set control, as long as }(hjIhhhNhNubj')}(h``request_fd``h]h request_fd}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjIubh and }(hjIhhhNhNubj')}(h ``which``h]hwhich}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjIubhm are properly set. The controls state at the moment of request submission is the one that will be considered.}(hjIhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM1hjEubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h?The order in which steps 1 and 2 take place is interchangeable.h]h)}(hjh]h?The order in which steps 1 and 2 take place is interchangeable.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhhhNhNubj)}(hXSubmit the request by invoking :c:func:`MEDIA_REQUEST_IOC_QUEUE` on the request FD. If the request is submitted without an ``OUTPUT`` buffer, or if some of the required controls are missing from the request, then :c:func:`MEDIA_REQUEST_IOC_QUEUE` will return ``-ENOENT``. If more than one ``OUTPUT`` buffer is queued, then it will return ``-EINVAL``. :c:func:`MEDIA_REQUEST_IOC_QUEUE` returning non-zero means that no ``CAPTURE`` buffer will be produced for this request. h](h)}(hSSubmit the request by invoking :c:func:`MEDIA_REQUEST_IOC_QUEUE` on the request FD.h](hSubmit the request by invoking }(hjhhhNhNubh)}(h!:c:func:`MEDIA_REQUEST_IOC_QUEUE`h]j')}(hjh]hMEDIA_REQUEST_IOC_QUEUE()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj MEDIA_REQUEST_IOC_QUEUEuh1hhhhM:hjubh on the request FD.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM:hjubj )}(hXIf the request is submitted without an ``OUTPUT`` buffer, or if some of the required controls are missing from the request, then :c:func:`MEDIA_REQUEST_IOC_QUEUE` will return ``-ENOENT``. If more than one ``OUTPUT`` buffer is queued, then it will return ``-EINVAL``. :c:func:`MEDIA_REQUEST_IOC_QUEUE` returning non-zero means that no ``CAPTURE`` buffer will be produced for this request. h]h)}(hXIf the request is submitted without an ``OUTPUT`` buffer, or if some of the required controls are missing from the request, then :c:func:`MEDIA_REQUEST_IOC_QUEUE` will return ``-ENOENT``. If more than one ``OUTPUT`` buffer is queued, then it will return ``-EINVAL``. :c:func:`MEDIA_REQUEST_IOC_QUEUE` returning non-zero means that no ``CAPTURE`` buffer will be produced for this request.h](h'If the request is submitted without an }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhP buffer, or if some of the required controls are missing from the request, then }(hjhhhNhNubh)}(h!:c:func:`MEDIA_REQUEST_IOC_QUEUE`h]j')}(hjh]hMEDIA_REQUEST_IOC_QUEUE()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj MEDIA_REQUEST_IOC_QUEUEuh1hhhhM=hjubh will return }(hjhhhNhNubj')}(h ``-ENOENT``h]h-ENOENT}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh. If more than one }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh' buffer is queued, then it will return }(hjhhhNhNubj')}(h ``-EINVAL``h]h-EINVAL}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh. }(hjhhhNhNubh)}(h!:c:func:`MEDIA_REQUEST_IOC_QUEUE`h]j')}(hjoh]hMEDIA_REQUEST_IOC_QUEUE()}(hjqhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjmubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj MEDIA_REQUEST_IOC_QUEUEuh1hhhhM=hjubh" returning non-zero means that no }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh* buffer will be produced for this request.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM=hjubah}(h]h ]h"]h$]h&]uh1j hhhM=hjubeh}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhjhhhhhKubh)}(h``CAPTURE`` buffers must not be part of the request, and are queued independently. They are returned in decode order (i.e. the same order as coded frames were submitted to the ``OUTPUT`` queue).h](j')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffers must not be part of the request, and are queued independently. They are returned in decode order (i.e. the same order as coded frames were submitted to the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMDhjhhubh)}(hXKRuntime decoding errors are signaled by the dequeued ``CAPTURE`` buffers carrying the ``V4L2_BUF_FLAG_ERROR`` flag. If a decoded reference frame has an error, then all following decoded frames that refer to it also have the ``V4L2_BUF_FLAG_ERROR`` flag set, although the decoder will still try to produce (likely corrupted) frames.h](h5Runtime decoding errors are signaled by the dequeued }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffers carrying the }(hjhhhNhNubj')}(h``V4L2_BUF_FLAG_ERROR``h]hV4L2_BUF_FLAG_ERROR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhs flag. If a decoded reference frame has an error, then all following decoded frames that refer to it also have the }(hjhhhNhNubj')}(h``V4L2_BUF_FLAG_ERROR``h]hV4L2_BUF_FLAG_ERROR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhT flag set, although the decoder will still try to produce (likely corrupted) frames.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMHhjhhubeh}(h]decodingah ]h"]decodingah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Buffer management while decodingh]h Buffer management while decoding}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj4hhhhhMOubh)}(hX Contrary to stateful decoders, a stateless decoder does not perform any kind of buffer management: it only guarantees that dequeued ``CAPTURE`` buffers can be used by the client for as long as they are not queued again. "Used" here encompasses using the buffer for compositing or display.h](hContrary to stateful decoders, a stateless decoder does not perform any kind of buffer management: it only guarantees that dequeued }(hjEhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjEubh buffers can be used by the client for as long as they are not queued again. “Used” here encompasses using the buffer for compositing or display.}(hjEhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMPhj4hhubh)}(hTA dequeued capture buffer can also be used as the reference frame of another buffer.h]hTA dequeued capture buffer can also be used as the reference frame of another buffer.}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMUhj4hhubh)}(hXA frame is specified as reference by converting its timestamp into nanoseconds, and storing it into the relevant member of a codec-dependent control structure. The :c:func:`v4l2_timeval_to_ns` function must be used to perform that conversion. The timestamp of a frame can be used to reference it as soon as all its units of encoded data are successfully submitted to the ``OUTPUT`` queue.h](hA frame is specified as reference by converting its timestamp into nanoseconds, and storing it into the relevant member of a codec-dependent control structure. The }(hjshhhNhNubh)}(h:c:func:`v4l2_timeval_to_ns`h]j')}(hj}h]hv4l2_timeval_to_ns()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hj{ubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj v4l2_timeval_to_nsuh1hhhhMXhjsubh function must be used to perform that conversion. The timestamp of a frame can be used to reference it as soon as all its units of encoded data are successfully submitted to the }(hjshhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjsubh queue.}(hjshhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMXhj4hhubh)}(hXA decoded buffer containing a reference frame must not be reused as a decoding target until all the frames referencing it have been decoded. The safest way to achieve this is to refrain from queueing a reference buffer until all the decoded frames referencing it have been dequeued. However, if the driver can guarantee that buffers queued to the ``CAPTURE`` queue are processed in queued order, then user-space can take advantage of this guarantee and queue a reference buffer when the following conditions are met:h](hX[A decoded buffer containing a reference frame must not be reused as a decoding target until all the frames referencing it have been decoded. The safest way to achieve this is to refrain from queueing a reference buffer until all the decoded frames referencing it have been dequeued. However, if the driver can guarantee that buffers queued to the }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue are processed in queued order, then user-space can take advantage of this guarantee and queue a reference buffer when the following conditions are met:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM^hj4hhubj)}(hhh](j)}(hRAll the requests for frames affected by the reference frame have been queued, and h]h)}(hQAll the requests for frames affected by the reference frame have been queued, andh]hQAll the requests for frames affected by the reference frame have been queued, and}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMfhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hiA sufficient number of ``CAPTURE`` buffers to cover all the decoded referencing frames have been queued. h]h)}(hhA sufficient number of ``CAPTURE`` buffers to cover all the decoded referencing frames have been queued.h](hA sufficient number of }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhF buffers to cover all the decoded referencing frames have been queued.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMihjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhj4hhhhhMfubh)}(hXWhen queuing a decoding request, the driver will increase the reference count of all the resources associated with reference frames. This means that the client can e.g. close the DMABUF file descriptors of reference frame buffers if it won't need them afterwards.h]hX When queuing a decoding request, the driver will increase the reference count of all the resources associated with reference frames. This means that the client can e.g. close the DMABUF file descriptors of reference frame buffers if it won’t need them afterwards.}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMlhj4hhubeh}(h] buffer-management-while-decodingah ]h"] buffer management while decodingah$]h&]uh1hhhhhhhhMOubh)}(hhh](h)}(hSeekingh]hSeeking}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7hhhhhMrubh)}(hXIn order to seek, the client just needs to submit requests using input buffers corresponding to the new stream position. It must however be aware that resolution may have changed and follow the dynamic resolution change sequence in that case. Also depending on the codec used, picture parameters (e.g. SPS/PPS for H.264) may have changed and the client is responsible for making sure that a valid state is sent to the decoder.h]hXIn order to seek, the client just needs to submit requests using input buffers corresponding to the new stream position. It must however be aware that resolution may have changed and follow the dynamic resolution change sequence in that case. Also depending on the codec used, picture parameters (e.g. SPS/PPS for H.264) may have changed and the client is responsible for making sure that a valid state is sent to the decoder.}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMshj7hhubh)}(hhThe client is then free to ignore any returned ``CAPTURE`` buffer that comes from the pre-seek position.h](h/The client is then free to ignore any returned }(hjVhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjVubh. buffer that comes from the pre-seek position.}(hjVhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMzhj7hhubeh}(h]seekingah ]h"]seekingah$]h&]uh1hhhhhhhhMrubh)}(hhh](h)}(hPausingh]hPausing}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj~hhhhhM~ubh)}(hIn order to pause, the client can just cease queuing buffers onto the ``OUTPUT`` queue. Without source bytestream data, there is no data to process and the codec will remain idle.h](hFIn order to pause, the client can just cease queuing buffers onto the }(hjhhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhc queue. Without source bytestream data, there is no data to process and the codec will remain idle.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj~hhubeh}(h]pausingah ]h"]pausingah$]h&]uh1hhhhhhhhM~ubh)}(hhh](h)}(hDynamic resolution changeh]hDynamic resolution change}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hIf the client detects a resolution change in the stream, it will need to perform the initialization sequence again with the new resolution:h]hIf the client detects a resolution change in the stream, it will need to perform the initialization sequence again with the new resolution:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hhh](j)}(hXEIf the last submitted request resulted in a ``CAPTURE`` buffer being held by the use of the ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag, then the last frame is not available on the ``CAPTURE`` queue. In this case, a ``V4L2_DEC_CMD_FLUSH`` command shall be sent. This will make the driver dequeue the held ``CAPTURE`` buffer. h]h)}(hXDIf the last submitted request resulted in a ``CAPTURE`` buffer being held by the use of the ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag, then the last frame is not available on the ``CAPTURE`` queue. In this case, a ``V4L2_DEC_CMD_FLUSH`` command shall be sent. This will make the driver dequeue the held ``CAPTURE`` buffer.h](h,If the last submitted request resulted in a }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh% buffer being held by the use of the }(hjhhhNhNubj')}(h&``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF``h]h"V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh3 flag, then the last frame is not available on the }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue. In this case, a }(hjhhhNhNubj')}(h``V4L2_DEC_CMD_FLUSH``h]hV4L2_DEC_CMD_FLUSH}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhC command shall be sent. This will make the driver dequeue the held }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffer.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h_Wait until all submitted requests have completed and dequeue the corresponding output buffers. h]h)}(h^Wait until all submitted requests have completed and dequeue the corresponding output buffers.h]h^Wait until all submitted requests have completed and dequeue the corresponding output buffers.}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjKubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hOCall :c:func:`VIDIOC_STREAMOFF` on both the ``OUTPUT`` and ``CAPTURE`` queues. h]h)}(hNCall :c:func:`VIDIOC_STREAMOFF` on both the ``OUTPUT`` and ``CAPTURE`` queues.h](hCall }(hjghhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j')}(hjqh]hVIDIOC_STREAMOFF()}(hjshhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjoubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_STREAMOFFuh1hhhhMhjgubh on both the }(hjghhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjgubh and }(hjghhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjgubh queues.}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hwFree all ``CAPTURE`` buffers by calling :c:func:`VIDIOC_REQBUFS` on the ``CAPTURE`` queue with a buffer count of zero. h]h)}(hvFree all ``CAPTURE`` buffers by calling :c:func:`VIDIOC_REQBUFS` on the ``CAPTURE`` queue with a buffer count of zero.h](h Free all }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffers by calling }(hjhhhNhNubh)}(h:c:func:`VIDIOC_REQBUFS`h]j')}(hjh]hVIDIOC_REQBUFS()}(hjhhhNhNubah}(h]h ](j jZc-funceh"]h$]h&]uh1j&hjubah}(h]h ]h"]h$]h&]refdocj refdomainjZreftypefunc refexplicitrefwarnj VIDIOC_REQBUFSuh1hhhhMhjubh on the }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh# queue with a buffer count of zero.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hPerform the initialization sequence again (minus the allocation of ``OUTPUT`` buffers), with the new resolution set on the ``OUTPUT`` queue. Note that due to resolution constraints, a different format may need to be picked on the ``CAPTURE`` queue. h]h)}(hPerform the initialization sequence again (minus the allocation of ``OUTPUT`` buffers), with the new resolution set on the ``OUTPUT`` queue. Note that due to resolution constraints, a different format may need to be picked on the ``CAPTURE`` queue.h](hCPerform the initialization sequence again (minus the allocation of }(hj%hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj%ubh. buffers), with the new resolution set on the }(hj%hhhNhNubj')}(h ``OUTPUT``h]hOUTPUT}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj%ubha queue. Note that due to resolution constraints, a different format may need to be picked on the }(hj%hhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hj%ubh queue.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhjhhhhhMubeh}(h]dynamic-resolution-changeah ]h"]dynamic resolution changeah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hDrainh]hDrain}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj}hhhhhMubh)}(hXDIf the last submitted request resulted in a ``CAPTURE`` buffer being held by the use of the ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag, then the last frame is not available on the ``CAPTURE`` queue. In this case, a ``V4L2_DEC_CMD_FLUSH`` command shall be sent. This will make the driver dequeue the held ``CAPTURE`` buffer.h](h,If the last submitted request resulted in a }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh% buffer being held by the use of the }(hjhhhNhNubj')}(h&``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF``h]h"V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh3 flag, then the last frame is not available on the }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh queue. In this case, a }(hjhhhNhNubj')}(h``V4L2_DEC_CMD_FLUSH``h]hV4L2_DEC_CMD_FLUSH}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubhC command shall be sent. This will make the driver dequeue the held }(hjhhhNhNubj')}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j&hjubh buffer.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj}hhubh)}(hAfter that, in order to drain the stream on a stateless decoder, the client just needs to wait until all the submitted requests are completed.h]hAfter that, in order to drain the stream on a stateless decoder, the client just needs to wait until all the submitted requests are completed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj}hhubeh}(h]drainah ]h"]drainah$]h&]uh1hhhhhhhhMubeh}(h](2memory-to-memory-stateless-video-decoder-interfaceheh ]h"](2memory-to-memory stateless video decoder interfacestateless_decodereh$]h&]uh1hhhhhhhhKexpect_referenced_by_name}jhsexpect_referenced_by_id}hhsubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj<error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}h]hasnameids}(jhjjjjjjj1j.j4j1j{jxjjjzjwj ju nametypes}(jjjjj1j4j{jjzj uh}(hhjhjjjjj.jj1j4jxj7jj~jwjjj}u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages]hsystem_message)}(hhh]h)}(hhh]h7Hyperlink target "stateless-decoder" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1juba transformerN include_log] decorationNhhub.