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_FRAMESIZES</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_ENUM_FMT" 17HREF="r8367.htm"><LINK 18REL="NEXT" 19TITLE="ioctl VIDIOC_ENUM_FRAMEINTERVALS" 20HREF="r8724.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="r8367.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="r8724.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-FRAMESIZES" 74></A 75>ioctl VIDIOC_ENUM_FRAMESIZES</H1 76><DIV 77CLASS="REFNAMEDIV" 78><A 79NAME="AEN8498" 80></A 81><H2 82>Name</H2 83>VIDIOC_ENUM_FRAMESIZES -- Enumerate frame sizes</DIV 84><DIV 85CLASS="REFSYNOPSISDIV" 86><A 87NAME="AEN8501" 88></A 89><H2 90>Synopsis</H2 91><DIV 92CLASS="FUNCSYNOPSIS" 93><P 94></P 95><A 96NAME="AEN8502" 97></A 98><P 99><CODE 100><CODE 101CLASS="FUNCDEF" 102>int ioctl</CODE 103>(int fd, int request, struct v4l2_frmsizeenum *argp);</CODE 104></P 105><P 106></P 107></DIV 108></DIV 109><DIV 110CLASS="REFSECT1" 111><A 112NAME="AEN8512" 113></A 114><H2 115>Arguments</H2 116><P 117></P 118><DIV 119CLASS="VARIABLELIST" 120><DL 121><DT 122><CODE 123CLASS="PARAMETER" 124>fd</CODE 125></DT 126><DD 127><P 128>File descriptor returned by <A 129HREF="r14090.htm" 130><CODE 131CLASS="FUNCTION" 132>open()</CODE 133></A 134>.</P 135></DD 136><DT 137><CODE 138CLASS="PARAMETER" 139>request</CODE 140></DT 141><DD 142><P 143>VIDIOC_ENUM_FRAMESIZES</P 144></DD 145><DT 146><CODE 147CLASS="PARAMETER" 148>argp</CODE 149></DT 150><DD 151><P 152>Pointer to a struct <A 153HREF="r8494.htm#V4L2-FRMSIZEENUM" 154>v4l2_frmsizeenum</A 155> that contains an index 156and pixel format and receives a frame width and height.</P 157></DD 158></DL 159></DIV 160></DIV 161><DIV 162CLASS="REFSECT1" 163><A 164NAME="AEN8533" 165></A 166><H2 167>Description</H2 168><DIV 169CLASS="NOTE" 170><BLOCKQUOTE 171CLASS="NOTE" 172><P 173><B 174>Experimental: </B 175>This is an <A 176HREF="x16453.htm" 177>experimental</A 178> 179interface and may change in the future.</P 180></BLOCKQUOTE 181></DIV 182><P 183>This ioctl allows applications to enumerate all frame sizes 184(i. e. width and height in pixels) that the device supports for the 185given pixel format.</P 186><P 187>The supported pixel formats can be obtained by using the 188<A 189HREF="r8367.htm" 190><CODE 191CLASS="CONSTANT" 192>VIDIOC_ENUM_FMT</CODE 193></A 194> function.</P 195><P 196>The return value and the content of the 197<CODE 198CLASS="STRUCTFIELD" 199>v4l2_frmsizeenum.type</CODE 200> field depend on the 201type of frame sizes the device supports. Here are the semantics of the 202function for the different cases:</P 203><P 204></P 205><UL 206><LI 207><P 208><SPAN 209CLASS="bold" 210><B 211CLASS="EMPHASIS" 212>Discrete:</B 213></SPAN 214> The function 215returns success if the given index value (zero-based) is valid. The 216application should increase the index by one for each call until 217<CODE 218CLASS="CONSTANT" 219>EINVAL</CODE 220> is returned. The 221<CODE 222CLASS="STRUCTFIELD" 223>v4l2_frmsizeenum.type</CODE 224> field is set to 225<CODE 226CLASS="CONSTANT" 227>V4L2_FRMSIZE_TYPE_DISCRETE</CODE 228> by the driver. Of the 229union only the <CODE 230CLASS="STRUCTFIELD" 231>discrete</CODE 232> member is 233valid.</P 234></LI 235><LI 236><P 237><SPAN 238CLASS="bold" 239><B 240CLASS="EMPHASIS" 241>Step-wise:</B 242></SPAN 243> The function 244returns success if the given index value is zero and 245<CODE 246CLASS="CONSTANT" 247>EINVAL</CODE 248> for any other index value. The 249<CODE 250CLASS="STRUCTFIELD" 251>v4l2_frmsizeenum.type</CODE 252> field is set to 253<CODE 254CLASS="CONSTANT" 255>V4L2_FRMSIZE_TYPE_STEPWISE</CODE 256> by the driver. Of the 257union only the <CODE 258CLASS="STRUCTFIELD" 259>stepwise</CODE 260> member is 261valid.</P 262></LI 263><LI 264><P 265><SPAN 266CLASS="bold" 267><B 268CLASS="EMPHASIS" 269>Continuous:</B 270></SPAN 271> This is a 272special case of the step-wise type above. The function returns success 273if the given index value is zero and <CODE 274CLASS="CONSTANT" 275>EINVAL</CODE 276> for 277any other index value. The 278<CODE 279CLASS="STRUCTFIELD" 280>v4l2_frmsizeenum.type</CODE 281> field is set to 282<CODE 283CLASS="CONSTANT" 284>V4L2_FRMSIZE_TYPE_CONTINUOUS</CODE 285> by the driver. Of 286the union only the <CODE 287CLASS="STRUCTFIELD" 288>stepwise</CODE 289> member is valid 290and the <CODE 291CLASS="STRUCTFIELD" 292>step_width</CODE 293> and 294<CODE 295CLASS="STRUCTFIELD" 296>step_height</CODE 297> values are set to 1.</P 298></LI 299></UL 300><P 301>When the application calls the function with index zero, it 302must check the <CODE 303CLASS="STRUCTFIELD" 304>type</CODE 305> field to determine the 306type of frame size enumeration the device supports. Only for the 307<CODE 308CLASS="CONSTANT" 309>V4L2_FRMSIZE_TYPE_DISCRETE</CODE 310> type does it make 311sense to increase the index value to receive more frame sizes.</P 312><P 313>Note that the order in which the frame sizes are returned 314has no special meaning. In particular does it not say anything about 315potential default format sizes.</P 316><P 317>Applications can assume that the enumeration data does not 318change without any interaction from the application itself. This means 319that the enumeration data is consistent if the application does not 320perform any other ioctl calls while it runs the frame size 321enumeration.</P 322></DIV 323><DIV 324CLASS="REFSECT1" 325><A 326NAME="AEN8574" 327></A 328><H2 329>Structs</H2 330><P 331>In the structs below, <SPAN 332CLASS="emphasis" 333><I 334CLASS="EMPHASIS" 335>IN</I 336></SPAN 337> denotes a 338value that has to be filled in by the application, 339<SPAN 340CLASS="emphasis" 341><I 342CLASS="EMPHASIS" 343>OUT</I 344></SPAN 345> denotes values that the driver fills in. The 346application should zero out all members except for the 347<SPAN 348CLASS="emphasis" 349><I 350CLASS="EMPHASIS" 351>IN</I 352></SPAN 353> fields.</P 354><DIV 355CLASS="TABLE" 356><A 357NAME="V4L2-FRMSIZE-DISCRETE" 358></A 359><P 360><B 361>Table 1. struct <CODE 362CLASS="STRUCTNAME" 363>v4l2_frmsize_discrete</CODE 364></B 365></P 366><TABLE 367BORDER="0" 368FRAME="void" 369WIDTH="100%" 370CLASS="CALSTABLE" 371><COL 372WIDTH="25%" 373TITLE="C1"><COL 374WIDTH="25%" 375TITLE="C2"><COL 376WIDTH="50%" 377TITLE="C3"><TBODY 378VALIGN="TOP" 379><TR 380><TD 381>__u32</TD 382><TD 383><CODE 384CLASS="STRUCTFIELD" 385>width</CODE 386></TD 387><TD 388>Width of the frame [pixel].</TD 389></TR 390><TR 391><TD 392>__u32</TD 393><TD 394><CODE 395CLASS="STRUCTFIELD" 396>height</CODE 397></TD 398><TD 399>Height of the frame [pixel].</TD 400></TR 401></TBODY 402></TABLE 403></DIV 404><DIV 405CLASS="TABLE" 406><A 407NAME="V4L2-FRMSIZE-STEPWISE" 408></A 409><P 410><B 411>Table 2. struct <CODE 412CLASS="STRUCTNAME" 413>v4l2_frmsize_stepwise</CODE 414></B 415></P 416><TABLE 417BORDER="0" 418FRAME="void" 419WIDTH="100%" 420CLASS="CALSTABLE" 421><COL 422WIDTH="25%" 423TITLE="C1"><COL 424WIDTH="25%" 425TITLE="C2"><COL 426WIDTH="50%" 427TITLE="C3"><TBODY 428VALIGN="TOP" 429><TR 430><TD 431>__u32</TD 432><TD 433><CODE 434CLASS="STRUCTFIELD" 435>min_width</CODE 436></TD 437><TD 438>Minimum frame width [pixel].</TD 439></TR 440><TR 441><TD 442>__u32</TD 443><TD 444><CODE 445CLASS="STRUCTFIELD" 446>max_width</CODE 447></TD 448><TD 449>Maximum frame width [pixel].</TD 450></TR 451><TR 452><TD 453>__u32</TD 454><TD 455><CODE 456CLASS="STRUCTFIELD" 457>step_width</CODE 458></TD 459><TD 460>Frame width step size [pixel].</TD 461></TR 462><TR 463><TD 464>__u32</TD 465><TD 466><CODE 467CLASS="STRUCTFIELD" 468>min_height</CODE 469></TD 470><TD 471>Minimum frame height [pixel].</TD 472></TR 473><TR 474><TD 475>__u32</TD 476><TD 477><CODE 478CLASS="STRUCTFIELD" 479>max_height</CODE 480></TD 481><TD 482>Maximum frame height [pixel].</TD 483></TR 484><TR 485><TD 486>__u32</TD 487><TD 488><CODE 489CLASS="STRUCTFIELD" 490>step_height</CODE 491></TD 492><TD 493>Frame height step size [pixel].</TD 494></TR 495></TBODY 496></TABLE 497></DIV 498><DIV 499CLASS="TABLE" 500><A 501NAME="V4L2-FRMSIZEENUM" 502></A 503><P 504><B 505>Table 3. struct <CODE 506CLASS="STRUCTNAME" 507>v4l2_frmsizeenum</CODE 508></B 509></P 510><TABLE 511BORDER="0" 512FRAME="void" 513WIDTH="100%" 514CLASS="CALSTABLE" 515><COL 516WIDTH="25%" 517TITLE="C1"><COL 518WIDTH="25%" 519TITLE="C2"><COL 520WIDTH="25%" 521TITLE="C3"><COL 522WIDTH="25%" 523TITLE="C4"><TBODY 524VALIGN="TOP" 525><TR 526><TD 527>__u32</TD 528><TD 529><CODE 530CLASS="STRUCTFIELD" 531>index</CODE 532></TD 533><TD 534> </TD 535><TD 536>IN: Index of the given frame size in the enumeration.</TD 537></TR 538><TR 539><TD 540>__u32</TD 541><TD 542><CODE 543CLASS="STRUCTFIELD" 544>pixel_format</CODE 545></TD 546><TD 547> </TD 548><TD 549>IN: Pixel format for which the frame sizes are enumerated.</TD 550></TR 551><TR 552><TD 553>__u32</TD 554><TD 555><CODE 556CLASS="STRUCTFIELD" 557>type</CODE 558></TD 559><TD 560> </TD 561><TD 562>OUT: Frame size type the device supports.</TD 563></TR 564><TR 565><TD 566>union</TD 567><TD 568> </TD 569><TD 570> </TD 571><TD 572>OUT: Frame size with the given index.</TD 573></TR 574><TR 575><TD 576> </TD 577><TD 578>struct <A 579HREF="r8494.htm#V4L2-FRMSIZE-DISCRETE" 580>v4l2_frmsize_discrete</A 581></TD 582><TD 583><CODE 584CLASS="STRUCTFIELD" 585>discrete</CODE 586></TD 587><TD 588> </TD 589></TR 590><TR 591><TD 592> </TD 593><TD 594>struct <A 595HREF="r8494.htm#V4L2-FRMSIZE-STEPWISE" 596>v4l2_frmsize_stepwise</A 597></TD 598><TD 599><CODE 600CLASS="STRUCTFIELD" 601>stepwise</CODE 602></TD 603><TD 604> </TD 605></TR 606><TR 607><TD 608>__u32</TD 609><TD 610><CODE 611CLASS="STRUCTFIELD" 612>reserved[2]</CODE 613></TD 614><TD 615> </TD 616><TD 617>Reserved space for future use.</TD 618></TR 619></TBODY 620></TABLE 621></DIV 622></DIV 623><DIV 624CLASS="REFSECT1" 625><A 626NAME="AEN8690" 627></A 628><H2 629>Enums</H2 630><DIV 631CLASS="TABLE" 632><A 633NAME="V4L2-FRMSIZETYPES" 634></A 635><P 636><B 637>Table 4. enum <CODE 638CLASS="STRUCTNAME" 639>v4l2_frmsizetypes</CODE 640></B 641></P 642><TABLE 643BORDER="0" 644FRAME="void" 645WIDTH="100%" 646CLASS="CALSTABLE" 647><COL 648WIDTH="38%" 649TITLE="C1"><COL 650WIDTH="12%" 651TITLE="C2"><COL 652WIDTH="50%" 653TITLE="C3"><TBODY 654VALIGN="TOP" 655><TR 656><TD 657><CODE 658CLASS="CONSTANT" 659>V4L2_FRMSIZE_TYPE_DISCRETE</CODE 660></TD 661><TD 662>1</TD 663><TD 664>Discrete frame size.</TD 665></TR 666><TR 667><TD 668><CODE 669CLASS="CONSTANT" 670>V4L2_FRMSIZE_TYPE_CONTINUOUS</CODE 671></TD 672><TD 673>2</TD 674><TD 675>Continuous frame size.</TD 676></TR 677><TR 678><TD 679><CODE 680CLASS="CONSTANT" 681>V4L2_FRMSIZE_TYPE_STEPWISE</CODE 682></TD 683><TD 684>3</TD 685><TD 686>Step-wise defined frame size.</TD 687></TR 688></TBODY 689></TABLE 690></DIV 691></DIV 692><DIV 693CLASS="REFSECT1" 694><A 695NAME="AEN8716" 696></A 697><H2 698>Return Value</H2 699><P 700>On success <SPAN 701CLASS="RETURNVALUE" 702>0</SPAN 703> is returned, on error <SPAN 704CLASS="RETURNVALUE" 705>-1</SPAN 706> and the <CODE 707CLASS="VARNAME" 708>errno</CODE 709> variable is set appropriately:</P 710><P 711>See the description section above for a list of return 712values that <CODE 713CLASS="VARNAME" 714>errno</CODE 715> can have.</P 716></DIV 717><DIV 718CLASS="NAVFOOTER" 719><HR 720ALIGN="LEFT" 721WIDTH="100%"><TABLE 722SUMMARY="Footer navigation table" 723WIDTH="100%" 724BORDER="0" 725CELLPADDING="0" 726CELLSPACING="0" 727><TR 728><TD 729WIDTH="33%" 730ALIGN="left" 731VALIGN="top" 732><A 733HREF="r8367.htm" 734ACCESSKEY="P" 735>Prev</A 736></TD 737><TD 738WIDTH="34%" 739ALIGN="center" 740VALIGN="top" 741><A 742HREF="book1.htm" 743ACCESSKEY="H" 744>Home</A 745></TD 746><TD 747WIDTH="33%" 748ALIGN="right" 749VALIGN="top" 750><A 751HREF="r8724.htm" 752ACCESSKEY="N" 753>Next</A 754></TD 755></TR 756><TR 757><TD 758WIDTH="33%" 759ALIGN="left" 760VALIGN="top" 761>ioctl VIDIOC_ENUM_FMT</TD 762><TD 763WIDTH="34%" 764ALIGN="center" 765VALIGN="top" 766><A 767HREF="r7624.htm" 768ACCESSKEY="U" 769>Up</A 770></TD 771><TD 772WIDTH="33%" 773ALIGN="right" 774VALIGN="top" 775>ioctl VIDIOC_ENUM_FRAMEINTERVALS</TD 776></TR 777></TABLE 778></DIV 779></BODY 780></HTML 781> 782