1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_G_ENC_INDEX</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="user-func.html" title="Appendix A. Function Reference"><link rel="prev" href="vidioc-g-edid.html" title="ioctl VIDIOC_G_EDID, VIDIOC_S_EDID"><link rel="next" href="vidioc-g-ext-ctrls.html" title="ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_G_ENC_INDEX</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-g-edid.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="vidioc-g-ext-ctrls.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-g-enc-index"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_G_ENC_INDEX — Get meta data about a compressed video stream</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>struct v4l2_enc_idx *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1114080188"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="func-open.html" title="V4L2 open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>VIDIOC_G_ENC_INDEX</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1"><a name="idp1114084236"></a><h2>Description</h2><p>The <code class="constant">VIDIOC_G_ENC_INDEX</code> ioctl provides 2meta data about a compressed video stream the same or another 3application currently reads from the driver, which is useful for 4random access into the stream without decoding it.</p><p>To read the data applications must call 5<code class="constant">VIDIOC_G_ENC_INDEX</code> with a pointer to a 6struct <a class="link" href="vidioc-g-enc-index.html#v4l2-enc-idx" title="Table A.63. struct v4l2_enc_idx">v4l2_enc_idx</a>. On success the driver fills the 7<em class="structfield"><code>entry</code></em> array, stores the number of elements 8written in the <em class="structfield"><code>entries</code></em> field, and 9initializes the <em class="structfield"><code>entries_cap</code></em> field.</p><p>Each element of the <em class="structfield"><code>entry</code></em> array 10contains meta data about one picture. A 11<code class="constant">VIDIOC_G_ENC_INDEX</code> call reads up to 12<code class="constant">V4L2_ENC_IDX_ENTRIES</code> entries from a driver 13buffer, which can hold up to <em class="structfield"><code>entries_cap</code></em> 14entries. This number can be lower or higher than 15<code class="constant">V4L2_ENC_IDX_ENTRIES</code>, but not zero. When the 16application fails to read the meta data in time the oldest entries 17will be lost. When the buffer is empty or no capturing/encoding is in 18progress, <em class="structfield"><code>entries</code></em> will be zero.</p><p>Currently this ioctl is only defined for MPEG-2 program 19streams and video elementary streams.</p><div class="table"><a name="v4l2-enc-idx"></a><p class="title"><b>Table A.63. struct <span class="structname">v4l2_enc_idx</span></b></p><div class="table-contents"><table summary="struct v4l2_enc_idx" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>entries</code></em></td><td valign="top">The number of entries the driver stored in the 20<em class="structfield"><code>entry</code></em> array.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>entries_cap</code></em></td><td valign="top">The number of entries the driver can 21buffer. Must be greater than zero.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[4]</td><td colspan="3" valign="top">Reserved for future extensions. 22Drivers must set the array to zero.</td></tr><tr><td valign="top">struct <a class="link" href="vidioc-g-enc-index.html#v4l2-enc-idx-entry" title="Table A.64. struct v4l2_enc_idx_entry">v4l2_enc_idx_entry</a></td><td valign="top"><em class="structfield"><code>entry</code></em>[<code class="constant">V4L2_ENC_IDX_ENTRIES</code>]</td><td valign="top">Meta data about a compressed video stream. Each 23element of the array corresponds to one picture, sorted in ascending 24order by their <em class="structfield"><code>offset</code></em>.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-enc-idx-entry"></a><p class="title"><b>Table A.64. struct <span class="structname">v4l2_enc_idx_entry</span></b></p><div class="table-contents"><table summary="struct v4l2_enc_idx_entry" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u64</td><td valign="top"><em class="structfield"><code>offset</code></em></td><td valign="top">The offset in bytes from the beginning of the 25compressed video stream to the beginning of this picture, that is a 26<em class="wordasword">PES packet header</em> as defined in <a class="xref" href="bi01.html#mpeg2part1" title='ITU-T Rec. H.222.0 | ISO/IEC 13818-1 "Information technology — Generic coding of moving pictures and associated audio information: Systems"'>[<abbr class="abbrev">ISO 13818-1</abbr>]</a> or a <em class="wordasword">picture 27header</em> as defined in <a class="xref" href="bi01.html#mpeg2part2" title='ITU-T Rec. H.262 | ISO/IEC 13818-2 "Information technology — Generic coding of moving pictures and associated audio information: Video"'>[<abbr class="abbrev">ISO 13818-2</abbr>]</a>. When 28the encoder is stopped, the driver resets the offset to zero.</td></tr><tr><td valign="top">__u64</td><td valign="top"><em class="structfield"><code>pts</code></em></td><td valign="top">The 33 bit <em class="wordasword">Presentation Time 29Stamp</em> of this picture as defined in <a class="xref" href="bi01.html#mpeg2part1" title='ITU-T Rec. H.222.0 | ISO/IEC 13818-1 "Information technology — Generic coding of moving pictures and associated audio information: Systems"'>[<abbr class="abbrev">ISO 13818-1</abbr>]</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>length</code></em></td><td valign="top">The length of this picture in bytes.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>flags</code></em></td><td valign="top">Flags containing the coding type of this picture, see <a class="xref" href="vidioc-g-enc-index.html#enc-idx-flags" title="Table A.65. Index Entry Flags">Table A.65, “Index Entry Flags”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[2]</td><td valign="top">Reserved for future extensions. 30Drivers must set the array to zero.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="enc-idx-flags"></a><p class="title"><b>Table A.65. Index Entry Flags</b></p><div class="table-contents"><table summary="Index Entry Flags" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">V4L2_ENC_IDX_FRAME_I</code></td><td valign="top">0x00</td><td valign="top">This is an Intra-coded picture.</td></tr><tr><td valign="top"><code class="constant">V4L2_ENC_IDX_FRAME_P</code></td><td valign="top">0x01</td><td valign="top">This is a Predictive-coded picture.</td></tr><tr><td valign="top"><code class="constant">V4L2_ENC_IDX_FRAME_B</code></td><td valign="top">0x02</td><td valign="top">This is a Bidirectionally predictive-coded 31picture.</td></tr><tr><td valign="top"><code class="constant">V4L2_ENC_IDX_FRAME_MASK</code></td><td valign="top">0x0F</td><td valign="top"><em class="wordasword">AND</em> the flags field with 32this mask to obtain the picture coding type.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="idp1114115476"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="vidioc-g-edid.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="user-func.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="vidioc-g-ext-ctrls.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_G_EDID, VIDIOC_S_EDID </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, 33VIDIOC_TRY_EXT_CTRLS</td></tr></table></div></body></html> 34