vidioc-enuminput.rst 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_ENUMINPUT:
  4. **********************
  5. ioctl VIDIOC_ENUMINPUT
  6. **********************
  7. Name
  8. ====
  9. VIDIOC_ENUMINPUT - Enumerate video inputs
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_ENUMINPUT
  13. ``int ioctl(int fd, VIDIOC_ENUMINPUT, struct v4l2_input *argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`v4l2_input`.
  20. Description
  21. ===========
  22. To query the attributes of a video input applications initialize the
  23. ``index`` field of struct :c:type:`v4l2_input` and call the
  24. :ref:`VIDIOC_ENUMINPUT` with a pointer to this structure. Drivers
  25. fill the rest of the structure or return an ``EINVAL`` error code when the
  26. index is out of bounds. To enumerate all inputs applications shall begin
  27. at index zero, incrementing by one until the driver returns ``EINVAL``.
  28. .. tabularcolumns:: |p{3.0cm}|p{3.5cm}|p{10.8cm}|
  29. .. c:type:: v4l2_input
  30. .. flat-table:: struct v4l2_input
  31. :header-rows: 0
  32. :stub-columns: 0
  33. :widths: 1 1 2
  34. * - __u32
  35. - ``index``
  36. - Identifies the input, set by the application.
  37. * - __u8
  38. - ``name``\ [32]
  39. - Name of the video input, a NUL-terminated ASCII string, for
  40. example: "Vin (Composite 2)". This information is intended for the
  41. user, preferably the connector label on the device itself.
  42. * - __u32
  43. - ``type``
  44. - Type of the input, see :ref:`input-type`.
  45. * - __u32
  46. - ``audioset``
  47. - Drivers can enumerate up to 32 video and audio inputs. This field
  48. shows which audio inputs were selectable as audio source if this
  49. was the currently selected video input. It is a bit mask. The LSB
  50. corresponds to audio input 0, the MSB to input 31. Any number of
  51. bits can be set, or none.
  52. When the driver does not enumerate audio inputs no bits must be
  53. set. Applications shall not interpret this as lack of audio
  54. support. Some drivers automatically select audio sources and do
  55. not enumerate them since there is no choice anyway.
  56. For details on audio inputs and how to select the current input
  57. see :ref:`audio`.
  58. * - __u32
  59. - ``tuner``
  60. - Capture devices can have zero or more tuners (RF demodulators).
  61. When the ``type`` is set to ``V4L2_INPUT_TYPE_TUNER`` this is an
  62. RF connector and this field identifies the tuner. It corresponds
  63. to struct :c:type:`v4l2_tuner` field ``index``. For
  64. details on tuners see :ref:`tuner`.
  65. * - :ref:`v4l2_std_id <v4l2-std-id>`
  66. - ``std``
  67. - Every video input supports one or more different video standards.
  68. This field is a set of all supported standards. For details on
  69. video standards and how to switch see :ref:`standard`.
  70. * - __u32
  71. - ``status``
  72. - This field provides status information about the input. See
  73. :ref:`input-status` for flags. With the exception of the sensor
  74. orientation bits ``status`` is only valid when this is the current
  75. input.
  76. * - __u32
  77. - ``capabilities``
  78. - This field provides capabilities for the input. See
  79. :ref:`input-capabilities` for flags.
  80. * - __u32
  81. - ``reserved``\ [3]
  82. - Reserved for future extensions. Drivers must set the array to
  83. zero.
  84. .. tabularcolumns:: |p{6.6cm}|p{1.0cm}|p{9.7cm}|
  85. .. _input-type:
  86. .. flat-table:: Input Types
  87. :header-rows: 0
  88. :stub-columns: 0
  89. :widths: 3 1 4
  90. * - ``V4L2_INPUT_TYPE_TUNER``
  91. - 1
  92. - This input uses a tuner (RF demodulator).
  93. * - ``V4L2_INPUT_TYPE_CAMERA``
  94. - 2
  95. - Any non-tuner video input, for example Composite Video,
  96. S-Video, HDMI, camera sensor. The naming as ``_TYPE_CAMERA`` is historical,
  97. today we would have called it ``_TYPE_VIDEO``.
  98. * - ``V4L2_INPUT_TYPE_TOUCH``
  99. - 3
  100. - This input is a touch device for capturing raw touch data.
  101. .. tabularcolumns:: |p{5.6cm}|p{2.6cm}|p{9.1cm}|
  102. .. _input-status:
  103. .. flat-table:: Input Status Flags
  104. :header-rows: 0
  105. :stub-columns: 0
  106. * - :cspan:`2` General
  107. * - ``V4L2_IN_ST_NO_POWER``
  108. - 0x00000001
  109. - Attached device is off.
  110. * - ``V4L2_IN_ST_NO_SIGNAL``
  111. - 0x00000002
  112. -
  113. * - ``V4L2_IN_ST_NO_COLOR``
  114. - 0x00000004
  115. - The hardware supports color decoding, but does not detect color
  116. modulation in the signal.
  117. * - :cspan:`2` Sensor Orientation
  118. * - ``V4L2_IN_ST_HFLIP``
  119. - 0x00000010
  120. - The input is connected to a device that produces a signal that is
  121. flipped horizontally and does not correct this before passing the
  122. signal to userspace.
  123. * - ``V4L2_IN_ST_VFLIP``
  124. - 0x00000020
  125. - The input is connected to a device that produces a signal that is
  126. flipped vertically and does not correct this before passing the
  127. signal to userspace.
  128. .. note:: A 180 degree rotation is the same as HFLIP | VFLIP
  129. * - :cspan:`2` Analog Video
  130. * - ``V4L2_IN_ST_NO_H_LOCK``
  131. - 0x00000100
  132. - No horizontal sync lock.
  133. * - ``V4L2_IN_ST_COLOR_KILL``
  134. - 0x00000200
  135. - A color killer circuit automatically disables color decoding when
  136. it detects no color modulation. When this flag is set the color
  137. killer is enabled *and* has shut off color decoding.
  138. * - ``V4L2_IN_ST_NO_V_LOCK``
  139. - 0x00000400
  140. - No vertical sync lock.
  141. * - ``V4L2_IN_ST_NO_STD_LOCK``
  142. - 0x00000800
  143. - No standard format lock in case of auto-detection format
  144. by the component.
  145. * - :cspan:`2` Digital Video
  146. * - ``V4L2_IN_ST_NO_SYNC``
  147. - 0x00010000
  148. - No synchronization lock.
  149. * - ``V4L2_IN_ST_NO_EQU``
  150. - 0x00020000
  151. - No equalizer lock.
  152. * - ``V4L2_IN_ST_NO_CARRIER``
  153. - 0x00040000
  154. - Carrier recovery failed.
  155. * - :cspan:`2` VCR and Set-Top Box
  156. * - ``V4L2_IN_ST_MACROVISION``
  157. - 0x01000000
  158. - Macrovision is an analog copy prevention system mangling the video
  159. signal to confuse video recorders. When this flag is set
  160. Macrovision has been detected.
  161. * - ``V4L2_IN_ST_NO_ACCESS``
  162. - 0x02000000
  163. - Conditional access denied.
  164. * - ``V4L2_IN_ST_VTR``
  165. - 0x04000000
  166. - VTR time constant. [?]
  167. .. tabularcolumns:: |p{6.6cm}|p{2.4cm}|p{8.3cm}|
  168. .. _input-capabilities:
  169. .. flat-table:: Input capabilities
  170. :header-rows: 0
  171. :stub-columns: 0
  172. :widths: 3 1 4
  173. * - ``V4L2_IN_CAP_DV_TIMINGS``
  174. - 0x00000002
  175. - This input supports setting video timings by using
  176. ``VIDIOC_S_DV_TIMINGS``.
  177. * - ``V4L2_IN_CAP_STD``
  178. - 0x00000004
  179. - This input supports setting the TV standard by using
  180. ``VIDIOC_S_STD``.
  181. * - ``V4L2_IN_CAP_NATIVE_SIZE``
  182. - 0x00000008
  183. - This input supports setting the native size using the
  184. ``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see
  185. :ref:`v4l2-selections-common`.
  186. Return Value
  187. ============
  188. On success 0 is returned, on error -1 and the ``errno`` variable is set
  189. appropriately. The generic error codes are described at the
  190. :ref:`Generic Error Codes <gen-errors>` chapter.
  191. EINVAL
  192. The struct :c:type:`v4l2_input` ``index`` is out of
  193. bounds.