vidioc-enumstd.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_ENUMSTD:
  4. *******************************************
  5. ioctl VIDIOC_ENUMSTD, VIDIOC_SUBDEV_ENUMSTD
  6. *******************************************
  7. Name
  8. ====
  9. VIDIOC_ENUMSTD - VIDIOC_SUBDEV_ENUMSTD - Enumerate supported video standards
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_ENUMSTD
  13. ``int ioctl(int fd, VIDIOC_ENUMSTD, struct v4l2_standard *argp)``
  14. .. c:macro:: VIDIOC_SUBDEV_ENUMSTD
  15. ``int ioctl(int fd, VIDIOC_SUBDEV_ENUMSTD, struct v4l2_standard *argp)``
  16. Arguments
  17. =========
  18. ``fd``
  19. File descriptor returned by :c:func:`open()`.
  20. ``argp``
  21. Pointer to struct :c:type:`v4l2_standard`.
  22. Description
  23. ===========
  24. To query the attributes of a video standard, especially a custom (driver
  25. defined) one, applications initialize the ``index`` field of struct
  26. :c:type:`v4l2_standard` and call the :ref:`VIDIOC_ENUMSTD`
  27. ioctl with a pointer to this structure. Drivers fill the rest of the
  28. structure or return an ``EINVAL`` error code when the index is out of
  29. bounds. To enumerate all standards applications shall begin at index
  30. zero, incrementing by one until the driver returns ``EINVAL``. Drivers may
  31. enumerate a different set of standards after switching the video input
  32. or output. [#f1]_
  33. .. c:type:: v4l2_standard
  34. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  35. .. flat-table:: struct v4l2_standard
  36. :header-rows: 0
  37. :stub-columns: 0
  38. :widths: 1 1 2
  39. * - __u32
  40. - ``index``
  41. - Number of the video standard, set by the application.
  42. * - :ref:`v4l2_std_id <v4l2-std-id>`
  43. - ``id``
  44. - The bits in this field identify the standard as one of the common
  45. standards listed in :ref:`v4l2-std-id`, or if bits 32 to 63 are
  46. set as custom standards. Multiple bits can be set if the hardware
  47. does not distinguish between these standards, however separate
  48. indices do not indicate the opposite. The ``id`` must be unique.
  49. No other enumerated struct :c:type:`v4l2_standard` structure,
  50. for this input or output anyway, can contain the same set of bits.
  51. * - __u8
  52. - ``name``\ [24]
  53. - Name of the standard, a NUL-terminated ASCII string, for example:
  54. "PAL-B/G", "NTSC Japan". This information is intended for the
  55. user.
  56. * - struct :c:type:`v4l2_fract`
  57. - ``frameperiod``
  58. - The frame period (not field period) is numerator / denominator.
  59. For example M/NTSC has a frame period of 1001 / 30000 seconds.
  60. * - __u32
  61. - ``framelines``
  62. - Total lines per frame including blanking, e. g. 625 for B/PAL.
  63. * - __u32
  64. - ``reserved``\ [4]
  65. - Reserved for future extensions. Drivers must set the array to
  66. zero.
  67. .. c:type:: v4l2_fract
  68. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  69. .. flat-table:: struct v4l2_fract
  70. :header-rows: 0
  71. :stub-columns: 0
  72. :widths: 1 1 2
  73. * - __u32
  74. - ``numerator``
  75. -
  76. * - __u32
  77. - ``denominator``
  78. -
  79. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  80. .. _v4l2-std-id:
  81. .. flat-table:: typedef v4l2_std_id
  82. :header-rows: 0
  83. :stub-columns: 0
  84. :widths: 1 1 2
  85. * - __u64
  86. - ``v4l2_std_id``
  87. - This type is a set, each bit representing another video standard
  88. as listed below and in :ref:`video-standards`. The 32 most
  89. significant bits are reserved for custom (driver defined) video
  90. standards.
  91. .. code-block:: c
  92. #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
  93. #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
  94. #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
  95. #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
  96. #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
  97. #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
  98. #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
  99. #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
  100. #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
  101. #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
  102. #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
  103. #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
  104. ``V4L2_STD_PAL_60`` is a hybrid standard with 525 lines, 60 Hz refresh
  105. rate, and PAL color modulation with a 4.43 MHz color subcarrier. Some
  106. PAL video recorders can play back NTSC tapes in this mode for display on
  107. a 50/60 Hz agnostic PAL TV.
  108. .. code-block:: c
  109. #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
  110. #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
  111. #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
  112. ``V4L2_STD_NTSC_443`` is a hybrid standard with 525 lines, 60 Hz refresh
  113. rate, and NTSC color modulation with a 4.43 MHz color subcarrier.
  114. .. code-block:: c
  115. #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000)
  116. #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
  117. #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
  118. #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
  119. #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
  120. #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
  121. #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
  122. #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
  123. #define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
  124. /* ATSC/HDTV */
  125. #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
  126. #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
  127. ``V4L2_STD_ATSC_8_VSB`` and ``V4L2_STD_ATSC_16_VSB`` are U.S.
  128. terrestrial digital TV standards. Presently the V4L2 API does not
  129. support digital TV. See also the Linux DVB API at
  130. `https://linuxtv.org <https://linuxtv.org>`__.
  131. .. code-block:: c
  132. #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |
  133. V4L2_STD_PAL_B1 |
  134. V4L2_STD_PAL_G)
  135. #define V4L2_STD_B (V4L2_STD_PAL_B |
  136. V4L2_STD_PAL_B1 |
  137. V4L2_STD_SECAM_B)
  138. #define V4L2_STD_GH (V4L2_STD_PAL_G |
  139. V4L2_STD_PAL_H |
  140. V4L2_STD_SECAM_G |
  141. V4L2_STD_SECAM_H)
  142. #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |
  143. V4L2_STD_PAL_D1 |
  144. V4L2_STD_PAL_K)
  145. #define V4L2_STD_PAL (V4L2_STD_PAL_BG |
  146. V4L2_STD_PAL_DK |
  147. V4L2_STD_PAL_H |
  148. V4L2_STD_PAL_I)
  149. #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |
  150. V4L2_STD_NTSC_M_JP |
  151. V4L2_STD_NTSC_M_KR)
  152. #define V4L2_STD_MN (V4L2_STD_PAL_M |
  153. V4L2_STD_PAL_N |
  154. V4L2_STD_PAL_Nc |
  155. V4L2_STD_NTSC)
  156. #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |
  157. V4L2_STD_SECAM_K |
  158. V4L2_STD_SECAM_K1)
  159. #define V4L2_STD_DK (V4L2_STD_PAL_DK |
  160. V4L2_STD_SECAM_DK)
  161. #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |
  162. V4L2_STD_SECAM_G |
  163. V4L2_STD_SECAM_H |
  164. V4L2_STD_SECAM_DK |
  165. V4L2_STD_SECAM_L |
  166. V4L2_STD_SECAM_LC)
  167. #define V4L2_STD_525_60 (V4L2_STD_PAL_M |
  168. V4L2_STD_PAL_60 |
  169. V4L2_STD_NTSC |
  170. V4L2_STD_NTSC_443)
  171. #define V4L2_STD_625_50 (V4L2_STD_PAL |
  172. V4L2_STD_PAL_N |
  173. V4L2_STD_PAL_Nc |
  174. V4L2_STD_SECAM)
  175. #define V4L2_STD_UNKNOWN 0
  176. #define V4L2_STD_ALL (V4L2_STD_525_60 |
  177. V4L2_STD_625_50)
  178. .. raw:: latex
  179. \begingroup
  180. \tiny
  181. \setlength{\tabcolsep}{2pt}
  182. .. NTSC/M PAL/M /N /B /D /H /I SECAM/B /D /K1 /L
  183. .. tabularcolumns:: |p{1.43cm}|p{1.38cm}|p{1.59cm}|p{1.7cm}|p{1.7cm}|p{1.17cm}|p{0.64cm}|p{1.71cm}|p{1.6cm}|p{1.07cm}|p{1.07cm}|p{1.07cm}|
  184. .. _video-standards:
  185. .. flat-table:: Video Standards (based on :ref:`itu470`)
  186. :header-rows: 1
  187. :stub-columns: 0
  188. * - Characteristics
  189. - M/NTSC [#f2]_
  190. - M/PAL
  191. - N/PAL [#f3]_
  192. - B, B1, G/PAL
  193. - D, D1, K/PAL
  194. - H/PAL
  195. - I/PAL
  196. - B, G/SECAM
  197. - D, K/SECAM
  198. - K1/SECAM
  199. - L/SECAM
  200. * - Frame lines
  201. - :cspan:`1` 525
  202. - :cspan:`8` 625
  203. * - Frame period (s)
  204. - :cspan:`1` 1001/30000
  205. - :cspan:`8` 1/25
  206. * - Chrominance sub-carrier frequency (Hz)
  207. - 3579545 ± 10
  208. - 3579611.49 ± 10
  209. - 4433618.75 ± 5
  210. (3582056.25 ± 5)
  211. - :cspan:`3` 4433618.75 ± 5
  212. - 4433618.75 ± 1
  213. - :cspan:`2` f\ :sub:`OR` = 4406250 ± 2000,
  214. f\ :sub:`OB` = 4250000 ± 2000
  215. * - Nominal radio-frequency channel bandwidth (MHz)
  216. - 6
  217. - 6
  218. - 6
  219. - B: 7; B1, G: 8
  220. - 8
  221. - 8
  222. - 8
  223. - 8
  224. - 8
  225. - 8
  226. - 8
  227. * - Sound carrier relative to vision carrier (MHz)
  228. - 4.5
  229. - 4.5
  230. - 4.5
  231. - 5.5 ± 0.001 [#f4]_ [#f5]_ [#f6]_ [#f7]_
  232. - 6.5 ± 0.001
  233. - 5.5
  234. - 5.9996 ± 0.0005
  235. - 5.5 ± 0.001
  236. - 6.5 ± 0.001
  237. - 6.5
  238. - 6.5 [#f8]_
  239. .. raw:: latex
  240. \endgroup
  241. Return Value
  242. ============
  243. On success 0 is returned, on error -1 and the ``errno`` variable is set
  244. appropriately. The generic error codes are described at the
  245. :ref:`Generic Error Codes <gen-errors>` chapter.
  246. EINVAL
  247. The struct :c:type:`v4l2_standard` ``index`` is out
  248. of bounds.
  249. ENODATA
  250. Standard video timings are not supported for this input or output.
  251. .. [#f1]
  252. The supported standards may overlap and we need an unambiguous set to
  253. find the current standard returned by :ref:`VIDIOC_G_STD <VIDIOC_G_STD>`.
  254. .. [#f2]
  255. Japan uses a standard similar to M/NTSC (V4L2_STD_NTSC_M_JP).
  256. .. [#f3]
  257. The values in brackets apply to the combination N/PAL a.k.a.
  258. N\ :sub:`C` used in Argentina (V4L2_STD_PAL_Nc).
  259. .. [#f4]
  260. In the Federal Republic of Germany, Austria, Italy, the Netherlands,
  261. Slovakia and Switzerland a system of two sound carriers is used, the
  262. frequency of the second carrier being 242.1875 kHz above the
  263. frequency of the first sound carrier. For stereophonic sound
  264. transmissions a similar system is used in Australia.
  265. .. [#f5]
  266. New Zealand uses a sound carrier displaced 5.4996 ± 0.0005 MHz from
  267. the vision carrier.
  268. .. [#f6]
  269. In Denmark, Finland, New Zealand, Sweden and Spain a system of two
  270. sound carriers is used. In Iceland, Norway and Poland the same system
  271. is being introduced. The second carrier is 5.85 MHz above the vision
  272. carrier and is DQPSK modulated with 728 kbit/s sound and data
  273. multiplex. (NICAM system)
  274. .. [#f7]
  275. In the United Kingdom, a system of two sound carriers is used. The
  276. second sound carrier is 6.552 MHz above the vision carrier and is
  277. DQPSK modulated with a 728 kbit/s sound and data multiplex able to
  278. carry two sound channels. (NICAM system)
  279. .. [#f8]
  280. In France, a digital carrier 5.85 MHz away from the vision carrier
  281. may be used in addition to the main sound carrier. It is modulated in
  282. differentially encoded QPSK with a 728 kbit/s sound and data
  283. multiplexer capable of carrying two sound channels. (NICAM system)