1 <refentry id="vidioc-g-enc-index">
3 <refentrytitle>ioctl VIDIOC_G_ENC_INDEX</refentrytitle>
8 <refname>VIDIOC_G_ENC_INDEX</refname>
9 <refpurpose>Get meta data about a compressed video stream</refpurpose>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_enc_idx *<parameter>argp</parameter></paramdef>
24 <title>Arguments</title>
28 <term><parameter>fd</parameter></term>
34 <term><parameter>request</parameter></term>
36 <para>VIDIOC_G_ENC_INDEX</para>
40 <term><parameter>argp</parameter></term>
49 <title>Description</title>
52 <title>Experimental</title>
54 <para>This is an <link linkend="experimental">experimental</link>
55 interface and may change in the future.</para>
58 <para>The <constant>VIDIOC_G_ENC_INDEX</constant> ioctl provides
59 meta data about a compressed video stream the same or another
60 application currently reads from the driver, which is useful for
61 random access into the stream without decoding it.</para>
63 <para>To read the data applications must call
64 <constant>VIDIOC_G_ENC_INDEX</constant> with a pointer to a
65 &v4l2-enc-idx;. On success the driver fills the
66 <structfield>entry</structfield> array, stores the number of elements
67 written in the <structfield>entries</structfield> field, and
68 initializes the <structfield>entries_cap</structfield> field.</para>
70 <para>Each element of the <structfield>entry</structfield> array
71 contains meta data about one picture. A
72 <constant>VIDIOC_G_ENC_INDEX</constant> call reads up to
73 <constant>V4L2_ENC_IDX_ENTRIES</constant> entries from a driver
74 buffer, which can hold up to <structfield>entries_cap</structfield>
75 entries. This number can be lower or higher than
76 <constant>V4L2_ENC_IDX_ENTRIES</constant>, but not zero. When the
77 application fails to read the meta data in time the oldest entries
78 will be lost. When the buffer is empty or no capturing/encoding is in
79 progress, <structfield>entries</structfield> will be zero.</para>
81 <para>Currently this ioctl is only defined for MPEG-2 program
82 streams and video elementary streams.</para>
84 <table pgwide="1" frame="none" id="v4l2-enc-idx">
85 <title>struct <structname>v4l2_enc_idx</structname></title>
91 <entry><structfield>entries</structfield></entry>
92 <entry>The number of entries the driver stored in the
93 <structfield>entry</structfield> array.</entry>
97 <entry><structfield>entries_cap</structfield></entry>
98 <entry>The number of entries the driver can
99 buffer. Must be greater than zero.</entry>
103 <entry><structfield>reserved</structfield>[4]</entry>
104 <entry spanname="hspan">Reserved for future extensions.
105 Drivers must set the array to zero.</entry>
108 <entry>&v4l2-enc-idx-entry;</entry>
109 <entry><structfield>entry</structfield>[<constant>V4L2_ENC_IDX_ENTRIES</constant>]</entry>
110 <entry>Meta data about a compressed video stream. Each
111 element of the array corresponds to one picture, sorted in ascending
112 order by their <structfield>offset</structfield>.</entry>
118 <table pgwide="1" frame="none" id="v4l2-enc-idx-entry">
119 <title>struct <structname>v4l2_enc_idx_entry</structname></title>
125 <entry><structfield>offset</structfield></entry>
126 <entry>The offset in bytes from the beginning of the
127 compressed video stream to the beginning of this picture, that is a
128 <wordasword>PES packet header</wordasword> as defined in <xref
129 linkend="mpeg2part1" /> or a <wordasword>picture
130 header</wordasword> as defined in <xref linkend="mpeg2part2" />. When
131 the encoder is stopped, the driver resets the offset to zero.</entry>
135 <entry><structfield>pts</structfield></entry>
136 <entry>The 33 bit <wordasword>Presentation Time
137 Stamp</wordasword> of this picture as defined in <xref
138 linkend="mpeg2part1" />.</entry>
142 <entry><structfield>length</structfield></entry>
143 <entry>The length of this picture in bytes.</entry>
147 <entry><structfield>flags</structfield></entry>
148 <entry>Flags containing the coding type of this picture, see <xref
149 linkend="enc-idx-flags" />.</entry>
153 <entry><structfield>reserved</structfield>[2]</entry>
154 <entry>Reserved for future extensions.
155 Drivers must set the array to zero.</entry>
161 <table pgwide="1" frame="none" id="enc-idx-flags">
162 <title>Index Entry Flags</title>
167 <entry><constant>V4L2_ENC_IDX_FRAME_I</constant></entry>
169 <entry>This is an Intra-coded picture.</entry>
172 <entry><constant>V4L2_ENC_IDX_FRAME_P</constant></entry>
174 <entry>This is a Predictive-coded picture.</entry>
177 <entry><constant>V4L2_ENC_IDX_FRAME_B</constant></entry>
179 <entry>This is a Bidirectionally predictive-coded
183 <entry><constant>V4L2_ENC_IDX_FRAME_MASK</constant></entry>
185 <entry><wordasword>AND</wordasword> the flags field with
186 this mask to obtain the picture coding type.</entry>