video.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _video:
  4. ************************
  5. Video Inputs and Outputs
  6. ************************
  7. Video inputs and outputs are physical connectors of a device. These can
  8. be for example: RF connectors (antenna/cable), CVBS a.k.a. Composite
  9. Video, S-Video and RGB connectors. Camera sensors are also considered to
  10. be a video input. Video and VBI capture devices have inputs. Video and
  11. VBI output devices have outputs, at least one each. Radio devices have
  12. no video inputs or outputs.
  13. To learn about the number and attributes of the available inputs and
  14. outputs applications can enumerate them with the
  15. :ref:`VIDIOC_ENUMINPUT` and
  16. :ref:`VIDIOC_ENUMOUTPUT` ioctl, respectively. The
  17. struct :c:type:`v4l2_input` returned by the
  18. :ref:`VIDIOC_ENUMINPUT` ioctl also contains signal
  19. status information applicable when the current video input is queried.
  20. The :ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` and
  21. :ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctls return the index of
  22. the current video input or output. To select a different input or output
  23. applications call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` and
  24. :ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctls. Drivers must
  25. implement all the input ioctls when the device has one or more inputs,
  26. all the output ioctls when the device has one or more outputs.
  27. Example: Information about the current video input
  28. ==================================================
  29. .. code-block:: c
  30. struct v4l2_input input;
  31. int index;
  32. if (-1 == ioctl(fd, VIDIOC_G_INPUT, &index)) {
  33. perror("VIDIOC_G_INPUT");
  34. exit(EXIT_FAILURE);
  35. }
  36. memset(&input, 0, sizeof(input));
  37. input.index = index;
  38. if (-1 == ioctl(fd, VIDIOC_ENUMINPUT, &input)) {
  39. perror("VIDIOC_ENUMINPUT");
  40. exit(EXIT_FAILURE);
  41. }
  42. printf("Current input: %s\\n", input.name);
  43. Example: Switching to the first video input
  44. ===========================================
  45. .. code-block:: c
  46. int index;
  47. index = 0;
  48. if (-1 == ioctl(fd, VIDIOC_S_INPUT, &index)) {
  49. perror("VIDIOC_S_INPUT");
  50. exit(EXIT_FAILURE);
  51. }