2020-08-26 09:03:09 +02:00
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2020-09-24 14:04:26 +02:00
.. c:namespace :: V4L
2018-08-30 10:15:26 -04:00
2016-06-30 15:18:56 +02:00
.. _sliced:
***** ***** ***** ***** *****
Sliced VBI Data Interface
***** ***** ***** ***** *****
VBI stands for Vertical Blanking Interval, a gap in the sequence of
lines of an analog video signal. During VBI no picture information is
transmitted, allowing some time while the electron beam of a cathode ray
tube TV returns to the top of the screen.
Sliced VBI devices use hardware to demodulate data transmitted in the
VBI. V4L2 drivers shall *not* do this by software, see also the
:ref: `raw VBI interface <raw-vbi>` . The data is passed as short
packets of fixed size, covering one scan line each. The number of
packets per video frame is variable.
Sliced VBI capture and output devices are accessed through the same
character special files as raw VBI devices. When a driver supports both
interfaces, the default function of a `` /dev/vbi `` device is *raw* VBI
capturing or output, and the sliced VBI function is only available after
2016-07-01 13:42:29 -03:00
calling the :ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl as defined
2016-06-30 15:18:56 +02:00
below. Likewise a `` /dev/video `` device may support the sliced VBI API,
however the default function here is video capturing or output.
Different file descriptors must be used to pass raw and sliced VBI data
simultaneously, if this is supported by the driver.
Querying Capabilities
=====================
Devices supporting the sliced VBI capturing or output API set the
`` V4L2_CAP_SLICED_VBI_CAPTURE `` or `` V4L2_CAP_SLICED_VBI_OUTPUT `` flag
respectively, in the `` capabilities `` field of struct
2016-08-29 17:37:59 -03:00
:c:type: `v4l2_capability` returned by the
2016-07-01 13:58:44 -03:00
:ref: `VIDIOC_QUERYCAP` ioctl. At least one of the
2016-06-30 15:18:56 +02:00
read/write, streaming or asynchronous :ref: `I/O methods <io>` must be
supported. Sliced VBI devices may have a tuner or modulator.
Supplemental Functions
======================
Sliced VBI devices shall support :ref: `video input or output <video>`
and :ref: `tuner or modulator <tuner>` ioctls if they have these
2016-07-01 13:58:44 -03:00
capabilities, and they may support :ref: `control` ioctls.
2016-06-30 15:18:56 +02:00
The :ref: `video standard <standard>` ioctls provide information vital
to program a sliced VBI device, therefore must be supported.
.. _sliced-vbi-format-negotitation:
Sliced VBI Format Negotiation
=============================
To find out which data services are supported by the hardware
applications can call the
2016-07-03 10:02:29 -03:00
:ref: `VIDIOC_G_SLICED_VBI_CAP <VIDIOC_G_SLICED_VBI_CAP>` ioctl.
2016-06-30 15:18:56 +02:00
All drivers implementing the sliced VBI interface must support this
ioctl. The results may differ from those of the
2016-07-01 13:42:29 -03:00
:ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl when the number of VBI
2016-06-30 15:18:56 +02:00
lines the hardware can capture or output per frame, or the number of
services it can identify on a given line are limited. For example on PAL
line 16 the hardware may be able to look for a VPS or Teletext signal,
but not both at the same time.
To determine the currently selected services applications set the
2016-08-29 17:37:59 -03:00
`` type `` field of struct :c:type: `v4l2_format` to
2016-06-30 15:18:56 +02:00
`` V4L2_BUF_TYPE_SLICED_VBI_CAPTURE `` or
`` V4L2_BUF_TYPE_SLICED_VBI_OUTPUT `` , and the
2016-07-03 10:02:29 -03:00
:ref: `VIDIOC_G_FMT <VIDIOC_G_FMT>` ioctl fills the `` fmt.sliced ``
2016-06-30 15:18:56 +02:00
member, a struct
2016-08-29 17:37:59 -03:00
:c:type: `v4l2_sliced_vbi_format` .
2016-06-30 15:18:56 +02:00
Applications can request different parameters by initializing or
modifying the `` fmt.sliced `` member and calling the
2016-07-01 13:42:29 -03:00
:ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl with a pointer to the
2016-09-08 05:43:01 -03:00
struct :c:type: `v4l2_format` structure.
2016-06-30 15:18:56 +02:00
The sliced VBI API is more complicated than the raw VBI API because the
hardware must be told which VBI service to expect on each scan line. Not
all services may be supported by the hardware on all lines (this is
especially true for VBI output where Teletext is often unsupported and
other services can only be inserted in one specific line). In many
cases, however, it is sufficient to just set the `` service_set `` field
to the required services and let the driver fill the `` service_lines ``
array according to hardware capabilities. Only if more precise control
is needed should the programmer set the `` service_lines `` array
explicitly.
2016-07-01 13:42:29 -03:00
The :ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl modifies the parameters
2016-06-30 15:18:56 +02:00
according to hardware capabilities. When the driver allocates resources
2016-07-03 11:53:09 -03:00
at this point, it may return an `` EBUSY `` error code if the required
2016-06-30 15:18:56 +02:00
resources are temporarily unavailable. Other resource allocation points
2016-07-03 11:53:09 -03:00
which may return `` EBUSY `` can be the
2016-07-01 13:58:44 -03:00
:ref: `VIDIOC_STREAMON` ioctl and the first
2020-09-24 14:04:26 +02:00
:c:func: `read()` , :c:func: `write()` and
:c:func: `select()` call.
2016-06-30 15:18:56 +02:00
2016-08-29 17:37:59 -03:00
.. c:type :: v4l2_sliced_vbi_format
2016-06-30 15:18:56 +02:00
2016-07-04 18:37:48 -03:00
struct v4l2_sliced_vbi_format
-----------------------------
media: fix pdf build with Spinx 1.6
Sphinx 1.6 generates some LaTeX code before each table,
starting its own environment before calling tabulary,
apparently to improve table layout.
The problem is that such environment is incompatible with
adjustbox. While, in thesis, it should be possible to override
it or to redefine tabulary, I was unable to produce such patch.
Also, that would likely break on some future Sphinx version.
So, instead, let's just change the font size on bigger tables,
in order for them to fit into the page size. That is not as
good as adjustbox, and require some manual work, but it should
be less sensitive to Sphinx changes.
While here, adjust a few other tables whose text is exceeding
the cell boundaries.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-26 05:28:26 -04:00
.. raw :: latex
\begingroup
\scriptsize
\setlength{\tabcolsep}{2pt}
2019-03-29 12:13:50 -04:00
.. tabularcolumns :: |p{.85cm}|p{3.3cm}|p{4.4cm}|p{4.4cm}|p{4.4cm}|
2016-08-18 07:38:53 -03:00
.. cssclass :: longtable
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 0
:stub-columns: 0
:widths: 3 3 2 2 2
2020-08-18 15:19:20 +02:00
* - __u16
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
- `` service_set ``
- :cspan: `2`
If `` service_set `` is non-zero when passed with
:ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` or
:ref: `VIDIOC_TRY_FMT <VIDIOC_G_FMT>` , the `` service_lines ``
array will be filled by the driver according to the services
specified in this field. For example, if `` service_set `` is
initialized with `` V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625 `` ,
a driver for the cx25840 video decoder sets lines 7-22 of both
fields [#f1]_ to `` V4L2_SLICED_TELETEXT_B `` and line 23 of the first
field to `` V4L2_SLICED_WSS_625 `` . If `` service_set `` is set to
zero, then the values of `` service_lines `` will be used instead.
On return the driver sets this field to the union of all elements
of the returned `` service_lines `` array. It may contain less
services than requested, perhaps just one, if the hardware cannot
handle more services simultaneously. It may be empty (zero) if
none of the requested services are supported by the hardware.
* - __u16
- `` service_lines ` ` \ [2][24]
- :cspan: `2`
Applications initialize this array with sets of data services the
driver shall look for or insert on the respective scan line.
Subject to hardware capabilities drivers return the requested set,
a subset, which may be just a single service, or an empty set.
When the hardware cannot handle multiple services on the same line
the driver shall choose one. No assumptions can be made on which
service the driver chooses.
Data services are defined in :ref: `vbi-services2` . Array indices
map to ITU-R line numbers\ [#f2]_ as follows:
* -
-
- Element
- 525 line systems
- 625 line systems
* -
-
- `` service_lines ` ` \ [0][1]
- 1
- 1
* -
-
- `` service_lines ` ` \ [0][23]
- 23
- 23
* -
-
- `` service_lines ` ` \ [1][1]
- 264
- 314
* -
-
- `` service_lines ` ` \ [1][23]
- 286
- 336
* -
-
- :cspan: `2` Drivers must set `` service_lines `` [0][0] and
`` service_lines ` ` \ [1][0] to zero. The
`` V4L2_VBI_ITU_525_F1_START `` , `` V4L2_VBI_ITU_525_F2_START `` ,
`` V4L2_VBI_ITU_625_F1_START `` and `` V4L2_VBI_ITU_625_F2_START ``
defines give the start line numbers for each field for each 525 or
625 line format as a convenience. Don't forget that ITU line
numbering starts at 1, not 0.
* - __u32
- `` io_size ``
- :cspan: `2` Maximum number of bytes passed by one
2020-09-24 14:04:26 +02:00
:c:func: `read()` or :c:func: `write()` call,
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
and the buffer size in bytes for the
:ref: `VIDIOC_QBUF` and
:ref: `VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl. Drivers set this field
to the size of struct
:c:type: `v4l2_sliced_vbi_data` times the
number of non-zero elements in the returned `` service_lines ``
array (that is the number of lines potentially carrying data).
* - __u32
- `` reserved ` ` \ [2]
- :cspan: `2` This array is reserved for future extensions.
Applications and drivers must set it to zero.
2016-06-30 15:18:56 +02:00
media: fix pdf build with Spinx 1.6
Sphinx 1.6 generates some LaTeX code before each table,
starting its own environment before calling tabulary,
apparently to improve table layout.
The problem is that such environment is incompatible with
adjustbox. While, in thesis, it should be possible to override
it or to redefine tabulary, I was unable to produce such patch.
Also, that would likely break on some future Sphinx version.
So, instead, let's just change the font size on bigger tables,
in order for them to fit into the page size. That is not as
good as adjustbox, and require some manual work, but it should
be less sensitive to Sphinx changes.
While here, adjust a few other tables whose text is exceeding
the cell boundaries.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-26 05:28:26 -04:00
.. raw :: latex
2017-08-26 20:16:51 -04:00
media: fix pdf build with Spinx 1.6
Sphinx 1.6 generates some LaTeX code before each table,
starting its own environment before calling tabulary,
apparently to improve table layout.
The problem is that such environment is incompatible with
adjustbox. While, in thesis, it should be possible to override
it or to redefine tabulary, I was unable to produce such patch.
Also, that would likely break on some future Sphinx version.
So, instead, let's just change the font size on bigger tables,
in order for them to fit into the page size. That is not as
good as adjustbox, and require some manual work, but it should
be less sensitive to Sphinx changes.
While here, adjust a few other tables whose text is exceeding
the cell boundaries.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-26 05:28:26 -04:00
\endgroup
2016-06-30 15:18:56 +02:00
.. _vbi-services2:
2016-07-04 18:37:48 -03:00
Sliced VBI services
-------------------
2016-08-18 07:38:53 -03:00
.. raw :: latex
2017-08-26 20:16:51 -04:00
2019-03-29 12:13:50 -04:00
\scriptsize
2016-08-18 07:38:53 -03:00
media: fix pdf build with Spinx 1.6
Sphinx 1.6 generates some LaTeX code before each table,
starting its own environment before calling tabulary,
apparently to improve table layout.
The problem is that such environment is incompatible with
adjustbox. While, in thesis, it should be possible to override
it or to redefine tabulary, I was unable to produce such patch.
Also, that would likely break on some future Sphinx version.
So, instead, let's just change the font size on bigger tables,
in order for them to fit into the page size. That is not as
good as adjustbox, and require some manual work, but it should
be less sensitive to Sphinx changes.
While here, adjust a few other tables whose text is exceeding
the cell boundaries.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-26 05:28:26 -04:00
.. tabularcolumns :: |p{4.1cm}|p{1.1cm}|p{2.4cm}|p{2.0cm}|p{7.3cm}|
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 1
:stub-columns: 0
:widths: 2 1 1 2 2
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - Symbol
- Value
- Reference
- Lines, usually
- Payload
* - `` V4L2_SLICED_TELETEXT_B `` (Teletext System B)
- 0x0001
- :ref: `ets300706` ,
:ref: `itu653`
- PAL/SECAM line 7-22, 320-335 (second field 7-22)
- Last 42 of the 45 byte Teletext packet, that is without clock
run-in and framing code, lsb first transmitted.
* - `` V4L2_SLICED_VPS ``
- 0x0400
- :ref: `ets300231`
- PAL line 16
- Byte number 3 to 15 according to Figure 9 of ETS 300 231, lsb
first transmitted.
* - `` V4L2_SLICED_CAPTION_525 ``
- 0x1000
- :ref: `cea608`
- NTSC line 21, 284 (second field 21)
- Two bytes in transmission order, including parity bit, lsb first
transmitted.
* - `` V4L2_SLICED_WSS_625 ``
- 0x4000
- :ref: `itu1119` ,
:ref: `en300294`
- PAL/SECAM line 23
2020-12-10 08:13:48 +01:00
- See :ref: `v4l2-sliced-wss-625-payload` below.
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - `` V4L2_SLICED_VBI_525 ``
- 0x1000
- :cspan: `2` Set of services applicable to 525 line systems.
* - `` V4L2_SLICED_VBI_625 ``
- 0x4401
- :cspan: `2` Set of services applicable to 625 line systems.
2016-06-30 15:18:56 +02:00
2016-08-18 07:38:53 -03:00
.. raw :: latex
media: fix pdf build with Spinx 1.6
Sphinx 1.6 generates some LaTeX code before each table,
starting its own environment before calling tabulary,
apparently to improve table layout.
The problem is that such environment is incompatible with
adjustbox. While, in thesis, it should be possible to override
it or to redefine tabulary, I was unable to produce such patch.
Also, that would likely break on some future Sphinx version.
So, instead, let's just change the font size on bigger tables,
in order for them to fit into the page size. That is not as
good as adjustbox, and require some manual work, but it should
be less sensitive to Sphinx changes.
While here, adjust a few other tables whose text is exceeding
the cell boundaries.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-26 05:28:26 -04:00
\normalsize
2016-08-18 07:38:53 -03:00
2016-07-03 11:53:09 -03:00
Drivers may return an `` EINVAL `` error code when applications attempt to
2016-06-30 15:18:56 +02:00
read or write data without prior format negotiation, after switching the
video standard (which may invalidate the negotiated VBI parameters) and
after switching the video input (which may change the video standard as
2016-07-01 13:42:29 -03:00
a side effect). The :ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl may
2016-07-03 11:53:09 -03:00
return an `` EBUSY `` error code when applications attempt to change the
2016-06-30 15:18:56 +02:00
format while i/o is in progress (between a
2016-07-01 13:58:44 -03:00
:ref: `VIDIOC_STREAMON` and
2016-07-01 13:42:29 -03:00
:ref: `VIDIOC_STREAMOFF <VIDIOC_STREAMON>` call, and after the first
2020-09-24 14:04:26 +02:00
:c:func: `read()` or :c:func: `write()` call).
2016-06-30 15:18:56 +02:00
2020-12-10 08:13:48 +01:00
.. _v4l2-sliced-wss-625-payload:
V4L2_SLICED_WSS_625 payload
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The payload for `` V4L2_SLICED_WSS_625 `` is:
+-----+------------------+-----------------------+
|Byte | 0 | 1 |
+-----+--------+---------+-----------+-----------+
| | msb | lsb | msb | lsb |
| +-+-+-+--+--+-+-+--+--+-+--+---+---+--+-+--+
| Bit |7|6|5|4 | 3|2|1|0 | x|x|13|12 | 11|10|9|8 |
+-----+-+-+-+--+--+-+-+--+--+-+--+---+---+--+-+--+
2016-06-30 15:18:56 +02:00
Reading and writing sliced VBI data
===================================
2020-09-24 14:04:26 +02:00
A single :c:func: `read()` or :c:func: `write()`
2016-06-30 15:18:56 +02:00
call must pass all data belonging to one video frame. That is an array
2016-09-08 05:43:01 -03:00
of struct :c:type: `v4l2_sliced_vbi_data` structures with one or
2016-06-30 15:18:56 +02:00
more elements and a total size not exceeding `` io_size `` bytes. Likewise
in streaming I/O mode one buffer of `` io_size `` bytes must contain data
of one video frame. The `` id `` of unused
2016-09-08 05:43:01 -03:00
struct :c:type: `v4l2_sliced_vbi_data` elements must be zero.
2016-06-30 15:18:56 +02:00
2016-08-29 17:37:59 -03:00
.. c:type :: v4l2_sliced_vbi_data
2016-06-30 15:18:56 +02:00
2016-07-04 18:37:48 -03:00
struct v4l2_sliced_vbi_data
---------------------------
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
.. tabularcolumns :: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 0
:stub-columns: 0
:widths: 3 1 4
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - __u32
- `` id ``
- A flag from :ref: `vbi-services` identifying the type of data in
this packet. Only a single bit must be set. When the `` id `` of a
captured packet is zero, the packet is empty and the contents of
other fields are undefined. Applications shall ignore empty
packets. When the `` id `` of a packet for output is zero the
contents of the `` data `` field are undefined and the driver must
no longer insert data on the requested `` field `` and `` line `` .
* - __u32
- `` field ``
- The video field number this data has been captured from, or shall
be inserted at. `` 0 `` for the first field, `` 1 `` for the second
field.
* - __u32
- `` line ``
- The field (as opposed to frame) line number this data has been
captured from, or shall be inserted at. See :ref: `vbi-525` and
:ref: `vbi-625` for valid values. Sliced VBI capture devices can
set the line number of all packets to `` 0 `` if the hardware cannot
reliably identify scan lines. The field number must always be
valid.
* - __u32
- `` reserved ``
- This field is reserved for future extensions. Applications and
drivers must set it to zero.
* - __u8
- `` data ` ` \ [48]
- The packet payload. See :ref: `vbi-services` for the contents and
number of bytes passed for each data type. The contents of padding
bytes at the end of this array are undefined, drivers and
applications shall ignore them.
2016-06-30 15:18:56 +02:00
Packets are always passed in ascending line number order, without
2020-09-24 14:04:26 +02:00
duplicate line numbers. The :c:func: `write()` function and
2016-07-03 11:53:09 -03:00
the :ref: `VIDIOC_QBUF` ioctl must return an `` EINVAL ``
2016-06-30 15:18:56 +02:00
error code when applications violate this rule. They must also return an
EINVAL error code when applications pass an incorrect field or line
number, or a combination of `` field `` , `` line `` and `` id `` which has not
2016-07-03 10:02:29 -03:00
been negotiated with the :ref: `VIDIOC_G_FMT <VIDIOC_G_FMT>` or
2016-07-01 13:42:29 -03:00
:ref: `VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl. When the line numbers are
2016-06-30 15:18:56 +02:00
unknown the driver must pass the packets in transmitted order. The
driver can insert empty packets with `` id `` set to zero anywhere in the
packet array.
To assure synchronization and to distinguish from frame dropping, when a
captured frame does not carry any of the requested data services drivers
must pass one or more empty packets. When an application fails to pass
VBI data in time for output, the driver must output the last VPS and WSS
packet again, and disable the output of Closed Caption and Teletext
data, or output data which is ignored by Closed Caption and Teletext
decoders.
A sliced VBI device may support :ref: `read/write <rw>` and/or
streaming (:ref: `memory mapping <mmap>` and/or
:ref: `user pointer <userp>` ) I/O. The latter bears the possibility of
synchronizing video and VBI data by using buffer timestamps.
Sliced VBI Data in MPEG Streams
===============================
If a device can produce an MPEG output stream, it may be capable of
providing
:ref: `negotiated sliced VBI services <sliced-vbi-format-negotitation>`
as data embedded in the MPEG stream. Users or applications control this
sliced VBI data insertion with the
:ref: `V4L2_CID_MPEG_STREAM_VBI_FMT <v4l2-mpeg-stream-vbi-fmt>`
control.
If the driver does not provide the
:ref: `V4L2_CID_MPEG_STREAM_VBI_FMT <v4l2-mpeg-stream-vbi-fmt>`
control, or only allows that control to be set to
:ref: `V4L2_MPEG_STREAM_VBI_FMT_NONE <v4l2-mpeg-stream-vbi-fmt>` ,
then the device cannot embed sliced VBI data in the MPEG stream.
The
:ref: `V4L2_CID_MPEG_STREAM_VBI_FMT <v4l2-mpeg-stream-vbi-fmt>`
control does not implicitly set the device driver to capture nor cease
capturing sliced VBI data. The control only indicates to embed sliced
VBI data in the MPEG stream, if an application has negotiated sliced VBI
service be captured.
It may also be the case that a device can embed sliced VBI data in only
certain types of MPEG streams: for example in an MPEG-2 PS but not an
MPEG-2 TS. In this situation, if sliced VBI data insertion is requested,
the sliced VBI data will be embedded in MPEG stream types when
supported, and silently omitted from MPEG stream types where sliced VBI
data insertion is not supported by the device.
The following subsections specify the format of the embedded sliced VBI
data.
MPEG Stream Embedded, Sliced VBI Data Format: NONE
--------------------------------------------------
The
:ref: `V4L2_MPEG_STREAM_VBI_FMT_NONE <v4l2-mpeg-stream-vbi-fmt>`
embedded sliced VBI format shall be interpreted by drivers as a control
to cease embedding sliced VBI data in MPEG streams. Neither the device
nor driver shall insert "empty" embedded sliced VBI data packets in the
MPEG stream when this format is set. No MPEG stream data structures are
specified for this format.
MPEG Stream Embedded, Sliced VBI Data Format: IVTV
--------------------------------------------------
The
:ref: `V4L2_MPEG_STREAM_VBI_FMT_IVTV <v4l2-mpeg-stream-vbi-fmt>`
embedded sliced VBI format, when supported, indicates to the driver to
embed up to 36 lines of sliced VBI data per frame in an MPEG-2 *Private
Stream 1 PES* packet encapsulated in an MPEG-2 * Program Pack* in the
MPEG stream.
*Historical context* : This format specification originates from a
custom, embedded, sliced VBI data format used by the `` ivtv `` driver.
This format has already been informally specified in the kernel sources
2020-03-06 08:50:46 +01:00
in the file `` Documentation/userspace-api/media/drivers/cx2341x-uapi.rst `` . The
2016-06-30 15:18:56 +02:00
maximum size of the payload and other aspects of this format are driven
by the CX23415 MPEG decoder's capabilities and limitations with respect
to extracting, decoding, and displaying sliced VBI data embedded within
an MPEG stream.
This format's use is *not* exclusive to the `` ivtv `` driver *nor*
exclusive to CX2341x devices, as the sliced VBI data packet insertion
into the MPEG stream is implemented in driver software. At least the
`` cx18 `` driver provides sliced VBI data insertion into an MPEG-2 PS in
this format as well.
The following definitions specify the payload of the MPEG-2 *Private
Stream 1 PES* packets that contain sliced VBI data when
:ref: `V4L2_MPEG_STREAM_VBI_FMT_IVTV <v4l2-mpeg-stream-vbi-fmt>`
is set. (The MPEG-2 *Private Stream 1 PES* packet header and
encapsulating MPEG-2 *Program Pack* header are not detailed here. Please
refer to the MPEG-2 specifications for details on those packet headers.)
The payload of the MPEG-2 *Private Stream 1 PES* packets that contain
sliced VBI data is specified by struct
2016-08-29 17:37:59 -03:00
:c:type: `v4l2_mpeg_vbi_fmt_ivtv` . The
2016-06-30 15:18:56 +02:00
payload is variable length, depending on the actual number of lines of
sliced VBI data present in a video frame. The payload may be padded at
the end with unspecified fill bytes to align the end of the payload to a
4-byte boundary. The payload shall never exceed 1552 bytes (2 fields
with 18 lines/field with 43 bytes of data/line and a 4 byte magic
number).
2016-08-29 17:37:59 -03:00
.. c:type :: v4l2_mpeg_vbi_fmt_ivtv
2016-06-30 15:18:56 +02:00
2016-07-04 18:37:48 -03:00
struct v4l2_mpeg_vbi_fmt_ivtv
-----------------------------
media: fix pdf build with Spinx 1.6
Sphinx 1.6 generates some LaTeX code before each table,
starting its own environment before calling tabulary,
apparently to improve table layout.
The problem is that such environment is incompatible with
adjustbox. While, in thesis, it should be possible to override
it or to redefine tabulary, I was unable to produce such patch.
Also, that would likely break on some future Sphinx version.
So, instead, let's just change the font size on bigger tables,
in order for them to fit into the page size. That is not as
good as adjustbox, and require some manual work, but it should
be less sensitive to Sphinx changes.
While here, adjust a few other tables whose text is exceeding
the cell boundaries.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-26 05:28:26 -04:00
.. tabularcolumns :: |p{1.0cm}|p{3.8cm}|p{1.0cm}|p{11.2cm}|
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 0
:stub-columns: 0
2020-02-10 11:42:38 +01:00
:widths: 1 1 2
2016-06-30 15:18:56 +02:00
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - __u8
- `` magic ` ` \ [4]
- A "magic" constant from :ref: `v4l2-mpeg-vbi-fmt-ivtv-magic` that
indicates this is a valid sliced VBI data payload and also
indicates which member of the anonymous union, `` itv0 `` or
`` ITV0 `` , to use for the payload data.
2020-02-10 11:42:38 +01:00
* - union {
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
- (anonymous)
2020-02-10 11:42:38 +01:00
* - struct :c:type: `v4l2_mpeg_vbi_itv0`
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
- `` itv0 ``
- The primary form of the sliced VBI data payload that contains
anywhere from 1 to 35 lines of sliced VBI data. Line masks are
provided in this form of the payload indicating which VBI lines
are provided.
2020-02-10 11:42:38 +01:00
* - struct :ref: `v4l2_mpeg_vbi_ITV0 <v4l2-mpeg-vbi-itv0-1>`
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
- `` ITV0 ``
- An alternate form of the sliced VBI data payload used when 36
lines of sliced VBI data are present. No line masks are provided
in this form of the payload; all valid line mask bits are
implcitly set.
2020-02-10 11:42:38 +01:00
* - }
-
2016-06-30 15:18:56 +02:00
.. _v4l2-mpeg-vbi-fmt-ivtv-magic:
2016-07-04 18:37:48 -03:00
Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field
-------------------------------------------------------------
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
.. tabularcolumns :: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 1
:stub-columns: 0
:widths: 3 1 4
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - Defined Symbol
- Value
- Description
* - `` V4L2_MPEG_VBI_IVTV_MAGIC0 ``
- "itv0"
- Indicates the `` itv0 `` member of the union in struct
:c:type: `v4l2_mpeg_vbi_fmt_ivtv` is
valid.
* - `` V4L2_MPEG_VBI_IVTV_MAGIC1 ``
- "ITV0"
- Indicates the `` ITV0 `` member of the union in struct
:c:type: `v4l2_mpeg_vbi_fmt_ivtv` is
valid and that 36 lines of sliced VBI data are present.
2016-06-30 15:18:56 +02:00
2016-08-29 17:37:59 -03:00
.. c:type :: v4l2_mpeg_vbi_itv0
2016-06-30 15:18:56 +02:00
2016-09-08 07:50:59 -03:00
.. c:type :: v4l2_mpeg_vbi_ITV0
structs v4l2_mpeg_vbi_itv0 and v4l2_mpeg_vbi_ITV0
-------------------------------------------------
2016-07-04 18:37:48 -03:00
2019-03-29 12:13:50 -04:00
.. tabularcolumns :: |p{5.2cm}|p{2.4cm}|p{9.9cm}|
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - __le32
- `` linemask ` ` \ [2]
- Bitmasks indicating the VBI service lines present. These
`` linemask `` values are stored in little endian byte order in the
MPEG stream. Some reference `` linemask `` bit positions with their
corresponding VBI line number and video field are given below.
b\ :sub: `0` indicates the least significant bit of a `` linemask ``
value:
::
2019-03-29 12:13:50 -04:00
linemask[0] b0: line 6 first field
linemask[0] b17: line 23 first field
linemask[0] b18: line 6 second field
linemask[0] b31: line 19 second field
linemask[1] b0: line 20 second field
linemask[1] b3: line 23 second field
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
linemask[1] b4-b31: unused and set to 0
* - struct
:c:type: `v4l2_mpeg_vbi_itv0_line`
- `` line ` ` \ [35]
- This is a variable length array that holds from 1 to 35 lines of
sliced VBI data. The sliced VBI data lines present correspond to
the bits set in the `` linemask `` array, starting from b\ :sub: `0`
of `` linemask ` ` \ [0] up through b\ :sub: ` 31 ` of ` ` linemask ` ` \ [0],
and from b\ :sub: `0` of `` linemask ` ` \ [1] up through b\ :sub: ` 3 ` of
`` linemask ` ` \ [1]. ` ` line ` ` \ [0] corresponds to the first bit
found set in the `` linemask `` array, `` line ` ` \ [1] corresponds to
the second bit found set in the `` linemask `` array, etc. If no
`` linemask `` array bits are set, then `` line ` ` \ [0] may contain
one line of unspecified data that should be ignored by
applications.
2016-06-30 15:18:56 +02:00
.. _v4l2-mpeg-vbi-itv0-1:
2016-07-04 18:37:48 -03:00
struct v4l2_mpeg_vbi_ITV0
-------------------------
2019-03-29 12:13:50 -04:00
.. tabularcolumns :: |p{5.2cm}|p{2.4cm}|p{9.9cm}|
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - struct
:c:type: `v4l2_mpeg_vbi_itv0_line`
- `` line ` ` \ [36]
- A fixed length array of 36 lines of sliced VBI data. `` line ` ` \ [0]
through `` line ` ` \ [17] correspond to lines 6 through 23 of the
first field. `` line ` ` \ [18] through ` ` line ` ` \ [35] corresponds to
lines 6 through 23 of the second field.
2016-06-30 15:18:56 +02:00
2016-08-29 17:37:59 -03:00
.. c:type :: v4l2_mpeg_vbi_itv0_line
2016-06-30 15:18:56 +02:00
2016-07-04 18:37:48 -03:00
struct v4l2_mpeg_vbi_itv0_line
------------------------------
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
.. tabularcolumns :: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - __u8
- `` id ``
- A line identifier value from
:ref: `ITV0-Line-Identifier-Constants` that indicates the type of
sliced VBI data stored on this line.
* - __u8
- `` data ` ` \ [42]
- The sliced VBI data for the line.
2016-06-30 15:18:56 +02:00
.. _ITV0-Line-Identifier-Constants:
2016-07-04 18:37:48 -03:00
Line Identifiers for struct v4l2_mpeg_vbi_itv0_line id field
------------------------------------------------------------
2019-03-29 12:13:50 -04:00
.. tabularcolumns :: |p{7.0cm}|p{1.8cm}|p{8.7cm}|
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 08:14:19 -03:00
2016-07-04 18:37:48 -03:00
.. flat-table ::
2016-06-30 15:18:56 +02:00
:header-rows: 1
:stub-columns: 0
:widths: 3 1 4
[media] v4l: doc: Remove row numbers from tables
Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.
All changes have been generated by the following script.
import io
import re
import sys
def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE)
data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE)
return data
def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0
for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|( )', line):
in_table = False
output += process_table(fname, table)
if in_table:
table += line
else:
output += line
if in_table:
in_table = False
output += process_table(fname, table)
return output
fname = sys.argv[1]
data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2016-09-05 08:44:34 -03:00
* - Defined Symbol
- Value
- Description
* - `` V4L2_MPEG_VBI_IVTV_TELETEXT_B ``
- 1
- Refer to :ref: `Sliced VBI services <vbi-services2>` for a
description of the line payload.
* - `` V4L2_MPEG_VBI_IVTV_CAPTION_525 ``
- 4
- Refer to :ref: `Sliced VBI services <vbi-services2>` for a
description of the line payload.
* - `` V4L2_MPEG_VBI_IVTV_WSS_625 ``
- 5
- Refer to :ref: `Sliced VBI services <vbi-services2>` for a
description of the line payload.
* - `` V4L2_MPEG_VBI_IVTV_VPS ``
- 7
- Refer to :ref: `Sliced VBI services <vbi-services2>` for a
description of the line payload.
2016-06-30 15:18:56 +02:00
2016-07-12 15:15:23 -03:00
.. [#f1]
2016-06-30 15:18:56 +02:00
According to :ref: `ETS 300 706 <ets300706>` lines 6-22 of the first
field and lines 5-22 of the second field may carry Teletext data.
2016-08-18 07:37:49 -03:00
.. [#f2]
See also :ref: `vbi-525` and :ref: `vbi-625` .