xref: /linux/Documentation/userspace-api/media/v4l/vidioc-query-dv-timings.rst (revision b8265621f4888af9494e1d685620871ec81bc33d)
1.. Permission is granted to copy, distribute and/or modify this
2.. document under the terms of the GNU Free Documentation License,
3.. Version 1.1 or any later version published by the Free Software
4.. Foundation, with no Invariant Sections, no Front-Cover Texts
5.. and no Back-Cover Texts. A copy of the license is included at
6.. Documentation/userspace-api/media/fdl-appendix.rst.
7..
8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10.. _VIDIOC_QUERY_DV_TIMINGS:
11
12*****************************
13ioctl VIDIOC_QUERY_DV_TIMINGS
14*****************************
15
16Name
17====
18
19VIDIOC_QUERY_DV_TIMINGS - VIDIOC_SUBDEV_QUERY_DV_TIMINGS - Sense the DV preset received by the current input
20
21
22Synopsis
23========
24
25.. c:function:: int ioctl( int fd, VIDIOC_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp )
26    :name: VIDIOC_QUERY_DV_TIMINGS
27
28.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp )
29    :name: VIDIOC_SUBDEV_QUERY_DV_TIMINGS
30
31
32Arguments
33=========
34
35``fd``
36    File descriptor returned by :ref:`open() <func-open>`.
37
38``argp``
39    Pointer to struct :c:type:`v4l2_dv_timings`.
40
41
42Description
43===========
44
45The hardware may be able to detect the current DV timings automatically,
46similar to sensing the video standard. To do so, applications call
47:ref:`VIDIOC_QUERY_DV_TIMINGS` with a pointer to a struct
48:c:type:`v4l2_dv_timings`. Once the hardware detects
49the timings, it will fill in the timings structure.
50
51.. note::
52
53   Drivers shall *not* switch timings automatically if new
54   timings are detected. Instead, drivers should send the
55   ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support this) and expect
56   that userspace will take action by calling :ref:`VIDIOC_QUERY_DV_TIMINGS`.
57   The reason is that new timings usually mean different buffer sizes as
58   well, and you cannot change buffer sizes on the fly. In general,
59   applications that receive the Source Change event will have to call
60   :ref:`VIDIOC_QUERY_DV_TIMINGS`, and if the detected timings are valid they
61   will have to stop streaming, set the new timings, allocate new buffers
62   and start streaming again.
63
64If the timings could not be detected because there was no signal, then
65ENOLINK is returned. If a signal was detected, but it was unstable and
66the receiver could not lock to the signal, then ``ENOLCK`` is returned. If
67the receiver could lock to the signal, but the format is unsupported
68(e.g. because the pixelclock is out of range of the hardware
69capabilities), then the driver fills in whatever timings it could find
70and returns ``ERANGE``. In that case the application can call
71:ref:`VIDIOC_DV_TIMINGS_CAP` to compare the
72found timings with the hardware's capabilities in order to give more
73precise feedback to the user.
74
75
76Return Value
77============
78
79On success 0 is returned, on error -1 and the ``errno`` variable is set
80appropriately. The generic error codes are described at the
81:ref:`Generic Error Codes <gen-errors>` chapter.
82
83ENODATA
84    Digital video timings are not supported for this input or output.
85
86ENOLINK
87    No timings could be detected because no signal was found.
88
89ENOLCK
90    The signal was unstable and the hardware could not lock on to it.
91
92ERANGE
93    Timings were found, but they are out of range of the hardware
94    capabilities.
95