vidioc-subdev-g-crop.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <refentry id="vidioc-subdev-g-crop">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_SUBDEV_G_CROP</refname>
  8. <refname>VIDIOC_SUBDEV_S_CROP</refname>
  9. <refpurpose>Get or set the crop rectangle on a subdev pad</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_subdev_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_subdev_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_SUBDEV_G_CROP, VIDIOC_SUBDEV_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. <note>
  55. <title>Experimental</title>
  56. <para>This is an <link linkend="experimental">experimental</link>
  57. interface and may change in the future.</para>
  58. </note>
  59. <para>To retrieve the current crop rectangle applications set the
  60. <structfield>pad</structfield> field of a &v4l2-subdev-crop; to the
  61. desired pad number as reported by the media API and the
  62. <structfield>which</structfield> field to
  63. <constant>V4L2_SUBDEV_FORMAT_ACTIVE</constant>. They then call the
  64. <constant>VIDIOC_SUBDEV_G_CROP</constant> ioctl with a pointer to this
  65. structure. The driver fills the members of the <structfield>rect</structfield>
  66. field or returns &EINVAL; if the input arguments are invalid, or if cropping
  67. is not supported on the given pad.</para>
  68. <para>To change the current crop rectangle applications set both the
  69. <structfield>pad</structfield> and <structfield>which</structfield> fields
  70. and all members of the <structfield>rect</structfield> field. They then call
  71. the <constant>VIDIOC_SUBDEV_S_CROP</constant> ioctl with a pointer to this
  72. structure. The driver verifies the requested crop rectangle, adjusts it
  73. based on the hardware capabilities and configures the device. Upon return
  74. the &v4l2-subdev-crop; contains the current format as would be returned
  75. by a <constant>VIDIOC_SUBDEV_G_CROP</constant> call.</para>
  76. <para>Applications can query the device capabilities by setting the
  77. <structfield>which</structfield> to
  78. <constant>V4L2_SUBDEV_FORMAT_TRY</constant>. When set, 'try' crop
  79. rectangles are not applied to the device by the driver, but are mangled
  80. exactly as active crop rectangles and stored in the sub-device file handle.
  81. Two applications querying the same sub-device would thus not interact with
  82. each other.</para>
  83. <para>Drivers must not return an error solely because the requested crop
  84. rectangle doesn't match the device capabilities. They must instead modify
  85. the rectangle to match what the hardware can provide. The modified format
  86. should be as close as possible to the original request.</para>
  87. <table pgwide="1" frame="none" id="v4l2-subdev-crop">
  88. <title>struct <structname>v4l2_subdev_crop</structname></title>
  89. <tgroup cols="3">
  90. &cs-str;
  91. <tbody valign="top">
  92. <row>
  93. <entry>__u32</entry>
  94. <entry><structfield>pad</structfield></entry>
  95. <entry>Pad number as reported by the media framework.</entry>
  96. </row>
  97. <row>
  98. <entry>__u32</entry>
  99. <entry><structfield>which</structfield></entry>
  100. <entry>Crop rectangle to get or set, from
  101. &v4l2-subdev-format-whence;.</entry>
  102. </row>
  103. <row>
  104. <entry>&v4l2-rect;</entry>
  105. <entry><structfield>rect</structfield></entry>
  106. <entry>Crop rectangle boundaries, in pixels.</entry>
  107. </row>
  108. <row>
  109. <entry>__u32</entry>
  110. <entry><structfield>reserved</structfield>[8]</entry>
  111. <entry>Reserved for future extensions. Applications and drivers must
  112. set the array to zero.</entry>
  113. </row>
  114. </tbody>
  115. </tgroup>
  116. </table>
  117. </refsect1>
  118. <refsect1>
  119. &return-value;
  120. <variablelist>
  121. <varlistentry>
  122. <term><errorcode>EBUSY</errorcode></term>
  123. <listitem>
  124. <para>The crop rectangle can't be changed because the pad is currently
  125. busy. This can be caused, for instance, by an active video stream on
  126. the pad. The ioctl must not be retried without performing another
  127. action to fix the problem first. Only returned by
  128. <constant>VIDIOC_SUBDEV_S_CROP</constant></para>
  129. </listitem>
  130. </varlistentry>
  131. <varlistentry>
  132. <term><errorcode>EINVAL</errorcode></term>
  133. <listitem>
  134. <para>The &v4l2-subdev-crop; <structfield>pad</structfield>
  135. references a non-existing pad, the <structfield>which</structfield>
  136. field references a non-existing format, or cropping is not supported
  137. on the given subdev pad.</para>
  138. </listitem>
  139. </varlistentry>
  140. </variablelist>
  141. </refsect1>
  142. </refentry>