csphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget7/translations/zh_CN/userspace-api/media/v4l/dev-encodermodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget7/translations/zh_TW/userspace-api/media/v4l/dev-encodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget7/translations/it_IT/userspace-api/media/v4l/dev-encodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget7/translations/ja_JP/userspace-api/media/v4l/dev-encodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget7/translations/ko_KR/userspace-api/media/v4l/dev-encodermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget7/translations/sp_SP/userspace-api/media/v4l/dev-encodermodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(hCSPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-laterh]hCSPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhQ/var/lib/git/docbuild/linux/Documentation/userspace-api/media/v4l/dev-encoder.rsthKubhtarget)}(h .. _encoder:h]h}(h]h ]h"]h$]h&]refidencoderuh1hhKhhhhhhubhsection)}(hhh](htitle)}(h1Memory-to-Memory Stateful Video Encoder Interfaceh]h1Memory-to-Memory Stateful Video Encoder Interface}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXA stateful video encoder takes raw video frames in display order and encodes them into a bytestream. It generates complete chunks of the bytestream, including all metadata, headers, etc. The resulting bytestream does not require any further post-processing by the client.h]hXA stateful video encoder takes raw video frames in display order and encodes them into a bytestream. It generates complete chunks of the bytestream, including all metadata, headers, etc. The resulting bytestream does not require any further post-processing by the client.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hPerforming software stream processing, header generation etc. in the driver in order to support this interface is strongly discouraged. In case such operations are needed, use of the Stateless Video Encoder Interface (in development) is strongly advised.h]hPerforming software stream processing, header generation etc. in the driver in order to support this interface is strongly discouraged. In case such operations are needed, use of the Stateless Video Encoder Interface (in development) is strongly advised.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h/Conventions and Notations Used in This Documenth]h/Conventions and Notations Used in This Document}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubhenumerated_list)}(hhh](h list_item)}(hNThe general V4L2 API rules apply if not specified in this document otherwise. h]h)}(hMThe general V4L2 API rules apply if not specified in this document otherwise.h]hMThe general V4L2 API rules apply if not specified in this document otherwise.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hpThe meaning of words "must", "may", "should", etc. is as per `RFC 2119 `_. h]h)}(hoThe meaning of words "must", "may", "should", etc. is as per `RFC 2119 `_.h](hIThe meaning of words “must”, “may”, “should”, etc. is as per }(hj)hhhNhNubh reference)}(h1`RFC 2119 `_h]hRFC 2119}(hj3hhhNhNubah}(h]h ]h"]h$]h&]nameRFC 2119refuri#https://tools.ietf.org/html/rfc2119uh1j1hj)ubh)}(h& h]h}(h]rfc-2119ah ]h"]rfc 2119ah$]h&]refurijDuh1h referencedKhj)ubh.}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj%ubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(h.All steps not marked "optional" are required. h]h)}(h-All steps not marked "optional" are required.h]h1All steps not marked “optional” are required.}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjcubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(h:c:func:`VIDIOC_G_EXT_CTRLS` and :c:func:`VIDIOC_S_EXT_CTRLS` may be used interchangeably with :c:func:`VIDIOC_G_CTRL` and :c:func:`VIDIOC_S_CTRL`, unless specified otherwise. h]h)}(h:c:func:`VIDIOC_G_EXT_CTRLS` and :c:func:`VIDIOC_S_EXT_CTRLS` may be used interchangeably with :c:func:`VIDIOC_G_CTRL` and :c:func:`VIDIOC_S_CTRL`, unless specified otherwise.h](h)}(h:c:func:`VIDIOC_G_EXT_CTRLS`h]hliteral)}(hjh]hVIDIOC_G_EXT_CTRLS()}(hjhhhNhNubah}(h]h ](xrefcc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdoc#userspace-api/media/v4l/dev-encoder refdomainjreftypefunc refexplicitrefwarn reftargetVIDIOC_G_EXT_CTRLSuh1hhhhKhjubh and }(hjhhhNhNubh)}(h:c:func:`VIDIOC_S_EXT_CTRLS`h]j)}(hjh]hVIDIOC_S_EXT_CTRLS()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_S_EXT_CTRLSuh1hhhhKhjubh" may be used interchangeably with }(hjhhhNhNubh)}(h:c:func:`VIDIOC_G_CTRL`h]j)}(hjh]hVIDIOC_G_CTRL()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_G_CTRLuh1hhhhKhjubh and }hjsbh)}(h:c:func:`VIDIOC_S_CTRL`h]j)}(hjh]hVIDIOC_S_CTRL()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_S_CTRLuh1hhhhKhjubh, unless specified otherwise.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj{ubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hSingle-planar API (see :ref:`planar-apis`) and applicable structures may be used interchangeably with multi-planar API, unless specified otherwise, depending on encoder capabilities and following the general V4L2 guidelines. h]h)}(hSingle-planar API (see :ref:`planar-apis`) and applicable structures may be used interchangeably with multi-planar API, unless specified otherwise, depending on encoder capabilities and following the general V4L2 guidelines.h](hSingle-planar API (see }(hj%hhhNhNubh)}(h:ref:`planar-apis`h]hinline)}(hj/h]h planar-apis}(hj3hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j1hj-ubah}(h]h ]h"]h$]h&]refdocj refdomainj=reftyperef refexplicitrefwarnj planar-apisuh1hhhhK"hj%ubh) and applicable structures may be used interchangeably with multi-planar API, unless specified otherwise, depending on encoder capabilities and following the general V4L2 guidelines.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK"hj!ubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hWi = [a..b]: sequence of integers from a to b, inclusive, i.e. i = [0..2]: i = 0, 1, 2. h]h)}(hVi = [a..b]: sequence of integers from a to b, inclusive, i.e. i = [0..2]: i = 0, 1, 2.h]hVi = [a..b]: sequence of integers from a to b, inclusive, i.e. i = [0..2]: i = 0, 1, 2.}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hj_ubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(hGiven an ``OUTPUT`` buffer A, then A' represents a buffer on the ``CAPTURE`` queue containing data that resulted from processing buffer A. h]h)}(hGiven an ``OUTPUT`` buffer A, then A' represents a buffer on the ``CAPTURE`` queue containing data that resulted from processing buffer A.h](h Given an }(hj{hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh0 buffer A, then A’ represents a buffer on the }(hj{hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh> queue containing data that resulted from processing buffer A.}(hj{hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK)hjwubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1jhhhhhhhKubeh}(h]/conventions-and-notations-used-in-this-documentah ]h"]/conventions and notations used in this documentah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hGlossaryh]hGlossary}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK-ubh)}(h!Refer to :ref:`decoder-glossary`.h](h Refer to }(hjhhhNhNubh)}(h:ref:`decoder-glossary`h]j2)}(hjh]hdecoder-glossary}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j1hjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdecoder-glossaryuh1hhhhK/hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK/hjhhubeh}(h]glossaryah ]h"]glossaryah$]h&]uh1hhhhhhhhK-ubh)}(hhh](h)}(h State Machineh]h State Machine}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK2ubhfigure)}(hhh](kfigure kernel_render)}(hhh]h literal_block)}(hXNdigraph encoder_state_machine { node [shape = doublecircle, label="Encoding"] Encoding; node [shape = circle, label="Initialization"] Initialization; node [shape = circle, label="Stopped"] Stopped; node [shape = circle, label="Drain"] Drain; node [shape = circle, label="Reset"] Reset; node [shape = point]; qi qi -> Initialization [ label = "open()" ]; Initialization -> Encoding [ label = "Both queues streaming" ]; Encoding -> Drain [ label = "V4L2_ENC_CMD_STOP" ]; Encoding -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; Encoding -> Stopped [ label = "VIDIOC_STREAMOFF(OUTPUT)" ]; Encoding -> Encoding; Drain -> Stopped [ label = "All CAPTURE\nbuffers dequeued\nor\nVIDIOC_STREAMOFF(OUTPUT)" ]; Drain -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; Reset -> Encoding [ label = "VIDIOC_STREAMON(CAPTURE)" ]; Reset -> Initialization [ label = "VIDIOC_REQBUFS(OUTPUT, 0)" ]; Stopped -> Encoding [ label = "V4L2_ENC_CMD_START\nor\nVIDIOC_STREAMON(OUTPUT)" ]; Stopped -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; }h]hXNdigraph encoder_state_machine { node [shape = doublecircle, label="Encoding"] Encoding; node [shape = circle, label="Initialization"] Initialization; node [shape = circle, label="Stopped"] Stopped; node [shape = circle, label="Drain"] Drain; node [shape = circle, label="Reset"] Reset; node [shape = point]; qi qi -> Initialization [ label = "open()" ]; Initialization -> Encoding [ label = "Both queues streaming" ]; Encoding -> Drain [ label = "V4L2_ENC_CMD_STOP" ]; Encoding -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; Encoding -> Stopped [ label = "VIDIOC_STREAMOFF(OUTPUT)" ]; Encoding -> Encoding; Drain -> Stopped [ label = "All CAPTURE\nbuffers dequeued\nor\nVIDIOC_STREAMOFF(OUTPUT)" ]; Drain -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; Reset -> Encoding [ label = "VIDIOC_STREAMON(CAPTURE)" ]; Reset -> Initialization [ label = "VIDIOC_REQBUFS(OUTPUT, 0)" ]; Stopped -> Encoding [ label = "V4L2_ENC_CMD_START\nor\nVIDIOC_STREAMON(OUTPUT)" ]; Stopped -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; }}hj/sbah}(h]h ]h"]h$]h&]hhuh1j-hj*hhubah}(h]h ]h"]h$]h&]alt$DOT digraph of encoder state machinesrclangDOTuh1j(hj$ubhcaption)}(hEncoder State Machineh]hEncoder State Machine}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1jGhhhKhj$ubeh}(h]id1ah ]h"]h$]h&]altjDcaptionjKuh1j"hjhhhhhNubeh}(h] state-machineah ]h"] state machineah$]h&]uh1hhhhhhhhK2ubh)}(hhh](h)}(hQuerying Capabilitiesh]hQuerying Capabilities}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhhKUubj)}(hhh](j )}(hTo enumerate the set of coded formats supported by the encoder, the client may call :c:func:`VIDIOC_ENUM_FMT` on ``CAPTURE``. * The full set of supported formats will be returned, regardless of the format set on ``OUTPUT``. h](h)}(h}To enumerate the set of coded formats supported by the encoder, the client may call :c:func:`VIDIOC_ENUM_FMT` on ``CAPTURE``.h](hTTo enumerate the set of coded formats supported by the encoder, the client may call }(hjhhhNhNubh)}(h:c:func:`VIDIOC_ENUM_FMT`h]j)}(hjh]hVIDIOC_ENUM_FMT()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FMTuh1hhhhKWhjubh on }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKWhj|ubh bullet_list)}(hhh]j )}(h`The full set of supported formats will be returned, regardless of the format set on ``OUTPUT``. h]h)}(h_The full set of supported formats will be returned, regardless of the format set on ``OUTPUT``.h](hTThe full set of supported formats will be returned, regardless of the format set on }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKZhjubah}(h]h ]h"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&]bullet*uh1jhhhKZhj|ubeh}(h]h ]h"]h$]h&]uh1j hjyhhhNhNubj )}(hXTo enumerate the set of supported raw formats, the client may call :c:func:`VIDIOC_ENUM_FMT` on ``OUTPUT``. * Only the formats supported for the format currently active on ``CAPTURE`` will be returned. * In order to enumerate raw formats supported by a given coded format, the client must first set that coded format on ``CAPTURE`` and then enumerate the formats on ``OUTPUT``. h](h)}(hkTo enumerate the set of supported raw formats, the client may call :c:func:`VIDIOC_ENUM_FMT` on ``OUTPUT``.h](hCTo enumerate the set of supported raw formats, the client may call }(hjhhhNhNubh)}(h:c:func:`VIDIOC_ENUM_FMT`h]j)}(hjh]hVIDIOC_ENUM_FMT()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FMTuh1hhhhK]hjubh on }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK]hjubj)}(hhh](j )}(h\Only the formats supported for the format currently active on ``CAPTURE`` will be returned. h]h)}(h[Only the formats supported for the format currently active on ``CAPTURE`` will be returned.h](h>Only the formats supported for the format currently active on }(hjNhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjNubh will be returned.}(hjNhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK`hjJubah}(h]h ]h"]h$]h&]uh1j hjGubj )}(hIn order to enumerate raw formats supported by a given coded format, the client must first set that coded format on ``CAPTURE`` and then enumerate the formats on ``OUTPUT``. h]h)}(hIn order to enumerate raw formats supported by a given coded format, the client must first set that coded format on ``CAPTURE`` and then enumerate the formats on ``OUTPUT``.h](htIn order to enumerate raw formats supported by a given coded format, the client must first set that coded format on }(hjxhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjxubh# and then enumerate the formats on }(hjxhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjxubh.}(hjxhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKchjtubah}(h]h ]h"]h$]h&]uh1j hjGubeh}(h]h ]h"]h$]h&]jjuh1jhhhK`hjubeh}(h]h ]h"]h$]h&]uh1j hjyhhhNhNubj )}(hXbThe client may use :c:func:`VIDIOC_ENUM_FRAMESIZES` to detect supported resolutions for a given format, passing the desired pixel format in :c:type:`v4l2_frmsizeenum` ``pixel_format``. * Values returned by :c:func:`VIDIOC_ENUM_FRAMESIZES` for a coded pixel format will include all possible coded resolutions supported by the encoder for the given coded pixel format. * Values returned by :c:func:`VIDIOC_ENUM_FRAMESIZES` for a raw pixel format will include all possible frame buffer resolutions supported by the encoder for the given raw pixel format and coded format currently set on ``CAPTURE``. h](h)}(hThe client may use :c:func:`VIDIOC_ENUM_FRAMESIZES` to detect supported resolutions for a given format, passing the desired pixel format in :c:type:`v4l2_frmsizeenum` ``pixel_format``.h](hThe client may use }(hjhhhNhNubh)}(h :c:func:`VIDIOC_ENUM_FRAMESIZES`h]j)}(hjh]hVIDIOC_ENUM_FRAMESIZES()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMESIZESuh1hhhhKghjubhY to detect supported resolutions for a given format, passing the desired pixel format in }(hjhhhNhNubh)}(h:c:type:`v4l2_frmsizeenum`h]j)}(hjh]hv4l2_frmsizeenum}(hjhhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjv4l2_frmsizeenumuh1hhhhKghjubh }(hjhhhNhNubj)}(h``pixel_format``h]h pixel_format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKghjubj)}(hhh](j )}(hValues returned by :c:func:`VIDIOC_ENUM_FRAMESIZES` for a coded pixel format will include all possible coded resolutions supported by the encoder for the given coded pixel format. h]h)}(hValues returned by :c:func:`VIDIOC_ENUM_FRAMESIZES` for a coded pixel format will include all possible coded resolutions supported by the encoder for the given coded pixel format.h](hValues returned by }(hj-hhhNhNubh)}(h :c:func:`VIDIOC_ENUM_FRAMESIZES`h]j)}(hj7h]hVIDIOC_ENUM_FRAMESIZES()}(hj9hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj5ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMESIZESuh1hhhhKkhj-ubh for a coded pixel format will include all possible coded resolutions supported by the encoder for the given coded pixel format.}(hj-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKkhj)ubah}(h]h ]h"]h$]h&]uh1j hj&ubj )}(hValues returned by :c:func:`VIDIOC_ENUM_FRAMESIZES` for a raw pixel format will include all possible frame buffer resolutions supported by the encoder for the given raw pixel format and coded format currently set on ``CAPTURE``. h]h)}(hValues returned by :c:func:`VIDIOC_ENUM_FRAMESIZES` for a raw pixel format will include all possible frame buffer resolutions supported by the encoder for the given raw pixel format and coded format currently set on ``CAPTURE``.h](hValues returned by }(hjhhhhNhNubh)}(h :c:func:`VIDIOC_ENUM_FRAMESIZES`h]j)}(hjrh]hVIDIOC_ENUM_FRAMESIZES()}(hjthhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjpubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMESIZESuh1hhhhKohjhubh for a raw pixel format will include all possible frame buffer resolutions supported by the encoder for the given raw pixel format and coded format currently set on }(hjhhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjhubh.}(hjhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKohjdubah}(h]h ]h"]h$]h&]uh1j hj&ubeh}(h]h ]h"]h$]h&]jjuh1jhhhKkhjubeh}(h]h ]h"]h$]h&]uh1j hjyhhhNhNubj )}(hXThe client may use :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` to detect supported frame intervals for a given format and resolution, passing the desired pixel format in :c:type:`v4l2_frmivalenum` ``pixel_format`` and the resolution in :c:type:`v4l2_frmivalenum` ``width`` and :c:type:`v4l2_frmivalenum` ``height``. * Values returned by :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` for a coded pixel format and coded resolution will include all possible frame intervals supported by the encoder for the given coded pixel format and resolution. * Values returned by :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` for a raw pixel format and resolution will include all possible frame intervals supported by the encoder for the given raw pixel format and resolution and for the coded format, coded resolution and coded frame interval currently set on ``CAPTURE``. * Support for :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` is optional. If it is not implemented, then there are no special restrictions other than the limits of the codec itself. h](h)}(hX4The client may use :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` to detect supported frame intervals for a given format and resolution, passing the desired pixel format in :c:type:`v4l2_frmivalenum` ``pixel_format`` and the resolution in :c:type:`v4l2_frmivalenum` ``width`` and :c:type:`v4l2_frmivalenum` ``height``.h](hThe client may use }(hjhhhNhNubh)}(h$:c:func:`VIDIOC_ENUM_FRAMEINTERVALS`h]j)}(hjh]hVIDIOC_ENUM_FRAMEINTERVALS()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMEINTERVALSuh1hhhhKthjubhl to detect supported frame intervals for a given format and resolution, passing the desired pixel format in }(hjhhhNhNubh)}(h:c:type:`v4l2_frmivalenum`h]j)}(hjh]hv4l2_frmivalenum}(hjhhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjv4l2_frmivalenumuh1hhhhKthjubh }(hjhhhNhNubj)}(h``pixel_format``h]h pixel_format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and the resolution in }(hjhhhNhNubh)}(h:c:type:`v4l2_frmivalenum`h]j)}(hj#h]hv4l2_frmivalenum}(hj%hhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhj!ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjv4l2_frmivalenumuh1hhhhKthjubh }hjsbj)}(h ``width``h]hwidth}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubh)}(h:c:type:`v4l2_frmivalenum`h]j)}(hjXh]hv4l2_frmivalenum}(hjZhhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjVubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjv4l2_frmivalenumuh1hhhhKthjubh }(hjhhhNhNubj)}(h ``height``h]hheight}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKthjubj)}(hhh](j )}(hValues returned by :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` for a coded pixel format and coded resolution will include all possible frame intervals supported by the encoder for the given coded pixel format and resolution. h]h)}(hValues returned by :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` for a coded pixel format and coded resolution will include all possible frame intervals supported by the encoder for the given coded pixel format and resolution.h](hValues returned by }(hjhhhNhNubh)}(h$:c:func:`VIDIOC_ENUM_FRAMEINTERVALS`h]j)}(hjh]hVIDIOC_ENUM_FRAMEINTERVALS()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMEINTERVALSuh1hhhhKzhjubh for a coded pixel format and coded resolution will include all possible frame intervals supported by the encoder for the given coded pixel format and resolution.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKzhjubah}(h]h ]h"]h$]h&]uh1j hjubj )}(hX1Values returned by :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` for a raw pixel format and resolution will include all possible frame intervals supported by the encoder for the given raw pixel format and resolution and for the coded format, coded resolution and coded frame interval currently set on ``CAPTURE``. h]h)}(hX0Values returned by :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` for a raw pixel format and resolution will include all possible frame intervals supported by the encoder for the given raw pixel format and resolution and for the coded format, coded resolution and coded frame interval currently set on ``CAPTURE``.h](hValues returned by }(hjhhhNhNubh)}(h$:c:func:`VIDIOC_ENUM_FRAMEINTERVALS`h]j)}(hjh]hVIDIOC_ENUM_FRAMEINTERVALS()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMEINTERVALSuh1hhhhK~hjubh for a raw pixel format and resolution will include all possible frame intervals supported by the encoder for the given raw pixel format and resolution and for the coded format, coded resolution and coded frame interval currently set on }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK~hjubah}(h]h ]h"]h$]h&]uh1j hjubj )}(hSupport for :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` is optional. If it is not implemented, then there are no special restrictions other than the limits of the codec itself. h]h)}(hSupport for :c:func:`VIDIOC_ENUM_FRAMEINTERVALS` is optional. If it is not implemented, then there are no special restrictions other than the limits of the codec itself.h](h Support for }(hj hhhNhNubh)}(h$:c:func:`VIDIOC_ENUM_FRAMEINTERVALS`h]j)}(hj*h]hVIDIOC_ENUM_FRAMEINTERVALS()}(hj,hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj(ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMEINTERVALSuh1hhhhKhj ubhy is optional. If it is not implemented, then there are no special restrictions other than the limits of the codec itself.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]jjuh1jhhhKzhjubeh}(h]h ]h"]h$]h&]uh1j hjyhhhNhNubj )}(hSupported profiles and levels for the coded format currently set on ``CAPTURE``, if applicable, may be queried using their respective controls via :c:func:`VIDIOC_QUERYCTRL`. h]h)}(hSupported profiles and levels for the coded format currently set on ``CAPTURE``, if applicable, may be queried using their respective controls via :c:func:`VIDIOC_QUERYCTRL`.h](hDSupported profiles and levels for the coded format currently set on }(hjghhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubhD, if applicable, may be queried using their respective controls via }(hjghhhNhNubh)}(h:c:func:`VIDIOC_QUERYCTRL`h]j)}(hjh]hVIDIOC_QUERYCTRL()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_QUERYCTRLuh1hhhhKhjgubh.}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjcubah}(h]h ]h"]h$]h&]uh1j hjyhhhhhNubj )}(h]Any additional encoder capabilities may be discovered by querying their respective controls. h]h)}(h\Any additional encoder capabilities may be discovered by querying their respective controls.h]h\Any additional encoder capabilities may be discovered by querying their respective controls.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j hjyhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhjhhhhhhKWubeh}(h]querying-capabilitiesah ]h"]querying capabilitiesah$]h&]uh1hhhhhhhhKUubh)}(hhh](h)}(hInitializationh]hInitialization}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj)}(hhh](j )}(hXSet the coded format on the ``CAPTURE`` queue via :c:func:`VIDIOC_S_FMT`. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``pixelformat`` the coded format to be produced. ``sizeimage`` desired size of ``CAPTURE`` buffers; the encoder may adjust it to match hardware requirements. ``width``, ``height`` ignored (read-only). other fields follow standard semantics. * **Returned fields:** ``sizeimage`` adjusted size of ``CAPTURE`` buffers. ``width``, ``height`` the coded size selected by the encoder based on current state, e.g. ``OUTPUT`` format, selection rectangles, etc. (read-only). .. important:: Changing the ``CAPTURE`` format may change the currently set ``OUTPUT`` format. How the new ``OUTPUT`` format is determined is up to the encoder and the client must ensure it matches its needs afterwards. h](h)}(hISet the coded format on the ``CAPTURE`` queue via :c:func:`VIDIOC_S_FMT`.h](hSet the coded format on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh queue via }(hjhhhNhNubh)}(h:c:func:`VIDIOC_S_FMT`h]j)}(hj h]hVIDIOC_S_FMT()}(hj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_S_FMTuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hhh](j )}(hXd**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``pixelformat`` the coded format to be produced. ``sizeimage`` desired size of ``CAPTURE`` buffers; the encoder may adjust it to match hardware requirements. ``width``, ``height`` ignored (read-only). other fields follow standard semantics. h](h)}(h**Required fields:**h]hstrong)}(hj:h]hRequired fields:}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj8ubah}(h]h ]h"]h$]h&]uh1hhhhKhj4ubhdefinition_list)}(hhh](hdefinition_list_item)}(hA``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](hterm)}(h``type``h]j)}(hj`h]htype}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^ubah}(h]h ]h"]h$]h&]uh1j\hhhKhjXubh definition)}(hhh]h)}(h7a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``.h](ha }(hjzhhhNhNubj)}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjzubh enum appropriate for }(hjzhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjzubh.}(hjzhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwubah}(h]h ]h"]h$]h&]uh1juhjXubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjSubjW)}(h1``pixelformat`` the coded format to be produced. h](j])}(h``pixelformat``h]j)}(hjh]h pixelformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhKhjubjv)}(hhh]h)}(h the coded format to be produced.h]h the coded format to be produced.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjSubjW)}(hm``sizeimage`` desired size of ``CAPTURE`` buffers; the encoder may adjust it to match hardware requirements. h](j])}(h ``sizeimage``h]j)}(hjh]h sizeimage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhKhjubjv)}(hhh]h)}(h^desired size of ``CAPTURE`` buffers; the encoder may adjust it to match hardware requirements.h](hdesired size of }(hj hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhC buffers; the encoder may adjust it to match hardware requirements.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjSubjW)}(h+``width``, ``height`` ignored (read-only). h](j])}(h``width``, ``height``h](j)}(h ``width``h]hwidth}(hjB hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj> ubh, }(hj> hhhNhNubj)}(h ``height``h]hheight}(hjT hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj> ubeh}(h]h ]h"]h$]h&]uh1j\hhhKhj: ubjv)}(hhh]h)}(hignored (read-only).h]hignored (read-only).}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjh ubah}(h]h ]h"]h$]h&]uh1juhj: ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjSubjW)}(h(other fields follow standard semantics. h](j])}(h other fieldsh]h other fields}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j\hhhKhj ubjv)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjSubeh}(h]h ]h"]h$]h&]uh1jQhj4ubeh}(h]h ]h"]h$]h&]uh1j hj1ubj )}(h**Returned fields:** ``sizeimage`` adjusted size of ``CAPTURE`` buffers. ``width``, ``height`` the coded size selected by the encoder based on current state, e.g. ``OUTPUT`` format, selection rectangles, etc. (read-only). h](h)}(h**Returned fields:**h]j=)}(hj h]hReturned fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubjR)}(hhh](jW)}(h4``sizeimage`` adjusted size of ``CAPTURE`` buffers. h](j])}(h ``sizeimage``h]j)}(hj h]h sizeimage}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j\hhhKhj ubjv)}(hhh]h)}(h%adjusted size of ``CAPTURE`` buffers.h](hadjusted size of }(hj hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh buffers.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubjW)}(h``width``, ``height`` the coded size selected by the encoder based on current state, e.g. ``OUTPUT`` format, selection rectangles, etc. (read-only). h](j])}(h``width``, ``height``h](j)}(h ``width``h]hwidth}(hj0 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj, ubh, }(hj, hhhNhNubj)}(h ``height``h]hheight}(hjB hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj, ubeh}(h]h ]h"]h$]h&]uh1j\hhhKhj( ubjv)}(hhh]h)}(h~the coded size selected by the encoder based on current state, e.g. ``OUTPUT`` format, selection rectangles, etc. (read-only).h](hDthe coded size selected by the encoder based on current state, e.g. }(hjY hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hja hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjY ubh0 format, selection rectangles, etc. (read-only).}(hjY hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjV ubah}(h]h ]h"]h$]h&]uh1juhj( ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubeh}(h]h ]h"]h$]h&]uh1jQhj ubeh}(h]h ]h"]h$]h&]uh1j hj1ubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhjubh important)}(hChanging the ``CAPTURE`` format may change the currently set ``OUTPUT`` format. How the new ``OUTPUT`` format is determined is up to the encoder and the client must ensure it matches its needs afterwards.h]h)}(hChanging the ``CAPTURE`` format may change the currently set ``OUTPUT`` format. How the new ``OUTPUT`` format is determined is up to the encoder and the client must ensure it matches its needs afterwards.h](h Changing the }(hj hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh% format may change the currently set }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh format. How the new }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhf format is determined is up to the encoder and the client must ensure it matches its needs afterwards.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(hX**Optional.** Enumerate supported ``OUTPUT`` formats (raw formats for source) for the selected coded format via :c:func:`VIDIOC_ENUM_FMT`. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. other fields follow standard semantics. * **Returned fields:** ``pixelformat`` raw format supported for the coded format currently selected on the ``CAPTURE`` queue. other fields follow standard semantics. h](h)}(h**Optional.** Enumerate supported ``OUTPUT`` formats (raw formats for source) for the selected coded format via :c:func:`VIDIOC_ENUM_FMT`.h](j=)}(h **Optional.**h]h Optional.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj ubh Enumerate supported }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhD formats (raw formats for source) for the selected coded format via }(hj hhhNhNubh)}(h:c:func:`VIDIOC_ENUM_FMT`h]j)}(hj h]hVIDIOC_ENUM_FMT()}(hj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FMTuh1hhhhKhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubj)}(hhh](j )}(h**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. other fields follow standard semantics. h](h)}(h**Required fields:**h]j=)}(hjK h]hRequired fields:}(hjM hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjI ubah}(h]h ]h"]h$]h&]uh1hhhhKhjE ubjR)}(hhh](jW)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](j])}(h``type``h]j)}(hji h]htype}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjg ubah}(h]h ]h"]h$]h&]uh1j\hhhKhjc ubjv)}(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&]uh1jhj ubh enum appropriate for }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj~ ubah}(h]h ]h"]h$]h&]uh1juhjc ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj` ubjW)}(h(other fields follow standard semantics. h](j])}(h other fieldsh]h other fields}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j\hhhKhj ubjv)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj` ubeh}(h]h ]h"]h$]h&]uh1jQhjE ubeh}(h]h ]h"]h$]h&]uh1j hjB ubj )}(h**Returned fields:** ``pixelformat`` raw format supported for the coded format currently selected on the ``CAPTURE`` queue. other fields follow standard semantics. h](h)}(h**Returned fields:**h]j=)}(hj h]hReturned fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubjR)}(hhh](jW)}(hg``pixelformat`` raw format supported for the coded format currently selected on the ``CAPTURE`` queue. h](j])}(h``pixelformat``h]j)}(hj h]h pixelformat}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j\hhhKhj ubjv)}(hhh]h)}(hVraw format supported for the coded format currently selected on the ``CAPTURE`` queue.h](hDraw format supported for the coded format currently selected on the }(hj6 hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj> hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6 ubh queue.}(hj6 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj3 ubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubjW)}(h(other fields follow standard semantics. h](j])}(h other fieldsh]h other fields}(hjf hhhNhNubah}(h]h ]h"]h$]h&]uh1j\hhhKhjb ubjv)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hjw hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjt ubah}(h]h ]h"]h$]h&]uh1juhjb ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubeh}(h]h ]h"]h$]h&]uh1jQhj ubeh}(h]h ]h"]h$]h&]uh1j hjB ubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhj ubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(hXSet the raw source format on the ``OUTPUT`` queue via :c:func:`VIDIOC_S_FMT`. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``pixelformat`` raw format of the source. ``width``, ``height`` source resolution. other fields follow standard semantics. * **Returned fields:** ``width``, ``height`` may be adjusted to match encoder minimums, maximums and alignment requirements, as required by the currently selected formats, as reported by :c:func:`VIDIOC_ENUM_FRAMESIZES`. other fields follow standard semantics. * Setting the ``OUTPUT`` format will reset the selection rectangles to their default values, based on the new resolution, as described in the next step. h](h)}(hMSet the raw source format on the ``OUTPUT`` queue via :c:func:`VIDIOC_S_FMT`.h](h!Set the raw source format on the }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh queue via }(hj hhhNhNubh)}(h:c:func:`VIDIOC_S_FMT`h]j)}(hj h]hVIDIOC_S_FMT()}(hj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_S_FMTuh1hhhhKhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubj)}(hhh](j )}(h**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``pixelformat`` raw format of the source. ``width``, ``height`` source resolution. other fields follow standard semantics. h](h)}(h**Required fields:**h]j=)}(hj h]hRequired fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubjR)}(hhh](jW)}(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&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1j\hhhKhj ubjv)}(hhh]h)}(h6a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.h](ha }(hj/ hhhNhNubj)}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hj7 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj/ ubh enum appropriate for }(hj/ hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjI hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj/ ubh.}(hj/ hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj, ubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubjW)}(h*``pixelformat`` raw format of the source. h](j])}(h``pixelformat``h]j)}(hjs h]h pixelformat}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjq ubah}(h]h ]h"]h$]h&]uh1j\hhhKhjm ubjv)}(hhh]h)}(hraw format of the source.h]hraw format of the source.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1juhjm ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubjW)}(h)``width``, ``height`` source resolution. h](j])}(h``width``, ``height``h](j)}(h ``width``h]hwidth}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh, }(hj hhhNhNubj)}(h ``height``h]hheight}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1j\hhhKhj ubjv)}(hhh]h)}(hsource resolution.h]hsource resolution.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubjW)}(h(other fields follow standard semantics. h](j])}(h other fieldsh]h other fields}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j\hhhKhj ubjv)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhKhj ubeh}(h]h ]h"]h$]h&]uh1jQhj ubeh}(h]h ]h"]h$]h&]uh1j hj ubj )}(hX**Returned fields:** ``width``, ``height`` may be adjusted to match encoder minimums, maximums and alignment requirements, as required by the currently selected formats, as reported by :c:func:`VIDIOC_ENUM_FRAMESIZES`. other fields follow standard semantics. h](h)}(h**Returned fields:**h]j=)}(hj1h]hReturned fields:}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj/ubah}(h]h ]h"]h$]h&]uh1hhhhKhj+ubjR)}(hhh](jW)}(h``width``, ``height`` may be adjusted to match encoder minimums, maximums and alignment requirements, as required by the currently selected formats, as reported by :c:func:`VIDIOC_ENUM_FRAMESIZES`. h](j])}(h``width``, ``height``h](j)}(h ``width``h]hwidth}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjMubh, }(hjMhhhNhNubj)}(h ``height``h]hheight}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1jhjMubeh}(h]h ]h"]h$]h&]uh1j\hhhKhjIubjv)}(hhh]h)}(hmay be adjusted to match encoder minimums, maximums and alignment requirements, as required by the currently selected formats, as reported by :c:func:`VIDIOC_ENUM_FRAMESIZES`.h](hmay be adjusted to match encoder minimums, maximums and alignment requirements, as required by the currently selected formats, as reported by }(hjzhhhNhNubh)}(h :c:func:`VIDIOC_ENUM_FRAMESIZES`h]j)}(hjh]hVIDIOC_ENUM_FRAMESIZES()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENUM_FRAMESIZESuh1hhhhKhjzubh.}(hjzhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwubah}(h]h ]h"]h$]h&]uh1juhjIubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjFubjW)}(h(other fields follow standard semantics. h](j])}(h other fieldsh]h other fields}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j\hhhKhjubjv)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjFubeh}(h]h ]h"]h$]h&]uh1jQhj+ubeh}(h]h ]h"]h$]h&]uh1j hj ubj )}(hSetting the ``OUTPUT`` format will reset the selection rectangles to their default values, based on the new resolution, as described in the next step. h]h)}(hSetting the ``OUTPUT`` format will reset the selection rectangles to their default values, based on the new resolution, as described in the next step.h](h Setting the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh format will reset the selection rectangles to their default values, based on the new resolution, as described in the next step.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhj ubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(hXSet the raw frame interval on the ``OUTPUT`` queue via :c:func:`VIDIOC_S_PARM`. This also sets the coded frame interval on the ``CAPTURE`` queue to the same value. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``parm.output`` set all fields except ``parm.output.timeperframe`` to 0. ``parm.output.timeperframe`` the desired frame interval; the encoder may adjust it to match hardware requirements. * **Returned fields:** ``parm.output.timeperframe`` the adjusted frame interval. .. important:: Changing the ``OUTPUT`` frame interval *also* sets the framerate that the encoder uses to encode the video. So setting the frame interval to 1/24 (or 24 frames per second) will produce a coded video stream that can be played back at that speed. The frame interval for the ``OUTPUT`` queue is just a hint, the application may provide raw frames at a different rate. It can be used by the driver to help schedule multiple encoders running in parallel. In the next step the ``CAPTURE`` frame interval can optionally be changed to a different value. This is useful for off-line encoding were the coded frame interval can be different from the rate at which raw frames are supplied. .. important:: ``timeperframe`` deals with *frames*, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field. .. note:: It is due to historical reasons that changing the ``OUTPUT`` frame interval also changes the coded frame interval on the ``CAPTURE`` queue. Ideally these would be independent settings, but that would break the existing API. h](h)}(hSet the raw frame interval on the ``OUTPUT`` queue via :c:func:`VIDIOC_S_PARM`. This also sets the coded frame interval on the ``CAPTURE`` queue to the same value.h](h"Set the raw frame interval on the }(hj,hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubh queue via }(hj,hhhNhNubh)}(h:c:func:`VIDIOC_S_PARM`h]j)}(hjHh]hVIDIOC_S_PARM()}(hjJhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjFubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_S_PARMuh1hhhhKhj,ubh1. This also sets the coded frame interval on the }(hj,hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubh queue to the same value.}(hj,hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj(ubj)}(hhh](j )}(hX$**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``parm.output`` set all fields except ``parm.output.timeperframe`` to 0. ``parm.output.timeperframe`` the desired frame interval; the encoder may adjust it to match hardware requirements. h](h)}(h**Required fields:**h]j=)}(hjh]hRequired fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjR)}(hhh](jW)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](j])}(h``type``h]j)}(hjh]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhKhjubjv)}(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&]uh1jhjubh enum appropriate for }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjubjW)}(hI``parm.output`` set all fields except ``parm.output.timeperframe`` to 0. h](j])}(h``parm.output``h]j)}(hjh]h parm.output}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhKhjubjv)}(hhh]h)}(h8set all fields except ``parm.output.timeperframe`` to 0.h](hset all fields except }(hjhhhNhNubj)}(h``parm.output.timeperframe``h]hparm.output.timeperframe}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh to 0.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjubjW)}(hs``parm.output.timeperframe`` the desired frame interval; the encoder may adjust it to match hardware requirements. h](j])}(h``parm.output.timeperframe``h]j)}(hjNh]hparm.output.timeperframe}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjLubah}(h]h ]h"]h$]h&]uh1j\hhhKhjHubjv)}(hhh]h)}(hUthe desired frame interval; the encoder may adjust it to match hardware requirements.h]hUthe desired frame interval; the encoder may adjust it to match hardware requirements.}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjcubah}(h]h ]h"]h$]h&]uh1juhjHubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjubeh}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1j hjubj )}(hT**Returned fields:** ``parm.output.timeperframe`` the adjusted frame interval. h](h)}(h**Returned fields:**h]j=)}(hjh]hReturned fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjR)}(hhh]jW)}(h:``parm.output.timeperframe`` the adjusted frame interval. h](j])}(h``parm.output.timeperframe``h]j)}(hjh]hparm.output.timeperframe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhKhjubjv)}(hhh]h)}(hthe adjusted frame interval.h]hthe adjusted frame interval.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhKhjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhj(ubj )}(hXChanging the ``OUTPUT`` frame interval *also* sets the framerate that the encoder uses to encode the video. So setting the frame interval to 1/24 (or 24 frames per second) will produce a coded video stream that can be played back at that speed. The frame interval for the ``OUTPUT`` queue is just a hint, the application may provide raw frames at a different rate. It can be used by the driver to help schedule multiple encoders running in parallel. In the next step the ``CAPTURE`` frame interval can optionally be changed to a different value. This is useful for off-line encoding were the coded frame interval can be different from the rate at which raw frames are supplied.h](h)}(hXChanging the ``OUTPUT`` frame interval *also* sets the framerate that the encoder uses to encode the video. So setting the frame interval to 1/24 (or 24 frames per second) will produce a coded video stream that can be played back at that speed. The frame interval for the ``OUTPUT`` queue is just a hint, the application may provide raw frames at a different rate. It can be used by the driver to help schedule multiple encoders running in parallel.h](h Changing the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh frame interval }(hjhhhNhNubhemphasis)}(h*also*h]halso}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh sets the framerate that the encoder uses to encode the video. So setting the frame interval to 1/24 (or 24 frames per second) will produce a coded video stream that can be played back at that speed. The frame interval for the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh queue is just a hint, the application may provide raw frames at a different rate. It can be used by the driver to help schedule multiple encoders running in parallel.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hIn the next step the ``CAPTURE`` frame interval can optionally be changed to a different value. This is useful for off-line encoding were the coded frame interval can be different from the rate at which raw frames are supplied.h](hIn the next step the }(hj>hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj>ubh frame interval can optionally be changed to a different value. This is useful for off-line encoding were the coded frame interval can be different from the rate at which raw frames are supplied.}(hj>hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j hj(ubj )}(h``timeperframe`` deals with *frames*, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.h]h)}(h``timeperframe`` deals with *frames*, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.h](j)}(h``timeperframe``h]h timeperframe}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjhubh deals with }(hjhhhhNhNubj)}(h*frames*h]hframes}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjhubh|, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.}(hjhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjdubah}(h]h ]h"]h$]h&]uh1j hj(ubhnote)}(hIt is due to historical reasons that changing the ``OUTPUT`` frame interval also changes the coded frame interval on the ``CAPTURE`` queue. Ideally these would be independent settings, but that would break the existing API.h]h)}(hIt is due to historical reasons that changing the ``OUTPUT`` frame interval also changes the coded frame interval on the ``CAPTURE`` queue. Ideally these would be independent settings, but that would break the existing API.h](h2It is due to historical reasons that changing the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh= frame interval also changes the coded frame interval on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh[ queue. Ideally these would be independent settings, but that would break the existing API.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhj(ubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(hX**Optional** Set the coded frame interval on the ``CAPTURE`` queue via :c:func:`VIDIOC_S_PARM`. This is only necessary if the coded frame interval is different from the raw frame interval, which is typically the case for off-line encoding. Support for this feature is signalled by the :ref:`V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL ` format flag. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``parm.capture`` set all fields except ``parm.capture.timeperframe`` to 0. ``parm.capture.timeperframe`` the desired coded frame interval; the encoder may adjust it to match hardware requirements. * **Returned fields:** ``parm.capture.timeperframe`` the adjusted frame interval. .. important:: Changing the ``CAPTURE`` frame interval sets the framerate for the coded video. It does *not* set the rate at which buffers arrive on the ``CAPTURE`` queue, that depends on how fast the encoder is and how fast raw frames are queued on the ``OUTPUT`` queue. .. important:: ``timeperframe`` deals with *frames*, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field. .. note:: Not all drivers support this functionality, in that case just set the desired coded frame interval for the ``OUTPUT`` queue. However, drivers that can schedule multiple encoders based on the ``OUTPUT`` frame interval must support this optional feature. h](h)}(hXe**Optional** Set the coded frame interval on the ``CAPTURE`` queue via :c:func:`VIDIOC_S_PARM`. This is only necessary if the coded frame interval is different from the raw frame interval, which is typically the case for off-line encoding. Support for this feature is signalled by the :ref:`V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL ` format flag.h](j=)}(h **Optional**h]hOptional}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjubh% Set the coded frame interval on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh queue via }(hjhhhNhNubh)}(h:c:func:`VIDIOC_S_PARM`h]j)}(hjh]hVIDIOC_S_PARM()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_S_PARMuh1hhhhMhjubh. This is only necessary if the coded frame interval is different from the raw frame interval, which is typically the case for off-line encoding. Support for this feature is signalled by the }(hjhhhNhNubh)}(h;:ref:`V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL `h]j2)}(hj1h]h$V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL}(hj3hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j1hj/ubah}(h]h ]h"]h$]h&]refdocj refdomainj=reftyperef refexplicitrefwarnj fmtdesc-flagsuh1hhhhMhjubh format flag.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubj)}(hhh](j )}(hX.**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. ``parm.capture`` set all fields except ``parm.capture.timeperframe`` to 0. ``parm.capture.timeperframe`` the desired coded frame interval; the encoder may adjust it to match hardware requirements. h](h)}(h**Required fields:**h]j=)}(hjbh]hRequired fields:}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj`ubah}(h]h ]h"]h$]h&]uh1hhhhMhj\ubjR)}(hhh](jW)}(hA``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](j])}(h``type``h]j)}(hjh]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj~ubah}(h]h ]h"]h$]h&]uh1j\hhhM"hjzubjv)}(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&]uh1jhjubh enum appropriate for }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM"hjubah}(h]h ]h"]h$]h&]uh1juhjzubeh}(h]h ]h"]h$]h&]uh1jVhhhM"hjwubjW)}(hK``parm.capture`` set all fields except ``parm.capture.timeperframe`` to 0. h](j])}(h``parm.capture``h]j)}(hjh]h parm.capture}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhM%hjubjv)}(hhh]h)}(h9set all fields except ``parm.capture.timeperframe`` to 0.h](hset all fields except }(hjhhhNhNubj)}(h``parm.capture.timeperframe``h]hparm.capture.timeperframe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh to 0.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM%hjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhM%hjwubjW)}(hz``parm.capture.timeperframe`` the desired coded frame interval; the encoder may adjust it to match hardware requirements. h](j])}(h``parm.capture.timeperframe``h]j)}(hj&h]hparm.capture.timeperframe}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]uh1j\hhhM)hj ubjv)}(hhh]h)}(h[the desired coded frame interval; the encoder may adjust it to match hardware requirements.h]h[the desired coded frame interval; the encoder may adjust it to match hardware requirements.}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM(hj;ubah}(h]h ]h"]h$]h&]uh1juhj ubeh}(h]h ]h"]h$]h&]uh1jVhhhM)hjwubeh}(h]h ]h"]h$]h&]uh1jQhj\ubeh}(h]h ]h"]h$]h&]uh1j hjYubj )}(hU**Returned fields:** ``parm.capture.timeperframe`` the adjusted frame interval. h](h)}(h**Returned fields:**h]j=)}(hjjh]hReturned fields:}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjhubah}(h]h ]h"]h$]h&]uh1hhhhM+hjdubjR)}(hhh]jW)}(h;``parm.capture.timeperframe`` the adjusted frame interval. h](j])}(h``parm.capture.timeperframe``h]j)}(hjh]hparm.capture.timeperframe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhM.hjubjv)}(hhh]h)}(hthe adjusted frame interval.h]hthe adjusted frame interval.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhM.hjubah}(h]h ]h"]h$]h&]uh1jQhjdubeh}(h]h ]h"]h$]h&]uh1j hjYubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjubj )}(hXChanging the ``CAPTURE`` frame interval sets the framerate for the coded video. It does *not* set the rate at which buffers arrive on the ``CAPTURE`` queue, that depends on how fast the encoder is and how fast raw frames are queued on the ``OUTPUT`` queue.h]h)}(hXChanging the ``CAPTURE`` frame interval sets the framerate for the coded video. It does *not* set the rate at which buffers arrive on the ``CAPTURE`` queue, that depends on how fast the encoder is and how fast raw frames are queued on the ``OUTPUT`` queue.h](h Changing the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh@ frame interval sets the framerate for the coded video. It does }(hjhhhNhNubj)}(h*not*h]hnot}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh- set the rate at which buffers arrive on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhZ queue, that depends on how fast the encoder is and how fast raw frames are queued on the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh queue.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM2hjubah}(h]h ]h"]h$]h&]uh1j hjubj )}(h``timeperframe`` deals with *frames*, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.h]h)}(h``timeperframe`` deals with *frames*, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.h](j)}(h``timeperframe``h]h timeperframe}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj0ubh deals with }(hj0hhhNhNubj)}(h*frames*h]hframes}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj0ubh|, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.}(hj0hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM9hj,ubah}(h]h ]h"]h$]h&]uh1j hjubj)}(hNot all drivers support this functionality, in that case just set the desired coded frame interval for the ``OUTPUT`` queue. However, drivers that can schedule multiple encoders based on the ``OUTPUT`` frame interval must support this optional feature.h](h)}(h|Not all drivers support this functionality, in that case just set the desired coded frame interval for the ``OUTPUT`` queue.h](hkNot all drivers support this functionality, in that case just set the desired coded frame interval for the }(hjhhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1jhjhubh queue.}(hjhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM?hjdubh)}(hHowever, drivers that can schedule multiple encoders based on the ``OUTPUT`` frame interval must support this optional feature.h](hBHowever, drivers that can schedule multiple encoders based on the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh3 frame interval must support this optional feature.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMBhjdubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(hX**Optional.** Set the visible resolution for the stream metadata via :c:func:`VIDIOC_S_SELECTION` on the ``OUTPUT`` queue if it is desired to be different than the full OUTPUT resolution. * **Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``target`` set to ``V4L2_SEL_TGT_CROP``. ``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle; this must fit within the `V4L2_SEL_TGT_CROP_BOUNDS` rectangle and may be subject to adjustment to match codec and hardware constraints. * **Returned fields:** ``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle adjusted by the encoder. * The following selection targets are supported on ``OUTPUT``: ``V4L2_SEL_TGT_CROP_BOUNDS`` equal to the full source frame, matching the active ``OUTPUT`` format. ``V4L2_SEL_TGT_CROP_DEFAULT`` equal to ``V4L2_SEL_TGT_CROP_BOUNDS``. ``V4L2_SEL_TGT_CROP`` rectangle within the source buffer to be encoded into the ``CAPTURE`` stream; defaults to ``V4L2_SEL_TGT_CROP_DEFAULT``. .. note:: A common use case for this selection target is encoding a source video with a resolution that is not a multiple of a macroblock, e.g. the common 1920x1080 resolution may require the source buffers to be aligned to 1920x1088 for codecs with 16x16 macroblock size. To avoid encoding the padding, the client needs to explicitly configure this selection target to 1920x1080. .. warning:: The encoder may adjust the crop/compose rectangles to the nearest supported ones to meet codec and hardware requirements. The client needs to check the adjusted rectangle returned by :c:func:`VIDIOC_S_SELECTION`. h](h)}(h**Optional.** Set the visible resolution for the stream metadata via :c:func:`VIDIOC_S_SELECTION` on the ``OUTPUT`` queue if it is desired to be different than the full OUTPUT resolution.h](j=)}(h **Optional.**h]h Optional.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjubh8 Set the visible resolution for the stream metadata via }(hjhhhNhNubh)}(h:c:func:`VIDIOC_S_SELECTION`h]j)}(hjh]hVIDIOC_S_SELECTION()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_S_SELECTIONuh1hhhhMEhjubh on the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhH queue if it is desired to be different than the full OUTPUT resolution.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMEhjubj)}(hhh](j )}(hXa**Required fields:** ``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. ``target`` set to ``V4L2_SEL_TGT_CROP``. ``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle; this must fit within the `V4L2_SEL_TGT_CROP_BOUNDS` rectangle and may be subject to adjustment to match codec and hardware constraints. h](h)}(h**Required fields:**h]j=)}(hjh]hRequired fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjubah}(h]h ]h"]h$]h&]uh1hhhhMIhj ubjR)}(hhh](jW)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](j])}(h``type``h]j)}(hj0h]htype}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubah}(h]h ]h"]h$]h&]uh1j\hhhMLhj*ubjv)}(hhh]h)}(h6a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.h](ha }(hjHhhhNhNubj)}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjHubh enum appropriate for }(hjHhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjHubh.}(hjHhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMLhjEubah}(h]h ]h"]h$]h&]uh1juhj*ubeh}(h]h ]h"]h$]h&]uh1jVhhhMLhj'ubjW)}(h)``target`` set to ``V4L2_SEL_TGT_CROP``. h](j])}(h ``target``h]j)}(hjh]htarget}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1j\hhhMOhjubjv)}(hhh]h)}(hset to ``V4L2_SEL_TGT_CROP``.h](hset to }(hjhhhNhNubj)}(h``V4L2_SEL_TGT_CROP``h]hV4L2_SEL_TGT_CROP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMOhjubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhMOhj'ubjW)}(h``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle; this must fit within the `V4L2_SEL_TGT_CROP_BOUNDS` rectangle and may be subject to adjustment to match codec and hardware constraints. h](j])}(h0``r.left``, ``r.top``, ``r.width``, ``r.height``h](j)}(h ``r.left``h]hr.left}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h ``r.top``h]hr.top}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }hjsbj)}(h ``r.width``h]hr.width}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }hjsbj)}(h ``r.height``h]hr.height}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j\hhhMThjubjv)}(hhh]h)}(hvisible rectangle; this must fit within the `V4L2_SEL_TGT_CROP_BOUNDS` rectangle and may be subject to adjustment to match codec and hardware constraints.h](h,visible rectangle; this must fit within the }(hj%hhhNhNubhtitle_reference)}(h`V4L2_SEL_TGT_CROP_BOUNDS`h]hV4L2_SEL_TGT_CROP_BOUNDS}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj%ubhT rectangle and may be subject to adjustment to match codec and hardware constraints.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMRhj"ubah}(h]h ]h"]h$]h&]uh1juhjubeh}(h]h ]h"]h$]h&]uh1jVhhhMThj'ubeh}(h]h ]h"]h$]h&]uh1jQhj ubeh}(h]h ]h"]h$]h&]uh1j hj ubj )}(hv**Returned fields:** ``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle adjusted by the encoder. h](h)}(h**Returned fields:**h]j=)}(hjeh]hReturned fields:}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1j<hjcubah}(h]h ]h"]h$]h&]uh1hhhhMVhj_ubjR)}(hhh]jW)}(h\``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle adjusted by the encoder. h](j])}(h0``r.left``, ``r.top``, ``r.width``, ``r.height``h](j)}(h ``r.left``h]hr.left}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h ``r.top``h]hr.top}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }hjsbj)}(h ``r.width``h]hr.width}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }hjsbj)}(h ``r.height``h]hr.height}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j\hhhMYhj}ubjv)}(hhh]h)}(h*visible rectangle adjusted by the encoder.h]h*visible rectangle adjusted by the encoder.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMYhjubah}(h]h ]h"]h$]h&]uh1juhj}ubeh}(h]h ]h"]h$]h&]uh1jVhhhMYhjzubah}(h]h ]h"]h$]h&]uh1jQhj_ubeh}(h]h ]h"]h$]h&]uh1j hj ubj )}(hX:The following selection targets are supported on ``OUTPUT``: ``V4L2_SEL_TGT_CROP_BOUNDS`` equal to the full source frame, matching the active ``OUTPUT`` format. ``V4L2_SEL_TGT_CROP_DEFAULT`` equal to ``V4L2_SEL_TGT_CROP_BOUNDS``. ``V4L2_SEL_TGT_CROP`` rectangle within the source buffer to be encoded into the ``CAPTURE`` stream; defaults to ``V4L2_SEL_TGT_CROP_DEFAULT``. .. note:: A common use case for this selection target is encoding a source video with a resolution that is not a multiple of a macroblock, e.g. the common 1920x1080 resolution may require the source buffers to be aligned to 1920x1088 for codecs with 16x16 macroblock size. To avoid encoding the padding, the client needs to explicitly configure this selection target to 1920x1080. h](h)}(h queue may differ from the order of queuing raw frames to the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhN queue, due to properties of the selected coded format, e.g. frame reordering.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj9hhubh)}(hThe client must not assume any direct relationship between ``CAPTURE`` and ``OUTPUT`` buffers and any specific timing of buffers becoming available to dequeue. Specifically:h](h;The client must not assume any direct relationship between }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX buffers and any specific timing of buffers becoming available to dequeue. Specifically:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj9hhubj)}(hhh](j )}(hX%a buffer queued to ``OUTPUT`` may result in more than one buffer produced on ``CAPTURE`` (for example, if returning an encoded frame allowed the encoder to return a frame that preceded it in display, but succeeded it in the decode order; however, there may be other reasons for this as well), h]h)}(hX$a buffer queued to ``OUTPUT`` may result in more than one buffer produced on ``CAPTURE`` (for example, if returning an encoded frame allowed the encoder to return a frame that preceded it in display, but succeeded it in the decode order; however, there may be other reasons for this as well),h](ha buffer queued to }(hj;hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1jhj;ubh0 may result in more than one buffer produced on }(hj;hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj;ubh (for example, if returning an encoded frame allowed the encoder to return a frame that preceded it in display, but succeeded it in the decode order; however, there may be other reasons for this as well),}(hj;hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj7ubah}(h]h ]h"]h$]h&]uh1j hj4hhhhhNubj )}(ha buffer queued to ``OUTPUT`` may result in a buffer being produced on ``CAPTURE`` later into encode process, and/or after processing further ``OUTPUT`` buffers, or be returned out of order, e.g. if display reordering is used, h]h)}(ha buffer queued to ``OUTPUT`` may result in a buffer being produced on ``CAPTURE`` later into encode process, and/or after processing further ``OUTPUT`` buffers, or be returned out of order, e.g. if display reordering is used,h](ha buffer queued to }(hjwhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh* may result in a buffer being produced on }(hjwhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh< later into encode process, and/or after processing further }(hjwhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubhJ buffers, or be returned out of order, e.g. if display reordering is used,}(hjwhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjsubah}(h]h ]h"]h$]h&]uh1j hj4hhhhhNubj )}(hXbuffers may become available on the ``CAPTURE`` queue without additional buffers queued to ``OUTPUT`` (e.g. during drain or ``EOS``), because of the ``OUTPUT`` buffers queued in the past whose encoding results are only available at later time, due to specifics of the encoding process, h]h)}(hXbuffers may become available on the ``CAPTURE`` queue without additional buffers queued to ``OUTPUT`` (e.g. during drain or ``EOS``), because of the ``OUTPUT`` buffers queued in the past whose encoding results are only available at later time, due to specifics of the encoding process,h](h$buffers may become available on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, queue without additional buffers queued to }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh (e.g. during drain or }(hjhhhNhNubj)}(h``EOS``h]hEOS}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh), because of the }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh~ buffers queued in the past whose encoding results are only available at later time, due to specifics of the encoding process,}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j hj4hhhhhNubj )}(hbuffers queued to ``OUTPUT`` may not become available to dequeue instantly after being encoded into a corresponding ``CAPTURE`` buffer, e.g. if the encoder needs to use the frame as a reference for encoding further frames. h]h)}(hbuffers queued to ``OUTPUT`` may not become available to dequeue instantly after being encoded into a corresponding ``CAPTURE`` buffer, e.g. if the encoder needs to use the frame as a reference for encoding further frames.h](hbuffers queued to }(hj%hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubhX may not become available to dequeue instantly after being encoded into a corresponding }(hj%hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubh_ buffer, e.g. if the encoder needs to use the frame as a reference for encoding further frames.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1j hj4hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhj9hhubj)}(hXXTo allow matching encoded ``CAPTURE`` buffers with ``OUTPUT`` buffers they originated from, the client can set the ``timestamp`` field of the :c:type:`v4l2_buffer` struct when queuing an ``OUTPUT`` buffer. The ``CAPTURE`` buffer(s), which resulted from encoding that ``OUTPUT`` buffer will have their ``timestamp`` field set to the same value when dequeued. In addition to the straightforward case of one ``OUTPUT`` buffer producing one ``CAPTURE`` buffer, the following cases are defined: * one ``OUTPUT`` buffer generates multiple ``CAPTURE`` buffers: the same ``OUTPUT`` timestamp will be copied to multiple ``CAPTURE`` buffers, * the encoding order differs from the presentation order (i.e. the ``CAPTURE`` buffers are out-of-order compared to the ``OUTPUT`` buffers): ``CAPTURE`` timestamps will not retain the order of ``OUTPUT`` timestamps.h](h)}(hXeTo allow matching encoded ``CAPTURE`` buffers with ``OUTPUT`` buffers they originated from, the client can set the ``timestamp`` field of the :c:type:`v4l2_buffer` struct when queuing an ``OUTPUT`` buffer. The ``CAPTURE`` buffer(s), which resulted from encoding that ``OUTPUT`` buffer will have their ``timestamp`` field set to the same value when dequeued.h](hTo allow matching encoded }(hjghhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubh buffers with }(hjghhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubh6 buffers they originated from, the client can set the }(hjghhhNhNubj)}(h ``timestamp``h]h timestamp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubh field of the }(hjghhhNhNubh)}(h:c:type:`v4l2_buffer`h]j)}(hjh]h v4l2_buffer}(hjhhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnj v4l2_bufferuh1hhhhMhjgubh struct when queuing an }(hjghhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubh buffer. The }(hjghhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubh. buffer(s), which resulted from encoding that }(hjghhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubh buffer will have their }(hjghhhNhNubj)}(h ``timestamp``h]h timestamp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubh+ field set to the same value when dequeued.}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjcubh)}(hIn addition to the straightforward case of one ``OUTPUT`` buffer producing one ``CAPTURE`` buffer, the following cases are defined:h](h/In addition to the straightforward case of one }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh buffer producing one }(hj hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj0 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh) buffer, the following cases are defined:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjcubj)}(hhh](j )}(hone ``OUTPUT`` buffer generates multiple ``CAPTURE`` buffers: the same ``OUTPUT`` timestamp will be copied to multiple ``CAPTURE`` buffers, h]h)}(hone ``OUTPUT`` buffer generates multiple ``CAPTURE`` buffers: the same ``OUTPUT`` timestamp will be copied to multiple ``CAPTURE`` buffers,h](hone }(hjO hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjW hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjO ubh buffer generates multiple }(hjO hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hji hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjO ubh buffers: the same }(hjO hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj{ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjO ubh& timestamp will be copied to multiple }(hjO hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjO ubh buffers,}(hjO hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjK ubah}(h]h ]h"]h$]h&]uh1j hjH ubj )}(hthe encoding order differs from the presentation order (i.e. the ``CAPTURE`` buffers are out-of-order compared to the ``OUTPUT`` buffers): ``CAPTURE`` timestamps will not retain the order of ``OUTPUT`` timestamps.h]h)}(hthe encoding order differs from the presentation order (i.e. the ``CAPTURE`` buffers are out-of-order compared to the ``OUTPUT`` buffers): ``CAPTURE`` timestamps will not retain the order of ``OUTPUT`` timestamps.h](hAthe encoding order differs from the presentation order (i.e. the }(hj hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh* buffers are out-of-order compared to the }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh buffers): }(hj hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh) timestamps will not retain the order of }(hj hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh timestamps.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j hjH ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjcubeh}(h]h ]h"]h$]h&]uh1jhj9hhhNhNubj)}(hXrTo let the client distinguish between frame types (keyframes, intermediate frames; the exact list of types depends on the coded format), the ``CAPTURE`` buffers will have corresponding flag bits set in their :c:type:`v4l2_buffer` struct when dequeued. See the documentation of :c:type:`v4l2_buffer` and each coded pixel format for exact list of flags and their meanings.h]h)}(hXrTo let the client distinguish between frame types (keyframes, intermediate frames; the exact list of types depends on the coded format), the ``CAPTURE`` buffers will have corresponding flag bits set in their :c:type:`v4l2_buffer` struct when dequeued. See the documentation of :c:type:`v4l2_buffer` and each coded pixel format for exact list of flags and their meanings.h](hTo let the client distinguish between frame types (keyframes, intermediate frames; the exact list of types depends on the coded format), the }(hj!hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj#!hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj!ubh8 buffers will have corresponding flag bits set in their }(hj!hhhNhNubh)}(h:c:type:`v4l2_buffer`h]j)}(hj7!h]h v4l2_buffer}(hj9!hhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhj5!ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnj v4l2_bufferuh1hhhhMhj!ubh0 struct when dequeued. See the documentation of }(hj!hhhNhNubh)}(h:c:type:`v4l2_buffer`h]j)}(hjZ!h]h v4l2_buffer}(hj\!hhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjX!ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnj v4l2_bufferuh1hhhhMhj!ubhH and each coded pixel format for exact list of flags and their meanings.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1jhj9hhhhhNubh)}(hShould an encoding error occur, it will be reported to the client with the level of details depending on the encoder capabilities. Specifically:h]hShould an encoding error occur, it will be reported to the client with the level of details depending on the encoder capabilities. Specifically:}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj9hhubj)}(hhh](j )}(hthe ``CAPTURE`` buffer (if any) that contains the results of the failed encode operation will be returned with the ``V4L2_BUF_FLAG_ERROR`` flag set, h]h)}(hthe ``CAPTURE`` buffer (if any) that contains the results of the failed encode operation will be returned with the ``V4L2_BUF_FLAG_ERROR`` flag set,h](hthe }(hj!hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj!ubhd buffer (if any) that contains the results of the failed encode operation will be returned with the }(hj!hhhNhNubj)}(h``V4L2_BUF_FLAG_ERROR``h]hV4L2_BUF_FLAG_ERROR}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj!ubh flag set,}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1j hj!hhhhhNubj )}(hif the encoder is able to precisely report the ``OUTPUT`` buffer(s) that triggered the error, such buffer(s) will be returned with the ``V4L2_BUF_FLAG_ERROR`` flag set. h]h)}(hif the encoder is able to precisely report the ``OUTPUT`` buffer(s) that triggered the error, such buffer(s) will be returned with the ``V4L2_BUF_FLAG_ERROR`` flag set.h](h/if the encoder is able to precisely report the }(hj!hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj!ubhN buffer(s) that triggered the error, such buffer(s) will be returned with the }(hj!hhhNhNubj)}(h``V4L2_BUF_FLAG_ERROR``h]hV4L2_BUF_FLAG_ERROR}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj!ubh flag set.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1j hj!hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhj9hhubj)}(hXIf a ``CAPTURE`` buffer is too small then it is just returned with the ``V4L2_BUF_FLAG_ERROR`` flag set. More work is needed to detect that this error occurred because the buffer was too small, and to provide support to free existing buffers that were too small.h]h)}(hXIf a ``CAPTURE`` buffer is too small then it is just returned with the ``V4L2_BUF_FLAG_ERROR`` flag set. More work is needed to detect that this error occurred because the buffer was too small, and to provide support to free existing buffers that were too small.h](hIf a }(hj"hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj""hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj"ubh7 buffer is too small then it is just returned with the }(hj"hhhNhNubj)}(h``V4L2_BUF_FLAG_ERROR``h]hV4L2_BUF_FLAG_ERROR}(hj4"hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj"ubh flag set. More work is needed to detect that this error occurred because the buffer was too small, and to provide support to free existing buffers that were too small.}(hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubah}(h]h ]h"]h$]h&]uh1jhj9hhhhhNubh)}(hXwIn case of a fatal failure that does not allow the encoding to continue, any further operations on corresponding encoder file handle will return the -EIO error code. The client may close the file handle and open a new one, or alternatively reinitialize the instance by stopping streaming on both queues, releasing all buffers and performing the Initialization sequence again.h]hXwIn case of a fatal failure that does not allow the encoding to continue, any further operations on corresponding encoder file handle will return the -EIO error code. The client may close the file handle and open a new one, or alternatively reinitialize the instance by stopping streaming on both queues, releasing all buffers and performing the Initialization sequence again.}(hjR"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj9hhubeh}(h]encodingah ]h"]encodingah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hEncoding Parameter Changesh]hEncoding Parameter Changes}(hjk"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjh"hhhhhMubh)}(hThe client is allowed to use :c:func:`VIDIOC_S_CTRL` to change encoder parameters at any time. The availability of parameters is encoder-specific and the client must query the encoder to find the set of available controls.h](hThe client is allowed to use }(hjy"hhhNhNubh)}(h:c:func:`VIDIOC_S_CTRL`h]j)}(hj"h]hVIDIOC_S_CTRL()}(hj"hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_S_CTRLuh1hhhhMhjy"ubh to change encoder parameters at any time. The availability of parameters is encoder-specific and the client must query the encoder to find the set of available controls.}(hjy"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjh"hhubh)}(hXThe ability to change each parameter during encoding is encoder-specific, as per the standard semantics of the V4L2 control interface. The client may attempt to set a control during encoding and if the operation fails with the -EBUSY error code, the ``CAPTURE`` queue needs to be stopped for the configuration change to be allowed. To do this, it may follow the `Drain` sequence to avoid losing the already queued/encoded frames.h](hThe ability to change each parameter during encoding is encoder-specific, as per the standard semantics of the V4L2 control interface. The client may attempt to set a control during encoding and if the operation fails with the -EBUSY error code, the }(hj"hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj"ubhe queue needs to be stopped for the configuration change to be allowed. To do this, it may follow the }(hj"hhhNhNubj.)}(h`Drain`h]hDrain}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj"ubh< sequence to avoid losing the already queued/encoded frames.}(hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjh"hhubh)}(hXThe timing of parameter updates is encoder-specific, as per the standard semantics of the V4L2 control interface. If the client needs to apply the parameters exactly at specific frame, using the Request API (:ref:`media-request-api`) should be considered, if supported by the encoder.h](hThe timing of parameter updates is encoder-specific, as per the standard semantics of the V4L2 control interface. If the client needs to apply the parameters exactly at specific frame, using the Request API (}(hj"hhhNhNubh)}(h:ref:`media-request-api`h]j2)}(hj"h]hmedia-request-api}(hj"hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j1hj"ubah}(h]h ]h"]h$]h&]refdocj refdomainj"reftyperef refexplicitrefwarnjmedia-request-apiuh1hhhhM'hj"ubh4) should be considered, if supported by the encoder.}(hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM'hjh"hhubeh}(h]encoding-parameter-changesah ]h"]encoding parameter changesah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hDrainh]hDrain}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#hhhhhM-ubh)}(hXITo ensure that all the queued ``OUTPUT`` buffers have been processed and the related ``CAPTURE`` buffers are given to the client, the client must follow the drain sequence described below. After the drain sequence ends, the client has received all encoded frames for all ``OUTPUT`` buffers queued before the sequence was started.h](hTo ensure that all the queued }(hj'#hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj/#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'#ubh- buffers have been processed and the related }(hj'#hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjA#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'#ubh buffers are given to the client, the client must follow the drain sequence described below. After the drain sequence ends, the client has received all encoded frames for all }(hj'#hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjS#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'#ubh0 buffers queued before the sequence was started.}(hj'#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM/hj#hhubj)}(hhh](j )}(hX2Begin the drain sequence by issuing :c:func:`VIDIOC_ENCODER_CMD`. * **Required fields:** ``cmd`` set to ``V4L2_ENC_CMD_STOP``. ``flags`` set to 0. ``pts`` set to 0. .. warning:: The sequence can be only initiated if both ``OUTPUT`` and ``CAPTURE`` queues are streaming. For compatibility reasons, the call to :c:func:`VIDIOC_ENCODER_CMD` will not fail even if any of the queues is not streaming, but at the same time it will not initiate the `Drain` sequence and so the steps described below would not be applicable. h](h)}(hABegin the drain sequence by issuing :c:func:`VIDIOC_ENCODER_CMD`.h](h$Begin the drain sequence by issuing }(hjr#hhhNhNubh)}(h:c:func:`VIDIOC_ENCODER_CMD`h]j)}(hj|#h]hVIDIOC_ENCODER_CMD()}(hj~#hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjz#ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENCODER_CMDuh1hhhhM5hjr#ubh.}(hjr#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM5hjn#ubj)}(hhh]j )}(hp**Required fields:** ``cmd`` set to ``V4L2_ENC_CMD_STOP``. ``flags`` set to 0. ``pts`` set to 0. h](h)}(h**Required fields:**h]j=)}(hj#h]hRequired fields:}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj#ubah}(h]h ]h"]h$]h&]uh1hhhhM7hj#ubjR)}(hhh](jW)}(h&``cmd`` set to ``V4L2_ENC_CMD_STOP``. h](j])}(h``cmd``h]j)}(hj#h]hcmd}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubah}(h]h ]h"]h$]h&]uh1j\hhhM:hj#ubjv)}(hhh]h)}(hset to ``V4L2_ENC_CMD_STOP``.h](hset to }(hj#hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubh.}(hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM:hj#ubah}(h]h ]h"]h$]h&]uh1juhj#ubeh}(h]h ]h"]h$]h&]uh1jVhhhM:hj#ubjW)}(h``flags`` set to 0. h](j])}(h ``flags``h]j)}(hj$h]hflags}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]uh1j\hhhM=hj$ubjv)}(hhh]h)}(h set to 0.h]h set to 0.}(hj,$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hj)$ubah}(h]h ]h"]h$]h&]uh1juhj$ubeh}(h]h ]h"]h$]h&]uh1jVhhhM=hj#ubjW)}(h``pts`` set to 0. h](j])}(h``pts``h]j)}(hjL$h]hpts}(hjN$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjJ$ubah}(h]h ]h"]h$]h&]uh1j\hhhM@hjF$ubjv)}(hhh]h)}(h set to 0.h]h set to 0.}(hjd$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM@hja$ubah}(h]h ]h"]h$]h&]uh1juhjF$ubeh}(h]h ]h"]h$]h&]uh1jVhhhM@hj#ubeh}(h]h ]h"]h$]h&]uh1jQhj#ubeh}(h]h ]h"]h$]h&]uh1j hj#ubah}(h]h ]h"]h$]h&]jjuh1jhhhM7hjn#ubj:)}(hXRThe sequence can be only initiated if both ``OUTPUT`` and ``CAPTURE`` queues are streaming. For compatibility reasons, the call to :c:func:`VIDIOC_ENCODER_CMD` will not fail even if any of the queues is not streaming, but at the same time it will not initiate the `Drain` sequence and so the steps described below would not be applicable.h]h)}(hXRThe sequence can be only initiated if both ``OUTPUT`` and ``CAPTURE`` queues are streaming. For compatibility reasons, the call to :c:func:`VIDIOC_ENCODER_CMD` will not fail even if any of the queues is not streaming, but at the same time it will not initiate the `Drain` sequence and so the steps described below would not be applicable.h](h+The sequence can be only initiated if both }(hj$hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ubh and }(hj$hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ubh> queues are streaming. For compatibility reasons, the call to }(hj$hhhNhNubh)}(h:c:func:`VIDIOC_ENCODER_CMD`h]j)}(hj$h]hVIDIOC_ENCODER_CMD()}(hj$hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENCODER_CMDuh1hhhhMDhj$ubhi will not fail even if any of the queues is not streaming, but at the same time it will not initiate the }(hj$hhhNhNubj.)}(h`Drain`h]hDrain}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj$ubhC sequence and so the steps described below would not be applicable.}(hj$hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMDhj$ubah}(h]h ]h"]h$]h&]uh1j9hjn#ubeh}(h]h ]h"]h$]h&]uh1j hjk#hhhNhNubj )}(hXAny ``OUTPUT`` buffers queued by the client before the :c:func:`VIDIOC_ENCODER_CMD` was issued will be processed and encoded as normal. The client must continue to handle both queues independently, similarly to normal encode operation. This includes: * queuing and dequeuing ``CAPTURE`` buffers, until a buffer marked with the ``V4L2_BUF_FLAG_LAST`` flag is dequeued, .. warning:: The last buffer may be empty (with :c:type:`v4l2_buffer` ``bytesused`` = 0) and in that case it must be ignored by the client, as it does not contain an encoded frame. .. note:: Any attempt to dequeue more ``CAPTURE`` buffers beyond the buffer marked with ``V4L2_BUF_FLAG_LAST`` will result in a -EPIPE error from :c:func:`VIDIOC_DQBUF`. * dequeuing processed ``OUTPUT`` buffers, until all the buffers queued before the ``V4L2_ENC_CMD_STOP`` command are dequeued, * dequeuing the ``V4L2_EVENT_EOS`` event, if the client subscribes to it. .. note:: For backwards compatibility, the encoder will signal a ``V4L2_EVENT_EOS`` event when the last frame has been encoded and all frames are ready to be dequeued. It is deprecated behavior and the client must not rely on it. The ``V4L2_BUF_FLAG_LAST`` buffer flag should be used instead. h](h)}(hAny ``OUTPUT`` buffers queued by the client before the :c:func:`VIDIOC_ENCODER_CMD` was issued will be processed and encoded as normal. The client must continue to handle both queues independently, similarly to normal encode operation. This includes:h](hAny }(hj %hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj %ubh) buffers queued by the client before the }(hj %hhhNhNubh)}(h:c:func:`VIDIOC_ENCODER_CMD`h]j)}(hj'%h]hVIDIOC_ENCODER_CMD()}(hj)%hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj%%ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_ENCODER_CMDuh1hhhhMJhj %ubh was issued will be processed and encoded as normal. The client must continue to handle both queues independently, similarly to normal encode operation. This includes:}(hj %hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMJhj%ubj)}(hhh](j )}(hXqueuing and dequeuing ``CAPTURE`` buffers, until a buffer marked with the ``V4L2_BUF_FLAG_LAST`` flag is dequeued, .. warning:: The last buffer may be empty (with :c:type:`v4l2_buffer` ``bytesused`` = 0) and in that case it must be ignored by the client, as it does not contain an encoded frame. .. note:: Any attempt to dequeue more ``CAPTURE`` buffers beyond the buffer marked with ``V4L2_BUF_FLAG_LAST`` will result in a -EPIPE error from :c:func:`VIDIOC_DQBUF`. h](h)}(hrqueuing and dequeuing ``CAPTURE`` buffers, until a buffer marked with the ``V4L2_BUF_FLAG_LAST`` flag is dequeued,h](hqueuing and dequeuing }(hjU%hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj]%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjU%ubh) buffers, until a buffer marked with the }(hjU%hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hjo%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjU%ubh flag is dequeued,}(hjU%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMOhjQ%ubj:)}(hThe last buffer may be empty (with :c:type:`v4l2_buffer` ``bytesused`` = 0) and in that case it must be ignored by the client, as it does not contain an encoded frame.h]h)}(hThe last buffer may be empty (with :c:type:`v4l2_buffer` ``bytesused`` = 0) and in that case it must be ignored by the client, as it does not contain an encoded frame.h](h#The last buffer may be empty (with }(hj%hhhNhNubh)}(h:c:type:`v4l2_buffer`h]j)}(hj%h]h v4l2_buffer}(hj%hhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhj%ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnj v4l2_bufferuh1hhhhMThj%ubh }(hj%hhhNhNubj)}(h ``bytesused``h]h bytesused}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubha = 0) and in that case it must be ignored by the client, as it does not contain an encoded frame.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMThj%ubah}(h]h ]h"]h$]h&]uh1j9hjQ%ubj)}(hAny attempt to dequeue more ``CAPTURE`` buffers beyond the buffer marked with ``V4L2_BUF_FLAG_LAST`` will result in a -EPIPE error from :c:func:`VIDIOC_DQBUF`.h]h)}(hAny attempt to dequeue more ``CAPTURE`` buffers beyond the buffer marked with ``V4L2_BUF_FLAG_LAST`` will result in a -EPIPE error from :c:func:`VIDIOC_DQBUF`.h](hAny attempt to dequeue more }(hj%hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubh' buffers beyond the buffer marked with }(hj%hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubh$ will result in a -EPIPE error from }(hj%hhhNhNubh)}(h:c:func:`VIDIOC_DQBUF`h]j)}(hj&h]hVIDIOC_DQBUF()}(hj&hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj&ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnj VIDIOC_DQBUFuh1hhhhMZhj%ubh.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMZhj%ubah}(h]h ]h"]h$]h&]uh1jhjQ%ubeh}(h]h ]h"]h$]h&]uh1j hjN%ubj )}(h|dequeuing processed ``OUTPUT`` buffers, until all the buffers queued before the ``V4L2_ENC_CMD_STOP`` command are dequeued, h]h)}(h{dequeuing processed ``OUTPUT`` buffers, until all the buffers queued before the ``V4L2_ENC_CMD_STOP`` command are dequeued,h](hdequeuing processed }(hj=&hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjE&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=&ubh2 buffers, until all the buffers queued before the }(hj=&hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hjW&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=&ubh command are dequeued,}(hj=&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM^hj9&ubah}(h]h ]h"]h$]h&]uh1j hjN%ubj )}(hHdequeuing the ``V4L2_EVENT_EOS`` event, if the client subscribes to it. h]h)}(hGdequeuing the ``V4L2_EVENT_EOS`` event, if the client subscribes to it.h](hdequeuing the }(hjy&hhhNhNubj)}(h``V4L2_EVENT_EOS``h]hV4L2_EVENT_EOS}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjy&ubh' event, if the client subscribes to it.}(hjy&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMahju&ubah}(h]h ]h"]h$]h&]uh1j hjN%ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMOhj%ubj)}(hXFor backwards compatibility, the encoder will signal a ``V4L2_EVENT_EOS`` event when the last frame has been encoded and all frames are ready to be dequeued. It is deprecated behavior and the client must not rely on it. The ``V4L2_BUF_FLAG_LAST`` buffer flag should be used instead.h]h)}(hXFor backwards compatibility, the encoder will signal a ``V4L2_EVENT_EOS`` event when the last frame has been encoded and all frames are ready to be dequeued. It is deprecated behavior and the client must not rely on it. The ``V4L2_BUF_FLAG_LAST`` buffer flag should be used instead.h](h7For backwards compatibility, the encoder will signal a }(hj&hhhNhNubj)}(h``V4L2_EVENT_EOS``h]hV4L2_EVENT_EOS}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubh event when the last frame has been encoded and all frames are ready to be dequeued. It is deprecated behavior and the client must not rely on it. The }(hj&hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubh$ buffer flag should be used instead.}(hj&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMehj&ubah}(h]h ]h"]h$]h&]uh1jhj%ubeh}(h]h ]h"]h$]h&]uh1j hjk#hhhNhNubj )}(hXtOnce all ``OUTPUT`` buffers queued before the ``V4L2_ENC_CMD_STOP`` call are dequeued and the last ``CAPTURE`` buffer is dequeued, the encoder is stopped and it will accept, but not process any newly queued ``OUTPUT`` buffers until the client issues any of the following operations: * ``V4L2_ENC_CMD_START`` - the encoder will not be reset and will resume operation normally, with all the state from before the drain, * a pair of :c:func:`VIDIOC_STREAMOFF` and :c:func:`VIDIOC_STREAMON` on the ``CAPTURE`` queue - the encoder will be reset (see the `Reset` sequence) and then resume encoding, * a pair of :c:func:`VIDIOC_STREAMOFF` and :c:func:`VIDIOC_STREAMON` on the ``OUTPUT`` queue - the encoder will resume operation normally, however any source frames queued to the ``OUTPUT`` queue between ``V4L2_ENC_CMD_STOP`` and :c:func:`VIDIOC_STREAMOFF` will be discarded. h](h)}(hXOnce all ``OUTPUT`` buffers queued before the ``V4L2_ENC_CMD_STOP`` call are dequeued and the last ``CAPTURE`` buffer is dequeued, the encoder is stopped and it will accept, but not process any newly queued ``OUTPUT`` buffers until the client issues any of the following operations:h](h Once all }(hj&hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubh buffers queued before the }(hj&hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubh call are dequeued and the last }(hj&hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubha buffer is dequeued, the encoder is stopped and it will accept, but not process any newly queued }(hj&hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj)'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubhA buffers until the client issues any of the following operations:}(hj&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMjhj&ubj)}(hhh](j )}(h``V4L2_ENC_CMD_START`` - the encoder will not be reset and will resume operation normally, with all the state from before the drain, h]h)}(h``V4L2_ENC_CMD_START`` - the encoder will not be reset and will resume operation normally, with all the state from before the drain,h](j)}(h``V4L2_ENC_CMD_START``h]hV4L2_ENC_CMD_START}(hjL'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjH'ubhn - the encoder will not be reset and will resume operation normally, with all the state from before the drain,}(hjH'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMohjD'ubah}(h]h ]h"]h$]h&]uh1j hjA'ubj )}(ha pair of :c:func:`VIDIOC_STREAMOFF` and :c:func:`VIDIOC_STREAMON` on the ``CAPTURE`` queue - the encoder will be reset (see the `Reset` sequence) and then resume encoding, h]h)}(ha pair of :c:func:`VIDIOC_STREAMOFF` and :c:func:`VIDIOC_STREAMON` on the ``CAPTURE`` queue - the encoder will be reset (see the `Reset` sequence) and then resume encoding,h](h a pair of }(hjn'hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hjx'h]hVIDIOC_STREAMOFF()}(hjz'hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjv'ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMOFFuh1hhhhMrhjn'ubh and }(hjn'hhhNhNubh)}(h:c:func:`VIDIOC_STREAMON`h]j)}(hj'h]hVIDIOC_STREAMON()}(hj'hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj'ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMONuh1hhhhMrhjn'ubh on the }(hjn'hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjn'ubh, queue - the encoder will be reset (see the }(hjn'hhhNhNubj.)}(h`Reset`h]hReset}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjn'ubh$ sequence) and then resume encoding,}(hjn'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMrhjj'ubah}(h]h ]h"]h$]h&]uh1j hjA'ubj )}(hXa pair of :c:func:`VIDIOC_STREAMOFF` and :c:func:`VIDIOC_STREAMON` on the ``OUTPUT`` queue - the encoder will resume operation normally, however any source frames queued to the ``OUTPUT`` queue between ``V4L2_ENC_CMD_STOP`` and :c:func:`VIDIOC_STREAMOFF` will be discarded. h]h)}(hXa pair of :c:func:`VIDIOC_STREAMOFF` and :c:func:`VIDIOC_STREAMON` on the ``OUTPUT`` queue - the encoder will resume operation normally, however any source frames queued to the ``OUTPUT`` queue between ``V4L2_ENC_CMD_STOP`` and :c:func:`VIDIOC_STREAMOFF` will be discarded.h](h a pair of }(hj'hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hj'h]hVIDIOC_STREAMOFF()}(hj'hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj'ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMOFFuh1hhhhMvhj'ubh and }(hj'hhhNhNubh)}(h:c:func:`VIDIOC_STREAMON`h]j)}(hj(h]hVIDIOC_STREAMON()}(hj(hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj(ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMONuh1hhhhMvhj'ubh on the }(hj'hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj>(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubh] queue - the encoder will resume operation normally, however any source frames queued to the }(hj'hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjP(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubh queue between }(hj'hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hjb(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubh and }(hj'hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hjv(h]hVIDIOC_STREAMOFF()}(hjx(hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjt(ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMOFFuh1hhhhMvhj'ubh will be discarded.}(hj'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMvhj'ubah}(h]h ]h"]h$]h&]uh1j hjA'ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMohj&ubeh}(h]h ]h"]h$]h&]uh1j hjk#hhhNhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhj#hhhhhM5ubj)}(hXOnce the drain sequence is initiated, the client needs to drive it to completion, as described by the steps above, unless it aborts the process by issuing :c:func:`VIDIOC_STREAMOFF` on any of the ``OUTPUT`` or ``CAPTURE`` queues. The client is not allowed to issue ``V4L2_ENC_CMD_START`` or ``V4L2_ENC_CMD_STOP`` again while the drain sequence is in progress and they will fail with -EBUSY error code if attempted. For reference, handling of various corner cases is described below: * In case of no buffer in the ``OUTPUT`` queue at the time the ``V4L2_ENC_CMD_STOP`` command was issued, the drain sequence completes immediately and the encoder returns an empty ``CAPTURE`` buffer with the ``V4L2_BUF_FLAG_LAST`` flag set. * In case of no buffer in the ``CAPTURE`` queue at the time the drain sequence completes, the next time the client queues a ``CAPTURE`` buffer it is returned at once as an empty buffer with the ``V4L2_BUF_FLAG_LAST`` flag set. * If :c:func:`VIDIOC_STREAMOFF` is called on the ``CAPTURE`` queue in the middle of the drain sequence, the drain sequence is canceled and all ``CAPTURE`` buffers are implicitly returned to the client. * If :c:func:`VIDIOC_STREAMOFF` is called on the ``OUTPUT`` queue in the middle of the drain sequence, the drain sequence completes immediately and next ``CAPTURE`` buffer will be returned empty with the ``V4L2_BUF_FLAG_LAST`` flag set. Although not mandatory, the availability of encoder commands may be queried using :c:func:`VIDIOC_TRY_ENCODER_CMD`.h](h)}(hXOnce the drain sequence is initiated, the client needs to drive it to completion, as described by the steps above, unless it aborts the process by issuing :c:func:`VIDIOC_STREAMOFF` on any of the ``OUTPUT`` or ``CAPTURE`` queues. The client is not allowed to issue ``V4L2_ENC_CMD_START`` or ``V4L2_ENC_CMD_STOP`` again while the drain sequence is in progress and they will fail with -EBUSY error code if attempted.h](hOnce the drain sequence is initiated, the client needs to drive it to completion, as described by the steps above, unless it aborts the process by issuing }(hj(hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hj(h]hVIDIOC_STREAMOFF()}(hj(hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj(ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMOFFuh1hhhhM}hj(ubh on any of the }(hj(hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj(ubh or }(hj(hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj(ubh- queues. The client is not allowed to issue }(hj(hhhNhNubj)}(h``V4L2_ENC_CMD_START``h]hV4L2_ENC_CMD_START}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj(ubh or }(hj(hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj(ubhf again while the drain sequence is in progress and they will fail with -EBUSY error code if attempted.}(hj(hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM}hj(ubh)}(hCFor reference, handling of various corner cases is described below:h]hCFor reference, handling of various corner cases is described below:}(hj2)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj(ubj)}(hhh](j )}(hIn case of no buffer in the ``OUTPUT`` queue at the time the ``V4L2_ENC_CMD_STOP`` command was issued, the drain sequence completes immediately and the encoder returns an empty ``CAPTURE`` buffer with the ``V4L2_BUF_FLAG_LAST`` flag set. h]h)}(hIn case of no buffer in the ``OUTPUT`` queue at the time the ``V4L2_ENC_CMD_STOP`` command was issued, the drain sequence completes immediately and the encoder returns an empty ``CAPTURE`` buffer with the ``V4L2_BUF_FLAG_LAST`` flag set.h](hIn case of no buffer in the }(hjG)hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjO)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjG)ubh queue at the time the }(hjG)hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hja)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjG)ubh_ command was issued, the drain sequence completes immediately and the encoder returns an empty }(hjG)hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjs)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjG)ubh buffer with the }(hjG)hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjG)ubh flag set.}(hjG)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjC)ubah}(h]h ]h"]h$]h&]uh1j hj@)ubj )}(hIn case of no buffer in the ``CAPTURE`` queue at the time the drain sequence completes, the next time the client queues a ``CAPTURE`` buffer it is returned at once as an empty buffer with the ``V4L2_BUF_FLAG_LAST`` flag set. h]h)}(hIn case of no buffer in the ``CAPTURE`` queue at the time the drain sequence completes, the next time the client queues a ``CAPTURE`` buffer it is returned at once as an empty buffer with the ``V4L2_BUF_FLAG_LAST`` flag set.h](hIn case of no buffer in the }(hj)hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubhS queue at the time the drain sequence completes, the next time the client queues a }(hj)hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubh; buffer it is returned at once as an empty buffer with the }(hj)hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubh flag set.}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj)ubah}(h]h ]h"]h$]h&]uh1j hj@)ubj )}(hIf :c:func:`VIDIOC_STREAMOFF` is called on the ``CAPTURE`` queue in the middle of the drain sequence, the drain sequence is canceled and all ``CAPTURE`` buffers are implicitly returned to the client. h]h)}(hIf :c:func:`VIDIOC_STREAMOFF` is called on the ``CAPTURE`` queue in the middle of the drain sequence, the drain sequence is canceled and all ``CAPTURE`` buffers are implicitly returned to the client.h](hIf }(hj)hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hj)h]hVIDIOC_STREAMOFF()}(hj*hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj)ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMOFFuh1hhhhMhj)ubh is called on the }(hj)hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj *hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubhS queue in the middle of the drain sequence, the drain sequence is canceled and all }(hj)hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj2*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubh/ buffers are implicitly returned to the client.}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj)ubah}(h]h ]h"]h$]h&]uh1j hj@)ubj )}(hIf :c:func:`VIDIOC_STREAMOFF` is called on the ``OUTPUT`` queue in the middle of the drain sequence, the drain sequence completes immediately and next ``CAPTURE`` buffer will be returned empty with the ``V4L2_BUF_FLAG_LAST`` flag set. h]h)}(hIf :c:func:`VIDIOC_STREAMOFF` is called on the ``OUTPUT`` queue in the middle of the drain sequence, the drain sequence completes immediately and next ``CAPTURE`` buffer will be returned empty with the ``V4L2_BUF_FLAG_LAST`` flag set.h](hIf }(hjT*hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hj^*h]hVIDIOC_STREAMOFF()}(hj`*hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj\*ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMOFFuh1hhhhMhjT*ubh is called on the }(hjT*hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjT*ubh^ queue in the middle of the drain sequence, the drain sequence completes immediately and next }(hjT*hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjT*ubh( buffer will be returned empty with the }(hjT*hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjT*ubh flag set.}(hjT*hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjP*ubah}(h]h ]h"]h$]h&]uh1j hj@)ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhj(ubh)}(hsAlthough not mandatory, the availability of encoder commands may be queried using :c:func:`VIDIOC_TRY_ENCODER_CMD`.h](hRAlthough not mandatory, the availability of encoder commands may be queried using }(hj*hhhNhNubh)}(h :c:func:`VIDIOC_TRY_ENCODER_CMD`h]j)}(hj*h]hVIDIOC_TRY_ENCODER_CMD()}(hj*hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj*ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_TRY_ENCODER_CMDuh1hhhhMhj*ubh.}(hj*hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj(ubeh}(h]h ]h"]h$]h&]uh1jhj#hhhhhNubeh}(h]drainah ]h"]drainah$]h&]uh1hhhhhhhhM-ubh)}(hhh](h)}(hReseth]hReset}(hj +hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj+hhhhhMubh)}(hThe client may want to request the encoder to reinitialize the encoding, so that the following stream data becomes independent from the stream data generated before. Depending on the coded format, that may imply that:h]hThe client may want to request the encoder to reinitialize the encoding, so that the following stream data becomes independent from the stream data generated before. Depending on the coded format, that may imply that:}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+hhubj)}(hhh](j )}(hencoded frames produced after the restart must not reference any frames produced before the stop, e.g. no long term references for H.264/HEVC, h]h)}(hencoded frames produced after the restart must not reference any frames produced before the stop, e.g. no long term references for H.264/HEVC,h]hencoded frames produced after the restart must not reference any frames produced before the stop, e.g. no long term references for H.264/HEVC,}(hj,+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj(+ubah}(h]h ]h"]h$]h&]uh1j hj%+hhhhhNubj )}(hrany headers that must be included in a standalone stream must be produced again, e.g. SPS and PPS for H.264/HEVC. h]h)}(hqany headers that must be included in a standalone stream must be produced again, e.g. SPS and PPS for H.264/HEVC.h]hqany headers that must be included in a standalone stream must be produced again, e.g. SPS and PPS for H.264/HEVC.}(hjD+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj@+ubah}(h]h ]h"]h$]h&]uh1j hj%+hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhj+hhubh)}(h6This can be achieved by performing the reset sequence.h]h6This can be achieved by performing the reset sequence.}(hj^+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+hhubj)}(hhh](j )}(hpPerform the `Drain` sequence to ensure all the in-flight encoding finishes and respective buffers are dequeued. h]h)}(hoPerform the `Drain` sequence to ensure all the in-flight encoding finishes and respective buffers are dequeued.h](h Perform the }(hjs+hhhNhNubj.)}(h`Drain`h]hDrain}(hj{+hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjs+ubh\ sequence to ensure all the in-flight encoding finishes and respective buffers are dequeued.}(hjs+hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjo+ubah}(h]h ]h"]h$]h&]uh1j hjl+hhhhhNubj )}(hStop streaming on the ``CAPTURE`` queue via :c:func:`VIDIOC_STREAMOFF`. This will return all currently queued ``CAPTURE`` buffers to the client, without valid frame data. h]h)}(hStop streaming on the ``CAPTURE`` queue via :c:func:`VIDIOC_STREAMOFF`. This will return all currently queued ``CAPTURE`` buffers to the client, without valid frame data.h](hStop streaming on the }(hj+hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj+ubh queue via }(hj+hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hj+h]hVIDIOC_STREAMOFF()}(hj+hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj+ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMOFFuh1hhhhMhj+ubh(. This will return all currently queued }(hj+hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj+ubh1 buffers to the client, without valid frame data.}(hj+hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj+ubah}(h]h ]h"]h$]h&]uh1j hjl+hhhhhNubj )}(hXStart streaming on the ``CAPTURE`` queue via :c:func:`VIDIOC_STREAMON` and continue with regular encoding sequence. The encoded frames produced into ``CAPTURE`` buffers from now on will contain a standalone stream that can be decoded without the need for frames encoded before the reset sequence, starting at the first ``OUTPUT`` buffer queued after issuing the `V4L2_ENC_CMD_STOP` of the `Drain` sequence. h]h)}(hXStart streaming on the ``CAPTURE`` queue via :c:func:`VIDIOC_STREAMON` and continue with regular encoding sequence. The encoded frames produced into ``CAPTURE`` buffers from now on will contain a standalone stream that can be decoded without the need for frames encoded before the reset sequence, starting at the first ``OUTPUT`` buffer queued after issuing the `V4L2_ENC_CMD_STOP` of the `Drain` sequence.h](hStart streaming on the }(hj+hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj+ubh queue via }(hj+hhhNhNubh)}(h:c:func:`VIDIOC_STREAMON`h]j)}(hj,h]hVIDIOC_STREAMON()}(hj,hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj,ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjVIDIOC_STREAMONuh1hhhhMhj+ubhO and continue with regular encoding sequence. The encoded frames produced into }(hj+hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj9,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj+ubh buffers from now on will contain a standalone stream that can be decoded without the need for frames encoded before the reset sequence, starting at the first }(hj+hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjK,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj+ubh! buffer queued after issuing the }(hj+hhhNhNubj.)}(h`V4L2_ENC_CMD_STOP`h]hV4L2_ENC_CMD_STOP}(hj],hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj+ubh of the }(hj+hhhNhNubj.)}(h`Drain`h]hDrain}(hjo,hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj+ubh sequence.}(hj+hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj+ubah}(h]h ]h"]h$]h&]uh1j hjl+hhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhj+hhhhhMubh)}(hThis sequence may be also used to change encoding parameters for encoders without the ability to change the parameters on the fly.h]hThis sequence may be also used to change encoding parameters for encoders without the ability to change the parameters on the fly.}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+hhubeh}(h]resetah ]h"]resetah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h Commit Pointsh]h Commit Points}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj,hhhhhMubh)}(hWSetting formats and allocating buffers triggers changes in the behavior of the encoder.h]hWSetting formats and allocating buffers triggers changes in the behavior of the encoder.}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj,hhubj)}(hhh](j )}(hXSetting the format on the ``CAPTURE`` queue may change the set of formats supported/advertised on the ``OUTPUT`` queue. In particular, it also means that the ``OUTPUT`` format may be reset and the client must not rely on the previously set format being preserved. h]h)}(hXSetting the format on the ``CAPTURE`` queue may change the set of formats supported/advertised on the ``OUTPUT`` queue. In particular, it also means that the ``OUTPUT`` format may be reset and the client must not rely on the previously set format being preserved.h](hSetting the format on the }(hj,hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubhA queue may change the set of formats supported/advertised on the }(hj,hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubh. queue. In particular, it also means that the }(hj,hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubh_ format may be reset and the client must not rely on the previously set format being preserved.}(hj,hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj,ubah}(h]h ]h"]h$]h&]uh1j hj,hhhhhNubj )}(hvEnumerating formats on the ``OUTPUT`` queue always returns only formats supported for the current ``CAPTURE`` format. h]h)}(huEnumerating formats on the ``OUTPUT`` queue always returns only formats supported for the current ``CAPTURE`` format.h](hEnumerating formats on the }(hj-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj%-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj-ubh= queue always returns only formats supported for the current }(hj-hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj7-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj-ubh format.}(hj-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj-ubah}(h]h ]h"]h$]h&]uh1j hj,hhhhhNubj )}(hX8Setting the format on the ``OUTPUT`` queue does not change the list of formats available on the ``CAPTURE`` queue. An attempt to set the ``OUTPUT`` format that is not supported for the currently selected ``CAPTURE`` format will result in the encoder adjusting the requested ``OUTPUT`` format to a supported one. h]h)}(hX7Setting the format on the ``OUTPUT`` queue does not change the list of formats available on the ``CAPTURE`` queue. An attempt to set the ``OUTPUT`` format that is not supported for the currently selected ``CAPTURE`` format will result in the encoder adjusting the requested ``OUTPUT`` format to a supported one.h](hSetting the format on the }(hjY-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hja-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjY-ubh< queue does not change the list of formats available on the }(hjY-hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjs-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjY-ubh queue. An attempt to set the }(hjY-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjY-ubh9 format that is not supported for the currently selected }(hjY-hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjY-ubh; format will result in the encoder adjusting the requested }(hjY-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjY-ubh format to a supported one.}(hjY-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjU-ubah}(h]h ]h"]h$]h&]uh1j hj,hhhhhNubj )}(hEnumerating formats on the ``CAPTURE`` queue always returns the full set of supported coded formats, irrespective of the current ``OUTPUT`` format. h]h)}(hEnumerating formats on the ``CAPTURE`` queue always returns the full set of supported coded formats, irrespective of the current ``OUTPUT`` format.h](hEnumerating formats on the }(hj-hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj-ubh[ queue always returns the full set of supported coded formats, irrespective of the current }(hj-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj-ubh format.}(hj-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj-ubah}(h]h ]h"]h$]h&]uh1j hj,hhhhhNubj )}(hWhile buffers are allocated on any of the ``OUTPUT`` or ``CAPTURE`` queues, the client must not change the format on the ``CAPTURE`` queue. Drivers will return the -EBUSY error code for any such format change attempt. h]h)}(hWhile buffers are allocated on any of the ``OUTPUT`` or ``CAPTURE`` queues, the client must not change the format on the ``CAPTURE`` queue. Drivers will return the -EBUSY error code for any such format change attempt.h](h*While buffers are allocated on any of the }(hj.hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubh or }(hj.hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj!.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubh6 queues, the client must not change the format on the }(hj.hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj3.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubhU queue. Drivers will return the -EBUSY error code for any such format change attempt.}(hj.hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj.ubah}(h]h ]h"]h$]h&]uh1j hj,hhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhj,hhhhhMubh)}(hTo summarize, setting formats and allocation must always start with the ``CAPTURE`` queue and the ``CAPTURE`` queue is the master that governs the set of supported formats for the ``OUTPUT`` queue.h](hHTo summarize, setting formats and allocation must always start with the }(hjW.hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj_.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjW.ubh queue and the }(hjW.hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjq.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjW.ubhG queue is the master that governs the set of supported formats for the }(hjW.hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjW.ubh queue.}(hjW.hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj,hhubeh}(h] commit-pointsah ]h"] commit pointsah$]h&]uh1hhhhhhhhMubeh}(h](1memory-to-memory-stateful-video-encoder-interfaceheh ]h"](1memory-to-memory stateful video encoder interfaceencodereh$]h&]uh1hhhhhhhhKexpect_referenced_by_name}j.hsexpect_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}(j.hj.j.jjjNjKjj jejbjjj6j3je"jb"j#j#j+j+j,j,j.j.u nametypes}(j.j.jjNjjejj6je"j#j+j,j.uh}(hhj.hjhjKjEj jjbjjjhj3jjb"j9j#jh"j+j#j,j+j.j,jYj$u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}j.KsRparse_messages]transform_messages]hsystem_message)}(hhh]h)}(hhh]h-Hyperlink target "encoder" is not referenced.}hj=/sbah}(h]h ]h"]h$]h&]uh1hhj:/ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1j8/uba transformerN include_log] decorationNhhub.