154f38fcaSMauro Carvalho Chehab.. Permission is granted to copy, distribute and/or modify this
254f38fcaSMauro Carvalho Chehab.. document under the terms of the GNU Free Documentation License,
354f38fcaSMauro Carvalho Chehab.. Version 1.1 or any later version published by the Free Software
454f38fcaSMauro Carvalho Chehab.. Foundation, with no Invariant Sections, no Front-Cover Texts
554f38fcaSMauro Carvalho Chehab.. and no Back-Cover Texts. A copy of the license is included at
654f38fcaSMauro Carvalho Chehab.. Documentation/userspace-api/media/fdl-appendix.rst.
754f38fcaSMauro Carvalho Chehab..
854f38fcaSMauro Carvalho Chehab.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho Chehab.. _VIDIOC_QUERYSTD:
1154f38fcaSMauro Carvalho Chehab
1254f38fcaSMauro Carvalho Chehab*********************************************
1354f38fcaSMauro Carvalho Chehabioctl VIDIOC_QUERYSTD, VIDIOC_SUBDEV_QUERYSTD
1454f38fcaSMauro Carvalho Chehab*********************************************
1554f38fcaSMauro Carvalho Chehab
1654f38fcaSMauro Carvalho ChehabName
1754f38fcaSMauro Carvalho Chehab====
1854f38fcaSMauro Carvalho Chehab
1954f38fcaSMauro Carvalho ChehabVIDIOC_QUERYSTD - VIDIOC_SUBDEV_QUERYSTD - Sense the video standard received by the current input
2054f38fcaSMauro Carvalho Chehab
2154f38fcaSMauro Carvalho Chehab
2254f38fcaSMauro Carvalho ChehabSynopsis
2354f38fcaSMauro Carvalho Chehab========
2454f38fcaSMauro Carvalho Chehab
2554f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp )
2654f38fcaSMauro Carvalho Chehab    :name: VIDIOC_QUERYSTD
2754f38fcaSMauro Carvalho Chehab
2854f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_QUERYSTD, v4l2_std_id *argp )
2954f38fcaSMauro Carvalho Chehab    :name: VIDIOC_SUBDEV_QUERYSTD
3054f38fcaSMauro Carvalho Chehab
3154f38fcaSMauro Carvalho Chehab
3254f38fcaSMauro Carvalho ChehabArguments
3354f38fcaSMauro Carvalho Chehab=========
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho Chehab``fd``
3654f38fcaSMauro Carvalho Chehab    File descriptor returned by :ref:`open() <func-open>`.
3754f38fcaSMauro Carvalho Chehab
3854f38fcaSMauro Carvalho Chehab``argp``
3954f38fcaSMauro Carvalho Chehab    Pointer to :c:type:`v4l2_std_id`.
4054f38fcaSMauro Carvalho Chehab
4154f38fcaSMauro Carvalho Chehab
4254f38fcaSMauro Carvalho ChehabDescription
4354f38fcaSMauro Carvalho Chehab===========
4454f38fcaSMauro Carvalho Chehab
4554f38fcaSMauro Carvalho ChehabThe hardware may be able to detect the current video standard
4654f38fcaSMauro Carvalho Chehabautomatically. To do so, applications call :ref:`VIDIOC_QUERYSTD` with a
4754f38fcaSMauro Carvalho Chehabpointer to a :ref:`v4l2_std_id <v4l2-std-id>` type. The driver
4854f38fcaSMauro Carvalho Chehabstores here a set of candidates, this can be a single flag or a set of
4954f38fcaSMauro Carvalho Chehabsupported standards if for example the hardware can only distinguish
5054f38fcaSMauro Carvalho Chehabbetween 50 and 60 Hz systems. If no signal was detected, then the driver
5154f38fcaSMauro Carvalho Chehabwill return V4L2_STD_UNKNOWN. When detection is not possible or fails,
5254f38fcaSMauro Carvalho Chehabthe set must contain all standards supported by the current video input
5354f38fcaSMauro Carvalho Chehabor output.
5454f38fcaSMauro Carvalho Chehab
5554f38fcaSMauro Carvalho Chehab.. note::
5654f38fcaSMauro Carvalho Chehab
5754f38fcaSMauro Carvalho Chehab   Drivers shall *not* switch the video standard
5854f38fcaSMauro Carvalho Chehab   automatically if a new video standard is detected. Instead, drivers
5954f38fcaSMauro Carvalho Chehab   should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support
6054f38fcaSMauro Carvalho Chehab   this) and expect that userspace will take action by calling
6154f38fcaSMauro Carvalho Chehab   :ref:`VIDIOC_QUERYSTD`. The reason is that a new video standard can mean
6254f38fcaSMauro Carvalho Chehab   different buffer sizes as well, and you cannot change buffer sizes on
6354f38fcaSMauro Carvalho Chehab   the fly. In general, applications that receive the Source Change event
6454f38fcaSMauro Carvalho Chehab   will have to call :ref:`VIDIOC_QUERYSTD`, and if the detected video
6554f38fcaSMauro Carvalho Chehab   standard is valid they will have to stop streaming, set the new
6654f38fcaSMauro Carvalho Chehab   standard, allocate new buffers and start streaming again.
6754f38fcaSMauro Carvalho Chehab
6854f38fcaSMauro Carvalho Chehab
6954f38fcaSMauro Carvalho ChehabReturn Value
7054f38fcaSMauro Carvalho Chehab============
7154f38fcaSMauro Carvalho Chehab
7254f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
7354f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
7454f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
7554f38fcaSMauro Carvalho Chehab
7654f38fcaSMauro Carvalho ChehabENODATA
7754f38fcaSMauro Carvalho Chehab    Standard video timings are not supported for this input or output.
78