diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:27:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:27:49 +0000 |
commit | ace9429bb58fd418f0c81d4c2835699bddf6bde6 (patch) | |
tree | b2d64bc10158fdd5497876388cd68142ca374ed3 /Documentation/userspace-api/media/v4l/video.rst | |
parent | Initial commit. (diff) | |
download | linux-ace9429bb58fd418f0c81d4c2835699bddf6bde6.tar.xz linux-ace9429bb58fd418f0c81d4c2835699bddf6bde6.zip |
Adding upstream version 6.6.15.upstream/6.6.15
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'Documentation/userspace-api/media/v4l/video.rst')
-rw-r--r-- | Documentation/userspace-api/media/v4l/video.rst | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Documentation/userspace-api/media/v4l/video.rst b/Documentation/userspace-api/media/v4l/video.rst new file mode 100644 index 0000000000..f8f69a5760 --- /dev/null +++ b/Documentation/userspace-api/media/v4l/video.rst @@ -0,0 +1,68 @@ +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later + +.. _video: + +************************ +Video Inputs and Outputs +************************ + +Video inputs and outputs are physical connectors of a device. These can +be for example: RF connectors (antenna/cable), CVBS a.k.a. Composite +Video, S-Video and RGB connectors. Camera sensors are also considered to +be a video input. Video and VBI capture devices have inputs. Video and +VBI output devices have outputs, at least one each. Radio devices have +no video inputs or outputs. + +To learn about the number and attributes of the available inputs and +outputs applications can enumerate them with the +:ref:`VIDIOC_ENUMINPUT` and +:ref:`VIDIOC_ENUMOUTPUT` ioctl, respectively. The +struct :c:type:`v4l2_input` returned by the +:ref:`VIDIOC_ENUMINPUT` ioctl also contains signal +status information applicable when the current video input is queried. + +The :ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` and +:ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctls return the index of +the current video input or output. To select a different input or output +applications call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` and +:ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctls. Drivers must +implement all the input ioctls when the device has one or more inputs, +all the output ioctls when the device has one or more outputs. + +Example: Information about the current video input +================================================== + +.. code-block:: c + + struct v4l2_input input; + int index; + + if (-1 == ioctl(fd, VIDIOC_G_INPUT, &index)) { + perror("VIDIOC_G_INPUT"); + exit(EXIT_FAILURE); + } + + memset(&input, 0, sizeof(input)); + input.index = index; + + if (-1 == ioctl(fd, VIDIOC_ENUMINPUT, &input)) { + perror("VIDIOC_ENUMINPUT"); + exit(EXIT_FAILURE); + } + + printf("Current input: %s\\n", input.name); + + +Example: Switching to the first video input +=========================================== + +.. code-block:: c + + int index; + + index = 0; + + if (-1 == ioctl(fd, VIDIOC_S_INPUT, &index)) { + perror("VIDIOC_S_INPUT"); + exit(EXIT_FAILURE); + } |