/Documentation/DocBook/v4l/vidioc-g-crop.xml

https://bitbucket.org/abioy/linux · XML · 143 lines · 121 code · 15 blank · 7 comment · 0 complexity · 1f61342b9ef3cad61c49ee647b1c5855 MD5 · raw file

  1. <refentry id="vidioc-g-crop">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_G_CROP, VIDIOC_S_CROP</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_G_CROP</refname>
  8. <refname>VIDIOC_S_CROP</refname>
  9. <refpurpose>Get or set the current cropping rectangle</refpurpose>
  10. </refnamediv>
  11. <refsynopsisdiv>
  12. <funcsynopsis>
  13. <funcprototype>
  14. <funcdef>int <function>ioctl</function></funcdef>
  15. <paramdef>int <parameter>fd</parameter></paramdef>
  16. <paramdef>int <parameter>request</parameter></paramdef>
  17. <paramdef>struct v4l2_crop *<parameter>argp</parameter></paramdef>
  18. </funcprototype>
  19. </funcsynopsis>
  20. <funcsynopsis>
  21. <funcprototype>
  22. <funcdef>int <function>ioctl</function></funcdef>
  23. <paramdef>int <parameter>fd</parameter></paramdef>
  24. <paramdef>int <parameter>request</parameter></paramdef>
  25. <paramdef>const struct v4l2_crop *<parameter>argp</parameter></paramdef>
  26. </funcprototype>
  27. </funcsynopsis>
  28. </refsynopsisdiv>
  29. <refsect1>
  30. <title>Arguments</title>
  31. <variablelist>
  32. <varlistentry>
  33. <term><parameter>fd</parameter></term>
  34. <listitem>
  35. <para>&fd;</para>
  36. </listitem>
  37. </varlistentry>
  38. <varlistentry>
  39. <term><parameter>request</parameter></term>
  40. <listitem>
  41. <para>VIDIOC_G_CROP, VIDIOC_S_CROP</para>
  42. </listitem>
  43. </varlistentry>
  44. <varlistentry>
  45. <term><parameter>argp</parameter></term>
  46. <listitem>
  47. <para></para>
  48. </listitem>
  49. </varlistentry>
  50. </variablelist>
  51. </refsect1>
  52. <refsect1>
  53. <title>Description</title>
  54. <para>To query the cropping rectangle size and position
  55. applications set the <structfield>type</structfield> field of a
  56. <structname>v4l2_crop</structname> structure to the respective buffer
  57. (stream) type and call the <constant>VIDIOC_G_CROP</constant> ioctl
  58. with a pointer to this structure. The driver fills the rest of the
  59. structure or returns the &EINVAL; if cropping is not supported.</para>
  60. <para>To change the cropping rectangle applications initialize the
  61. <structfield>type</structfield> and &v4l2-rect; substructure named
  62. <structfield>c</structfield> of a v4l2_crop structure and call the
  63. <constant>VIDIOC_S_CROP</constant> ioctl with a pointer to this
  64. structure.</para>
  65. <para>The driver first adjusts the requested dimensions against
  66. hardware limits, &ie; the bounds given by the capture/output window,
  67. and it rounds to the closest possible values of horizontal and
  68. vertical offset, width and height. In particular the driver must round
  69. the vertical offset of the cropping rectangle to frame lines modulo
  70. two, such that the field order cannot be confused.</para>
  71. <para>Second the driver adjusts the image size (the opposite
  72. rectangle of the scaling process, source or target depending on the
  73. data direction) to the closest size possible while maintaining the
  74. current horizontal and vertical scaling factor.</para>
  75. <para>Finally the driver programs the hardware with the actual
  76. cropping and image parameters. <constant>VIDIOC_S_CROP</constant> is a
  77. write-only ioctl, it does not return the actual parameters. To query
  78. them applications must call <constant>VIDIOC_G_CROP</constant> and
  79. &VIDIOC-G-FMT;. When the parameters are unsuitable the application may
  80. modify the cropping or image parameters and repeat the cycle until
  81. satisfactory parameters have been negotiated.</para>
  82. <para>When cropping is not supported then no parameters are
  83. changed and <constant>VIDIOC_S_CROP</constant> returns the
  84. &EINVAL;.</para>
  85. <table pgwide="1" frame="none" id="v4l2-crop">
  86. <title>struct <structname>v4l2_crop</structname></title>
  87. <tgroup cols="3">
  88. &cs-str;
  89. <tbody valign="top">
  90. <row>
  91. <entry>&v4l2-buf-type;</entry>
  92. <entry><structfield>type</structfield></entry>
  93. <entry>Type of the data stream, set by the application.
  94. Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
  95. <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
  96. <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
  97. defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
  98. and higher.</entry>
  99. </row>
  100. <row>
  101. <entry>&v4l2-rect;</entry>
  102. <entry><structfield>c</structfield></entry>
  103. <entry>Cropping rectangle. The same co-ordinate system as
  104. for &v4l2-cropcap; <structfield>bounds</structfield> is used.</entry>
  105. </row>
  106. </tbody>
  107. </tgroup>
  108. </table>
  109. </refsect1>
  110. <refsect1>
  111. &return-value;
  112. <variablelist>
  113. <varlistentry>
  114. <term><errorcode>EINVAL</errorcode></term>
  115. <listitem>
  116. <para>Cropping is not supported.</para>
  117. </listitem>
  118. </varlistentry>
  119. </variablelist>
  120. </refsect1>
  121. </refentry>
  122. <!--
  123. Local Variables:
  124. mode: sgml
  125. sgml-parent-document: "v4l2.sgml"
  126. indent-tabs-mode: nil
  127. End:
  128. -->