Merge tag 'drm-msm-fixes-2019-01-24' of git://people.freedesktop.org/~robclark/linux...
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / video.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 .. _video:
11
12 ************************
13 Video Inputs and Outputs
14 ************************
15
16 Video inputs and outputs are physical connectors of a device. These can
17 be for example: RF connectors (antenna/cable), CVBS a.k.a. Composite
18 Video, S-Video and RGB connectors. Camera sensors are also considered to
19 be a video input. Video and VBI capture devices have inputs. Video and
20 VBI output devices have outputs, at least one each. Radio devices have
21 no video inputs or outputs.
22
23 To learn about the number and attributes of the available inputs and
24 outputs applications can enumerate them with the
25 :ref:`VIDIOC_ENUMINPUT` and
26 :ref:`VIDIOC_ENUMOUTPUT` ioctl, respectively. The
27 struct :c:type:`v4l2_input` returned by the
28 :ref:`VIDIOC_ENUMINPUT` ioctl also contains signal
29 status information applicable when the current video input is queried.
30
31 The :ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` and
32 :ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctls return the index of
33 the current video input or output. To select a different input or output
34 applications call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` and
35 :ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctls. Drivers must
36 implement all the input ioctls when the device has one or more inputs,
37 all the output ioctls when the device has one or more outputs.
38
39 Example: Information about the current video input
40 ==================================================
41
42 .. code-block:: c
43
44     struct v4l2_input input;
45     int index;
46
47     if (-1 == ioctl(fd, VIDIOC_G_INPUT, &index)) {
48         perror("VIDIOC_G_INPUT");
49         exit(EXIT_FAILURE);
50     }
51
52     memset(&input, 0, sizeof(input));
53     input.index = index;
54
55     if (-1 == ioctl(fd, VIDIOC_ENUMINPUT, &input)) {
56         perror("VIDIOC_ENUMINPUT");
57         exit(EXIT_FAILURE);
58     }
59
60     printf("Current input: %s\\n", input.name);
61
62
63 Example: Switching to the first video input
64 ===========================================
65
66 .. code-block:: c
67
68     int index;
69
70     index = 0;
71
72     if (-1 == ioctl(fd, VIDIOC_S_INPUT, &index)) {
73         perror("VIDIOC_S_INPUT");
74         exit(EXIT_FAILURE);
75     }