dev-sliced-vbi.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  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.</entry>
  175. </row>
  176. <row>
  177. <entry>__u32</entry>
  178. <entry><structfield>io_size</structfield></entry>
  179. <entry spanname="hspan">Maximum number of bytes passed by
  180. one &func-read; or &func-write; call, and the buffer size in bytes for
  181. the &VIDIOC-QBUF; and &VIDIOC-DQBUF; ioctl. Drivers set this field to
  182. the size of &v4l2-sliced-vbi-data; times the number of non-zero
  183. elements in the returned <structfield>service_lines</structfield>
  184. array (that is the number of lines potentially carrying data).</entry>
  185. </row>
  186. <row>
  187. <entry>__u32</entry>
  188. <entry><structfield>reserved</structfield>[2]</entry>
  189. <entry spanname="hspan">This array is reserved for future
  190. extensions. Applications and drivers must set it to zero.</entry>
  191. </row>
  192. </tbody>
  193. </tgroup>
  194. </table>
  195. <!-- See also vidioc-g-sliced-vbi-cap.sgml -->
  196. <table frame="none" pgwide="1" id="vbi-services2">
  197. <title>Sliced VBI services</title>
  198. <tgroup cols="5">
  199. <colspec colname="c1" colwidth="2*" />
  200. <colspec colname="c2" colwidth="1*" />
  201. <colspec colname="c3" colwidth="1*" />
  202. <colspec colname="c4" colwidth="2*" />
  203. <colspec colname="c5" colwidth="2*" />
  204. <spanspec namest="c3" nameend="c5" spanname="rlp" />
  205. <thead>
  206. <row>
  207. <entry>Symbol</entry>
  208. <entry>Value</entry>
  209. <entry>Reference</entry>
  210. <entry>Lines, usually</entry>
  211. <entry>Payload</entry>
  212. </row>
  213. </thead>
  214. <tbody valign="top">
  215. <row>
  216. <entry><constant>V4L2_SLICED_TELETEXT_B</constant>
  217. (Teletext System B)</entry>
  218. <entry>0x0001</entry>
  219. <entry><xref linkend="ets300706" />, <xref linkend="itu653" /></entry>
  220. <entry>PAL/SECAM line 7-22, 320-335 (second field 7-22)</entry>
  221. <entry>Last 42 of the 45 byte Teletext packet, that is
  222. without clock run-in and framing code, lsb first transmitted.</entry>
  223. </row>
  224. <row>
  225. <entry><constant>V4L2_SLICED_VPS</constant></entry>
  226. <entry>0x0400</entry>
  227. <entry><xref linkend="ets300231" /></entry>
  228. <entry>PAL line 16</entry>
  229. <entry>Byte number 3 to 15 according to Figure 9 of
  230. ETS&nbsp;300&nbsp;231, lsb first transmitted.</entry>
  231. </row>
  232. <row>
  233. <entry><constant>V4L2_SLICED_CAPTION_525</constant></entry>
  234. <entry>0x1000</entry>
  235. <entry><xref linkend="eia608" /></entry>
  236. <entry>NTSC line 21, 284 (second field 21)</entry>
  237. <entry>Two bytes in transmission order, including parity
  238. bit, lsb first transmitted.</entry>
  239. </row>
  240. <row>
  241. <entry><constant>V4L2_SLICED_WSS_625</constant></entry>
  242. <entry>0x4000</entry>
  243. <entry><xref linkend="itu1119" />, <xref linkend="en300294" /></entry>
  244. <entry>PAL/SECAM line 23</entry>
  245. <entry><screen>
  246. Byte 0 1
  247. msb lsb msb lsb
  248. Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9
  249. </screen></entry>
  250. </row>
  251. <row>
  252. <entry><constant>V4L2_SLICED_VBI_525</constant></entry>
  253. <entry>0x1000</entry>
  254. <entry spanname="rlp">Set of services applicable to 525
  255. line systems.</entry>
  256. </row>
  257. <row>
  258. <entry><constant>V4L2_SLICED_VBI_625</constant></entry>
  259. <entry>0x4401</entry>
  260. <entry spanname="rlp">Set of services applicable to 625
  261. line systems.</entry>
  262. </row>
  263. </tbody>
  264. </tgroup>
  265. </table>
  266. <para>Drivers may return an &EINVAL; when applications attempt to
  267. read or write data without prior format negotiation, after switching
  268. the video standard (which may invalidate the negotiated VBI
  269. parameters) and after switching the video input (which may change the
  270. video standard as a side effect). The &VIDIOC-S-FMT; ioctl may return
  271. an &EBUSY; when applications attempt to change the format while i/o is
  272. in progress (between a &VIDIOC-STREAMON; and &VIDIOC-STREAMOFF; call,
  273. and after the first &func-read; or &func-write; call).</para>
  274. </section>
  275. <section>
  276. <title>Reading and writing sliced VBI data</title>
  277. <para>A single &func-read; or &func-write; call must pass all data
  278. belonging to one video frame. That is an array of
  279. <structname>v4l2_sliced_vbi_data</structname> structures with one or
  280. more elements and a total size not exceeding
  281. <structfield>io_size</structfield> bytes. Likewise in streaming I/O
  282. mode one buffer of <structfield>io_size</structfield> bytes must
  283. contain data of one video frame. The <structfield>id</structfield> of
  284. unused <structname>v4l2_sliced_vbi_data</structname> elements must be
  285. zero.</para>
  286. <table frame="none" pgwide="1" id="v4l2-sliced-vbi-data">
  287. <title>struct
  288. <structname>v4l2_sliced_vbi_data</structname></title>
  289. <tgroup cols="3">
  290. &cs-def;
  291. <tbody valign="top">
  292. <row>
  293. <entry>__u32</entry>
  294. <entry><structfield>id</structfield></entry>
  295. <entry>A flag from <xref linkend="vbi-services" />
  296. identifying the type of data in this packet. Only a single bit must be
  297. set. When the <structfield>id</structfield> of a captured packet is
  298. zero, the packet is empty and the contents of other fields are
  299. undefined. Applications shall ignore empty packets. When the
  300. <structfield>id</structfield> of a packet for output is zero the
  301. contents of the <structfield>data</structfield> field are undefined
  302. and the driver must no longer insert data on the requested
  303. <structfield>field</structfield> and
  304. <structfield>line</structfield>.</entry>
  305. </row>
  306. <row>
  307. <entry>__u32</entry>
  308. <entry><structfield>field</structfield></entry>
  309. <entry>The video field number this data has been captured
  310. from, or shall be inserted at. <constant>0</constant> for the first
  311. field, <constant>1</constant> for the second field.</entry>
  312. </row>
  313. <row>
  314. <entry>__u32</entry>
  315. <entry><structfield>line</structfield></entry>
  316. <entry>The field (as opposed to frame) line number this
  317. data has been captured from, or shall be inserted at. See <xref
  318. linkend="vbi-525" /> and <xref linkend="vbi-625" /> for valid
  319. values. Sliced VBI capture devices can set the line number of all
  320. packets to <constant>0</constant> if the hardware cannot reliably
  321. identify scan lines. The field number must always be valid.</entry>
  322. </row>
  323. <row>
  324. <entry>__u32</entry>
  325. <entry><structfield>reserved</structfield></entry>
  326. <entry>This field is reserved for future extensions.
  327. Applications and drivers must set it to zero.</entry>
  328. </row>
  329. <row>
  330. <entry>__u8</entry>
  331. <entry><structfield>data</structfield>[48]</entry>
  332. <entry>The packet payload. See <xref
  333. linkend="vbi-services" /> for the contents and number of
  334. bytes passed for each data type. The contents of padding bytes at the
  335. end of this array are undefined, drivers and applications shall ignore
  336. them.</entry>
  337. </row>
  338. </tbody>
  339. </tgroup>
  340. </table>
  341. <para>Packets are always passed in ascending line number order,
  342. without duplicate line numbers. The &func-write; function and the
  343. &VIDIOC-QBUF; ioctl must return an &EINVAL; when applications violate
  344. this rule. They must also return an &EINVAL; when applications pass an
  345. incorrect field or line number, or a combination of
  346. <structfield>field</structfield>, <structfield>line</structfield> and
  347. <structfield>id</structfield> which has not been negotiated with the
  348. &VIDIOC-G-FMT; or &VIDIOC-S-FMT; ioctl. When the line numbers are
  349. unknown the driver must pass the packets in transmitted order. The
  350. driver can insert empty packets with <structfield>id</structfield> set
  351. to zero anywhere in the packet array.</para>
  352. <para>To assure synchronization and to distinguish from frame
  353. dropping, when a captured frame does not carry any of the requested
  354. data services drivers must pass one or more empty packets. When an
  355. application fails to pass VBI data in time for output, the driver
  356. must output the last VPS and WSS packet again, and disable the output
  357. of Closed Caption and Teletext data, or output data which is ignored
  358. by Closed Caption and Teletext decoders.</para>
  359. <para>A sliced VBI device may support <link
  360. linkend="rw">read/write</link> and/or streaming (<link
  361. linkend="mmap">memory mapping</link> and/or <link linkend="userp">user
  362. pointer</link>) I/O. The latter bears the possibility of synchronizing
  363. video and VBI data by using buffer timestamps.</para>
  364. </section>
  365. <section>
  366. <title>Sliced VBI Data in MPEG Streams</title>
  367. <para>If a device can produce an MPEG output stream, it may be
  368. capable of providing <link
  369. linkend="sliced-vbi-format-negotitation">negotiated sliced VBI
  370. services</link> as data embedded in the MPEG stream. Users or
  371. applications control this sliced VBI data insertion with the <link
  372. linkend="v4l2-mpeg-stream-vbi-fmt">V4L2_CID_MPEG_STREAM_VBI_FMT</link>
  373. control.</para>
  374. <para>If the driver does not provide the <link
  375. linkend="v4l2-mpeg-stream-vbi-fmt">V4L2_CID_MPEG_STREAM_VBI_FMT</link>
  376. control, or only allows that control to be set to <link
  377. linkend="v4l2-mpeg-stream-vbi-fmt"><constant>
  378. V4L2_MPEG_STREAM_VBI_FMT_NONE</constant></link>, then the device
  379. cannot embed sliced VBI data in the MPEG stream.</para>
  380. <para>The <link linkend="v4l2-mpeg-stream-vbi-fmt">
  381. V4L2_CID_MPEG_STREAM_VBI_FMT</link> control does not implicitly set
  382. the device driver to capture nor cease capturing sliced VBI data. The
  383. control only indicates to embed sliced VBI data in the MPEG stream, if
  384. an application has negotiated sliced VBI service be captured.</para>
  385. <para>It may also be the case that a device can embed sliced VBI
  386. data in only certain types of MPEG streams: for example in an MPEG-2
  387. PS but not an MPEG-2 TS. In this situation, if sliced VBI data
  388. insertion is requested, the sliced VBI data will be embedded in MPEG
  389. stream types when supported, and silently omitted from MPEG stream
  390. types where sliced VBI data insertion is not supported by the device.
  391. </para>
  392. <para>The following subsections specify the format of the
  393. embedded sliced VBI data.</para>
  394. <section>
  395. <title>MPEG Stream Embedded, Sliced VBI Data Format: NONE</title>
  396. <para>The <link linkend="v4l2-mpeg-stream-vbi-fmt"><constant>
  397. V4L2_MPEG_STREAM_VBI_FMT_NONE</constant></link> embedded sliced VBI
  398. format shall be interpreted by drivers as a control to cease
  399. embedding sliced VBI data in MPEG streams. Neither the device nor
  400. driver shall insert "empty" embedded sliced VBI data packets in the
  401. MPEG stream when this format is set. No MPEG stream data structures
  402. are specified for this format.</para>
  403. </section>
  404. <section>
  405. <title>MPEG Stream Embedded, Sliced VBI Data Format: IVTV</title>
  406. <para>The <link linkend="v4l2-mpeg-stream-vbi-fmt"><constant>
  407. V4L2_MPEG_STREAM_VBI_FMT_IVTV</constant></link> embedded sliced VBI
  408. format, when supported, indicates to the driver to embed up to 36
  409. lines of sliced VBI data per frame in an MPEG-2 <emphasis>Private
  410. Stream 1 PES</emphasis> packet encapsulated in an MPEG-2 <emphasis>
  411. Program Pack</emphasis> in the MPEG stream.</para>
  412. <para><emphasis>Historical context</emphasis>: This format
  413. specification originates from a custom, embedded, sliced VBI data
  414. format used by the <filename>ivtv</filename> driver. This format
  415. has already been informally specified in the kernel sources in the
  416. file <filename>Documentation/video4linux/cx2341x/README.vbi</filename>
  417. . The maximum size of the payload and other aspects of this format
  418. are driven by the CX23415 MPEG decoder's capabilities and limitations
  419. with respect to extracting, decoding, and displaying sliced VBI data
  420. embedded within an MPEG stream.</para>
  421. <para>This format's use is <emphasis>not</emphasis> exclusive to
  422. the <filename>ivtv</filename> driver <emphasis>nor</emphasis>
  423. exclusive to CX2341x devices, as the sliced VBI data packet insertion
  424. into the MPEG stream is implemented in driver software. At least the
  425. <filename>cx18</filename> driver provides sliced VBI data insertion
  426. into an MPEG-2 PS in this format as well.</para>
  427. <para>The following definitions specify the payload of the
  428. MPEG-2 <emphasis>Private Stream 1 PES</emphasis> packets that contain
  429. sliced VBI data when <link linkend="v4l2-mpeg-stream-vbi-fmt">
  430. <constant>V4L2_MPEG_STREAM_VBI_FMT_IVTV</constant></link> is set.
  431. (The MPEG-2 <emphasis>Private Stream 1 PES</emphasis> packet header
  432. and encapsulating MPEG-2 <emphasis>Program Pack</emphasis> header are
  433. not detailed here. Please refer to the MPEG-2 specifications for
  434. details on those packet headers.)</para>
  435. <para>The payload of the MPEG-2 <emphasis>Private Stream 1 PES
  436. </emphasis> packets that contain sliced VBI data is specified by
  437. &v4l2-mpeg-vbi-fmt-ivtv;. The payload is variable
  438. length, depending on the actual number of lines of sliced VBI data
  439. present in a video frame. The payload may be padded at the end with
  440. unspecified fill bytes to align the end of the payload to a 4-byte
  441. boundary. The payload shall never exceed 1552 bytes (2 fields with
  442. 18 lines/field with 43 bytes of data/line and a 4 byte magic number).
  443. </para>
  444. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-fmt-ivtv">
  445. <title>struct <structname>v4l2_mpeg_vbi_fmt_ivtv</structname>
  446. </title>
  447. <tgroup cols="4">
  448. &cs-ustr;
  449. <tbody valign="top">
  450. <row>
  451. <entry>__u8</entry>
  452. <entry><structfield>magic</structfield>[4]</entry>
  453. <entry></entry>
  454. <entry>A "magic" constant from <xref
  455. linkend="v4l2-mpeg-vbi-fmt-ivtv-magic" /> that indicates
  456. this is a valid sliced VBI data payload and also indicates which
  457. member of the anonymous union, <structfield>itv0</structfield> or
  458. <structfield>ITV0</structfield>, to use for the payload data.</entry>
  459. </row>
  460. <row>
  461. <entry>union</entry>
  462. <entry>(anonymous)</entry>
  463. </row>
  464. <row>
  465. <entry></entry>
  466. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0">
  467. <structname>v4l2_mpeg_vbi_itv0</structname></link>
  468. </entry>
  469. <entry><structfield>itv0</structfield></entry>
  470. <entry>The primary form of the sliced VBI data payload
  471. that contains anywhere from 1 to 35 lines of sliced VBI data.
  472. Line masks are provided in this form of the payload indicating
  473. which VBI lines are provided.</entry>
  474. </row>
  475. <row>
  476. <entry></entry>
  477. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0-1">
  478. <structname>v4l2_mpeg_vbi_ITV0</structname></link>
  479. </entry>
  480. <entry><structfield>ITV0</structfield></entry>
  481. <entry>An alternate form of the sliced VBI data payload
  482. used when 36 lines of sliced VBI data are present. No line masks are
  483. provided in this form of the payload; all valid line mask bits are
  484. implcitly set.</entry>
  485. </row>
  486. </tbody>
  487. </tgroup>
  488. </table>
  489. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-fmt-ivtv-magic">
  490. <title>Magic Constants for &v4l2-mpeg-vbi-fmt-ivtv;
  491. <structfield>magic</structfield> field</title>
  492. <tgroup cols="3">
  493. &cs-def;
  494. <thead>
  495. <row>
  496. <entry align="left">Defined Symbol</entry>
  497. <entry align="left">Value</entry>
  498. <entry align="left">Description</entry>
  499. </row>
  500. </thead>
  501. <tbody valign="top">
  502. <row>
  503. <entry><constant>V4L2_MPEG_VBI_IVTV_MAGIC0</constant>
  504. </entry>
  505. <entry>"itv0"</entry>
  506. <entry>Indicates the <structfield>itv0</structfield>
  507. member of the union in &v4l2-mpeg-vbi-fmt-ivtv; is valid.</entry>
  508. </row>
  509. <row>
  510. <entry><constant>V4L2_MPEG_VBI_IVTV_MAGIC1</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 and
  515. that 36 lines of sliced VBI data are present.</entry>
  516. </row>
  517. </tbody>
  518. </tgroup>
  519. </table>
  520. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-itv0">
  521. <title>struct <structname>v4l2_mpeg_vbi_itv0</structname>
  522. </title>
  523. <tgroup cols="3">
  524. &cs-str;
  525. <tbody valign="top">
  526. <row>
  527. <entry>__le32</entry>
  528. <entry><structfield>linemask</structfield>[2]</entry>
  529. <entry><para>Bitmasks indicating the VBI service lines
  530. present. These <structfield>linemask</structfield> values are stored
  531. in little endian byte order in the MPEG stream. Some reference
  532. <structfield>linemask</structfield> bit positions with their
  533. corresponding VBI line number and video field are given below.
  534. b<subscript>0</subscript> indicates the least significant bit of a
  535. <structfield>linemask</structfield> value:<screen>
  536. <structfield>linemask</structfield>[0] b<subscript>0</subscript>: line 6 first field
  537. <structfield>linemask</structfield>[0] b<subscript>17</subscript>: line 23 first field
  538. <structfield>linemask</structfield>[0] b<subscript>18</subscript>: line 6 second field
  539. <structfield>linemask</structfield>[0] b<subscript>31</subscript>: line 19 second field
  540. <structfield>linemask</structfield>[1] b<subscript>0</subscript>: line 20 second field
  541. <structfield>linemask</structfield>[1] b<subscript>3</subscript>: line 23 second field
  542. <structfield>linemask</structfield>[1] b<subscript>4</subscript>-b<subscript>31</subscript>: unused and set to 0</screen></para></entry>
  543. </row>
  544. <row>
  545. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0-line">
  546. <structname>v4l2_mpeg_vbi_itv0_line</structname></link>
  547. </entry>
  548. <entry><structfield>line</structfield>[35]</entry>
  549. <entry>This is a variable length array that holds from 1
  550. to 35 lines of sliced VBI data. The sliced VBI data lines present
  551. correspond to the bits set in the <structfield>linemask</structfield>
  552. array, starting from b<subscript>0</subscript> of <structfield>
  553. linemask</structfield>[0] up through b<subscript>31</subscript> of
  554. <structfield>linemask</structfield>[0], and from b<subscript>0
  555. </subscript> of <structfield>linemask</structfield>[1] up through b
  556. <subscript>3</subscript> of <structfield>linemask</structfield>[1].
  557. <structfield>line</structfield>[0] corresponds to the first bit
  558. found set in the <structfield>linemask</structfield> array,
  559. <structfield>line</structfield>[1] corresponds to the second bit
  560. found set in the <structfield>linemask</structfield> array, etc.
  561. If no <structfield>linemask</structfield> array bits are set, then
  562. <structfield>line</structfield>[0] may contain one line of
  563. unspecified data that should be ignored by applications.</entry>
  564. </row>
  565. </tbody>
  566. </tgroup>
  567. </table>
  568. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-itv0-1">
  569. <title>struct <structname>v4l2_mpeg_vbi_ITV0</structname>
  570. </title>
  571. <tgroup cols="3">
  572. &cs-str;
  573. <tbody valign="top">
  574. <row>
  575. <entry>struct <link linkend="v4l2-mpeg-vbi-itv0-line">
  576. <structname>v4l2_mpeg_vbi_itv0_line</structname></link>
  577. </entry>
  578. <entry><structfield>line</structfield>[36]</entry>
  579. <entry>A fixed length array of 36 lines of sliced VBI
  580. data. <structfield>line</structfield>[0] through <structfield>line
  581. </structfield>[17] correspond to lines 6 through 23 of the
  582. first field. <structfield>line</structfield>[18] through
  583. <structfield>line</structfield>[35] corresponds to lines 6
  584. through 23 of the second field.</entry>
  585. </row>
  586. </tbody>
  587. </tgroup>
  588. </table>
  589. <table frame="none" pgwide="1" id="v4l2-mpeg-vbi-itv0-line">
  590. <title>struct <structname>v4l2_mpeg_vbi_itv0_line</structname>
  591. </title>
  592. <tgroup cols="3">
  593. &cs-str;
  594. <tbody valign="top">
  595. <row>
  596. <entry>__u8</entry>
  597. <entry><structfield>id</structfield></entry>
  598. <entry>A line identifier value from
  599. <xref linkend="ITV0-Line-Identifier-Constants" /> that indicates
  600. the type of sliced VBI data stored on this line.</entry>
  601. </row>
  602. <row>
  603. <entry>__u8</entry>
  604. <entry><structfield>data</structfield>[42]</entry>
  605. <entry>The sliced VBI data for the line.</entry>
  606. </row>
  607. </tbody>
  608. </tgroup>
  609. </table>
  610. <table frame="none" pgwide="1" id="ITV0-Line-Identifier-Constants">
  611. <title>Line Identifiers for struct <link
  612. linkend="v4l2-mpeg-vbi-itv0-line"><structname>
  613. v4l2_mpeg_vbi_itv0_line</structname></link> <structfield>id
  614. </structfield> field</title>
  615. <tgroup cols="3">
  616. &cs-def;
  617. <thead>
  618. <row>
  619. <entry align="left">Defined Symbol</entry>
  620. <entry align="left">Value</entry>
  621. <entry align="left">Description</entry>
  622. </row>
  623. </thead>
  624. <tbody valign="top">
  625. <row>
  626. <entry><constant>V4L2_MPEG_VBI_IVTV_TELETEXT_B</constant>
  627. </entry>
  628. <entry>1</entry>
  629. <entry>Refer to <link linkend="vbi-services2">
  630. Sliced VBI services</link> for a description of the line payload.</entry>
  631. </row>
  632. <row>
  633. <entry><constant>V4L2_MPEG_VBI_IVTV_CAPTION_525</constant>
  634. </entry>
  635. <entry>4</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_WSS_625</constant>
  641. </entry>
  642. <entry>5</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_VPS</constant>
  648. </entry>
  649. <entry>7</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. </tbody>
  654. </tgroup>
  655. </table>
  656. </section>
  657. </section>
  658. <!--
  659. Local Variables:
  660. mode: sgml
  661. sgml-parent-document: "v4l2.sgml"
  662. indent-tabs-mode: nil
  663. End:
  664. -->