1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> 2<HTML 3><HEAD 4><TITLE 5>ioctl VIDIOC_G_ENC_INDEX</TITLE 6><META 7NAME="GENERATOR" 8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK 9REL="HOME" 10TITLE="Video for Linux Two API Specification" 11HREF="book1.htm"><LINK 12REL="UP" 13TITLE="Function Reference" 14HREF="r7624.htm"><LINK 15REL="PREVIOUS" 16TITLE="ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL" 17HREF="r10104.htm"><LINK 18REL="NEXT" 19TITLE="ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, 20VIDIOC_TRY_EXT_CTRLS" 21HREF="r10386.htm"></HEAD 22><BODY 23CLASS="REFENTRY" 24BGCOLOR="#FFFFFF" 25TEXT="#000000" 26LINK="#0000FF" 27VLINK="#840084" 28ALINK="#0000FF" 29><DIV 30CLASS="NAVHEADER" 31><TABLE 32SUMMARY="Header navigation table" 33WIDTH="100%" 34BORDER="0" 35CELLPADDING="0" 36CELLSPACING="0" 37><TR 38><TH 39COLSPAN="3" 40ALIGN="center" 41>Video for Linux Two API Specification: Revision 0.24</TH 42></TR 43><TR 44><TD 45WIDTH="10%" 46ALIGN="left" 47VALIGN="bottom" 48><A 49HREF="r10104.htm" 50ACCESSKEY="P" 51>Prev</A 52></TD 53><TD 54WIDTH="80%" 55ALIGN="center" 56VALIGN="bottom" 57></TD 58><TD 59WIDTH="10%" 60ALIGN="right" 61VALIGN="bottom" 62><A 63HREF="r10386.htm" 64ACCESSKEY="N" 65>Next</A 66></TD 67></TR 68></TABLE 69><HR 70ALIGN="LEFT" 71WIDTH="100%"></DIV 72><H1 73><A 74NAME="VIDIOC-G-ENC-INDEX" 75></A 76>ioctl VIDIOC_G_ENC_INDEX</H1 77><DIV 78CLASS="REFNAMEDIV" 79><A 80NAME="AEN10215" 81></A 82><H2 83>Name</H2 84>VIDIOC_G_ENC_INDEX -- Get meta data about a compressed video stream</DIV 85><DIV 86CLASS="REFSYNOPSISDIV" 87><A 88NAME="AEN10218" 89></A 90><H2 91>Synopsis</H2 92><DIV 93CLASS="FUNCSYNOPSIS" 94><P 95></P 96><A 97NAME="AEN10219" 98></A 99><P 100><CODE 101><CODE 102CLASS="FUNCDEF" 103>int ioctl</CODE 104>(int fd, int request, struct v4l2_enc_idx *argp);</CODE 105></P 106><P 107></P 108></DIV 109></DIV 110><DIV 111CLASS="REFSECT1" 112><A 113NAME="AEN10229" 114></A 115><H2 116>Arguments</H2 117><P 118></P 119><DIV 120CLASS="VARIABLELIST" 121><DL 122><DT 123><CODE 124CLASS="PARAMETER" 125>fd</CODE 126></DT 127><DD 128><P 129>File descriptor returned by <A 130HREF="r14090.htm" 131><CODE 132CLASS="FUNCTION" 133>open()</CODE 134></A 135>.</P 136></DD 137><DT 138><CODE 139CLASS="PARAMETER" 140>request</CODE 141></DT 142><DD 143><P 144>VIDIOC_G_ENC_INDEX</P 145></DD 146><DT 147><CODE 148CLASS="PARAMETER" 149>argp</CODE 150></DT 151><DD 152><P 153></P 154></DD 155></DL 156></DIV 157></DIV 158><DIV 159CLASS="REFSECT1" 160><A 161NAME="AEN10249" 162></A 163><H2 164>Description</H2 165><DIV 166CLASS="NOTE" 167><BLOCKQUOTE 168CLASS="NOTE" 169><P 170><B 171>Experimental: </B 172>This is an <A 173HREF="x16453.htm" 174>experimental</A 175> 176interface and may change in the future.</P 177></BLOCKQUOTE 178></DIV 179><P 180>The <CODE 181CLASS="CONSTANT" 182>VIDIOC_G_ENC_INDEX</CODE 183> ioctl provides 184meta data about a compressed video stream the same or another 185application currently reads from the driver, which is useful for 186random access into the stream without decoding it.</P 187><P 188>To read the data applications must call 189<CODE 190CLASS="CONSTANT" 191>VIDIOC_G_ENC_INDEX</CODE 192> with a pointer to a 193struct <A 194HREF="r10211.htm#V4L2-ENC-IDX" 195>v4l2_enc_idx</A 196>. On success the driver fills the 197<CODE 198CLASS="STRUCTFIELD" 199>entry</CODE 200> array, stores the number of elements 201written in the <CODE 202CLASS="STRUCTFIELD" 203>entries</CODE 204> field, and 205initializes the <CODE 206CLASS="STRUCTFIELD" 207>entries_cap</CODE 208> field.</P 209><P 210>Each element of the <CODE 211CLASS="STRUCTFIELD" 212>entry</CODE 213> array 214contains meta data about one picture. A 215<CODE 216CLASS="CONSTANT" 217>VIDIOC_G_ENC_INDEX</CODE 218> call reads up to 219<CODE 220CLASS="CONSTANT" 221>V4L2_ENC_IDX_ENTRIES</CODE 222> entries from a driver 223buffer, which can hold up to <CODE 224CLASS="STRUCTFIELD" 225>entries_cap</CODE 226> 227entries. This number can be lower or higher than 228<CODE 229CLASS="CONSTANT" 230>V4L2_ENC_IDX_ENTRIES</CODE 231>, but not zero. When the 232application fails to read the meta data in time the oldest entries 233will be lost. When the buffer is empty or no capturing/encoding is in 234progress, <CODE 235CLASS="STRUCTFIELD" 236>entries</CODE 237> will be zero.</P 238><P 239>Currently this ioctl is only defined for MPEG-2 program 240streams and video elementary streams.</P 241><DIV 242CLASS="TABLE" 243><A 244NAME="V4L2-ENC-IDX" 245></A 246><P 247><B 248>Table 1. struct <CODE 249CLASS="STRUCTNAME" 250>v4l2_enc_idx</CODE 251></B 252></P 253><TABLE 254BORDER="0" 255FRAME="void" 256WIDTH="100%" 257CLASS="CALSTABLE" 258><COL 259WIDTH="25%" 260TITLE="C1"><COL 261WIDTH="25%" 262TITLE="C2"><COL 263WIDTH="50%" 264TITLE="C3"><TBODY 265VALIGN="TOP" 266><TR 267><TD 268>__u32</TD 269><TD 270><CODE 271CLASS="STRUCTFIELD" 272>entries</CODE 273></TD 274><TD 275>The number of entries the driver stored in the 276<CODE 277CLASS="STRUCTFIELD" 278>entry</CODE 279> array.</TD 280></TR 281><TR 282><TD 283>__u32</TD 284><TD 285><CODE 286CLASS="STRUCTFIELD" 287>entries_cap</CODE 288></TD 289><TD 290>The number of entries the driver can 291buffer. Must be greater than zero.</TD 292></TR 293><TR 294><TD 295>__u32</TD 296><TD 297><CODE 298CLASS="STRUCTFIELD" 299>reserved</CODE 300>[4]</TD 301><TD 302COLSPAN="3" 303>Reserved for future extensions. 304Drivers must set the array to zero.</TD 305></TR 306><TR 307><TD 308>struct <A 309HREF="r10211.htm#V4L2-ENC-IDX-ENTRY" 310>v4l2_enc_idx_entry</A 311></TD 312><TD 313><CODE 314CLASS="STRUCTFIELD" 315>entry</CODE 316>[<CODE 317CLASS="CONSTANT" 318>V4L2_ENC_IDX_ENTRIES</CODE 319>]</TD 320><TD 321>Meta data about a compressed video stream. Each 322element of the array corresponds to one picture, sorted in ascending 323order by their <CODE 324CLASS="STRUCTFIELD" 325>offset</CODE 326>.</TD 327></TR 328></TBODY 329></TABLE 330></DIV 331><DIV 332CLASS="TABLE" 333><A 334NAME="V4L2-ENC-IDX-ENTRY" 335></A 336><P 337><B 338>Table 2. struct <CODE 339CLASS="STRUCTNAME" 340>v4l2_enc_idx_entry</CODE 341></B 342></P 343><TABLE 344BORDER="0" 345FRAME="void" 346WIDTH="100%" 347CLASS="CALSTABLE" 348><COL 349WIDTH="25%" 350TITLE="C1"><COL 351WIDTH="25%" 352TITLE="C2"><COL 353WIDTH="50%" 354TITLE="C3"><TBODY 355VALIGN="TOP" 356><TR 357><TD 358>__u64</TD 359><TD 360><CODE 361CLASS="STRUCTFIELD" 362>offset</CODE 363></TD 364><TD 365>The offset in bytes from the beginning of the 366compressed video stream to the beginning of this picture, that is a 367<I 368CLASS="WORDASWORD" 369>PES packet header</I 370> as defined in <A 371HREF="b17127.htm#MPEG2PART1" 372><ABBR 373CLASS="ABBREV" 374>ISO 13818-1</ABBR 375></A 376> or a <I 377CLASS="WORDASWORD" 378>picture 379header</I 380> as defined in <A 381HREF="b17127.htm#MPEG2PART2" 382><ABBR 383CLASS="ABBREV" 384>ISO 13818-2</ABBR 385></A 386>. When 387the encoder is stopped, the driver resets the offset to zero.</TD 388></TR 389><TR 390><TD 391>__u64</TD 392><TD 393><CODE 394CLASS="STRUCTFIELD" 395>pts</CODE 396></TD 397><TD 398>The 33 bit <I 399CLASS="WORDASWORD" 400>Presentation Time 401Stamp</I 402> of this picture as defined in <A 403HREF="b17127.htm#MPEG2PART1" 404><ABBR 405CLASS="ABBREV" 406>ISO 13818-1</ABBR 407></A 408>.</TD 409></TR 410><TR 411><TD 412>__u32</TD 413><TD 414><CODE 415CLASS="STRUCTFIELD" 416>length</CODE 417></TD 418><TD 419>The length of this picture in bytes.</TD 420></TR 421><TR 422><TD 423>__u32</TD 424><TD 425><CODE 426CLASS="STRUCTFIELD" 427>flags</CODE 428></TD 429><TD 430>Flags containing the coding type of this picture, see <A 431HREF="r10211.htm#ENC-IDX-FLAGS" 432>Table 3</A 433>.</TD 434></TR 435><TR 436><TD 437>__u32</TD 438><TD 439><CODE 440CLASS="STRUCTFIELD" 441>reserved</CODE 442>[2]</TD 443><TD 444>Reserved for future extensions. 445Drivers must set the array to zero.</TD 446></TR 447></TBODY 448></TABLE 449></DIV 450><DIV 451CLASS="TABLE" 452><A 453NAME="ENC-IDX-FLAGS" 454></A 455><P 456><B 457>Table 3. Index Entry Flags</B 458></P 459><TABLE 460BORDER="0" 461FRAME="void" 462WIDTH="100%" 463CLASS="CALSTABLE" 464><COL 465WIDTH="38%" 466TITLE="C1"><COL 467WIDTH="12%" 468TITLE="C2"><COL 469WIDTH="50%" 470TITLE="C3"><TBODY 471VALIGN="TOP" 472><TR 473><TD 474><CODE 475CLASS="CONSTANT" 476>V4L2_ENC_IDX_FRAME_I</CODE 477></TD 478><TD 479>0x00</TD 480><TD 481>This is an Intra-coded picture.</TD 482></TR 483><TR 484><TD 485><CODE 486CLASS="CONSTANT" 487>V4L2_ENC_IDX_FRAME_P</CODE 488></TD 489><TD 490>0x01</TD 491><TD 492>This is a Predictive-coded picture.</TD 493></TR 494><TR 495><TD 496><CODE 497CLASS="CONSTANT" 498>V4L2_ENC_IDX_FRAME_B</CODE 499></TD 500><TD 501>0x02</TD 502><TD 503>This is a Bidirectionally predictive-coded 504picture.</TD 505></TR 506><TR 507><TD 508><CODE 509CLASS="CONSTANT" 510>V4L2_ENC_IDX_FRAME_MASK</CODE 511></TD 512><TD 513>0x0F</TD 514><TD 515><I 516CLASS="WORDASWORD" 517>AND</I 518> the flags field with 519this mask to obtain the picture coding type.</TD 520></TR 521></TBODY 522></TABLE 523></DIV 524></DIV 525><DIV 526CLASS="REFSECT1" 527><A 528NAME="AEN10374" 529></A 530><H2 531>Return Value</H2 532><P 533>On success <SPAN 534CLASS="RETURNVALUE" 535>0</SPAN 536> is returned, on error <SPAN 537CLASS="RETURNVALUE" 538>-1</SPAN 539> and the <CODE 540CLASS="VARNAME" 541>errno</CODE 542> variable is set appropriately:</P 543><P 544></P 545><DIV 546CLASS="VARIABLELIST" 547><DL 548><DT 549><SPAN 550CLASS="ERRORCODE" 551>EINVAL</SPAN 552></DT 553><DD 554><P 555>The driver does not support this ioctl.</P 556></DD 557></DL 558></DIV 559></DIV 560><DIV 561CLASS="NAVFOOTER" 562><HR 563ALIGN="LEFT" 564WIDTH="100%"><TABLE 565SUMMARY="Footer navigation table" 566WIDTH="100%" 567BORDER="0" 568CELLPADDING="0" 569CELLSPACING="0" 570><TR 571><TD 572WIDTH="33%" 573ALIGN="left" 574VALIGN="top" 575><A 576HREF="r10104.htm" 577ACCESSKEY="P" 578>Prev</A 579></TD 580><TD 581WIDTH="34%" 582ALIGN="center" 583VALIGN="top" 584><A 585HREF="book1.htm" 586ACCESSKEY="H" 587>Home</A 588></TD 589><TD 590WIDTH="33%" 591ALIGN="right" 592VALIGN="top" 593><A 594HREF="r10386.htm" 595ACCESSKEY="N" 596>Next</A 597></TD 598></TR 599><TR 600><TD 601WIDTH="33%" 602ALIGN="left" 603VALIGN="top" 604>ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL</TD 605><TD 606WIDTH="34%" 607ALIGN="center" 608VALIGN="top" 609><A 610HREF="r7624.htm" 611ACCESSKEY="U" 612>Up</A 613></TD 614><TD 615WIDTH="33%" 616ALIGN="right" 617VALIGN="top" 618>ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, 619VIDIOC_TRY_EXT_CTRLS</TD 620></TR 621></TABLE 622></DIV 623></BODY 624></HTML 625> 626