1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _VIDIOC_QUERYSTD:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab*********************************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_QUERYSTD, VIDIOC_SUBDEV_QUERYSTD
854f38fcaSMauro Carvalho Chehab*********************************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_QUERYSTD - VIDIOC_SUBDEV_QUERYSTD - Sense the video standard received by the current input
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_QUERYSTD
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp)``
2154f38fcaSMauro Carvalho Chehab
22407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_QUERYSTD
23407e84cdSMauro Carvalho Chehab
24407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBDEV_QUERYSTD, v4l2_std_id *argp)``
2554f38fcaSMauro Carvalho Chehab
2654f38fcaSMauro Carvalho ChehabArguments
2754f38fcaSMauro Carvalho Chehab=========
2854f38fcaSMauro Carvalho Chehab
2954f38fcaSMauro Carvalho Chehab``fd``
30407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
3154f38fcaSMauro Carvalho Chehab
3254f38fcaSMauro Carvalho Chehab``argp``
3354f38fcaSMauro Carvalho Chehab    Pointer to :c:type:`v4l2_std_id`.
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho ChehabDescription
3654f38fcaSMauro Carvalho Chehab===========
3754f38fcaSMauro Carvalho Chehab
3854f38fcaSMauro Carvalho ChehabThe hardware may be able to detect the current video standard
3954f38fcaSMauro Carvalho Chehabautomatically. To do so, applications call :ref:`VIDIOC_QUERYSTD` with a
4054f38fcaSMauro Carvalho Chehabpointer to a :ref:`v4l2_std_id <v4l2-std-id>` type. The driver
4154f38fcaSMauro Carvalho Chehabstores here a set of candidates, this can be a single flag or a set of
4254f38fcaSMauro Carvalho Chehabsupported standards if for example the hardware can only distinguish
4354f38fcaSMauro Carvalho Chehabbetween 50 and 60 Hz systems. If no signal was detected, then the driver
4454f38fcaSMauro Carvalho Chehabwill return V4L2_STD_UNKNOWN. When detection is not possible or fails,
4554f38fcaSMauro Carvalho Chehabthe set must contain all standards supported by the current video input
4654f38fcaSMauro Carvalho Chehabor output.
4754f38fcaSMauro Carvalho Chehab
4854f38fcaSMauro Carvalho Chehab.. note::
4954f38fcaSMauro Carvalho Chehab
5054f38fcaSMauro Carvalho Chehab   Drivers shall *not* switch the video standard
5154f38fcaSMauro Carvalho Chehab   automatically if a new video standard is detected. Instead, drivers
5254f38fcaSMauro Carvalho Chehab   should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support
5354f38fcaSMauro Carvalho Chehab   this) and expect that userspace will take action by calling
5454f38fcaSMauro Carvalho Chehab   :ref:`VIDIOC_QUERYSTD`. The reason is that a new video standard can mean
5554f38fcaSMauro Carvalho Chehab   different buffer sizes as well, and you cannot change buffer sizes on
5654f38fcaSMauro Carvalho Chehab   the fly. In general, applications that receive the Source Change event
5754f38fcaSMauro Carvalho Chehab   will have to call :ref:`VIDIOC_QUERYSTD`, and if the detected video
5854f38fcaSMauro Carvalho Chehab   standard is valid they will have to stop streaming, set the new
5954f38fcaSMauro Carvalho Chehab   standard, allocate new buffers and start streaming again.
6054f38fcaSMauro Carvalho Chehab
6154f38fcaSMauro Carvalho ChehabReturn Value
6254f38fcaSMauro Carvalho Chehab============
6354f38fcaSMauro Carvalho Chehab
6454f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
6554f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
6654f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
6754f38fcaSMauro Carvalho Chehab
6854f38fcaSMauro Carvalho ChehabENODATA
6954f38fcaSMauro Carvalho Chehab    Standard video timings are not supported for this input or output.
70