€•NŒŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ` you can use requests only for output buffers, not for capture buffers. Attempting to add a capture buffer to a request will result in an ``EBADR`` error.”h]”hØ)”}”(hŒÇFor :ref:`memory-to-memory devices ` you can use requests only for output buffers, not for capture buffers. Attempting to add a capture buffer to a request will result in an ``EBADR`` error.”h]”(hŒFor ”…””}”(hjThžhhŸNh Nubh)”}”(hŒ):ref:`memory-to-memory devices `”h]”jj)”}”(hj^h]”hŒmemory-to-memory devices”…””}”(hj`hžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihj\ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”jjŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒmem2mem”uh1hhŸh³h KGhjTubhŒŠ you can use requests only for output buffers, not for capture buffers. Attempting to add a capture buffer to a request will result in an ”…””}”(hjThžhhŸNh Nubj+)”}”(hŒ ``EBADR``”h]”hŒEBADR”…””}”(hj€hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j*hjTubhŒ error.”…””}”(hjThžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KGhjPubah}”(h]”h ]”h"]”h$]”h&]”uh1jNhjùhžhhŸh³h NubhØ)”}”(hX4If the request contains configurations for multiple entities, individual drivers may synchronize so the requested pipeline's topology is applied before the buffers are processed. Media controller drivers do a best effort implementation since perfect atomicity may not be possible due to hardware limitations.”h]”hX6If the request contains configurations for multiple entities, individual drivers may synchronize so the requested pipeline’s topology is applied before the buffers are processed. Media controller drivers do a best effort implementation since perfect atomicity may not be possible due to hardware limitations.”…””}”(hjžhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KKhjùhžhubjO)”}”(hXfIt is not allowed to mix queuing requests with directly queuing buffers: whichever method is used first locks this in place until :ref:`VIDIOC_STREAMOFF ` is called or the device is :ref:`closed `. Attempts to directly queue a buffer when earlier a buffer was queued via a request or vice versa will result in an ``EBUSY`` error.”h]”hØ)”}”(hXfIt is not allowed to mix queuing requests with directly queuing buffers: whichever method is used first locks this in place until :ref:`VIDIOC_STREAMOFF ` is called or the device is :ref:`closed `. Attempts to directly queue a buffer when earlier a buffer was queued via a request or vice versa will result in an ``EBUSY`` error.”h]”(hŒ‚It is not allowed to mix queuing requests with directly queuing buffers: whichever method is used first locks this in place until ”…””}”(hj°hžhhŸNh Nubh)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”jj)”}”(hjºh]”hŒVIDIOC_STREAMOFF”…””}”(hj¼hžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihj¸ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”jÆŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒvidioc_streamon”uh1hhŸh³h KRhj°ubhŒ is called or the device is ”…””}”(hj°hžhhŸNh Nubh)”}”(hŒ:ref:`closed `”h]”jj)”}”(hjÞh]”hŒclosed”…””}”(hjàhžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihjÜubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”jêŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒ func-close”uh1hhŸh³h KRhj°ubhŒu. Attempts to directly queue a buffer when earlier a buffer was queued via a request or vice versa will result in an ”…””}”(hj°hžhhŸNh Nubj+)”}”(hŒ ``EBUSY``”h]”hŒEBUSY”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j*hj°ubhŒ error.”…””}”(hj°hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KRhj¬ubah}”(h]”h ]”h"]”h$]”h&]”uh1jNhjùhžhhŸh³h NubhØ)”}”(hŒzControls can still be set without a request and are applied immediately, regardless of whether a request is in use or not.”h]”hŒzControls can still be set without a request and are applied immediately, regardless of whether a request is in use or not.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KYhjùhžhubjO)”}”(hŒ\Setting the same control through a request and also directly can lead to undefined behavior!”h]”hØ)”}”(hŒ\Setting the same control through a request and also directly can lead to undefined behavior!”h]”hŒ\Setting the same control through a request and also directly can lead to undefined behavior!”…””}”(hj0hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K^hj,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jNhjùhžhhŸh³h NubhØ)”}”(hXëUser-space can :c:func:`poll()` a request file descriptor in order to wait until the request completes. A request is considered complete once all its associated buffers are available for dequeuing and all the associated controls have been updated with the values at the time of completion. Note that user-space does not need to wait for the request to complete to dequeue its buffers: buffers that are available halfway through a request can be dequeued independently of the request's state.”h]”(hŒUser-space can ”…””}”(hjDhžhhŸNh Nubh)”}”(hŒ:c:func:`poll()`”h]”j+)”}”(hjNh]”hŒpoll()”…””}”(hjPhžhhŸNh Nubah}”(h]”h ]”(juŒc”Œc-func”eh"]”h$]”h&]”uh1j*hjLubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”jZŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰Œ c:parent_key”Œsphinx.domains.c”Œ LookupKey”“”)”}”Œdata”]”jlŒ ASTIdentifier”“”)”}”Œ identifier”ŒMC”sbN†”asbjˆŒpoll”uh1hhŸh³h KahjDubhXÎ a request file descriptor in order to wait until the request completes. A request is considered complete once all its associated buffers are available for dequeuing and all the associated controls have been updated with the values at the time of completion. Note that user-space does not need to wait for the request to complete to dequeue its buffers: buffers that are available halfway through a request can be dequeued independently of the request’s state.”…””}”(hjDhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KahjùhžhubhØ)”}”(hXÆA completed request contains the state of the device after the request was executed. User-space can query that state by calling :ref:`ioctl VIDIOC_G_EXT_CTRLS ` with the request file descriptor. Calling :ref:`ioctl VIDIOC_G_EXT_CTRLS ` for a request that has been queued but not yet completed will return ``EBUSY`` since the control values might be changed at any time by the driver while the request is in flight.”h]”(hŒ€A completed request contains the state of the device after the request was executed. User-space can query that state by calling ”…””}”(hj…hžhhŸNh Nubh)”}”(hŒ4:ref:`ioctl VIDIOC_G_EXT_CTRLS `”h]”jj)”}”(hjh]”hŒioctl VIDIOC_G_EXT_CTRLS”…””}”(hj‘hžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”j›Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒvidioc_g_ext_ctrls”uh1hhŸh³h Kihj…ubhŒ+ with the request file descriptor. Calling ”…””}”(hj…hžhhŸNh Nubh)”}”(hŒ4:ref:`ioctl VIDIOC_G_EXT_CTRLS `”h]”jj)”}”(hj³h]”hŒioctl VIDIOC_G_EXT_CTRLS”…””}”(hjµhžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihj±ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”j¿Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒvidioc_g_ext_ctrls”uh1hhŸh³h Kihj…ubhŒF for a request that has been queued but not yet completed will return ”…””}”(hj…hžhhŸNh Nubj+)”}”(hŒ ``EBUSY``”h]”hŒEBUSY”…””}”(hjÕhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j*hj…ubhŒd since the control values might be changed at any time by the driver while the request is in flight.”…””}”(hj…hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h Kihjùhžhubhµ)”}”(hŒ.. _media-request-life-time:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÀŒmedia-request-life-time”uh1h´h KqhjùhžhhŸh³ubeh}”(h]”Œrequest-submission”ah ]”h"]”Œrequest submission”ah$]”h&]”uh1hÂhhÄhžhhŸh³h K?ubhÃ)”}”(hhh]”(hÈ)”}”(hŒRecycling and Destruction”h]”hŒRecycling and Destruction”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÇhjhžhhŸh³h KtubhØ)”}”(hXsFinally, a completed request can either be discarded or be reused. Calling :c:func:`close()` on a request file descriptor will make that file descriptor unusable and the request will be freed once it is no longer in use by the kernel. That is, if the request is queued and then the file descriptor is closed, then it won't be freed until the driver completed the request.”h]”(hŒKFinally, a completed request can either be discarded or be reused. Calling ”…””}”(hjhžhhŸNh Nubh)”}”(hŒ:c:func:`close()`”h]”j+)”}”(hjh]”hŒclose()”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”(jujZŒc-func”eh"]”h$]”h&]”uh1j*hjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”jZŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jkjojˆŒclose”uh1hhŸh³h KvhjubhX on a request file descriptor will make that file descriptor unusable and the request will be freed once it is no longer in use by the kernel. That is, if the request is queued and then the file descriptor is closed, then it won’t be freed until the driver completed the request.”…””}”(hjhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KvhjhžhubhØ)”}”(hŒ¶The :ref:`MEDIA_REQUEST_IOC_REINIT` will clear a request's state and make it available again. No state is retained by this operation: the request is as if it had just been allocated.”h]”(hŒThe ”…””}”(hjBhžhhŸNh Nubh)”}”(hŒ:ref:`MEDIA_REQUEST_IOC_REINIT`”h]”jj)”}”(hjLh]”hŒMEDIA_REQUEST_IOC_REINIT”…””}”(hjNhžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihjJubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”jXŒreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆjˆŒmedia_request_ioc_reinit”uh1hhŸh³h K}hjBubhŒ• will clear a request’s state and make it available again. No state is retained by this operation: the request is as if it had just been allocated.”…””}”(hjBhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K}hjhžhubeh}”(h]”(Œrecycling-and-destruction”j÷eh ]”h"]”(Œrecycling and destruction”Œmedia-request-life-time”eh$]”h&]”uh1hÂhhÄhžhhŸh³h KtŒexpect_referenced_by_name”}”jzjísŒexpect_referenced_by_id”}”j÷jísubhÃ)”}”(hhh]”(hÈ)”}”(hŒExample for a Codec Device”h]”hŒExample for a Codec Device”…””}”(hj„hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÇhjhžhhŸh³h K‚ubhØ)”}”(hX{For use-cases such as :ref:`codecs `, the request API can be used to associate specific controls to be applied by the driver for the OUTPUT buffer, allowing user-space to queue many such buffers in advance. It can also take advantage of requests' ability to capture the state of controls when the request completes to read back information that may be subject to change.”h]”(hŒFor use-cases such as ”…””}”(hj’hžhhŸNh Nubh)”}”(hŒ:ref:`codecs `”h]”jj)”}”(hjœh]”hŒcodecs”…””}”(hjžhžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihjšubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”j¨Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒmem2mem”uh1hhŸh³h K„hj’ubhXP, the request API can be used to associate specific controls to be applied by the driver for the OUTPUT buffer, allowing user-space to queue many such buffers in advance. It can also take advantage of requests’ ability to capture the state of controls when the request completes to read back information that may be subject to change.”…””}”(hj’hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K„hjhžhubhØ)”}”(hŒePut into code, after obtaining a request, user-space can assign controls and one OUTPUT buffer to it:”h]”hŒePut into code, after obtaining a request, user-space can assign controls and one OUTPUT buffer to it:”…””}”(hjÄhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K‹hjhžhubhŒ literal_block”“”)”}”(hXÎstruct v4l2_buffer buf; struct v4l2_ext_controls ctrls; int req_fd; ... if (ioctl(media_fd, MEDIA_IOC_REQUEST_ALLOC, &req_fd)) return errno; ... ctrls.which = V4L2_CTRL_WHICH_REQUEST_VAL; ctrls.request_fd = req_fd; if (ioctl(codec_fd, VIDIOC_S_EXT_CTRLS, &ctrls)) return errno; ... buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; buf.flags |= V4L2_BUF_FLAG_REQUEST_FD; buf.request_fd = req_fd; if (ioctl(codec_fd, VIDIOC_QBUF, &buf)) return errno;”h]”hXÎstruct v4l2_buffer buf; struct v4l2_ext_controls ctrls; int req_fd; ... if (ioctl(media_fd, MEDIA_IOC_REQUEST_ALLOC, &req_fd)) return errno; ... ctrls.which = V4L2_CTRL_WHICH_REQUEST_VAL; ctrls.request_fd = req_fd; if (ioctl(codec_fd, VIDIOC_S_EXT_CTRLS, &ctrls)) return errno; ... buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; buf.flags |= V4L2_BUF_FLAG_REQUEST_FD; buf.request_fd = req_fd; if (ioctl(codec_fd, VIDIOC_QBUF, &buf)) return errno;”…””}”hjÔsbah}”(h]”h ]”h"]”h$]”h&]”h±h²Œforce”‰Œlanguage”jZŒhighlight_args”}”uh1jÒhŸh³h KŽhjhžhubhØ)”}”(hŒ}Note that it is not allowed to use the Request API for CAPTURE buffers since there are no per-frame settings to report there.”h]”hŒ}Note that it is not allowed to use the Request API for CAPTURE buffers since there are no per-frame settings to report there.”…””}”(hjæhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K¢hjhžhubhØ)”}”(hŒCOnce the request is fully prepared, it can be queued to the driver:”h]”hŒCOnce the request is fully prepared, it can be queued to the driver:”…””}”(hjôhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K¥hjhžhubjÓ)”}”(hŒAif (ioctl(req_fd, MEDIA_REQUEST_IOC_QUEUE)) return errno;”h]”hŒAif (ioctl(req_fd, MEDIA_REQUEST_IOC_QUEUE)) return errno;”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”h±h²jâ‰jãjZjä}”uh1jÒhŸh³h K§hjhžhubhØ)”}”(hXUser-space can then either wait for the request to complete by calling poll() on its file descriptor, or start dequeuing CAPTURE buffers. Most likely, it will want to get CAPTURE buffers as soon as possible and this can be done using a regular :ref:`VIDIOC_DQBUF `:”h]”(hŒôUser-space can then either wait for the request to complete by calling poll() on its file descriptor, or start dequeuing CAPTURE buffers. Most likely, it will want to get CAPTURE buffers as soon as possible and this can be done using a regular ”…””}”(hjhžhhŸNh Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”jj)”}”(hjh]”hŒ VIDIOC_DQBUF”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”j'Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒ vidioc_qbuf”uh1hhŸh³h K¬hjubhŒ:”…””}”(hjhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K¬hjhžhubjÓ)”}”(hŒstruct v4l2_buffer buf; memset(&buf, 0, sizeof(buf)); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(codec_fd, VIDIOC_DQBUF, &buf)) return errno;”h]”hŒstruct v4l2_buffer buf; memset(&buf, 0, sizeof(buf)); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(codec_fd, VIDIOC_DQBUF, &buf)) return errno;”…””}”hjCsbah}”(h]”h ]”h"]”h$]”h&]”h±h²jâ‰jãjZjä}”uh1jÒhŸh³h K±hjhžhubhØ)”}”(hŒ“Note that this example assumes for simplicity that for every OUTPUT buffer there will be one CAPTURE buffer, but this does not have to be the case.”h]”hŒ“Note that this example assumes for simplicity that for every OUTPUT buffer there will be one CAPTURE buffer, but this does not have to be the case.”…””}”(hjRhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KºhjhžhubhØ)”}”(hXRWe can then, after ensuring that the request is completed via polling the request file descriptor, query control values at the time of its completion via a call to :ref:`VIDIOC_G_EXT_CTRLS `. This is particularly useful for volatile controls for which we want to query values as soon as the capture buffer is produced.”h]”(hŒ¤We can then, after ensuring that the request is completed via polling the request file descriptor, query control values at the time of its completion via a call to ”…””}”(hj`hžhhŸNh Nubh)”}”(hŒ.:ref:`VIDIOC_G_EXT_CTRLS `”h]”jj)”}”(hjjh]”hŒVIDIOC_G_EXT_CTRLS”…””}”(hjlhžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihjhubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”jvŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjˆŒvidioc_g_ext_ctrls”uh1hhŸh³h K½hj`ubhŒ€. This is particularly useful for volatile controls for which we want to query values as soon as the capture buffer is produced.”…””}”(hj`hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h K½hjhžhubjÓ)”}”(hŒÜstruct pollfd pfd = { .events = POLLPRI, .fd = req_fd }; poll(&pfd, 1, -1); ... ctrls.which = V4L2_CTRL_WHICH_REQUEST_VAL; ctrls.request_fd = req_fd; if (ioctl(codec_fd, VIDIOC_G_EXT_CTRLS, &ctrls)) return errno;”h]”hŒÜstruct pollfd pfd = { .events = POLLPRI, .fd = req_fd }; poll(&pfd, 1, -1); ... ctrls.which = V4L2_CTRL_WHICH_REQUEST_VAL; ctrls.request_fd = req_fd; if (ioctl(codec_fd, VIDIOC_G_EXT_CTRLS, &ctrls)) return errno;”…””}”hj’sbah}”(h]”h ]”h"]”h$]”h&]”h±h²jâ‰jãjZjä}”uh1jÒhŸh³h KÃhjhžhubhØ)”}”(hŒrOnce we don't need the request anymore, we can either recycle it for reuse with :ref:`MEDIA_REQUEST_IOC_REINIT`...”h]”(hŒROnce we don’t need the request anymore, we can either recycle it for reuse with ”…””}”(hj¡hžhhŸNh Nubh)”}”(hŒ:ref:`MEDIA_REQUEST_IOC_REINIT`”h]”jj)”}”(hj«h]”hŒMEDIA_REQUEST_IOC_REINIT”…””}”(hj­hžhhŸNh Nubah}”(h]”h ]”(juŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jihj©ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j‚Œ refdomain”j·Œreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆjˆŒmedia_request_ioc_reinit”uh1hhŸh³h KÍhj¡ubhŒ...”…””}”(hj¡hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KÍhjhžhubjÓ)”}”(hŒBif (ioctl(req_fd, MEDIA_REQUEST_IOC_REINIT)) return errno;”h]”hŒBif (ioctl(req_fd, MEDIA_REQUEST_IOC_REINIT)) return errno;”…””}”hjÓsbah}”(h]”h ]”h"]”h$]”h&]”h±h²jâ‰jãjZjä}”uh1jÒhŸh³h KÐhjhžhubhØ)”}”(hŒ=... or close its file descriptor to completely dispose of it.”h]”hŒ=... or close its file descriptor to completely dispose of it.”…””}”(hjâhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KÕhjhžhubjÓ)”}”(hŒclose(req_fd);”h]”hŒclose(req_fd);”…””}”hjðsbah}”(h]”h ]”h"]”h$]”h&]”h±h²jâ‰jãjZjä}”uh1jÒhŸh³h K×hjhžhubeh}”(h]”Œexample-for-a-codec-device”ah ]”h"]”Œexample for a codec device”ah$]”h&]”uh1hÂhhÄhžhhŸh³h K‚ubhÃ)”}”(hhh]”(hÈ)”}”(hŒ#Example for a Simple Capture Device”h]”hŒ#Example for a Simple Capture Device”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÇhjhžhhŸh³h KÜubhØ)”}”(hŒkWith a simple capture device, requests can be used to specify controls to apply for a given CAPTURE buffer.”h]”hŒkWith a simple capture device, requests can be used to specify controls to apply for a given CAPTURE buffer.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KÞhjhžhubjÓ)”}”(hXÑstruct v4l2_buffer buf; struct v4l2_ext_controls ctrls; int req_fd; ... if (ioctl(media_fd, MEDIA_IOC_REQUEST_ALLOC, &req_fd)) return errno; ... ctrls.which = V4L2_CTRL_WHICH_REQUEST_VAL; ctrls.request_fd = req_fd; if (ioctl(camera_fd, VIDIOC_S_EXT_CTRLS, &ctrls)) return errno; ... buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.flags |= V4L2_BUF_FLAG_REQUEST_FD; buf.request_fd = req_fd; if (ioctl(camera_fd, VIDIOC_QBUF, &buf)) return errno;”h]”hXÑstruct v4l2_buffer buf; struct v4l2_ext_controls ctrls; int req_fd; ... if (ioctl(media_fd, MEDIA_IOC_REQUEST_ALLOC, &req_fd)) return errno; ... ctrls.which = V4L2_CTRL_WHICH_REQUEST_VAL; ctrls.request_fd = req_fd; if (ioctl(camera_fd, VIDIOC_S_EXT_CTRLS, &ctrls)) return errno; ... buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.flags |= V4L2_BUF_FLAG_REQUEST_FD; buf.request_fd = req_fd; if (ioctl(camera_fd, VIDIOC_QBUF, &buf)) return errno;”…””}”hj&sbah}”(h]”h ]”h"]”h$]”h&]”h±h²jâ‰jãjZjä}”uh1jÒhŸh³h KáhjhžhubhØ)”}”(hŒCOnce the request is fully prepared, it can be queued to the driver:”h]”hŒCOnce the request is fully prepared, it can be queued to the driver:”…””}”(hj5hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h KõhjhžhubjÓ)”}”(hŒAif (ioctl(req_fd, MEDIA_REQUEST_IOC_QUEUE)) return errno;”h]”hŒAif (ioctl(req_fd, MEDIA_REQUEST_IOC_QUEUE)) return errno;”…””}”hjCsbah}”(h]”h ]”h"]”h$]”h&]”h±h²jâ‰jãjZjä}”uh1jÒhŸh³h K÷hjhžhubhØ)”}”(hŒ‰User-space can then dequeue buffers, wait for the request completion, query controls and recycle the request as in the M2M example above.”h]”hŒ‰User-space can then dequeue buffers, wait for the request completion, query controls and recycle the request as in the M2M example above.”…””}”(hjRhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h×hŸh³h Kühjhžhubeh}”(h]”Œ#example-for-a-simple-capture-device”ah ]”h"]”Œ#example for a simple capture device”ah$]”h&]”uh1hÂhhÄhžhhŸh³h KÜubeh}”(h]”(Œ request-api”hÁeh ]”h"]”(Œ request api”Œmedia-request-api”eh$]”h&]”uh1hÂhhhžhhŸh³h Kj}}”jnh¶sj}”hÁh¶subeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h³uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÇNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j–Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h³Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”(hÁ]”h¶aj÷]”jíauŒnameids”}”(jnhÁjmjjjIjFj™j–jöjójýjújzj÷jyjvjjjejbuŒ nametypes”}”(jnˆjm‰jI‰j™‰jö‰jý‰jzˆjy‰j‰je‰uh}”(hÁhÄjjhÄjFjj–jLjójœjújùj÷jjvjjjjbjuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”(hŒsystem_message”“”)”}”(hhh]”hØ)”}”(hhh]”hŒ7Hyperlink target "media-request-api" is not referenced.”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”uh1h×hjþubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”h³Œline”Kuh1jüubjý)”}”(hhh]”hØ)”}”(hhh]”hŒ=Hyperlink target "media-request-life-time" is not referenced.”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”uh1h×hjubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”jŒsource”h³Œline”Kquh1jüubeŒ transformer”NŒ include_log”]”Œ decoration”Nhžhub.