18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: V4L 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _VIDIOC_QUERYSTD: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci********************************************* 78c2ecf20Sopenharmony_ciioctl VIDIOC_QUERYSTD, VIDIOC_SUBDEV_QUERYSTD 88c2ecf20Sopenharmony_ci********************************************* 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciVIDIOC_QUERYSTD - VIDIOC_SUBDEV_QUERYSTD - Sense the video standard received by the current input 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_QUERYSTD 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_QUERYSTD 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_QUERYSTD, v4l2_std_id *argp)`` 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciArguments 278c2ecf20Sopenharmony_ci========= 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci``fd`` 308c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci``argp`` 338c2ecf20Sopenharmony_ci Pointer to :c:type:`v4l2_std_id`. 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciDescription 368c2ecf20Sopenharmony_ci=========== 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciThe hardware may be able to detect the current video standard 398c2ecf20Sopenharmony_ciautomatically. To do so, applications call :ref:`VIDIOC_QUERYSTD` with a 408c2ecf20Sopenharmony_cipointer to a :ref:`v4l2_std_id <v4l2-std-id>` type. The driver 418c2ecf20Sopenharmony_cistores here a set of candidates, this can be a single flag or a set of 428c2ecf20Sopenharmony_cisupported standards if for example the hardware can only distinguish 438c2ecf20Sopenharmony_cibetween 50 and 60 Hz systems. If no signal was detected, then the driver 448c2ecf20Sopenharmony_ciwill return V4L2_STD_UNKNOWN. When detection is not possible or fails, 458c2ecf20Sopenharmony_cithe set must contain all standards supported by the current video input 468c2ecf20Sopenharmony_cior output. 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci.. note:: 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci Drivers shall *not* switch the video standard 518c2ecf20Sopenharmony_ci automatically if a new video standard is detected. Instead, drivers 528c2ecf20Sopenharmony_ci should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support 538c2ecf20Sopenharmony_ci this) and expect that userspace will take action by calling 548c2ecf20Sopenharmony_ci :ref:`VIDIOC_QUERYSTD`. The reason is that a new video standard can mean 558c2ecf20Sopenharmony_ci different buffer sizes as well, and you cannot change buffer sizes on 568c2ecf20Sopenharmony_ci the fly. In general, applications that receive the Source Change event 578c2ecf20Sopenharmony_ci will have to call :ref:`VIDIOC_QUERYSTD`, and if the detected video 588c2ecf20Sopenharmony_ci standard is valid they will have to stop streaming, set the new 598c2ecf20Sopenharmony_ci standard, allocate new buffers and start streaming again. 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ciReturn Value 628c2ecf20Sopenharmony_ci============ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 658c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 668c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciENODATA 698c2ecf20Sopenharmony_ci Standard video timings are not supported for this input or output. 70