dev-sliced-vbi.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <title>Sliced VBI Data Interface</title>
  2. <para>VBI stands for Vertical Blanking Interval, a gap in the
  3. sequence of lines of an analog video signal. During VBI no picture
  4. information is transmitted, allowing some time while the electron beam
  5. of a cathode ray tube TV returns to the top of the screen.</para>
  6. <para>Sliced VBI devices use hardware to demodulate data transmitted
  7. in the VBI. V4L2 drivers shall <emphasis>not</emphasis> do this by
  8. software, see also the <link linkend="raw-vbi">raw VBI
  9. interface</link>. The data is passed as short packets of fixed size,
  10. covering one scan line each. The number of packets per video frame is
  11. variable.</para>
  12. <para>Sliced VBI capture and output devices are accessed through the
  13. same character special files as raw VBI devices. When a driver
  14. supports both interfaces, the default function of a
  15. <filename>/dev/vbi</filename> device is <emphasis>raw</emphasis> VBI
  16. capturing or output, and the sliced VBI function is only available
  17. after calling the &VIDIOC-S-FMT; ioctl as defined below. Likewise a
  18. <filename>/dev/video</filename> device may support the sliced VBI API,
  19. however the default function here is video capturing or output.
  20. Different file descriptors must be used to pass raw and sliced VBI
  21. data simultaneously, if this is supported by the driver.</para>
  22. <section>
  23. <title>Querying Capabilities</title>
  24. <para>Devices supporting the sliced VBI capturing or output API
  25. set the <constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant> or
  26. <constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant> flag respectively, in
  27. the <structfield>capabilities</structfield> field of &v4l2-capability;
  28. returned by the &VIDIOC-QUERYCAP; ioctl. At least one of the
  29. read/write, streaming or asynchronous <link linkend="io">I/O
  30. methods</link> must be supported. Sliced VBI devices may have a tuner
  31. or modulator.</para>
  32. </section>
  33. <section>
  34. <title>Supplemental Functions</title>
  35. <para>Sliced VBI devices shall support <link linkend="video">video
  36. input or output</link> and <link linkend="tuner">tuner or
  37. modulator</link> ioctls if they have these capabilities, and they may
  38. support <link linkend="control">control</link> ioctls. The <link
  39. linkend="standard">video standard</link> ioctls provide information
  40. vital to program a sliced VBI device, therefore must be
  41. supported.</para>
  42. </section>
  43. <section id="sliced-vbi-format-negotitation">
  44. <title>Sliced VBI Format Negotiation</title>
  45. <para>To find out which data services are supported by the
  46. hardware applications can call the &VIDIOC-G-SLICED-VBI-CAP; ioctl.
  47. All drivers implementing the sliced VBI interface must support this
  48. ioctl. The results may differ from those of the &VIDIOC-S-FMT; ioctl
  49. when the number of VBI lines the hardware can capture or output per
  50. frame, or the number of services it can identify on a given line are
  51. limited. For example on PAL line 16 the hardware may be able to look
  52. for a VPS or Teletext signal, but not both at the same time.</para>
  53. <para>To determine the currently selected services applications
  54. set the <structfield>type </structfield> field of &v4l2-format; to
  55. <constant> V4L2_BUF_TYPE_SLICED_VBI_CAPTURE</constant> or <constant>
  56. V4L2_BUF_TYPE_SLICED_VBI_OUTPUT</constant>, and the &VIDIOC-G-FMT;
  57. ioctl fills the <structfield>fmt.sliced</structfield> member, a
  58. &v4l2-sliced-vbi-format;.</para>
  59. <para>Applications can request different parameters by
  60. initializing or modifying the <structfield>fmt.sliced</structfield>
  61. member and calling the &VIDIOC-S-FMT; ioctl with a pointer to the
  62. <structname>v4l2_format</structname> structure.</para>
  63. <para>The sliced VBI API is more complicated than the raw VBI API
  64. because the hardware must be told which VBI service to expect on each
  65. scan line. Not all services may be supported by the hardware on all
  66. lines (this is especially true for VBI output where Teletext is often
  67. unsupported and other services can only be inserted in one specific
  68. line). In many cases, however, it is sufficient to just set the
  69. <structfield>service_set</structfield> field to the required services
  70. and let the driver fill the <structfield>service_lines</structfield>
  71. array according to hardware capabilities. Only if more precise control
  72. is needed should the programmer set the
  73. <structfield>service_lines</structfield> array explicitly.</para>
  74. <para>The &VIDIOC-S-FMT; ioctl modifies the parameters
  75. according to hardware capabilities. When the driver allocates
  76. resources at this point, it may return an &EBUSY; if the required
  77. resources are temporarily unavailable. Other resource allocation
  78. points which may return <errorcode>EBUSY</errorcode> can be the
  79. &VIDIOC-STREAMON; ioctl and the first &func-read;, &func-write; and
  80. &func-select; call.</para>
  81. <table frame="none" pgwide="1" id="v4l2-sliced-vbi-format">
  82. <title>struct
  83. <structname>v4l2_sliced_vbi_format</structname></title>
  84. <tgroup cols="5">
  85. <colspec colname="c1" colwidth="3*" />
  86. <colspec colname="c2" colwidth="3*" />
  87. <colspec colname="c3" colwidth="2*" />
  88. <colspec colname="c4" colwidth="2*" />
  89. <colspec colname="c5" colwidth="2*" />
  90. <spanspec namest="c3" nameend="c5" spanname="hspan" />
  91. <tbody valign="top">
  92. <row>
  93. <entry>__u32</entry>
  94. <entry><structfield>service_set</structfield></entry>
  95. <entry spanname="hspan"><para>If
  96. <structfield>service_set</structfield> is non-zero when passed with
  97. &VIDIOC-S-FMT; or &VIDIOC-TRY-FMT;, the
  98. <structfield>service_lines</structfield> array will be filled by the
  99. driver according to the services specified in this field. For example,
  100. if <structfield>service_set</structfield> is initialized with
  101. <constant>V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625</constant>, a
  102. driver for the cx25840 video decoder sets lines 7-22 of both
  103. fields<footnote><para>According to <link
  104. linkend="ets300706">ETS&nbsp;300&nbsp;706</link> lines 6-22 of the
  105. first field and lines 5-22 of the second field may carry Teletext
  106. data.</para></footnote> to <constant>V4L2_SLICED_TELETEXT_B</constant>
  107. and line 23 of the first field to
  108. <constant>V4L2_SLICED_WSS_625</constant>. If
  109. <structfield>service_set</structfield> is set to zero, then the values
  110. of <structfield>service_lines</structfield> will be used instead.
  111. </para><para>On return the driver sets this field to the union of all
  112. elements of the returned <structfield>service_lines</structfield>
  113. array. It may contain less services than requested, perhaps just one,
  114. if the hardware cannot handle more services simultaneously. It may be
  115. empty (zero) if none of the requested services are supported by the
  116. hardware.</para></entry>
  117. </row>
  118. <row>
  119. <entry>__u16</entry>
  120. <entry><structfield>service_lines</structfield>[2][24]</entry>
  121. <entry spanname="hspan"><para>Applications initialize this
  122. array with sets of data services the driver shall look for or insert
  123. on the respective scan line. Subject to hardware capabilities drivers
  124. return the requested set, a subset, which may be just a single
  125. service, or an empty set. When the hardware cannot handle multiple
  126. services on the same line the driver shall choose one. No assumptions
  127. can be made on which service the driver chooses.</para><para>Data
  128. services are defined in <xref linkend="vbi-services2" />. Array indices
  129. map to ITU-R line numbers (see also <xref linkend="vbi-525" /> and <xref
  130. linkend="vbi-625" />) as follows: <!-- No nested
  131. tables, sigh. --></para></entry>
  132. </row>
  133. <row>
  134. <entry></entry>
  135. <entry></entry>
  136. <entry>Element</entry>
  137. <entry>525 line systems</entry>
  138. <entry>625 line systems</entry>
  139. </row>
  140. <row>
  141. <entry></entry>
  142. <entry></entry>
  143. <entry><structfield>service_lines</structfield>[0][1]</entry>
  144. <entry align="center">1</entry>
  145. <entry align="center">1</entry>
  146. </row>
  147. <row>
  148. <entry></entry>
  149. <entry></entry>
  150. <entry><structfield>service_lines</structfield>[0][23]</entry>
  151. <entry align="center">23</entry>
  152. <entry align="center">23</entry>
  153. </row>
  154. <row>
  155. <entry></entry>
  156. <entry></entry>
  157. <entry><structfield>service_lines</structfield>[1][1]</entry>
  158. <entry align="center">264</entry>
  159. <entry align="center">314</entry>
  160. </row>
  161. <row>
  162. <entry></entry>
  163. <entry></entry>
  164. <entry><structfield>service_lines</structfield>[1][23]</entry>
  165. <entry align="center">286</entry>
  166. <entry align="center">336</entry>
  167. </row>
  168. <!-- End of line numbers table. -->
  169. <row>
  170. <entry></entry>
  171. <entry></entry>
  172. <entry spanname="hspan">Drivers must set
  173. <structfield>service_lines</structfield>[0][0] and
  174. <structfield>service_lines</structfield>[1][0] to zero.
  175. The <constant>V4L2_VBI_ITU_525_F1_START</constant>,
  176. <constant>V4L2_VBI_ITU_525_F2_START</constant>,
  177. <constant>V4L2_VBI_ITU_625_F1_START</constant> and
  178. <constant>V4L2_VBI_ITU_625_F2_START</constant> defines give the start
  179. line numbers for each field for each 525 or 625 line format as a
  180. convenience. Don't forget that ITU line numbering starts at 1, not 0.
  181. </entry>
  182. </row>
  183. <row>
  184. <entry>__u32</entry>
  185. <entry><structfield>io_size</structfield></entry>
  186. <entry spanname="hspan">Maximum number of bytes passed by
  187. one &func-read; or &func-write; call, and the buffer size in bytes for
  188. the &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. Drivers set this field to
  189. the size of &v4l2-sliced-vbi-data; times the number of non-zero
  190. elements in the returned <structfield>service_lines</structfield>
  191. array (that is the number of lines potentially carrying data).</entry>
  192. </row>
  193. <row>
  194. <entry>__u32</entry>
  195. <entry><structfield>reserved</structfield>[2]</entry>
  196. <entry spanname="hspan">This array is reserved for future
  197. extensions. Applications and drivers must set it to zero.</entry>
  198. </row>
  199. </tbody>
  200. </tgroup>
  201. </table>
  202. <!-- See also vidioc-g-sliced-vbi-cap.sgml -->
  203. <table frame="none" pgwide="1" id="vbi-services2">
  204. <title>Sliced VBI services</title>
  205. <tgroup cols="5">
  206. <colspec colname="c1" colwidth="2*" />
  207. <colspec colname="c2" colwidth="1*" />
  208. <colspec colname="c3" colwidth="1*" />
  209. <colspec colname="c4" colwidth="2*" />
  210. <colspec colname="c5" colwidth="2*" />
  211. <spanspec namest="c3" nameend="c5" spanname="rlp" />
  212. <thead>
  213. <row>
  214. <entry>Symbol</entry>
  215. <entry>Value</entry>
  216. <entry>Reference</entry>
  217. <entry>Lines, usually</entry>
  218. <entry>Payload</entry>
  219. </row>
  220. </thead>
  221. <tbody valign="top">
  222. <row>
  223. <entry><constant>V4L2_SLICED_TELETEXT_B</constant>
  224. (Teletext System B)</entry>
  225. <entry>0x0001</entry>
  226. <entry><xref linkend="ets300706" />, <xref linkend="itu653" /></entry>
  227. <entry>PAL/SECAM line 7-22, 320-335 (second field 7-22)</entry>
  228. <entry>Last 42 of the 45 byte Teletext packet, that is
  229. without clock run-in and framing code, lsb first transmitted.</entry>
  230. </row>
  231. <row>
  232. <entry><constant>V4L2_SLICED_VPS</constant></entry>
  233. <entry>0x0400</entry>
  234. <entry><xref linkend="ets300231" /></entry>
  235. <entry>PAL line 16</entry>
  236. <entry>Byte number 3 to 15 according to Figure 9 of
  237. ETS&nbsp;300&nbsp;231, lsb first transmitted.</entry>
  238. </row>
  239. <row>
  240. <entry><constant>V4L2_SLICED_CAPTION_525</constant></entry>
  241. <entry>0x1000</entry>
  242. <entry><xref linkend="cea608" /></entry>
  243. <entry>NTSC line 21, 284 (second field 21)</entry>
  244. <entry>Two bytes in transmission order, including parity
  245. bit, lsb first transmitted.</entry>
  246. </row>
  247. <row>
  248. <entry><constant>V4L2_SLICED_WSS_625</constant></entry>
  249. <entry>0x4000</entry>
  250. <entry><xref linkend="itu1119" />, <xref linkend="en300294" /></entry>
  251. <entry>PAL/SECAM line 23</entry>
  252. <entry><screen>
  253. Byte 0 1
  254. msb lsb msb lsb
  255. Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9
  256. </screen></entry>
  257. </row>
  258. <row>
  259. <entry><constant>V4L2_SLICED_VBI_525</constant></entry>
  260. <entry>0x1000</entry>
  261. <entry spanname="rlp">Set of services applicable to 525
  262. line systems.</entry>
  263. </row>
  264. <row>
  265. <entry><constant>V4L2_SLICED_VBI_625</constant></entry>
  266. <entry>0x4401</entry>
  267. <entry spanname="rlp">Set of services applicable to 625
  268. line systems.</entry>
  269. </row>
  270. </tbody>
  271. </tgroup>
  272. </table>
  273. <para>Drivers may return an &EINVAL; when applications attempt to
  274. read or write data without prior format negotiation, after switching
  275. the video standard (which may invalidate the negotiated VBI
  276. parameters) and after switching the video input (which may change the
  277. video standard as a side effect). The &VIDIOC-S-FMT; ioctl may return
  278. an &EBUSY; when applications attempt to change the format while i/o is
  279. in progress (between a &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; call,
  280. and after the first &func-read; or &func-write; call).</para>
  281. </section>
  282. <section>
  283. <title>Reading and writing sliced VBI data</title>
  284. <para>A single &func-read; or &func-write; call must pass all data
  285. belonging to one video frame. That is an array of
  286. <structname>v4l2_sliced_vbi_data</structname> structures with one or
  287. more elements and a total size not exceeding
  288. <structfield>io_size</structfield> bytes. Likewise in streaming I/O
  289. mode one buffer of <structfield>io_size</structfield> bytes must
  290. contain data of one video frame. The <structfield>id</structfield> of
  291. unused <structname>v4l2_sliced_vbi_data</structname> elements must be
  292. zero.</para>
  293. <table frame="none" pgwide="1" id="v4l2-sliced-vbi-data">
  294. <title>struct
  295. <structname>v4l2_sliced_vbi_data</structname></title>
  296. <tgroup cols="3">
  297. &cs-def;
  298. <tbody valign="top">
  299. <row>
  300. <entry>__u32</entry>
  301. <entry><structfield>id</structfield></entry>
  302. <entry>A flag from <xref linkend="vbi-services" />
  303. identifying the type of data in this packet. Only a single bit must be
  304. set. When the <structfield>id</structfield> of a captured packet is
  305. zero, the packet is empty and the contents of other fields are
  306. undefined. Applications shall ignore empty packets. When the
  307. <structfield>id</structfield> of a packet for output is zero the
  308. contents of the <structfield>data</structfield> field are undefined
  309. and the driver must no longer insert data on the requested
  310. <structfield>field</structfield> and
  311. <structfield>line</structfield>.</entry>
  312. </row>
  313. <row>
  314. <entry>__u32</entry>
  315. <entry><structfield>field</structfield></entry>
  316. <entry>The video field number this data has been captured
  317. from, or shall be inserted at. <constant>0</constant> for the first
  318. field, <constant>1</constant> for the second field.</entry>
  319. </row>
  320. <row>
  321. <entry>__u32</entry>
  322. <entry><structfield>line</structfield></entry>
  323. <entry>The field (as opposed to frame) line number this
  324. data has been captured from, or shall be inserted at. See <xref
  325. linkend="vbi-525" /> and <xref linkend="vbi-625" /> for valid
  326. values. Sliced VBI capture devices can set the line number of all
  327. packets to <constant>0</constant> if the hardware cannot reliably
  328. identify scan lines. The field number must always be valid.</entry>
  329. </row>
  330. <row>
  331. <entry>__u32</entry>
  332. <entry><structfield>reserved</structfield></entry>
  333. <entry>This field is reserved for future extensions.
  334. Applications and drivers must set it to zero.</entry>
  335. </row>
  336. <row>
  337. <entry>__u8</entry>
  338. <entry><structfield>data</structfield>[48]</entry>
  339. <entry>The packet payload. See <xref
  340. linkend="vbi-services" /> for the contents and number of
  341. bytes passed for each data type. The contents of padding bytes at the
  342. end of this array are undefined, drivers and applications shall ignore
  343. them.</entry>
  344. </row>
  345. </tbody>
  346. </tgroup>
  347. </table>
  348. <para>Packets are always passed in ascending line number order,
  349. without duplicate line numbers. The &func-write; function and the
  350. &VIDIOC-QBUF; ioctl must return an &EINVAL; when applications violate
  351. this rule. They must also return an &EINVAL; when applications pass an
  352. incorrect field or line number, or a combination of
  353. <structfield>field</structfield>, <structfield>line</structfield> and
  354. <structfield>id</structfield> which has not been negotiated with the
  355. &VIDIOC-G-FMT; or &VIDIOC-S-FMT; ioctl. When the line numbers are
  356. unknown the driver must pass the packets in transmitted order. The
  357. driver can insert empty packets with <structfield>id</structfield> set
  358. to zero anywhere in the packet array.</para>
  359. <para>To assure synchronization and to distinguish from frame
  360. dropping, when a captured frame does not carry any of the requested
  361. data services drivers must pass one or more empty packets. When an
  362. application fails to pass VBI data in time for output, the driver
  363. must output the last VPS and WSS packet again, and disable the output
  364. of Closed Caption and Teletext data, or output data which is ignored
  365. by Closed Caption and Teletext decoders.</para>
  366. <para>A sliced VBI device may support <link
  367. linkend="rw">read/write</link> and/or streaming (<link
  368. linkend="mmap">memory mapping</link> and/or <link linkend="userp">user
  369. pointer</link>) I/O. The latter bears the possibility of synchronizing
  370. video and VBI data by using buffer timestamps.</para>
  371. </section>
  372. <section>
  373. <title>Sliced VBI Data in MPEG Streams</title>
  374. <para>If a device can produce an MPEG output stream, it may be
  375. capable of providing <link
  376. linkend="sliced-vbi-format-negotitation">negotiated sliced VBI
  377. services</link> as data embedded in the MPEG stream. Users or
  378. applications control this sliced VBI data insertion with the <link
  379. linkend="v4l2-mpeg-stream-vbi-fmt">V4L2_CID_MPEG_STREAM_VBI_FMT</link>
  380. control.</para>
  381. <para>If the driver does not provide the <link
  382. linkend="v4l2-mpeg-stream-vbi-fmt">V4L2_CID_MPEG_STREAM_VBI_FMT</link>
  383. control, or only allows that control to be set to <link
  384. linkend="v4l2-mpeg-stream-vbi-fmt"><constant>
  385. V4L2_MPEG_STREAM_VBI_FMT_NONE</constant></link>, then the device
  386. cannot embed sliced VBI data in the MPEG stream.</para>
  387. <para>The <link linkend="v4l2-mpeg-stream-vbi-fmt">
  388. V4L2_CID_MPEG_STREAM_VBI_FMT</link> control does not implicitly set
  389. the device driver to capture nor cease capturing sliced VBI data. The
  390. control only indicates to embed sliced VBI data in the MPEG stream, if
  391. an application has negotiated sliced VBI service be captured.</para>
  392. <para>It may also be the case that a device can embed sliced VBI
  393. data in only certain types of MPEG streams: for example in an MPEG-2
  394. PS but not an MPEG-2 TS. In this situation, if sliced VBI data
  395. insertion is requested, the sliced VBI data will be embedded in MPEG
  396. stream types when supported, and silently omitted from MPEG stream
  397. types where sliced VBI data insertion is not supported by the device.
  398. </para>
  399. <para>The following subsections specify the format of the
  400. embedded sliced VBI data.</para>
  401. <section>
  402. <title>MPEG Stream Embedded, Sliced VBI Data Format: NONE</title>
  403. <para>The <link linkend="v4l2-mpeg-stream-vbi-fmt"><constant>
  404. V4L2_MPEG_STREAM_VBI_FMT_NONE</constant></link> embedded sliced VBI
  405. format shall be interpreted by drivers as a control to cease
  406. embedding sliced VBI data in MPEG streams. Neither the device nor
  407. driver shall insert "empty" embedded sliced VBI data packets in the
  408. MPEG stream when this format is set. No MPEG stream data structures
  409. are specified for this format.</para>
  410. </section>
  411. <section>
  412. <title>MPEG Stream Embedded, Sliced VBI Data Format: IVTV</title>
  413. <para>The <link linkend="v4l2-mpeg-stream-vbi-fmt"><constant>
  414. V4L2_MPEG_STREAM_VBI_FMT_IVTV</constant></link> embedded sliced VBI
  415. format, when supported, indicates to the driver to embed up to 36
  416. lines of sliced VBI data per frame in an MPEG-2 <emphasis>Private
  417. Stream 1 PES</emphasis> packet encapsulated in an MPEG-2 <emphasis>
  418. Program Pack</emphasis> in the MPEG stream.</para>
  419. <para><emphasis>Historical context</emphasis>: This format
  420. specification originates from a custom, embedded, sliced VBI data
  421. format used by the <filename>ivtv</filename> driver. This format
  422. has already been informally specified in the kernel sources in the
  423. file <filename>Documentation/video4linux/cx2341x/README.vbi</filename>
  424. . The maximum size of the payload and other aspects of this format
  425. are driven by the CX23415 MPEG decoder's capabilities and limitations
  426. with respect to extracting, decoding, and displaying sliced VBI data
  427. embedded within an MPEG stream.</para>
  428. <para>This format's use is <emphasis>not</emphasis> exclusive to
  429. the <filename>ivtv</filename> driver <emphasis>nor</emphasis>
  430. exclusive to CX2341x devices, as the sliced VBI data packet insertion
  431. into the MPEG stream is implemented in driver software. At least the
  432. <filename>cx18</filename> driver provides sliced VBI data insertion
  433. into an MPEG-2 PS in this format as well.</para>
  434. <para>The following definitions specify the payload of the
  435. MPEG-2 <emphasis>Private Stream 1 PES</emphasis> packets that contain
  436. sliced VBI data when <link linkend="v4l2-mpeg-stream-vbi-fmt">
  437. <constant>V4L2_MPEG_STREAM_VBI_FMT_IVTV</constant></link> is set.
  438. (The MPEG-2 <emphasis>Private Stream 1 PES</emphasis> packet header
  439. and encapsulating MPEG-2 <emphasis>Program Pack</emphasis> header are
  440. not detailed here. Please refer to the MPEG-2 specifications for
  441. details on those packet headers.)</para>
  442. <para>The payload of the MPEG-2 <emphasis>Private Stream 1 PES
  443. </emphasis> packets that contain sliced VBI data is specified by
  444. &v4l2-mpeg-vbi-fmt-ivtv;. The payload is variable
  445. length, depending on the actual number of lines of sliced VBI data
  446. present in a video frame. The payload may be padded at the end with
  447. unspecified fill bytes to align the end of the payload to a 4-byte
  448. boundary. The payload shall never exceed 1552 bytes (2 fields with
  449. 18 lines/field with 43 bytes of data/line and a 4 byte magic number).
  450. </para>
  451. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-fmt-ivtv">
  452. <title>struct <structname>v4l2_mpeg_vbi_fmt_ivtv</structname>
  453. </title>
  454. <tgroup cols="4">
  455. &cs-ustr;
  456. <tbody valign="top">
  457. <row>
  458. <entry>__u8</entry>
  459. <entry><structfield>magic</structfield>[4]</entry>
  460. <entry></entry>
  461. <entry>A "magic" constant from <xref
  462. linkend="v4l2-mpeg-vbi-fmt-ivtv-magic" /> that indicates
  463. this is a valid sliced VBI data payload and also indicates which
  464. member of the anonymous union, <structfield>itv0</structfield> or
  465. <structfield>ITV0</structfield>, to use for the payload data.</entry>
  466. </row>
  467. <row>
  468. <entry>union</entry>
  469. <entry>(anonymous)</entry>
  470. </row>
  471. <row>
  472. <entry></entry>
  473. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0">
  474. <structname>v4l2_mpeg_vbi_itv0</structname></link>
  475. </entry>
  476. <entry><structfield>itv0</structfield></entry>
  477. <entry>The primary form of the sliced VBI data payload
  478. that contains anywhere from 1 to 35 lines of sliced VBI data.
  479. Line masks are provided in this form of the payload indicating
  480. which VBI lines are provided.</entry>
  481. </row>
  482. <row>
  483. <entry></entry>
  484. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0-1">
  485. <structname>v4l2_mpeg_vbi_ITV0</structname></link>
  486. </entry>
  487. <entry><structfield>ITV0</structfield></entry>
  488. <entry>An alternate form of the sliced VBI data payload
  489. used when 36 lines of sliced VBI data are present. No line masks are
  490. provided in this form of the payload; all valid line mask bits are
  491. implcitly set.</entry>
  492. </row>
  493. </tbody>
  494. </tgroup>
  495. </table>
  496. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-fmt-ivtv-magic">
  497. <title>Magic Constants for &v4l2-mpeg-vbi-fmt-ivtv;
  498. <structfield>magic</structfield> field</title>
  499. <tgroup cols="3">
  500. &cs-def;
  501. <thead>
  502. <row>
  503. <entry align="left">Defined Symbol</entry>
  504. <entry align="left">Value</entry>
  505. <entry align="left">Description</entry>
  506. </row>
  507. </thead>
  508. <tbody valign="top">
  509. <row>
  510. <entry><constant>V4L2_MPEG_VBI_IVTV_MAGIC0</constant>
  511. </entry>
  512. <entry>"itv0"</entry>
  513. <entry>Indicates the <structfield>itv0</structfield>
  514. member of the union in &v4l2-mpeg-vbi-fmt-ivtv; is valid.</entry>
  515. </row>
  516. <row>
  517. <entry><constant>V4L2_MPEG_VBI_IVTV_MAGIC1</constant>
  518. </entry>
  519. <entry>"ITV0"</entry>
  520. <entry>Indicates the <structfield>ITV0</structfield>
  521. member of the union in &v4l2-mpeg-vbi-fmt-ivtv; is valid and
  522. that 36 lines of sliced VBI data are present.</entry>
  523. </row>
  524. </tbody>
  525. </tgroup>
  526. </table>
  527. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-itv0">
  528. <title>struct <structname>v4l2_mpeg_vbi_itv0</structname>
  529. </title>
  530. <tgroup cols="3">
  531. &cs-str;
  532. <tbody valign="top">
  533. <row>
  534. <entry>__le32</entry>
  535. <entry><structfield>linemask</structfield>[2]</entry>
  536. <entry><para>Bitmasks indicating the VBI service lines
  537. present. These <structfield>linemask</structfield> values are stored
  538. in little endian byte order in the MPEG stream. Some reference
  539. <structfield>linemask</structfield> bit positions with their
  540. corresponding VBI line number and video field are given below.
  541. b<subscript>0</subscript> indicates the least significant bit of a
  542. <structfield>linemask</structfield> value:<screen>
  543. <structfield>linemask</structfield>[0] b<subscript>0</subscript>: line 6 first field
  544. <structfield>linemask</structfield>[0] b<subscript>17</subscript>: line 23 first field
  545. <structfield>linemask</structfield>[0] b<subscript>18</subscript>: line 6 second field
  546. <structfield>linemask</structfield>[0] b<subscript>31</subscript>: line 19 second field
  547. <structfield>linemask</structfield>[1] b<subscript>0</subscript>: line 20 second field
  548. <structfield>linemask</structfield>[1] b<subscript>3</subscript>: line 23 second field
  549. <structfield>linemask</structfield>[1] b<subscript>4</subscript>-b<subscript>31</subscript>: unused and set to 0</screen></para></entry>
  550. </row>
  551. <row>
  552. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0-line">
  553. <structname>v4l2_mpeg_vbi_itv0_line</structname></link>
  554. </entry>
  555. <entry><structfield>line</structfield>[35]</entry>
  556. <entry>This is a variable length array that holds from 1
  557. to 35 lines of sliced VBI data. The sliced VBI data lines present
  558. correspond to the bits set in the <structfield>linemask</structfield>
  559. array, starting from b<subscript>0</subscript> of <structfield>
  560. linemask</structfield>[0] up through b<subscript>31</subscript> of
  561. <structfield>linemask</structfield>[0], and from b<subscript>0
  562. </subscript> of <structfield>linemask</structfield>[1] up through b
  563. <subscript>3</subscript> of <structfield>linemask</structfield>[1].
  564. <structfield>line</structfield>[0] corresponds to the first bit
  565. found set in the <structfield>linemask</structfield> array,
  566. <structfield>line</structfield>[1] corresponds to the second bit
  567. found set in the <structfield>linemask</structfield> array, etc.
  568. If no <structfield>linemask</structfield> array bits are set, then
  569. <structfield>line</structfield>[0] may contain one line of
  570. unspecified data that should be ignored by applications.</entry>
  571. </row>
  572. </tbody>
  573. </tgroup>
  574. </table>
  575. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-itv0-1">
  576. <title>struct <structname>v4l2_mpeg_vbi_ITV0</structname>
  577. </title>
  578. <tgroup cols="3">
  579. &cs-str;
  580. <tbody valign="top">
  581. <row>
  582. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0-line">
  583. <structname>v4l2_mpeg_vbi_itv0_line</structname></link>
  584. </entry>
  585. <entry><structfield>line</structfield>[36]</entry>
  586. <entry>A fixed length array of 36 lines of sliced VBI
  587. data. <structfield>line</structfield>[0] through <structfield>line
  588. </structfield>[17] correspond to lines 6 through 23 of the
  589. first field. <structfield>line</structfield>[18] through
  590. <structfield>line</structfield>[35] corresponds to lines 6
  591. through 23 of the second field.</entry>
  592. </row>
  593. </tbody>
  594. </tgroup>
  595. </table>
  596. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-itv0-line">
  597. <title>struct <structname>v4l2_mpeg_vbi_itv0_line</structname>
  598. </title>
  599. <tgroup cols="3">
  600. &cs-str;
  601. <tbody valign="top">
  602. <row>
  603. <entry>__u8</entry>
  604. <entry><structfield>id</structfield></entry>
  605. <entry>A line identifier value from
  606. <xref linkend="ITV0-Line-Identifier-Constants" /> that indicates
  607. the type of sliced VBI data stored on this line.</entry>
  608. </row>
  609. <row>
  610. <entry>__u8</entry>
  611. <entry><structfield>data</structfield>[42]</entry>
  612. <entry>The sliced VBI data for the line.</entry>
  613. </row>
  614. </tbody>
  615. </tgroup>
  616. </table>
  617. <table frame="none" pgwide="1" id="ITV0-Line-Identifier-Constants">
  618. <title>Line Identifiers for struct <link
  619. linkend="v4l2-mpeg-vbi-itv0-line"><structname>
  620. v4l2_mpeg_vbi_itv0_line</structname></link> <structfield>id
  621. </structfield> field</title>
  622. <tgroup cols="3">
  623. &cs-def;
  624. <thead>
  625. <row>
  626. <entry align="left">Defined Symbol</entry>
  627. <entry align="left">Value</entry>
  628. <entry align="left">Description</entry>
  629. </row>
  630. </thead>
  631. <tbody valign="top">
  632. <row>
  633. <entry><constant>V4L2_MPEG_VBI_IVTV_TELETEXT_B</constant>
  634. </entry>
  635. <entry>1</entry>
  636. <entry>Refer to <link linkend="vbi-services2">
  637. Sliced VBI services</link> for a description of the line payload.</entry>
  638. </row>
  639. <row>
  640. <entry><constant>V4L2_MPEG_VBI_IVTV_CAPTION_525</constant>
  641. </entry>
  642. <entry>4</entry>
  643. <entry>Refer to <link linkend="vbi-services2">
  644. Sliced VBI services</link> for a description of the line payload.</entry>
  645. </row>
  646. <row>
  647. <entry><constant>V4L2_MPEG_VBI_IVTV_WSS_625</constant>
  648. </entry>
  649. <entry>5</entry>
  650. <entry>Refer to <link linkend="vbi-services2">
  651. Sliced VBI services</link> for a description of the line payload.</entry>
  652. </row>
  653. <row>
  654. <entry><constant>V4L2_MPEG_VBI_IVTV_VPS</constant>
  655. </entry>
  656. <entry>7</entry>
  657. <entry>Refer to <link linkend="vbi-services2">
  658. Sliced VBI services</link> for a description of the line payload.</entry>
  659. </row>
  660. </tbody>
  661. </tgroup>
  662. </table>
  663. </section>
  664. </section>