1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_G_ENC_INDEX:
5 ************************
6 ioctl VIDIOC_G_ENC_INDEX
7 ************************
12 VIDIOC_G_ENC_INDEX - Get meta data about a compressed video stream
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_enc_idx *argp )
25 File descriptor returned by :ref:`open() <func-open>`.
36 The :ref:`VIDIOC_G_ENC_INDEX <VIDIOC_G_ENC_INDEX>` ioctl provides meta data about a compressed
37 video stream the same or another application currently reads from the
38 driver, which is useful for random access into the stream without
41 To read the data applications must call :ref:`VIDIOC_G_ENC_INDEX <VIDIOC_G_ENC_INDEX>` with a
42 pointer to a struct :ref:`v4l2_enc_idx <v4l2-enc-idx>`. On success
43 the driver fills the ``entry`` array, stores the number of elements
44 written in the ``entries`` field, and initializes the ``entries_cap``
47 Each element of the ``entry`` array contains meta data about one
48 picture. A :ref:`VIDIOC_G_ENC_INDEX <VIDIOC_G_ENC_INDEX>` call reads up to
49 ``V4L2_ENC_IDX_ENTRIES`` entries from a driver buffer, which can hold up
50 to ``entries_cap`` entries. This number can be lower or higher than
51 ``V4L2_ENC_IDX_ENTRIES``, but not zero. When the application fails to
52 read the meta data in time the oldest entries will be lost. When the
53 buffer is empty or no capturing/encoding is in progress, ``entries``
56 Currently this ioctl is only defined for MPEG-2 program streams and
57 video elementary streams.
62 .. flat-table:: struct v4l2_enc_idx
74 - The number of entries the driver stored in the ``entry`` array.
82 - The number of entries the driver can buffer. Must be greater than
91 - :cspan:`2` Reserved for future extensions. Drivers must set the
96 - struct :ref:`v4l2_enc_idx_entry <v4l2-enc-idx-entry>`
98 - ``entry``\ [``V4L2_ENC_IDX_ENTRIES``]
100 - Meta data about a compressed video stream. Each element of the
101 array corresponds to one picture, sorted in ascending order by
106 .. _v4l2-enc-idx-entry:
108 .. flat-table:: struct v4l2_enc_idx_entry
120 - The offset in bytes from the beginning of the compressed video
121 stream to the beginning of this picture, that is a *PES packet
122 header* as defined in :ref:`mpeg2part1` or a *picture header* as
123 defined in :ref:`mpeg2part2`. When the encoder is stopped, the
124 driver resets the offset to zero.
132 - The 33 bit *Presentation Time Stamp* of this picture as defined in
141 - The length of this picture in bytes.
149 - Flags containing the coding type of this picture, see
150 :ref:`enc-idx-flags`.
158 - Reserved for future extensions. Drivers must set the array to
165 .. flat-table:: Index Entry Flags
173 - ``V4L2_ENC_IDX_FRAME_I``
177 - This is an Intra-coded picture.
181 - ``V4L2_ENC_IDX_FRAME_P``
185 - This is a Predictive-coded picture.
189 - ``V4L2_ENC_IDX_FRAME_B``
193 - This is a Bidirectionally predictive-coded picture.
197 - ``V4L2_ENC_IDX_FRAME_MASK``
201 - *AND* the flags field with this mask to obtain the picture coding
208 On success 0 is returned, on error -1 and the ``errno`` variable is set
209 appropriately. The generic error codes are described at the
210 :ref:`Generic Error Codes <gen-errors>` chapter.