162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_QUERYSTD:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci*********************************************
762306a36Sopenharmony_ciioctl VIDIOC_QUERYSTD, VIDIOC_SUBDEV_QUERYSTD
862306a36Sopenharmony_ci*********************************************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_QUERYSTD - VIDIOC_SUBDEV_QUERYSTD - Sense the video standard received by the current input
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_QUERYSTD
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp)``
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_QUERYSTD
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_QUERYSTD, v4l2_std_id *argp)``
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciArguments
2762306a36Sopenharmony_ci=========
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci``fd``
3062306a36Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci``argp``
3362306a36Sopenharmony_ci    Pointer to :c:type:`v4l2_std_id`.
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciDescription
3662306a36Sopenharmony_ci===========
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciThe hardware may be able to detect the current video standard
3962306a36Sopenharmony_ciautomatically. To do so, applications call :ref:`VIDIOC_QUERYSTD` with a
4062306a36Sopenharmony_cipointer to a :ref:`v4l2_std_id <v4l2-std-id>` type. The driver
4162306a36Sopenharmony_cistores here a set of candidates, this can be a single flag or a set of
4262306a36Sopenharmony_cisupported standards if for example the hardware can only distinguish
4362306a36Sopenharmony_cibetween 50 and 60 Hz systems. If no signal was detected, then the driver
4462306a36Sopenharmony_ciwill return V4L2_STD_UNKNOWN. When detection is not possible or fails,
4562306a36Sopenharmony_cithe set must contain all standards supported by the current video input
4662306a36Sopenharmony_cior output.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci.. note::
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci   Drivers shall *not* switch the video standard
5162306a36Sopenharmony_ci   automatically if a new video standard is detected. Instead, drivers
5262306a36Sopenharmony_ci   should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support
5362306a36Sopenharmony_ci   this) and expect that userspace will take action by calling
5462306a36Sopenharmony_ci   :ref:`VIDIOC_QUERYSTD`. The reason is that a new video standard can mean
5562306a36Sopenharmony_ci   different buffer sizes as well, and you cannot change buffer sizes on
5662306a36Sopenharmony_ci   the fly. In general, applications that receive the Source Change event
5762306a36Sopenharmony_ci   will have to call :ref:`VIDIOC_QUERYSTD`, and if the detected video
5862306a36Sopenharmony_ci   standard is valid they will have to stop streaming, set the new
5962306a36Sopenharmony_ci   standard, allocate new buffers and start streaming again.
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciReturn Value
6262306a36Sopenharmony_ci============
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
6562306a36Sopenharmony_ciappropriately. The generic error codes are described at the
6662306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciENODATA
6962306a36Sopenharmony_ci    Standard video timings are not supported for this input or output.
70