blob: e4e543b5698967bebe32e0fb2e322312c81cf7a4 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3.. _video:
4
5************************
6Video Inputs and Outputs
7************************
8
9Video inputs and outputs are physical connectors of a device. These can
10be for example RF connectors (antenna/cable), CVBS a.k.a. Composite
11Video, S-Video or RGB connectors. Video and VBI capture devices have
12inputs. Video and VBI output devices have outputs, at least one each.
13Radio devices have no video inputs or outputs.
14
15To learn about the number and attributes of the available inputs and
16outputs applications can enumerate them with the
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030017:ref:`VIDIOC_ENUMINPUT <VIDIOC_ENUMINPUT>` and
18:ref:`VIDIOC_ENUMOUTPUT <VIDIOC_ENUMOUTPUT>` ioctl, respectively. The
Markus Heiser5377d912016-06-30 15:18:56 +020019struct :ref:`v4l2_input <v4l2-input>` returned by the
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030020:ref:`VIDIOC_ENUMINPUT <VIDIOC_ENUMINPUT>` ioctl also contains signal
Mauro Carvalho Chehab234d5492016-06-30 22:17:31 -030021:status information applicable when the current video input is queried.
Markus Heiser5377d912016-06-30 15:18:56 +020022
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030023The :ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` and
24:ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctls return the index of
Markus Heiser5377d912016-06-30 15:18:56 +020025the current video input or output. To select a different input or output
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030026applications call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` and
27:ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctls. Drivers must
Markus Heiser5377d912016-06-30 15:18:56 +020028implement all the input ioctls when the device has one or more inputs,
29all the output ioctls when the device has one or more outputs.
30
Markus Heiser5377d912016-06-30 15:18:56 +020031.. code-block:: c
Mauro Carvalho Chehab013504f52016-06-30 22:45:08 -030032 :caption: Example 1: Information about the current video input
Markus Heiser5377d912016-06-30 15:18:56 +020033
34 struct v4l2_input input;
35 int index;
36
37 if (-1 == ioctl(fd, VIDIOC_G_INPUT, &index)) {
38 perror("VIDIOC_G_INPUT");
39 exit(EXIT_FAILURE);
40 }
41
42 memset(&input, 0, sizeof(input));
43 input.index = index;
44
45 if (-1 == ioctl(fd, VIDIOC_ENUMINPUT, &input)) {
46 perror("VIDIOC_ENUMINPUT");
47 exit(EXIT_FAILURE);
48 }
49
50 printf("Current input: %s\\n", input.name);
51
52
53.. code-block:: c
Mauro Carvalho Chehab013504f52016-06-30 22:45:08 -030054 :caption: Example 2: Switching to the first video input
Markus Heiser5377d912016-06-30 15:18:56 +020055
56 int index;
57
58 index = 0;
59
60 if (-1 == ioctl(fd, VIDIOC_S_INPUT, &index)) {
61 perror("VIDIOC_S_INPUT");
62 exit(EXIT_FAILURE);
63 }
64
65
66
67
68.. ------------------------------------------------------------------------------
69.. This file was automatically converted from DocBook-XML with the dbxml
70.. library (https://github.com/return42/sphkerneldoc). The origin XML comes
71.. from the linux kernel, refer to:
72..
73.. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
74.. ------------------------------------------------------------------------------