Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
3 | .. _video: | |
4 | ||
5 | ************************ | |
6 | Video Inputs and Outputs | |
7 | ************************ | |
8 | ||
9 | Video inputs and outputs are physical connectors of a device. These can | |
10 | be for example RF connectors (antenna/cable), CVBS a.k.a. Composite | |
11 | Video, S-Video or RGB connectors. Video and VBI capture devices have | |
12 | inputs. Video and VBI output devices have outputs, at least one each. | |
13 | Radio devices have no video inputs or outputs. | |
14 | ||
15 | To learn about the number and attributes of the available inputs and | |
16 | outputs applications can enumerate them with the | |
7347081e MCC |
17 | :ref:`VIDIOC_ENUMINPUT` and |
18 | :ref:`VIDIOC_ENUMOUTPUT` ioctl, respectively. The | |
5377d91f | 19 | struct :ref:`v4l2_input <v4l2-input>` returned by the |
7347081e | 20 | :ref:`VIDIOC_ENUMINPUT` ioctl also contains signal |
234d5496 | 21 | :status information applicable when the current video input is queried. |
5377d91f | 22 | |
4e03cb76 MCC |
23 | The :ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` and |
24 | :ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctls return the index of | |
5377d91f | 25 | the current video input or output. To select a different input or output |
af4a4d0d MCC |
26 | applications call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` and |
27 | :ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctls. Drivers must | |
5377d91f MH |
28 | implement all the input ioctls when the device has one or more inputs, |
29 | all the output ioctls when the device has one or more outputs. | |
30 | ||
282f02cb MCC |
31 | Example: Information about the current video input |
32 | ================================================== | |
33 | ||
5377d91f MH |
34 | .. code-block:: c |
35 | ||
36 | struct v4l2_input input; | |
37 | int index; | |
38 | ||
39 | if (-1 == ioctl(fd, VIDIOC_G_INPUT, &index)) { | |
0579e6e3 MCC |
40 | perror("VIDIOC_G_INPUT"); |
41 | exit(EXIT_FAILURE); | |
5377d91f MH |
42 | } |
43 | ||
44 | memset(&input, 0, sizeof(input)); | |
45 | input.index = index; | |
46 | ||
47 | if (-1 == ioctl(fd, VIDIOC_ENUMINPUT, &input)) { | |
0579e6e3 MCC |
48 | perror("VIDIOC_ENUMINPUT"); |
49 | exit(EXIT_FAILURE); | |
5377d91f MH |
50 | } |
51 | ||
52 | printf("Current input: %s\\n", input.name); | |
53 | ||
54 | ||
282f02cb MCC |
55 | Example: Switching to the first video input |
56 | =========================================== | |
57 | ||
5377d91f MH |
58 | .. code-block:: c |
59 | ||
60 | int index; | |
61 | ||
62 | index = 0; | |
63 | ||
64 | if (-1 == ioctl(fd, VIDIOC_S_INPUT, &index)) { | |
0579e6e3 MCC |
65 | perror("VIDIOC_S_INPUT"); |
66 | exit(EXIT_FAILURE); | |
5377d91f | 67 | } |