vidioc-enumstd.rst 11 KB

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