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_CROPCAP</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="V4L2 ioctl()" 17HREF="r7667.htm"><LINK 18REL="NEXT" 19TITLE="ioctl VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER" 20HREF="r7900.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="r7667.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="r7900.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-CROPCAP" 74></A 75>ioctl VIDIOC_CROPCAP</H1 76><DIV 77CLASS="REFNAMEDIV" 78><A 79NAME="AEN7775" 80></A 81><H2 82>Name</H2 83>VIDIOC_CROPCAP -- Information about the video cropping and scaling abilities</DIV 84><DIV 85CLASS="REFSYNOPSISDIV" 86><A 87NAME="AEN7778" 88></A 89><H2 90>Synopsis</H2 91><DIV 92CLASS="FUNCSYNOPSIS" 93><P 94></P 95><A 96NAME="AEN7779" 97></A 98><P 99><CODE 100><CODE 101CLASS="FUNCDEF" 102>int ioctl</CODE 103>(int fd, int request, struct v4l2_cropcap 104*argp);</CODE 105></P 106><P 107></P 108></DIV 109></DIV 110><DIV 111CLASS="REFSECT1" 112><A 113NAME="AEN7789" 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_CROPCAP</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="AEN7809" 162></A 163><H2 164>Description</H2 165><P 166>Applications use this function to query the cropping 167limits, the pixel aspect of images and to calculate scale factors. 168They set the <CODE 169CLASS="STRUCTFIELD" 170>type</CODE 171> field of a v4l2_cropcap 172structure to the respective buffer (stream) type and call the 173<CODE 174CLASS="CONSTANT" 175>VIDIOC_CROPCAP</CODE 176> ioctl with a pointer to this 177structure. Drivers fill the rest of the structure. The results are 178constant except when switching the video standard. Remember this 179switch can occur implicit when switching the video input or 180output.</P 181><DIV 182CLASS="TABLE" 183><A 184NAME="V4L2-CROPCAP" 185></A 186><P 187><B 188>Table 1. struct <CODE 189CLASS="STRUCTNAME" 190>v4l2_cropcap</CODE 191></B 192></P 193><TABLE 194BORDER="0" 195FRAME="void" 196WIDTH="100%" 197CLASS="CALSTABLE" 198><COL 199WIDTH="25%" 200TITLE="C1"><COL 201WIDTH="25%" 202TITLE="C2"><COL 203WIDTH="50%" 204TITLE="C3"><TBODY 205VALIGN="TOP" 206><TR 207><TD 208>enum <A 209HREF="x5953.htm#V4L2-BUF-TYPE" 210>v4l2_buf_type</A 211></TD 212><TD 213><CODE 214CLASS="STRUCTFIELD" 215>type</CODE 216></TD 217><TD 218>Type of the data stream, set by the application. 219Only these types are valid here: 220<CODE 221CLASS="CONSTANT" 222>V4L2_BUF_TYPE_VIDEO_CAPTURE</CODE 223>, 224<CODE 225CLASS="CONSTANT" 226>V4L2_BUF_TYPE_VIDEO_OUTPUT</CODE 227>, 228<CODE 229CLASS="CONSTANT" 230>V4L2_BUF_TYPE_VIDEO_OVERLAY</CODE 231>, and custom (driver 232defined) types with code <CODE 233CLASS="CONSTANT" 234>V4L2_BUF_TYPE_PRIVATE</CODE 235> 236and higher.</TD 237></TR 238><TR 239><TD 240>struct <A 241HREF="r7771.htm#V4L2-RECT-CROP" 242>v4l2_rect</A 243></TD 244><TD 245><CODE 246CLASS="STRUCTFIELD" 247>bounds</CODE 248></TD 249><TD 250>Defines the window within capturing or output is 251possible, this may exclude for example the horizontal and vertical 252blanking areas. The cropping rectangle cannot exceed these limits. 253Width and height are defined in pixels, the driver writer is free to 254choose origin and units of the coordinate system in the analog 255domain.</TD 256></TR 257><TR 258><TD 259>struct <A 260HREF="r7771.htm#V4L2-RECT-CROP" 261>v4l2_rect</A 262></TD 263><TD 264><CODE 265CLASS="STRUCTFIELD" 266>defrect</CODE 267></TD 268><TD 269>Default cropping rectangle, it shall cover the 270"whole picture". Assuming pixel aspect 1/1 this could be for example a 271640 × 480 rectangle for NTSC, a 272768 × 576 rectangle for PAL and SECAM centered over 273the active picture area. The same co-ordinate system as for 274 <CODE 275CLASS="STRUCTFIELD" 276>bounds</CODE 277> is used.</TD 278></TR 279><TR 280><TD 281>struct <A 282HREF="r9288.htm#V4L2-FRACT" 283>v4l2_fract</A 284></TD 285><TD 286><CODE 287CLASS="STRUCTFIELD" 288>pixelaspect</CODE 289></TD 290><TD 291><P 292>This is the pixel aspect (y / x) when no 293scaling is applied, the ratio of the actual sampling 294frequency and the frequency required to get square 295pixels.</P 296><P 297>When cropping coordinates refer to square pixels, 298the driver sets <CODE 299CLASS="STRUCTFIELD" 300>pixelaspect</CODE 301> to 1/1. Other 302common values are 54/59 for PAL and SECAM, 11/10 for NTSC sampled 303according to [<A 304HREF="b17127.htm#ITU601" 305><ABBR 306CLASS="ABBREV" 307>ITU BT.601</ABBR 308></A 309>].</P 310></TD 311></TR 312></TBODY 313></TABLE 314></DIV 315><DIV 316CLASS="TABLE" 317><A 318NAME="V4L2-RECT-CROP" 319></A 320><P 321><B 322>Table 2. struct <CODE 323CLASS="STRUCTNAME" 324>v4l2_rect</CODE 325></B 326></P 327><TABLE 328BORDER="0" 329FRAME="void" 330WIDTH="100%" 331CLASS="CALSTABLE" 332><COL 333WIDTH="25%" 334TITLE="C1"><COL 335WIDTH="25%" 336TITLE="C2"><COL 337WIDTH="50%" 338TITLE="C3"><TBODY 339VALIGN="TOP" 340><TR 341><TD 342>__s32</TD 343><TD 344><CODE 345CLASS="STRUCTFIELD" 346>left</CODE 347></TD 348><TD 349>Horizontal offset of the top, left corner of the 350rectangle, in pixels.</TD 351></TR 352><TR 353><TD 354>__s32</TD 355><TD 356><CODE 357CLASS="STRUCTFIELD" 358>top</CODE 359></TD 360><TD 361>Vertical offset of the top, left corner of the 362rectangle, in pixels.</TD 363></TR 364><TR 365><TD 366>__s32</TD 367><TD 368><CODE 369CLASS="STRUCTFIELD" 370>width</CODE 371></TD 372><TD 373>Width of the rectangle, in pixels.</TD 374></TR 375><TR 376><TD 377>__s32</TD 378><TD 379><CODE 380CLASS="STRUCTFIELD" 381>height</CODE 382></TD 383><TD 384>Height of the rectangle, in pixels. Width 385and height cannot be negative, the fields are signed for 386hysterical reasons. </TD 387></TR 388></TBODY 389></TABLE 390></DIV 391></DIV 392><DIV 393CLASS="REFSECT1" 394><A 395NAME="AEN7885" 396></A 397><H2 398>Return Value</H2 399><P 400>On success <SPAN 401CLASS="RETURNVALUE" 402>0</SPAN 403> is returned, on error <SPAN 404CLASS="RETURNVALUE" 405>-1</SPAN 406> and the <CODE 407CLASS="VARNAME" 408>errno</CODE 409> variable is set appropriately:</P 410><P 411></P 412><DIV 413CLASS="VARIABLELIST" 414><DL 415><DT 416><SPAN 417CLASS="ERRORCODE" 418>EINVAL</SPAN 419></DT 420><DD 421><P 422>The struct <A 423HREF="r7771.htm#V4L2-CROPCAP" 424>v4l2_cropcap</A 425> <CODE 426CLASS="STRUCTFIELD" 427>type</CODE 428> is 429invalid or the ioctl is not supported. This is not permitted for 430video capture, output and overlay devices, which must support 431<CODE 432CLASS="CONSTANT" 433>VIDIOC_CROPCAP</CODE 434>.</P 435></DD 436></DL 437></DIV 438></DIV 439><DIV 440CLASS="NAVFOOTER" 441><HR 442ALIGN="LEFT" 443WIDTH="100%"><TABLE 444SUMMARY="Footer navigation table" 445WIDTH="100%" 446BORDER="0" 447CELLPADDING="0" 448CELLSPACING="0" 449><TR 450><TD 451WIDTH="33%" 452ALIGN="left" 453VALIGN="top" 454><A 455HREF="r7667.htm" 456ACCESSKEY="P" 457>Prev</A 458></TD 459><TD 460WIDTH="34%" 461ALIGN="center" 462VALIGN="top" 463><A 464HREF="book1.htm" 465ACCESSKEY="H" 466>Home</A 467></TD 468><TD 469WIDTH="33%" 470ALIGN="right" 471VALIGN="top" 472><A 473HREF="r7900.htm" 474ACCESSKEY="N" 475>Next</A 476></TD 477></TR 478><TR 479><TD 480WIDTH="33%" 481ALIGN="left" 482VALIGN="top" 483>V4L2 ioctl()</TD 484><TD 485WIDTH="34%" 486ALIGN="center" 487VALIGN="top" 488><A 489HREF="r7624.htm" 490ACCESSKEY="U" 491>Up</A 492></TD 493><TD 494WIDTH="33%" 495ALIGN="right" 496VALIGN="top" 497>ioctl VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER</TD 498></TR 499></TABLE 500></DIV 501></BODY 502></HTML 503> 504