Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / Documentation / media / uapi / v4l / vidioc-query-dv-timings.rst
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/media/uapi/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 *****************************
13 ioctl VIDIOC_QUERY_DV_TIMINGS
14 *****************************
15
16 Name
17 ====
18
19 VIDIOC_QUERY_DV_TIMINGS - VIDIOC_SUBDEV_QUERY_DV_TIMINGS - Sense the DV preset received by the current input
20
21
22 Synopsis
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
32 Arguments
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
42 Description
43 ===========
44
45 The hardware may be able to detect the current DV timings automatically,
46 similar 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
49 the 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
64 If the timings could not be detected because there was no signal, then
65 ENOLINK is returned. If a signal was detected, but it was unstable and
66 the receiver could not lock to the signal, then ``ENOLCK`` is returned. If
67 the receiver could lock to the signal, but the format is unsupported
68 (e.g. because the pixelclock is out of range of the hardware
69 capabilities), then the driver fills in whatever timings it could find
70 and returns ``ERANGE``. In that case the application can call
71 :ref:`VIDIOC_DV_TIMINGS_CAP` to compare the
72 found timings with the hardware's capabilities in order to give more
73 precise feedback to the user.
74
75
76 Return Value
77 ============
78
79 On success 0 is returned, on error -1 and the ``errno`` variable is set
80 appropriately. The generic error codes are described at the
81 :ref:`Generic Error Codes <gen-errors>` chapter.
82
83 ENODATA
84     Digital video timings are not supported for this input or output.
85
86 ENOLINK
87     No timings could be detected because no signal was found.
88
89 ENOLCK
90     The signal was unstable and the hardware could not lock on to it.
91
92 ERANGE
93     Timings were found, but they are out of range of the hardware
94     capabilities.