2018-08-30 14:15:26 +00:00
|
|
|
.. Permission is granted to copy, distribute and/or modify this
|
|
|
|
.. document under the terms of the GNU Free Documentation License,
|
|
|
|
.. Version 1.1 or any later version published by the Free Software
|
|
|
|
.. Foundation, with no Invariant Sections, no Front-Cover Texts
|
|
|
|
.. and no Back-Cover Texts. A copy of the license is included at
|
|
|
|
.. Documentation/media/uapi/fdl-appendix.rst.
|
|
|
|
..
|
|
|
|
.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
|
|
|
|
|
2016-07-01 16:42:29 +00:00
|
|
|
.. _VIDIOC_G_ENC_INDEX:
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
************************
|
|
|
|
ioctl VIDIOC_G_ENC_INDEX
|
|
|
|
************************
|
|
|
|
|
2016-07-05 18:14:35 +00:00
|
|
|
Name
|
2016-07-05 10:58:48 +00:00
|
|
|
====
|
2016-06-30 13:18:56 +00:00
|
|
|
|
2016-07-05 10:58:48 +00:00
|
|
|
VIDIOC_G_ENC_INDEX - Get meta data about a compressed video stream
|
2016-06-30 13:18:56 +00:00
|
|
|
|
2016-07-05 18:14:35 +00:00
|
|
|
|
|
|
|
Synopsis
|
2016-06-30 13:18:56 +00:00
|
|
|
========
|
|
|
|
|
2016-08-19 19:53:38 +00:00
|
|
|
.. c:function:: int ioctl( int fd, VIDIOC_G_ENC_INDEX, struct v4l2_enc_idx *argp )
|
|
|
|
:name: VIDIOC_G_ENC_INDEX
|
2016-06-30 13:18:56 +00:00
|
|
|
|
2016-07-05 10:58:48 +00:00
|
|
|
|
2016-07-05 18:14:35 +00:00
|
|
|
Arguments
|
2016-06-30 13:18:56 +00:00
|
|
|
=========
|
|
|
|
|
|
|
|
``fd``
|
|
|
|
File descriptor returned by :ref:`open() <func-open>`.
|
|
|
|
|
|
|
|
``argp``
|
2017-09-02 13:54:48 +00:00
|
|
|
Pointer to struct :c:type:`v4l2_enc_idx`.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
|
2016-07-05 18:14:35 +00:00
|
|
|
Description
|
2016-06-30 13:18:56 +00:00
|
|
|
===========
|
|
|
|
|
2016-07-03 13:02:29 +00:00
|
|
|
The :ref:`VIDIOC_G_ENC_INDEX <VIDIOC_G_ENC_INDEX>` ioctl provides meta data about a compressed
|
2016-06-30 13:18:56 +00:00
|
|
|
video stream the same or another application currently reads from the
|
|
|
|
driver, which is useful for random access into the stream without
|
|
|
|
decoding it.
|
|
|
|
|
2016-07-03 13:02:29 +00:00
|
|
|
To read the data applications must call :ref:`VIDIOC_G_ENC_INDEX <VIDIOC_G_ENC_INDEX>` with a
|
2016-08-29 20:37:59 +00:00
|
|
|
pointer to a struct :c:type:`v4l2_enc_idx`. On success
|
2016-06-30 13:18:56 +00:00
|
|
|
the driver fills the ``entry`` array, stores the number of elements
|
|
|
|
written in the ``entries`` field, and initializes the ``entries_cap``
|
|
|
|
field.
|
|
|
|
|
|
|
|
Each element of the ``entry`` array contains meta data about one
|
2016-07-03 13:02:29 +00:00
|
|
|
picture. A :ref:`VIDIOC_G_ENC_INDEX <VIDIOC_G_ENC_INDEX>` call reads up to
|
2016-06-30 13:18:56 +00:00
|
|
|
``V4L2_ENC_IDX_ENTRIES`` entries from a driver buffer, which can hold up
|
|
|
|
to ``entries_cap`` entries. This number can be lower or higher than
|
|
|
|
``V4L2_ENC_IDX_ENTRIES``, but not zero. When the application fails to
|
|
|
|
read the meta data in time the oldest entries will be lost. When the
|
|
|
|
buffer is empty or no capturing/encoding is in progress, ``entries``
|
|
|
|
will be zero.
|
|
|
|
|
|
|
|
Currently this ioctl is only defined for MPEG-2 program streams and
|
|
|
|
video elementary streams.
|
|
|
|
|
|
|
|
|
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 09:28:26 +00:00
|
|
|
.. tabularcolumns:: |p{3.8cm}|p{5.6cm}|p{8.1cm}|
|
[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 11:14:19 +00:00
|
|
|
|
2016-08-29 20:37:59 +00:00
|
|
|
.. c:type:: v4l2_enc_idx
|
2016-08-19 14:14:23 +00:00
|
|
|
|
2016-06-30 13:18:56 +00:00
|
|
|
.. flat-table:: struct v4l2_enc_idx
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
2016-08-18 17:31:47 +00:00
|
|
|
:widths: 1 3 8
|
2016-06-30 13:18:56 +00: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 11:44:34 +00:00
|
|
|
* - __u32
|
|
|
|
- ``entries``
|
|
|
|
- The number of entries the driver stored in the ``entry`` array.
|
|
|
|
* - __u32
|
|
|
|
- ``entries_cap``
|
|
|
|
- The number of entries the driver can buffer. Must be greater than
|
|
|
|
zero.
|
|
|
|
* - __u32
|
|
|
|
- ``reserved``\ [4]
|
|
|
|
- Reserved for future extensions. Drivers must set the
|
|
|
|
array to zero.
|
|
|
|
* - struct :c:type:`v4l2_enc_idx_entry`
|
|
|
|
- ``entry``\ [``V4L2_ENC_IDX_ENTRIES``]
|
|
|
|
- Meta data about a compressed video stream. Each element of the
|
|
|
|
array corresponds to one picture, sorted in ascending order by
|
|
|
|
their ``offset``.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
[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 11:14:19 +00:00
|
|
|
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
|
|
|
|
|
2016-08-29 20:37:59 +00:00
|
|
|
.. c:type:: v4l2_enc_idx_entry
|
2016-08-19 14:14:23 +00:00
|
|
|
|
2016-06-30 13:18:56 +00:00
|
|
|
.. flat-table:: struct v4l2_enc_idx_entry
|
|
|
|
: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 11:44:34 +00:00
|
|
|
* - __u64
|
|
|
|
- ``offset``
|
|
|
|
- The offset in bytes from the beginning of the compressed video
|
|
|
|
stream to the beginning of this picture, that is a *PES packet
|
|
|
|
header* as defined in :ref:`mpeg2part1` or a *picture header* as
|
|
|
|
defined in :ref:`mpeg2part2`. When the encoder is stopped, the
|
|
|
|
driver resets the offset to zero.
|
|
|
|
* - __u64
|
|
|
|
- ``pts``
|
|
|
|
- The 33 bit *Presentation Time Stamp* of this picture as defined in
|
|
|
|
:ref:`mpeg2part1`.
|
|
|
|
* - __u32
|
|
|
|
- ``length``
|
|
|
|
- The length of this picture in bytes.
|
|
|
|
* - __u32
|
|
|
|
- ``flags``
|
|
|
|
- Flags containing the coding type of this picture, see
|
|
|
|
:ref:`enc-idx-flags`.
|
|
|
|
* - __u32
|
|
|
|
- ``reserved``\ [2]
|
|
|
|
- Reserved for future extensions. Drivers must set the array to
|
|
|
|
zero.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
|
2016-08-19 14:14:23 +00:00
|
|
|
.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
.. _enc-idx-flags:
|
|
|
|
|
|
|
|
.. flat-table:: Index Entry Flags
|
|
|
|
: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 11:44:34 +00:00
|
|
|
* - ``V4L2_ENC_IDX_FRAME_I``
|
|
|
|
- 0x00
|
|
|
|
- This is an Intra-coded picture.
|
|
|
|
* - ``V4L2_ENC_IDX_FRAME_P``
|
|
|
|
- 0x01
|
|
|
|
- This is a Predictive-coded picture.
|
|
|
|
* - ``V4L2_ENC_IDX_FRAME_B``
|
|
|
|
- 0x02
|
|
|
|
- This is a Bidirectionally predictive-coded picture.
|
|
|
|
* - ``V4L2_ENC_IDX_FRAME_MASK``
|
|
|
|
- 0x0F
|
|
|
|
- *AND* the flags field with this mask to obtain the picture coding
|
|
|
|
type.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
|
2016-07-05 18:14:35 +00:00
|
|
|
Return Value
|
2016-06-30 13:18:56 +00:00
|
|
|
============
|
|
|
|
|
|
|
|
On success 0 is returned, on error -1 and the ``errno`` variable is set
|
|
|
|
appropriately. The generic error codes are described at the
|
|
|
|
:ref:`Generic Error Codes <gen-errors>` chapter.
|