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_ENUM_FMT</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_ENUMAUDOUT" 17HREF="r8304.htm"><LINK 18REL="NEXT" 19TITLE="ioctl VIDIOC_ENUM_FRAMESIZES" 20HREF="r8494.htm"></HEAD 21><BODY 22CLASS="REFENTRY" 23BGCOLOR="#FFFFFF" 24TEXT="#000000" 25LINK="#0000FF" 26VLINK="#840084" 27ALINK="#0000FF" 28><DIV 29CLASS="NAVHEADER" 30><TABLE 31SUMMARY="Header navigation table" 32WIDTH="100%" 33BORDER="0" 34CELLPADDING="0" 35CELLSPACING="0" 36><TR 37><TH 38COLSPAN="3" 39ALIGN="center" 40>Video for Linux Two API Specification: Revision 0.24</TH 41></TR 42><TR 43><TD 44WIDTH="10%" 45ALIGN="left" 46VALIGN="bottom" 47><A 48HREF="r8304.htm" 49ACCESSKEY="P" 50>Prev</A 51></TD 52><TD 53WIDTH="80%" 54ALIGN="center" 55VALIGN="bottom" 56></TD 57><TD 58WIDTH="10%" 59ALIGN="right" 60VALIGN="bottom" 61><A 62HREF="r8494.htm" 63ACCESSKEY="N" 64>Next</A 65></TD 66></TR 67></TABLE 68><HR 69ALIGN="LEFT" 70WIDTH="100%"></DIV 71><H1 72><A 73NAME="VIDIOC-ENUM-FMT" 74></A 75>ioctl VIDIOC_ENUM_FMT</H1 76><DIV 77CLASS="REFNAMEDIV" 78><A 79NAME="AEN8371" 80></A 81><H2 82>Name</H2 83>VIDIOC_ENUM_FMT -- Enumerate image formats</DIV 84><DIV 85CLASS="REFSYNOPSISDIV" 86><A 87NAME="AEN8374" 88></A 89><H2 90>Synopsis</H2 91><DIV 92CLASS="FUNCSYNOPSIS" 93><P 94></P 95><A 96NAME="AEN8375" 97></A 98><P 99><CODE 100><CODE 101CLASS="FUNCDEF" 102>int ioctl</CODE 103>(int fd, int request, struct v4l2_fmtdesc 104*argp);</CODE 105></P 106><P 107></P 108></DIV 109></DIV 110><DIV 111CLASS="REFSECT1" 112><A 113NAME="AEN8385" 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_ENUM_FMT</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="AEN8405" 162></A 163><H2 164>Description</H2 165><P 166>To enumerate image formats applications initialize the 167<CODE 168CLASS="STRUCTFIELD" 169>type</CODE 170> and <CODE 171CLASS="STRUCTFIELD" 172>index</CODE 173> 174field of struct <A 175HREF="r8367.htm#V4L2-FMTDESC" 176>v4l2_fmtdesc</A 177> and call the 178<CODE 179CLASS="CONSTANT" 180>VIDIOC_ENUM_FMT</CODE 181> ioctl with a pointer to this 182structure. Drivers fill the rest of the structure or return an 183<SPAN 184CLASS="ERRORCODE" 185>EINVAL</SPAN 186> error code. All formats are enumerable by beginning at index zero and 187incrementing by one until <SPAN 188CLASS="ERRORCODE" 189>EINVAL</SPAN 190> is 191returned.</P 192><DIV 193CLASS="TABLE" 194><A 195NAME="V4L2-FMTDESC" 196></A 197><P 198><B 199>Table 1. struct <CODE 200CLASS="STRUCTNAME" 201>v4l2_fmtdesc</CODE 202></B 203></P 204><TABLE 205BORDER="0" 206FRAME="void" 207WIDTH="100%" 208CLASS="CALSTABLE" 209><COL 210WIDTH="25%" 211TITLE="C1"><COL 212WIDTH="25%" 213TITLE="C2"><COL 214WIDTH="50%" 215TITLE="C3"><TBODY 216VALIGN="TOP" 217><TR 218><TD 219>__u32</TD 220><TD 221><CODE 222CLASS="STRUCTFIELD" 223>index</CODE 224></TD 225><TD 226>Number of the format in the enumeration, set by 227the application. This is in no way related to the <CODE 228CLASS="STRUCTFIELD" 229>pixelformat</CODE 230> field.</TD 231></TR 232><TR 233><TD 234>enum <A 235HREF="x5953.htm#V4L2-BUF-TYPE" 236>v4l2_buf_type</A 237></TD 238><TD 239><CODE 240CLASS="STRUCTFIELD" 241>type</CODE 242></TD 243><TD 244>Type of the data stream, set by the application. 245Only these types are valid here: 246<CODE 247CLASS="CONSTANT" 248>V4L2_BUF_TYPE_VIDEO_CAPTURE</CODE 249>, 250<CODE 251CLASS="CONSTANT" 252>V4L2_BUF_TYPE_VIDEO_OUTPUT</CODE 253>, 254<CODE 255CLASS="CONSTANT" 256>V4L2_BUF_TYPE_VIDEO_OVERLAY</CODE 257>, and custom (driver 258defined) types with code <CODE 259CLASS="CONSTANT" 260>V4L2_BUF_TYPE_PRIVATE</CODE 261> 262and higher.</TD 263></TR 264><TR 265><TD 266>__u32</TD 267><TD 268><CODE 269CLASS="STRUCTFIELD" 270>flags</CODE 271></TD 272><TD 273>See <A 274HREF="r8367.htm#FMTDESC-FLAGS" 275>Table 2</A 276></TD 277></TR 278><TR 279><TD 280>__u8</TD 281><TD 282><CODE 283CLASS="STRUCTFIELD" 284>description</CODE 285>[32]</TD 286><TD 287>Description of the format, a NUL-terminated ASCII 288string. This information is intended for the user, for example: "YUV 2894:2:2".</TD 290></TR 291><TR 292><TD 293>__u32</TD 294><TD 295><CODE 296CLASS="STRUCTFIELD" 297>pixelformat</CODE 298></TD 299><TD 300>The image format identifier. This is a 301four character code as computed by the v4l2_fourcc() 302macro:</TD 303></TR 304><TR 305><TD 306COLSPAN="3" 307><P 308><PRE 309CLASS="PROGRAMLISTING" 310>#define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))</PRE 311></P 312><P 313>Several image formats are already 314defined by this specification in <A 315HREF="c2030.htm" 316>Chapter 2</A 317>. Note these 318codes are not the same as those used in the Windows world.</P 319></TD 320></TR 321><TR 322><TD 323>__u32</TD 324><TD 325><CODE 326CLASS="STRUCTFIELD" 327>reserved</CODE 328>[4]</TD 329><TD 330>Reserved for future extensions. Drivers must set 331the array to zero.</TD 332></TR 333></TBODY 334></TABLE 335></DIV 336><DIV 337CLASS="TABLE" 338><A 339NAME="FMTDESC-FLAGS" 340></A 341><P 342><B 343>Table 2. Image Format Description Flags</B 344></P 345><TABLE 346BORDER="0" 347FRAME="void" 348WIDTH="100%" 349CLASS="CALSTABLE" 350><COL 351WIDTH="38%" 352TITLE="C1"><COL 353WIDTH="12%" 354TITLE="C2"><COL 355WIDTH="50%" 356TITLE="C3"><TBODY 357VALIGN="TOP" 358><TR 359><TD 360><CODE 361CLASS="CONSTANT" 362>V4L2_FMT_FLAG_COMPRESSED</CODE 363></TD 364><TD 365>0x0001</TD 366><TD 367>This is a compressed format.</TD 368></TR 369></TBODY 370></TABLE 371></DIV 372></DIV 373><DIV 374CLASS="REFSECT1" 375><A 376NAME="AEN8479" 377></A 378><H2 379>Return Value</H2 380><P 381>On success <SPAN 382CLASS="RETURNVALUE" 383>0</SPAN 384> is returned, on error <SPAN 385CLASS="RETURNVALUE" 386>-1</SPAN 387> and the <CODE 388CLASS="VARNAME" 389>errno</CODE 390> variable is set appropriately:</P 391><P 392></P 393><DIV 394CLASS="VARIABLELIST" 395><DL 396><DT 397><SPAN 398CLASS="ERRORCODE" 399>EINVAL</SPAN 400></DT 401><DD 402><P 403>The struct <A 404HREF="r8367.htm#V4L2-FMTDESC" 405>v4l2_fmtdesc</A 406> <CODE 407CLASS="STRUCTFIELD" 408>type</CODE 409> 410is not supported or the <CODE 411CLASS="STRUCTFIELD" 412>index</CODE 413> is out of 414bounds.</P 415></DD 416></DL 417></DIV 418></DIV 419><DIV 420CLASS="NAVFOOTER" 421><HR 422ALIGN="LEFT" 423WIDTH="100%"><TABLE 424SUMMARY="Footer navigation table" 425WIDTH="100%" 426BORDER="0" 427CELLPADDING="0" 428CELLSPACING="0" 429><TR 430><TD 431WIDTH="33%" 432ALIGN="left" 433VALIGN="top" 434><A 435HREF="r8304.htm" 436ACCESSKEY="P" 437>Prev</A 438></TD 439><TD 440WIDTH="34%" 441ALIGN="center" 442VALIGN="top" 443><A 444HREF="book1.htm" 445ACCESSKEY="H" 446>Home</A 447></TD 448><TD 449WIDTH="33%" 450ALIGN="right" 451VALIGN="top" 452><A 453HREF="r8494.htm" 454ACCESSKEY="N" 455>Next</A 456></TD 457></TR 458><TR 459><TD 460WIDTH="33%" 461ALIGN="left" 462VALIGN="top" 463>ioctl VIDIOC_ENUMAUDOUT</TD 464><TD 465WIDTH="34%" 466ALIGN="center" 467VALIGN="top" 468><A 469HREF="r7624.htm" 470ACCESSKEY="U" 471>Up</A 472></TD 473><TD 474WIDTH="33%" 475ALIGN="right" 476VALIGN="top" 477>ioctl VIDIOC_ENUM_FRAMESIZES</TD 478></TR 479></TABLE 480></DIV 481></BODY 482></HTML 483> 484