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