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