2016-06-30 13:18:56 +00:00
|
|
|
.. -*- coding: utf-8; mode: rst -*-
|
|
|
|
|
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-07-02 12:49:16 +00:00
|
|
|
.. cpp:function:: int ioctl( int fd, int request, struct v4l2_enc_idx *argp )
|
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>`.
|
|
|
|
|
|
|
|
``request``
|
|
|
|
VIDIOC_G_ENC_INDEX
|
|
|
|
|
|
|
|
``argp``
|
|
|
|
|
|
|
|
|
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-06-30 13:18:56 +00:00
|
|
|
pointer to a struct :ref:`v4l2_enc_idx <v4l2-enc-idx>`. On success
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
.. _v4l2-enc-idx:
|
|
|
|
|
[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{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}|
|
|
|
|
|
2016-06-30 13:18:56 +00:00
|
|
|
.. flat-table:: struct v4l2_enc_idx
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 1 1 2 1 1
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``entries``
|
|
|
|
|
|
|
|
- The number of entries the driver stored in the ``entry`` array.
|
|
|
|
|
|
|
|
- .. row 2
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``entries_cap``
|
|
|
|
|
|
|
|
- The number of entries the driver can buffer. Must be greater than
|
2016-07-04 19:25:48 +00:00
|
|
|
zero.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
- .. row 3
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
2016-07-13 11:43:30 +00:00
|
|
|
- ``reserved``\ [4]
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
- :cspan:`2` Reserved for future extensions. Drivers must set the
|
2016-07-04 19:25:48 +00:00
|
|
|
array to zero.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
- .. row 4
|
|
|
|
|
|
|
|
- struct :ref:`v4l2_enc_idx_entry <v4l2-enc-idx-entry>`
|
|
|
|
|
|
|
|
- ``entry``\ [``V4L2_ENC_IDX_ENTRIES``]
|
|
|
|
|
|
|
|
- Meta data about a compressed video stream. Each element of the
|
2016-07-04 19:25:48 +00:00
|
|
|
array corresponds to one picture, sorted in ascending order by
|
|
|
|
their ``offset``.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _v4l2-enc-idx-entry:
|
|
|
|
|
[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-06-30 13:18:56 +00:00
|
|
|
.. flat-table:: struct v4l2_enc_idx_entry
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 1 1 2
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- __u64
|
|
|
|
|
|
|
|
- ``offset``
|
|
|
|
|
|
|
|
- The offset in bytes from the beginning of the compressed video
|
2016-07-04 19:25:48 +00:00
|
|
|
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.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
- .. row 2
|
|
|
|
|
|
|
|
- __u64
|
|
|
|
|
|
|
|
- ``pts``
|
|
|
|
|
|
|
|
- The 33 bit *Presentation Time Stamp* of this picture as defined in
|
2016-07-04 19:25:48 +00:00
|
|
|
:ref:`mpeg2part1`.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
- .. row 3
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``length``
|
|
|
|
|
|
|
|
- The length of this picture in bytes.
|
|
|
|
|
|
|
|
- .. row 4
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``flags``
|
|
|
|
|
|
|
|
- Flags containing the coding type of this picture, see
|
2016-07-04 19:25:48 +00:00
|
|
|
:ref:`enc-idx-flags`.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
- .. row 5
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
2016-07-13 11:43:30 +00:00
|
|
|
- ``reserved``\ [2]
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
- Reserved for future extensions. Drivers must set the array to
|
2016-07-04 19:25:48 +00:00
|
|
|
zero.
|
2016-06-30 13:18:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _enc-idx-flags:
|
|
|
|
|
[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{6.6cm}|p{2.2cm}|p{8.7cm}|
|
|
|
|
|
2016-06-30 13:18:56 +00:00
|
|
|
.. flat-table:: Index Entry Flags
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 3 1 4
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- ``V4L2_ENC_IDX_FRAME_I``
|
|
|
|
|
|
|
|
- 0x00
|
|
|
|
|
|
|
|
- This is an Intra-coded picture.
|
|
|
|
|
|
|
|
- .. row 2
|
|
|
|
|
|
|
|
- ``V4L2_ENC_IDX_FRAME_P``
|
|
|
|
|
|
|
|
- 0x01
|
|
|
|
|
|
|
|
- This is a Predictive-coded picture.
|
|
|
|
|
|
|
|
- .. row 3
|
|
|
|
|
|
|
|
- ``V4L2_ENC_IDX_FRAME_B``
|
|
|
|
|
|
|
|
- 0x02
|
|
|
|
|
|
|
|
- This is a Bidirectionally predictive-coded picture.
|
|
|
|
|
|
|
|
- .. row 4
|
|
|
|
|
|
|
|
- ``V4L2_ENC_IDX_FRAME_MASK``
|
|
|
|
|
|
|
|
- 0x0F
|
|
|
|
|
|
|
|
- *AND* the flags field with this mask to obtain the picture coding
|
2016-07-04 19:25:48 +00:00
|
|
|
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.
|