^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. c:namespace:: V4L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .. _VIDIOC_QUERYSTD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *********************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ioctl VIDIOC_QUERYSTD, VIDIOC_SUBDEV_QUERYSTD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *********************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) VIDIOC_QUERYSTD - VIDIOC_SUBDEV_QUERYSTD - Sense the video standard received by the current input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .. c:macro:: VIDIOC_QUERYSTD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ``int ioctl(int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .. c:macro:: VIDIOC_SUBDEV_QUERYSTD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ``int ioctl(int fd, VIDIOC_SUBDEV_QUERYSTD, v4l2_std_id *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Pointer to :c:type:`v4l2_std_id`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) The hardware may be able to detect the current video standard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) automatically. To do so, applications call :ref:`VIDIOC_QUERYSTD` with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) pointer to a :ref:`v4l2_std_id <v4l2-std-id>` type. The driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) stores here a set of candidates, this can be a single flag or a set of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) supported standards if for example the hardware can only distinguish
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) between 50 and 60 Hz systems. If no signal was detected, then the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) will return V4L2_STD_UNKNOWN. When detection is not possible or fails,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) the set must contain all standards supported by the current video input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) or output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) Drivers shall *not* switch the video standard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) automatically if a new video standard is detected. Instead, drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) this) and expect that userspace will take action by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) :ref:`VIDIOC_QUERYSTD`. The reason is that a new video standard can mean
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) different buffer sizes as well, and you cannot change buffer sizes on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) the fly. In general, applications that receive the Source Change event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) will have to call :ref:`VIDIOC_QUERYSTD`, and if the detected video
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) standard is valid they will have to stop streaming, set the new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) standard, allocate new buffers and start streaming again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ENODATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) Standard video timings are not supported for this input or output.