sphinx.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 c:parent_keysphinx.domains.c LookupKey)}data]j ASTIdentifier)} identifierV4LsbNasb 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 refexplicitrefwarnjjjVIDIOC_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 refexplicitrefwarnjjj 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 refexplicitrefwarnjjj 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 }(hj4hhhNhNubh)}(h:ref:`planar-apis`h]hinline)}(hj>h]h planar-apis}(hjBhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j@hj<ubah}(h]h ]h"]h$]h&]refdocj refdomainjLreftyperef refexplicitrefwarnj planar-apisuh1hhhhK#hj4ubh) and applicable structures may be used interchangeably with multi-planar API, unless specified otherwise, depending on encoder capabilities and following the general V4L2 guidelines.}(hj4hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK#hj0ubah}(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.}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjnubah}(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 }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh0 buffer A, then A’ represents a buffer on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh> queue containing data that resulted from processing buffer A.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK*hjubah}(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]jA)}(hjh]hdecoder-glossary}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j@hjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjdecoder-glossaryuh1hhhhK0hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK0hjhhubeh}(h]glossaryah ]h"]glossaryah$]h&]uh1hhhhhhhhK.ubh)}(hhh](h)}(h State Machineh]h State Machine}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhK3ubhfigure)}(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<hj9hhubah}(h]h ]h"]h$]h&]alt$DOT digraph of encoder state machinesrclangDOTuh1j7hj3ubhcaption)}(hEncoder State Machineh]hEncoder State Machine}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1jVhhhKhj3ubeh}(h]id1ah ]h"]h$]h&]altjScaptionjZuh1j1hj hhhhhNubeh}(h] state-machineah ]h"] state machineah$]h&]uh1hhhhhhhhK3ubh)}(hhh](h)}(hQuerying Capabilitiesh]hQuerying Capabilities}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjwhhhhhKVubj)}(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 refexplicitrefwarnjjjVIDIOC_ENUM_FMTuh1hhhhKXhjubh on }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKXhjubh 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&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&]bullet*uh1jhhhK[hjubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(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&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjjVIDIOC_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 }(hj]hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1jhj]ubh will be returned.}(hj]hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKahjYubah}(h]h ]h"]h$]h&]uh1j hjVubj )}(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 }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh# and then enumerate the formats on }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKdhjubah}(h]h ]h"]h$]h&]uh1j hjVubeh}(h]h ]h"]h$]h&]jjuh1jhhhKahjubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(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 refexplicitrefwarnjjjVIDIOC_ENUM_FRAMESIZESuh1hhhhKhhjubhY 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 refexplicitrefwarnjjjv4l2_frmsizeenumuh1hhhhKhhjubh }(hjhhhNhNubj)}(h``pixel_format``h]h pixel_format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhjubj)}(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)}(hjFh]hVIDIOC_ENUM_FRAMESIZES()}(hjHhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjDubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjjVIDIOC_ENUM_FRAMESIZESuh1hhhhKlhj<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&]uh1hhhhKlhj8ubah}(h]h ]h"]h$]h&]uh1j hj5ubj )}(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 }(hjwhhhNhNubh)}(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 refexplicitrefwarnjjjVIDIOC_ENUM_FRAMESIZESuh1hhhhKphjwubh 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 }(hjwhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh.}(hjwhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKphjsubah}(h]h ]h"]h$]h&]uh1j hj5ubeh}(h]h ]h"]h$]h&]jjuh1jhhhKlhjubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(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 refexplicitrefwarnjjjVIDIOC_ENUM_FRAMEINTERVALSuh1hhhhKuhjubhl 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 refexplicitrefwarnjjjv4l2_frmivalenumuh1hhhhKuhjubh }(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)}(hj2h]hv4l2_frmivalenum}(hj4hhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhj0ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjjjv4l2_frmivalenumuh1hhhhKuhjubh }hjsbj)}(h ``width``h]hwidth}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubh)}(h:c:type:`v4l2_frmivalenum`h]j)}(hjgh]hv4l2_frmivalenum}(hjihhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjeubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjjjv4l2_frmivalenumuh1hhhhKuhjubh }(hjhhhNhNubj)}(h ``height``h]hheight}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKuhjubj)}(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 refexplicitrefwarnjjjVIDIOC_ENUM_FRAMEINTERVALSuh1hhhhK{hjubh 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&]uh1hhhhK{hjubah}(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 refexplicitrefwarnjjjVIDIOC_ENUM_FRAMEINTERVALSuh1hhhhKhjubh 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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(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)}(hj9h]hVIDIOC_ENUM_FRAMEINTERVALS()}(hj;hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj7ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjjVIDIOC_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&]uh1hhhhKhj+ubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]jjuh1jhhhK{hjubeh}(h]h ]h"]h$]h&]uh1j hjhhhNhNubj )}(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 }(hjvhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubhD, if applicable, may be queried using their respective controls via }(hjvhhhNhNubh)}(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 refexplicitrefwarnjjjVIDIOC_QUERYCTRLuh1hhhhKhjvubh.}(hjvhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjrubah}(h]h ]h"]h$]h&]uh1j hjhhhhhNubj )}(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 hjhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhjwhhhhhKXubeh}(h]querying-capabilitiesah ]h"]querying capabilitiesah$]h&]uh1hhhhhhhhKVubh)}(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)}(hjh]hVIDIOC_S_FMT()}(hjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjj 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)}(hjIh]hRequired fields:}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjGubah}(h]h ]h"]h$]h&]uh1hhhhKhjCubhdefinition_list)}(hhh](hdefinition_list_item)}(hA``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](hterm)}(h``type``h]j)}(hjoh]htype}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjmubah}(h]h ]h"]h$]h&]uh1jkhhhKhjgubh definition)}(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&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjgubeh}(h]h ]h"]h$]h&]uh1jehhhKhjbubjf)}(h1``pixelformat`` the coded format to be produced. h](jl)}(h``pixelformat``h]j)}(hjh]h pixelformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhKhjubj)}(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&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhKhjbubjf)}(hm``sizeimage`` desired size of ``CAPTURE`` buffers; the encoder may adjust it to match hardware requirements. h](jl)}(h ``sizeimage``h]j)}(hj h]h sizeimage}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jkhhhKhjubj)}(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&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhKhjbubjf)}(h+``width``, ``height`` ignored (read-only). h](jl)}(h``width``, ``height``h](j)}(h ``width``h]hwidth}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjM ubh, }(hjM hhhNhNubj)}(h ``height``h]hheight}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjM ubeh}(h]h ]h"]h$]h&]uh1jkhhhKhjI ubj)}(hhh]h)}(hignored (read-only).h]hignored (read-only).}(hjz hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjw ubah}(h]h ]h"]h$]h&]uh1jhjI ubeh}(h]h ]h"]h$]h&]uh1jehhhKhjbubjf)}(h(other fields follow standard semantics. h](jl)}(h other fieldsh]h other fields}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhhhKhj ubj)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jehhhKhjbubeh}(h]h ]h"]h$]h&]uh1j`hjCubeh}(h]h ]h"]h$]h&]uh1j hj@ubj )}(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]jL)}(hj h]hReturned fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhj ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubja)}(hhh](jf)}(h4``sizeimage`` adjusted size of ``CAPTURE`` buffers. h](jl)}(h ``sizeimage``h]j)}(hj h]h sizeimage}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jkhhhKhj ubj)}(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&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj ubjf)}(h``width``, ``height`` the coded size selected by the encoder based on current state, e.g. ``OUTPUT`` format, selection rectangles, etc. (read-only). h](jl)}(h``width``, ``height``h](j)}(h ``width``h]hwidth}(hj? hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj; ubh, }(hj; hhhNhNubj)}(h ``height``h]hheight}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj; ubeh}(h]h ]h"]h$]h&]uh1jkhhhKhj7 ubj)}(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. }(hjh hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjp hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjh ubh0 format, selection rectangles, etc. (read-only).}(hjh hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhje ubah}(h]h ]h"]h$]h&]uh1jhj7 ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj ubeh}(h]h ]h"]h$]h&]uh1j`hj ubeh}(h]h ]h"]h$]h&]uh1j hj@ubeh}(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](jL)}(h **Optional.**h]h Optional.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhj 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 refexplicitrefwarnjjjVIDIOC_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]jL)}(hjZ h]hRequired fields:}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjX ubah}(h]h ]h"]h$]h&]uh1hhhhKhjT ubja)}(hhh](jf)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](jl)}(h``type``h]j)}(hjx h]htype}(hjz hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjv ubah}(h]h ]h"]h$]h&]uh1jkhhhKhjr ubj)}(hhh]h)}(h6a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.h](ha }(hj hhhNhNubj)}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hj hhhNhNubah}(h]h ]h"]h$]h&]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&]uh1jhjr ubeh}(h]h ]h"]h$]h&]uh1jehhhKhjo ubjf)}(h(other fields follow standard semantics. h](jl)}(h other fieldsh]h other fields}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhhhKhj ubj)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jehhhKhjo ubeh}(h]h ]h"]h$]h&]uh1j`hjT ubeh}(h]h ]h"]h$]h&]uh1j hjQ 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]jL)}(hj h]hReturned fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhj ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubja)}(hhh](jf)}(hg``pixelformat`` raw format supported for the coded format currently selected on the ``CAPTURE`` queue. h](jl)}(h``pixelformat``h]j)}(hj- h]h pixelformat}(hj/ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj+ ubah}(h]h ]h"]h$]h&]uh1jkhhhKhj' ubj)}(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 }(hjE hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjM hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjE ubh queue.}(hjE hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjB ubah}(h]h ]h"]h$]h&]uh1jhj' ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj$ ubjf)}(h(other fields follow standard semantics. h](jl)}(h other fieldsh]h other fields}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhhhKhjq ubj)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjq ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj$ ubeh}(h]h ]h"]h$]h&]uh1j`hj ubeh}(h]h ]h"]h$]h&]uh1j hjQ 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 refexplicitrefwarnjjj 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]jL)}(hj h]hRequired fields:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhj ubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubja)}(hhh](jf)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](jl)}(h``type``h]j)}(hj& h]htype}(hj( hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ ubah}(h]h ]h"]h$]h&]uh1jkhhhKhj ubj)}(hhh]h)}(h6a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.h](ha }(hj> hhhNhNubj)}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hjF hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj> ubh enum appropriate for }(hj> hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjX hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj> ubh.}(hj> hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj; ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj ubjf)}(h*``pixelformat`` raw format of the source. h](jl)}(h``pixelformat``h]j)}(hj h]h pixelformat}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jkhhhKhj| ubj)}(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&]uh1jhj| ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj ubjf)}(h)``width``, ``height`` source resolution. h](jl)}(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&]uh1jkhhhKhj ubj)}(hhh]h)}(hsource resolution.h]hsource resolution.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj ubjf)}(h(other fields follow standard semantics. h](jl)}(h other fieldsh]h other fields}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhhhKhj ubj)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jehhhKhj ubeh}(h]h ]h"]h$]h&]uh1j`hj 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]jL)}(hj@h]hReturned fields:}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1jKhj>ubah}(h]h ]h"]h$]h&]uh1hhhhKhj:ubja)}(hhh](jf)}(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](jl)}(h``width``, ``height``h](j)}(h ``width``h]hwidth}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj\ubh, }(hj\hhhNhNubj)}(h ``height``h]hheight}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj\ubeh}(h]h ]h"]h$]h&]uh1jkhhhKhjXubj)}(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 }(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 refexplicitrefwarnjjjVIDIOC_ENUM_FRAMESIZESuh1hhhhKhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjXubeh}(h]h ]h"]h$]h&]uh1jehhhKhjUubjf)}(h(other fields follow standard semantics. h](jl)}(h other fieldsh]h other fields}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhhhKhjubj)}(hhh]h)}(hfollow standard semantics.h]hfollow standard semantics.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhKhjUubeh}(h]h ]h"]h$]h&]uh1j`hj: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}(hj hhhNhNubah}(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}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1jhj;ubh queue via }(hj;hhhNhNubh)}(h:c:func:`VIDIOC_S_PARM`h]j)}(hjWh]hVIDIOC_S_PARM()}(hjYhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjUubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjj VIDIOC_S_PARMuh1hhhhKhj;ubh1. This also sets the coded frame interval on the }(hj;hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj;ubh queue to the same value.}(hj;hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj7ubj)}(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]jL)}(hjh]hRequired fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubja)}(hhh](jf)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](jl)}(h``type``h]j)}(hjh]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhKhjubj)}(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&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhKhjubjf)}(hI``parm.output`` set all fields except ``parm.output.timeperframe`` to 0. h](jl)}(h``parm.output``h]j)}(hjh]h parm.output}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhKhj ubj)}(hhh]h)}(h8set all fields except ``parm.output.timeperframe`` to 0.h](hset all fields except }(hj+hhhNhNubj)}(h``parm.output.timeperframe``h]hparm.output.timeperframe}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj+ubh to 0.}(hj+hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj(ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jehhhKhjubjf)}(hs``parm.output.timeperframe`` the desired frame interval; the encoder may adjust it to match hardware requirements. h](jl)}(h``parm.output.timeperframe``h]j)}(hj]h]hparm.output.timeperframe}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj[ubah}(h]h ]h"]h$]h&]uh1jkhhhKhjWubj)}(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.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjrubah}(h]h ]h"]h$]h&]uh1jhjWubeh}(h]h ]h"]h$]h&]uh1jehhhKhjubeh}(h]h ]h"]h$]h&]uh1j`hjubeh}(h]h ]h"]h$]h&]uh1j hjubj )}(hT**Returned fields:** ``parm.output.timeperframe`` the adjusted frame interval. h](h)}(h**Returned fields:**h]jL)}(hjh]hReturned fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubja)}(hhh]jf)}(h:``parm.output.timeperframe`` the adjusted frame interval. h](jl)}(h``parm.output.timeperframe``h]j)}(hjh]hparm.output.timeperframe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhKhjubj)}(hhh]h)}(hthe adjusted frame interval.h]hthe adjusted frame interval.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhKhjubah}(h]h ]h"]h$]h&]uh1j`hjubeh}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhj7ubj )}(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}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjubh 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}(hj5hhhNhNubah}(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&]uh1hhhhMhjubh)}(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 }(hjMhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjMubh 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.}(hjMhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j hj7ubj )}(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}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh deals with }(hjwhhhNhNubj")}(h*frames*h]hframes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hjwubh|, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.}(hjwhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjsubah}(h]h ]h"]h$]h&]uh1j hj7ubhnote)}(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.dh]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&]uh1jhj7ubeh}(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](jL)}(h **Optional**h]hOptional}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjubh% Set the coded frame interval on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(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&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjj 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]jA)}(hj@h]h$V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL}(hjBhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j@hj>ubah}(h]h ]h"]h$]h&]refdocj refdomainjLreftyperef 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]jL)}(hjqh]hRequired fields:}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjoubah}(h]h ]h"]h$]h&]uh1hhhhM hjkubja)}(hhh](jf)}(hA``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE``. h](jl)}(h``type``h]j)}(hjh]htype}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhM#hjubj)}(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&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhM#hjubjf)}(hK``parm.capture`` set all fields except ``parm.capture.timeperframe`` to 0. h](jl)}(h``parm.capture``h]j)}(hjh]h parm.capture}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhM&hjubj)}(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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh to 0.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM&hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhM&hjubjf)}(hz``parm.capture.timeperframe`` the desired coded frame interval; the encoder may adjust it to match hardware requirements. h](jl)}(h``parm.capture.timeperframe``h]j)}(hj5h]hparm.capture.timeperframe}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj3ubah}(h]h ]h"]h$]h&]uh1jkhhhM*hj/ubj)}(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.}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM)hjJubah}(h]h ]h"]h$]h&]uh1jhj/ubeh}(h]h ]h"]h$]h&]uh1jehhhM*hjubeh}(h]h ]h"]h$]h&]uh1j`hjkubeh}(h]h ]h"]h$]h&]uh1j hjhubj )}(hU**Returned fields:** ``parm.capture.timeperframe`` the adjusted frame interval. h](h)}(h**Returned fields:**h]jL)}(hjyh]hReturned fields:}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjwubah}(h]h ]h"]h$]h&]uh1hhhhM,hjsubja)}(hhh]jf)}(h;``parm.capture.timeperframe`` the adjusted frame interval. h](jl)}(h``parm.capture.timeperframe``h]j)}(hjh]hparm.capture.timeperframe}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhM/hjubj)}(hhh]h)}(hthe adjusted frame interval.h]hthe adjusted frame interval.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM/hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhM/hjubah}(h]h ]h"]h$]h&]uh1j`hjsubeh}(h]h ]h"]h$]h&]uh1j hjhubeh}(h]h ]h"]h$]h&]jjuh1jhhhM hjubj )}(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&]uh1j!hjubh- set the rate at which buffers arrive on the }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(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&]uh1hhhhM3hjubah}(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}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1jhj?ubh deals with }(hj?hhhNhNubj")}(h*frames*h]hframes}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1j!hj?ubh|, not fields. So for interlaced formats this is the time per two fields, since a frame consists of a top and a bottom field.}(hj?hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM:hj;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 }(hjwhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjwubh queue.}(hjwhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM@hjsubh)}(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&]uh1hhhhMChjsubeh}(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](jL)}(h **Optional.**h]h Optional.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjubh8 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 refexplicitrefwarnjjjVIDIOC_S_SELECTIONuh1hhhhMFhjubh 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&]uh1hhhhMFhjubj)}(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]jL)}(hj!h]hRequired fields:}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjubah}(h]h ]h"]h$]h&]uh1hhhhMJhjubja)}(hhh](jf)}(h@``type`` a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``. h](jl)}(h``type``h]j)}(hj?h]htype}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=ubah}(h]h ]h"]h$]h&]uh1jkhhhMMhj9ubj)}(hhh]h)}(h6a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``.h](ha }(hjWhhhNhNubj)}(h``V4L2_BUF_TYPE_*``h]hV4L2_BUF_TYPE_*}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjWubh enum appropriate for }(hjWhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjWubh.}(hjWhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMMhjTubah}(h]h ]h"]h$]h&]uh1jhj9ubeh}(h]h ]h"]h$]h&]uh1jehhhMMhj6ubjf)}(h)``target`` set to ``V4L2_SEL_TGT_CROP``. h](jl)}(h ``target``h]j)}(hjh]htarget}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jkhhhMPhjubj)}(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&]uh1hhhhMPhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhMPhj6ubjf)}(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](jl)}(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}(hj hhhNhNubah}(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&]uh1jkhhhMUhjubj)}(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 }(hj4hhhNhNubhtitle_reference)}(h`V4L2_SEL_TGT_CROP_BOUNDS`h]hV4L2_SEL_TGT_CROP_BOUNDS}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj4ubhT rectangle and may be subject to adjustment to match codec and hardware constraints.}(hj4hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMShj1ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhMUhj6ubeh}(h]h ]h"]h$]h&]uh1j`hjubeh}(h]h ]h"]h$]h&]uh1j hjubj )}(hv**Returned fields:** ``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle adjusted by the encoder. h](h)}(h**Returned fields:**h]jL)}(hjth]hReturned fields:}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1jKhjrubah}(h]h ]h"]h$]h&]uh1hhhhMWhjnubja)}(hhh]jf)}(h\``r.left``, ``r.top``, ``r.width``, ``r.height`` visible rectangle adjusted by the encoder. h](jl)}(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&]uh1jkhhhMZhjubj)}(hhh]h)}(h*visible rectangle adjusted by the encoder.h]h*visible rectangle adjusted by the encoder.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMZhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jehhhMZhjubah}(h]h ]h"]h$]h&]uh1j`hjnubeh}(h]h ]h"]h$]h&]uh1j hjubj )}(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&]uh1hhhhMhjHhhubh)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX buffers and any specific timing of buffers becoming available to dequeue. Specifically:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjHhhubj)}(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 }(hjJhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjJubh0 may result in more than one buffer produced on }(hjJhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjJubh (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),}(hjJhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjFubah}(h]h ]h"]h$]h&]uh1j hjChhhhhNubj )}(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 }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh* may result in a buffer being produced on }(hjhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh< later into encode process, and/or after processing further }(hjhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhJ buffers, or be returned out of order, e.g. if display reordering is used,}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j hjChhhhhNubj )}(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 hjChhhhhNubj )}(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 }(hj4hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj4ubhX may not become available to dequeue instantly after being encoded into a corresponding }(hj4hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj4ubh_ buffer, e.g. if the encoder needs to use the frame as a reference for encoding further frames.}(hj4hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj0ubah}(h]h ]h"]h$]h&]uh1j hjChhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjHhhubj)}(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 }(hjvhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh buffers with }(hjvhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh6 buffers they originated from, the client can set the }(hjvhhhNhNubj)}(h ``timestamp``h]h timestamp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh field of the }(hjvhhhNhNubh)}(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 refexplicitrefwarnjjj v4l2_bufferuh1hhhhMhjvubh struct when queuing an }(hjvhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh buffer. The }(hjvhhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh. buffer(s), which resulted from encoding that }(hjvhhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh buffer will have their }(hjvhhhNhNubj)}(h ``timestamp``h]h timestamp}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubh+ field set to the same value when dequeued.}(hjvhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjrubh)}(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}(hj? hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj% ubh) buffer, the following cases are defined:}(hj% hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjrubj)}(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 }(hj^ hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjf hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^ ubh buffer generates multiple }(hj^ hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^ ubh buffers: the same }(hj^ hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^ ubh& timestamp will be copied to multiple }(hj^ hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^ ubh buffers,}(hj^ hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjZ ubah}(h]h ]h"]h$]h&]uh1j hjW 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 hjW ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjrubeh}(h]h ]h"]h$]h&]uh1jhjHhhhNhNubj)}(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}(hj2!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)}(hjF!h]h v4l2_buffer}(hjH!hhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjD!ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjjj v4l2_bufferuh1hhhhMhj*!ubh0 struct when dequeued. See the documentation of }(hj*!hhhNhNubh)}(h:c:type:`v4l2_buffer`h]j)}(hji!h]h v4l2_buffer}(hjk!hhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjg!ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjjj 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&]uh1jhjHhhhhhNubh)}(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&]uh1hhhhMhjHhhubj)}(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&]uh1hhhhM hj!ubah}(h]h ]h"]h$]h&]uh1j hj!hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjHhhubj)}(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}(hj1"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}(hjC"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&]uh1jhjHhhhhhNubh)}(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.0}(hja"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjHhhubeh}(h]encodingah ]h"]encodingah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hEncoding Parameter Changesh]hEncoding Parameter Changes}(hjz"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjw"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 }(hj"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 refexplicitrefwarnjjj VIDIOC_S_CTRLuh1hhhhMhj"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.}(hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjw"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!hjw"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]jA)}(hj"h]hmedia-request-api}(hj"hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j@hj"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(hjw"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 }(hj6#hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj>#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6#ubh- buffers have been processed and the related }(hj6#hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjP#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6#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 }(hj6#hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjb#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6#ubh0 buffers queued before the sequence was started.}(hj6#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM0hj%#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 }(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 refexplicitrefwarnjjjVIDIOC_ENCODER_CMDuh1hhhhM6hj#ubh.}(hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM6hj}#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]jL)}(hj#h]hRequired fields:}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jKhj#ubah}(h]h ]h"]h$]h&]uh1hhhhM8hj#ubja)}(hhh](jf)}(h&``cmd`` set to ``V4L2_ENC_CMD_STOP``. h](jl)}(h``cmd``h]j)}(hj#h]hcmd}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubah}(h]h ]h"]h$]h&]uh1jkhhhM;hj#ubj)}(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&]uh1jhj#ubeh}(h]h ]h"]h$]h&]uh1jehhhM;hj#ubjf)}(h``flags`` set to 0. h](jl)}(h ``flags``h]j)}(hj#$h]hflags}(hj%$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj!$ubah}(h]h ]h"]h$]h&]uh1jkhhhM>hj$ubj)}(hhh]h)}(h set to 0.h]h set to 0.}(hj;$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hj8$ubah}(h]h ]h"]h$]h&]uh1jhj$ubeh}(h]h ]h"]h$]h&]uh1jehhhM>hj#ubjf)}(h``pts`` set to 0. h](jl)}(h``pts``h]j)}(hj[$h]hpts}(hj]$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjY$ubah}(h]h ]h"]h$]h&]uh1jkhhhMAhjU$ubj)}(hhh]h)}(h set to 0.h]h set to 0.}(hjs$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjp$ubah}(h]h ]h"]h$]h&]uh1jhjU$ubeh}(h]h ]h"]h$]h&]uh1jehhhMAhj#ubeh}(h]h ]h"]h$]h&]uh1j`hj#ubeh}(h]h ]h"]h$]h&]uh1j hj#ubah}(h]h ]h"]h$]h&]jjuh1jhhhM8hj}#ubjI)}(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 refexplicitrefwarnjjjVIDIOC_ENCODER_CMDuh1hhhhMEhj$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&]uh1hhhhMEhj$ubah}(h]h ]h"]h$]h&]uh1jHhj}#ubeh}(h]h ]h"]h$]h&]uh1j hjz#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)}(hj6%h]hVIDIOC_ENCODER_CMD()}(hj8%hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhj4%ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjjVIDIOC_ENCODER_CMDuh1hhhhMKhj%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&]uh1hhhhMKhj%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 }(hjd%hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjl%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjd%ubh) buffers, until a buffer marked with the }(hjd%hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj~%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjd%ubh flag is dequeued,}(hjd%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMPhj`%ubjI)}(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 refexplicitrefwarnjjj v4l2_bufferuh1hhhhMUhj%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&]uh1hhhhMUhj%ubah}(h]h ]h"]h$]h&]uh1jHhj`%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 refexplicitrefwarnjjj VIDIOC_DQBUFuh1hhhhM[hj%ubh.}(hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM[hj%ubah}(h]h ]h"]h$]h&]uh1jhj`%ubeh}(h]h ]h"]h$]h&]uh1j hj]%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 }(hjL&hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjT&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjL&ubh2 buffers, until all the buffers queued before the }(hjL&hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hjf&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjL&ubh command are dequeued,}(hjL&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM_hjH&ubah}(h]h ]h"]h$]h&]uh1j hj]%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 }(hj&hhhNhNubj)}(h``V4L2_EVENT_EOS``h]hV4L2_EVENT_EOS}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubh' event, if the client subscribes to it.}(hj&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMbhj&ubah}(h]h ]h"]h$]h&]uh1j hj]%ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMPhj%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&]uh1hhhhMfhj&ubah}(h]h ]h"]h$]h&]uh1jhj%ubeh}(h]h ]h"]h$]h&]uh1j hjz#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}(hj8'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&]uh1hhhhMkhj&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}(hj['hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjW'ubhn - the encoder will not be reset and will resume operation normally, with all the state from before the drain,}(hjW'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMphjS'ubah}(h]h ]h"]h$]h&]uh1j hjP'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 }(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 refexplicitrefwarnjjjVIDIOC_STREAMOFFuh1hhhhMshj}'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 refexplicitrefwarnjjjVIDIOC_STREAMONuh1hhhhMshj}'ubh on the }(hj}'hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj}'ubh, queue - the encoder will be reset (see the }(hj}'hhhNhNubj=)}(h`Reset`h]hReset}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj}'ubh$ sequence) and then resume encoding,}(hj}'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMshjy'ubah}(h]h ]h"]h$]h&]uh1j hjP'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 refexplicitrefwarnjjjVIDIOC_STREAMOFFuh1hhhhMwhj'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 refexplicitrefwarnjjjVIDIOC_STREAMONuh1hhhhMwhj'ubh on the }(hj'hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjM(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}(hj_(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubh queue between }(hj'hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hjq(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubh and }(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 refexplicitrefwarnjjjVIDIOC_STREAMOFFuh1hhhhMwhj'ubh will be discarded.}(hj'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMwhj'ubah}(h]h ]h"]h$]h&]uh1j hjP'ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMphj&ubeh}(h]h ]h"]h$]h&]uh1j hjz#hhhNhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhj%#hhhhhM6ubj)}(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 refexplicitrefwarnjjjVIDIOC_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:}(hjA)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 }(hjV)hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj^)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjV)ubh queue at the time the }(hjV)hhhNhNubj)}(h``V4L2_ENC_CMD_STOP``h]hV4L2_ENC_CMD_STOP}(hjp)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjV)ubh_ command was issued, the drain sequence completes immediately and the encoder returns an empty }(hjV)hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjV)ubh buffer with the }(hjV)hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjV)ubh flag set.}(hjV)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjR)ubah}(h]h ]h"]h$]h&]uh1j hjO)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 hjO)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 refexplicitrefwarnjjjVIDIOC_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}(hjA*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 hjO)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 }(hjc*hhhNhNubh)}(h:c:func:`VIDIOC_STREAMOFF`h]j)}(hjm*h]hVIDIOC_STREAMOFF()}(hjo*hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jhjk*ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjjjVIDIOC_STREAMOFFuh1hhhhMhjc*ubh is called on the }(hjc*hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjc*ubh^ queue in the middle of the drain sequence, the drain sequence completes immediately and next }(hjc*hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjc*ubh( buffer will be returned empty with the }(hjc*hhhNhNubj)}(h``V4L2_BUF_FLAG_LAST``h]hV4L2_BUF_FLAG_LAST}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjc*ubh flag set.}(hjc*hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj_*ubah}(h]h ]h"]h$]h&]uh1j hjO)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 refexplicitrefwarnjjjVIDIOC_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&]uh1hhhhMhj7+ubah}(h]h ]h"]h$]h&]uh1j hj4+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.}(hjS+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjO+ubah}(h]h ]h"]h$]h&]uh1j hj4+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.}(hjm+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 }(hj+hhhNhNubj=)}(h`Drain`h]hDrain}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj+ubh\ sequence to ensure all the in-flight encoding finishes and respective buffers are dequeued.}(hj+hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj~+ubah}(h]h ]h"]h$]h&]uh1j hj{+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 refexplicitrefwarnjjjVIDIOC_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 hj{+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 refexplicitrefwarnjjjVIDIOC_STREAMONuh1hhhhMhj ,ubhO and continue with regular encoding sequence. The encoded frames produced into }(hj ,hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjH,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}(hjZ,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}(hjl,hhhNhNubah}(h]h ]h"]h$]h&]uh1j<hj ,ubh of the }(hj ,hhhNhNubj=)}(h`Drain`h]hDrain}(hj~,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 hj{+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}(hj4-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,-ubh= queue always returns only formats supported for the current }(hj,-hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjF-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 }(hjh-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hjp-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjh-ubh< queue does not change the list of formats available on the }(hjh-hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjh-ubh queue. An attempt to set the }(hjh-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjh-ubh9 format that is not supported for the currently selected }(hjh-hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjh-ubh; format will result in the encoder adjusting the requested }(hjh-hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjh-ubh format to a supported one.}(hjh-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjd-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}(hj0.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubh6 queues, the client must not change the format on the }(hj.hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjB.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 }(hjf.hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hjn.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjf.ubh queue and the }(hjf.hhhNhNubj)}(h ``CAPTURE``h]hCAPTURE}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjf.ubhG queue is the master that governs the set of supported formats for the }(hjf.hhhNhNubj)}(h ``OUTPUT``h]hOUTPUT}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjf.ubh queue.}(hjf.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.jjjNjKjjjtjqjjjEjBjt"jq"j"#j#j+j+j,j,j.j.u nametypes}(j.j.jjNjjtjjEjt"j"#j+j,j.uh}(hhj.hjhjKjEjjjqj jjwjBjjq"jHj#jw"j+j%#j,j+j.j,jhj3u 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.}hjL/sbah}(h]h ]h"]h$]h&]uh1hhjI/ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jG/uba transformerN include_log] decorationNhhub.