€•uŒ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”Œ1/translations/zh_CN/userspace-api/media/v4l/userp”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/zh_TW/userspace-api/media/v4l/userp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/it_IT/userspace-api/media/v4l/userp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ja_JP/userspace-api/media/v4l/userp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ko_KR/userspace-api/media/v4l/userp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/pt_BR/userspace-api/media/v4l/userp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/sp_SP/userspace-api/media/v4l/userp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later”h]”hŒ8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒK/var/lib/git/docbuild/linux/Documentation/userspace-api/media/v4l/userp.rst”h´KubhŒtarget”“”)”}”(hŒ .. _userp:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œuserp”uh1hÈh´Khhh²hh³hÇubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒStreaming I/O (User Pointers)”h]”hŒStreaming I/O (User Pointers)”…””}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´KubhŒ paragraph”“”)”}”(hXŒInput and output devices support this I/O method when the ``V4L2_CAP_STREAMING`` flag in the ``capabilities`` field of struct :c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl is set. If the particular user pointer method (not only memory mapping) is supported must be determined by calling the :ref:`VIDIOC_REQBUFS` ioctl with the memory type set to ``V4L2_MEMORY_USERPTR``.”h]”(hŒ:Input and output devices support this I/O method when the ”…””}”(hhíh²hh³Nh´NubhŒliteral”“”)”}”(hŒ``V4L2_CAP_STREAMING``”h]”hŒV4L2_CAP_STREAMING”…””}”(hh÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hõhhíubhŒ flag in the ”…””}”(hhíh²hh³Nh´Nubhö)”}”(hŒ``capabilities``”h]”hŒ capabilities”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hõhhíubhŒ field of struct ”…””}”(hhíh²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_capability`”h]”hö)”}”(hjh]”hŒv4l2_capability”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œc”Œc-type”eh"]”h$]”h&]”uh1hõhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œuserspace-api/media/v4l/userp”Œ refdomain”j*Œreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰Œ c:parent_key”Œsphinx.domains.c”Œ LookupKey”“”)”}”Œdata”]”j=Œ ASTIdentifier”“”)”}”Œ identifier”ŒV4L”sbN†”asbŒ reftarget”Œv4l2_capability”uh1hh³hÇh´K hhíubhŒ returned by the ”…””}”(hhíh²hh³Nh´Nubh)”}”(hŒ:ref:`VIDIOC_QUERYCAP`”h]”hŒinline”“”)”}”(hjSh]”hŒVIDIOC_QUERYCAP”…””}”(hjWh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjQubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jaŒreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆjKŒvidioc_querycap”uh1hh³hÇh´K hhíubhŒ~ ioctl is set. If the particular user pointer method (not only memory mapping) is supported must be determined by calling the ”…””}”(hhíh²hh³Nh´Nubh)”}”(hŒ:ref:`VIDIOC_REQBUFS`”h]”jV)”}”(hjyh]”hŒVIDIOC_REQBUFS”…””}”(hj{h²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjwubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j…Œreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆjKŒvidioc_reqbufs”uh1hh³hÇh´K hhíubhŒ# ioctl with the memory type set to ”…””}”(hhíh²hh³Nh´Nubhö)”}”(hŒ``V4L2_MEMORY_USERPTR``”h]”hŒV4L2_MEMORY_USERPTR”…””}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hõhhíubhŒ.”…””}”(hhíh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K hhØh²hubhì)”}”(hX¦This I/O method combines advantages of the read/write and memory mapping methods. Buffers (planes) are allocated by the application itself, and can reside for example in virtual or shared memory. Only pointers to data are exchanged, these pointers and meta-information are passed in struct :c:type:`v4l2_buffer` (or in struct :c:type:`v4l2_plane` in the multi-planar API case). The driver must be switched into user pointer I/O mode by calling the :ref:`VIDIOC_REQBUFS` with the desired buffer type. No buffers (planes) are allocated beforehand, consequently they are not indexed and cannot be queried like mapped buffers with the :ref:`VIDIOC_QUERYBUF ` ioctl.”h]”(hX"This I/O method combines advantages of the read/write and memory mapping methods. Buffers (planes) are allocated by the application itself, and can reside for example in virtual or shared memory. Only pointers to data are exchanged, these pointers and meta-information are passed in struct ”…””}”(hj³h²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_buffer`”h]”hö)”}”(hj½h]”hŒ v4l2_buffer”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-type”eh"]”h$]”h&]”uh1hõhj»ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒ v4l2_buffer”uh1hh³hÇh´Khj³ubhŒ (or in struct ”…””}”(hj³h²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_plane`”h]”hö)”}”(hjàh]”hŒ v4l2_plane”…””}”(hjâh²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-type”eh"]”h$]”h&]”uh1hõhjÞubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒ v4l2_plane”uh1hh³hÇh´Khj³ubhŒf in the multi-planar API case). The driver must be switched into user pointer I/O mode by calling the ”…””}”(hj³h²hh³Nh´Nubh)”}”(hŒ:ref:`VIDIOC_REQBUFS`”h]”jV)”}”(hjh]”hŒVIDIOC_REQBUFS”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jŒreftype”Œref”Œ refexplicit”‰Œrefwarn”ˆjKŒvidioc_reqbufs”uh1hh³hÇh´Khj³ubhŒ¢ with the desired buffer type. No buffers (planes) are allocated beforehand, consequently they are not indexed and cannot be queried like mapped buffers with the ”…””}”(hj³h²hh³Nh´Nubh)”}”(hŒ(:ref:`VIDIOC_QUERYBUF `”h]”jV)”}”(hj'h]”hŒVIDIOC_QUERYBUF”…””}”(hj)h²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhj%ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j3Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_querybuf”uh1hh³hÇh´Khj³ubhŒ ioctl.”…””}”(hj³h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubh×)”}”(hhh]”(hÜ)”}”(hŒ4Example: Initiating streaming I/O with user pointers”h]”hŒ4Example: Initiating streaming I/O with user pointers”…””}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjOh²hh³hÇh´KubhŒ literal_block”“”)”}”(hX~struct v4l2_requestbuffers reqbuf; memset (&reqbuf, 0, sizeof (reqbuf)); reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; reqbuf.memory = V4L2_MEMORY_USERPTR; if (ioctl (fd, VIDIOC_REQBUFS, &reqbuf) == -1) { if (errno == EINVAL) printf ("Video capturing or user pointer streaming is not supported\\n"); else perror ("VIDIOC_REQBUFS"); exit (EXIT_FAILURE); }”h]”hX~struct v4l2_requestbuffers reqbuf; memset (&reqbuf, 0, sizeof (reqbuf)); reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; reqbuf.memory = V4L2_MEMORY_USERPTR; if (ioctl (fd, VIDIOC_REQBUFS, &reqbuf) == -1) { if (errno == EINVAL) printf ("Video capturing or user pointer streaming is not supported\\n"); else perror ("VIDIOC_REQBUFS"); exit (EXIT_FAILURE); }”…””}”hjbsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”j*Œhighlight_args”}”uh1j`h³hÇh´K!hjOh²hubhì)”}”(hXCBuffer (plane) addresses and sizes are passed on the fly with the :ref:`VIDIOC_QBUF ` ioctl. Although buffers are commonly cycled, applications can pass different addresses and sizes at each :ref:`VIDIOC_QBUF ` call. If required by the hardware the driver swaps memory pages within physical memory to create a continuous area of memory. This happens transparently to the application in the virtual memory subsystem of the kernel. When buffer pages have been swapped out to disk they are brought back and finally locked in physical memory for DMA. [#f1]_”h]”(hŒBBuffer (plane) addresses and sizes are passed on the fly with the ”…””}”(hjth²hh³Nh´Nubh)”}”(hŒ :ref:`VIDIOC_QBUF `”h]”jV)”}”(hj~h]”hŒ VIDIOC_QBUF”…””}”(hj€h²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhj|ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jŠŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ vidioc_qbuf”uh1hh³hÇh´K2hjtubhŒj ioctl. Although buffers are commonly cycled, applications can pass different addresses and sizes at each ”…””}”(hjth²hh³Nh´Nubh)”}”(hŒ :ref:`VIDIOC_QBUF `”h]”jV)”}”(hj¢h]”hŒ VIDIOC_QBUF”…””}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j®Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ vidioc_qbuf”uh1hh³hÇh´K2hjtubhXQ call. If required by the hardware the driver swaps memory pages within physical memory to create a continuous area of memory. This happens transparently to the application in the virtual memory subsystem of the kernel. When buffer pages have been swapped out to disk they are brought back and finally locked in physical memory for DMA. ”…””}”(hjth²hh³Nh´NubhŒfootnote_reference”“”)”}”(hŒ[#f1]_”h]”hŒ1”…””}”(hjÆh²hh³Nh´Nubah}”(h]”Œid1”ah ]”h"]”h$]”h&]”Œauto”KhÔŒf1”Œdocname”j6uh1jÄhjtŒresolved”Kubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K2hjOh²hubhì)”}”(hXªFilled or displayed buffers are dequeued with the :ref:`VIDIOC_DQBUF ` ioctl. The driver can unlock the memory pages at any time between the completion of the DMA and this ioctl. The memory is also unlocked when :ref:`VIDIOC_STREAMOFF ` is called, :ref:`VIDIOC_REQBUFS`, or when the device is closed. Applications must take care not to free buffers without dequeuing. Firstly, the buffers remain locked for longer, wasting physical memory. Secondly the driver will not be notified when the memory is returned to the application's free list and subsequently reused for other purposes, possibly completing the requested DMA and overwriting valuable data.”h]”(hŒ2Filled or displayed buffers are dequeued with the ”…””}”(hjßh²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”jV)”}”(hjéh]”hŒ VIDIOC_DQBUF”…””}”(hjëh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjçubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jõŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ vidioc_qbuf”uh1hh³hÇh´K`”h]”jV)”}”(hj h]”hŒVIDIOC_STREAMOFF”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_streamon”uh1hh³hÇh´K` blocks when no buffer is in the outgoing queue. When the ``O_NONBLOCK`` flag was given to the :c:func:`open()` function, :ref:`VIDIOC_DQBUF ` returns immediately with an ``EAGAIN`` error code when no buffer is available. The :ref:`select() ` or :c:func:`poll()` function are always available.”h]”(hXQFor capturing applications it is customary to enqueue a number of empty buffers, to start capturing and enter the read loop. Here the application waits until a filled buffer can be dequeued, and re-enqueues the buffer when the data is no longer needed. Output applications fill and enqueue buffers, when enough buffers are stacked up output is started. In the write loop, when the application runs out of free buffers it must wait until an empty buffer can be dequeued and reused. Two methods exist to suspend execution of the application until one or more buffers can be dequeued. By default ”…””}”(hjYh²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”jV)”}”(hjch]”hŒ VIDIOC_DQBUF”…””}”(hjeh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjaubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”joŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ vidioc_qbuf”uh1hh³hÇh´KHhjYubhŒ: blocks when no buffer is in the outgoing queue. When the ”…””}”(hjYh²hh³Nh´Nubhö)”}”(hŒ``O_NONBLOCK``”h]”hŒ O_NONBLOCK”…””}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hõhjYubhŒ flag was given to the ”…””}”(hjYh²hh³Nh´Nubh)”}”(hŒ:c:func:`open()`”h]”hö)”}”(hj™h]”hŒopen()”…””}”(hj›h²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-func”eh"]”h$]”h&]”uh1hõhj—ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒopen”uh1hh³hÇh´KHhjYubhŒ function, ”…””}”(hjYh²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”jV)”}”(hj¼h]”hŒ VIDIOC_DQBUF”…””}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjºubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jÈŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ vidioc_qbuf”uh1hh³hÇh´KHhjYubhŒ returns immediately with an ”…””}”(hjYh²hh³Nh´Nubhö)”}”(hŒ ``EAGAIN``”h]”hŒEAGAIN”…””}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hõhjYubhŒ- error code when no buffer is available. The ”…””}”(hjYh²hh³Nh´Nubh)”}”(hŒ:ref:`select() `”h]”jV)”}”(hjòh]”hŒselect()”…””}”(hjôh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjðubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jþŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ func-select”uh1hh³hÇh´KHhjYubhŒ or ”…””}”(hjYh²hh³Nh´Nubh)”}”(hŒ:c:func:`poll()`”h]”hö)”}”(hjh]”hŒpoll()”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-func”eh"]”h$]”h&]”uh1hõhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒpoll”uh1hh³hÇh´KHhjYubhŒ function are always available.”…””}”(hjYh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KHhjOh²hubhì)”}”(hŒ™To start and stop capturing or output applications call the :ref:`VIDIOC_STREAMON ` and :ref:`VIDIOC_STREAMOFF ` ioctl.”h]”(hŒ`”h]”jV)”}”(hjGh]”hŒVIDIOC_STREAMON”…””}”(hjIh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjEubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jSŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_streamon”uh1hh³hÇh´KXhj=ubhŒ and ”…””}”(hj=h²hh³Nh´Nubh)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”jV)”}”(hjkh]”hŒVIDIOC_STREAMOFF”…””}”(hjmh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjiubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jwŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_streamon”uh1hh³hÇh´KXhj=ubhŒ ioctl.”…””}”(hj=h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KXhjOh²hubhŒnote”“”)”}”(hX`:ref:`VIDIOC_STREAMOFF ` removes all buffers from both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine the struct :c:type:`v4l2_buffer` ``timestamp`` of captured or outputted buffers.”h]”hì)”}”(hX`:ref:`VIDIOC_STREAMOFF ` removes all buffers from both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine the struct :c:type:`v4l2_buffer` ``timestamp`` of captured or outputted buffers.”h]”(h)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”jV)”}”(hjŸh]”hŒVIDIOC_STREAMOFF”…””}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j«Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_streamon”uh1hh³hÇh´K^hj™ubhŒö removes all buffers from both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything “now†on a multitasking system, if an application needs to synchronize with another event it should examine the struct ”…””}”(hj™h²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_buffer`”h]”hö)”}”(hjÃh]”hŒ v4l2_buffer”…””}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-type”eh"]”h$]”h&]”uh1hõhjÁubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒ v4l2_buffer”uh1hh³hÇh´K^hj™ubhŒ ”…””}”(hj™h²hh³Nh´Nubhö)”}”(hŒ ``timestamp``”h]”hŒ timestamp”…””}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hõhj™ubhŒ" of captured or outputted buffers.”…””}”(hj™h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K^hj•ubah}”(h]”h ]”h"]”h$]”h&]”uh1j“hjOh²hh³hÇh´Nubhì)”}”(hX?Drivers implementing user pointer I/O must support the :ref:`VIDIOC_REQBUFS `, :ref:`VIDIOC_QBUF `, :ref:`VIDIOC_DQBUF `, :ref:`VIDIOC_STREAMON ` and :ref:`VIDIOC_STREAMOFF ` ioctls, the :c:func:`select()` and :c:func:`poll()` function. [#f2]_”h]”(hŒ7Drivers implementing user pointer I/O must support the ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ&:ref:`VIDIOC_REQBUFS `”h]”jV)”}”(hj h]”hŒVIDIOC_REQBUFS”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”jŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_reqbufs”uh1hh³hÇh´KehjubhŒ, ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ :ref:`VIDIOC_QBUF `”h]”jV)”}”(hj0h]”hŒ VIDIOC_QBUF”…””}”(hj2h²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhj.ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j<Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ vidioc_qbuf”uh1hh³hÇh´KehjubhŒ, ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”jV)”}”(hjTh]”hŒ VIDIOC_DQBUF”…””}”(hjVh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjRubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j`Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒ vidioc_qbuf”uh1hh³hÇh´KehjubhŒ, ”…””}”hjsbh)”}”(hŒ(:ref:`VIDIOC_STREAMON `”h]”jV)”}”(hjxh]”hŒVIDIOC_STREAMON”…””}”(hjzh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjvubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j„Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_streamon”uh1hh³hÇh´KehjubhŒ and ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”jV)”}”(hjœh]”hŒVIDIOC_STREAMOFF”…””}”(hjžh²hh³Nh´Nubah}”(h]”h ]”(j)Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jUhjšubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j¨Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjKŒvidioc_streamon”uh1hh³hÇh´KehjubhŒ ioctls, the ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ:c:func:`select()`”h]”hö)”}”(hjÀh]”hŒselect()”…””}”(hjÂh²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-func”eh"]”h$]”h&]”uh1hõhj¾ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒselect”uh1hh³hÇh´KehjubhŒ and ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ:c:func:`poll()`”h]”hö)”}”(hjãh]”hŒpoll()”…””}”(hjåh²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-func”eh"]”h$]”h&]”uh1hõhjáubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒpoll”uh1hh³hÇh´KehjubhŒ function. ”…””}”(hjh²hh³Nh´NubjÅ)”}”(hŒ[#f2]_”h]”hŒ2”…””}”(hjh²hh³Nh´Nubah}”(h]”Œid2”ah ]”h"]”h$]”h&]”jÕKhÔŒf2”j×j6uh1jÄhjjØKubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KehjOh²hubhŒfootnote”“”)”}”(hX¨We expect that frequently used buffers are typically not swapped out. Anyway, the process of swapping, locking or generating scatter-gather lists may be time consuming. The delay can be masked by the depth of the incoming buffer queue, and perhaps by maintaining caches assuming a buffer will be soon enqueued again. On the other hand, to optimize memory usage drivers can limit the number of buffers locked in advance and recycle the most recently used buffers first. Of course, the pages of empty buffers in the incoming queue need not be saved to disk. Output buffers must be saved on the incoming and outgoing queue because an application may share them with other processes. ”h]”(hŒlabel”“”)”}”(hhh]”hŒ1”…””}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j hjh²hh³Nh´Nubhì)”}”(hX§We expect that frequently used buffers are typically not swapped out. Anyway, the process of swapping, locking or generating scatter-gather lists may be time consuming. The delay can be masked by the depth of the incoming buffer queue, and perhaps by maintaining caches assuming a buffer will be soon enqueued again. On the other hand, to optimize memory usage drivers can limit the number of buffers locked in advance and recycle the most recently used buffers first. Of course, the pages of empty buffers in the incoming queue need not be saved to disk. Output buffers must be saved on the incoming and outgoing queue because an application may share them with other processes.”h]”hX§We expect that frequently used buffers are typically not swapped out. Anyway, the process of swapping, locking or generating scatter-gather lists may be time consuming. The delay can be masked by the depth of the incoming buffer queue, and perhaps by maintaining caches assuming a buffer will be soon enqueued again. On the other hand, to optimize memory usage drivers can limit the number of buffers locked in advance and recycle the most recently used buffers first. Of course, the pages of empty buffers in the incoming queue need not be saved to disk. Output buffers must be saved on the incoming and outgoing queue because an application may share them with other processes.”…””}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Klhjubeh}”(h]”jÖah ]”h"]”Œf1”ah$]”h&]”jÐajÕKj×j6uh1jh³hÇh´KkhjOh²hubj)”}”(hŒAt the driver level :c:func:`select()` and :c:func:`poll()` are the same, and :c:func:`select()` is too important to be optional. The rest should be evident.”h]”(j!)”}”(hhh]”hŒ2”…””}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j hjDh²hh³Nh´Nubhì)”}”(hŒAt the driver level :c:func:`select()` and :c:func:`poll()` are the same, and :c:func:`select()` is too important to be optional. The rest should be evident.”h]”(hŒAt the driver level ”…””}”(hjUh²hh³Nh´Nubh)”}”(hŒ:c:func:`select()`”h]”hö)”}”(hj_h]”hŒselect()”…””}”(hjah²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-func”eh"]”h$]”h&]”uh1hõhj]ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒselect”uh1hh³hÇh´KxhjUubhŒ and ”…””}”(hjUh²hh³Nh´Nubh)”}”(hŒ:c:func:`poll()`”h]”hö)”}”(hj‚h]”hŒpoll()”…””}”(hj„h²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-func”eh"]”h$]”h&]”uh1hõhj€ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒpoll”uh1hh³hÇh´KxhjUubhŒ are the same, and ”…””}”(hjUh²hh³Nh´Nubh)”}”(hŒ:c:func:`select()`”h]”hö)”}”(hj¥h]”hŒselect()”…””}”(hj§h²hh³Nh´Nubah}”(h]”h ]”(j)j*Œc-func”eh"]”h$]”h&]”uh1hõhj£ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j6Œ refdomain”j*Œreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰j<j@jKŒselect”uh1hh³hÇh´KxhjUubhŒ= is too important to be optional. The rest should be evident.”…””}”(hjUh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KxhjDubeh}”(h]”jah ]”h"]”Œf2”ah$]”h&]”jajÕKj×j6uh1jh³hÇh´KwhjOh²hubeh}”(h]”Œ3example-initiating-streaming-i-o-with-user-pointers”ah ]”h"]”Œ4example: initiating streaming i/o with user pointers”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Kubeh}”(h]”(Œstreaming-i-o-user-pointers”hÕeh ]”h"]”(Œstreaming i/o (user pointers)”Œuserp”eh$]”h&]”uh1hÖhhh²hh³hÇh´KŒexpect_referenced_by_name”}”jáhÊsŒexpect_referenced_by_id”}”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”}”(Œf1”]”jÆaŒf2”]”jauŒrefids”}”(hÕ]”hÊajÖ]”jÆaj]”jauŒnameids”}”(jáhÕjàjÝjØjÕjAjÖjÐjuŒ nametypes”}”(jáˆjà‰j؉jAˆjЈuh}”(hÕhØjÝhØjÕjOjÐjÆjjjÖjjjDuŒ footnote_refs”}”(jK]”jÆajM]”jauŒ citation_refs”}”Œ autofootnotes”]”(jjDeŒautofootnote_refs”]”(jÆjeŒsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”jKs…”R”Œparse_messages”]”Œtransform_messages”]”hŒsystem_message”“”)”}”(hhh]”hì)”}”(hhh]”hŒ+Hyperlink target "userp" is not referenced.”…””}”hj}sbah}”(h]”h ]”h"]”h$]”h&]”uh1hëhjzubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kuh1jxubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.