vidioc-subdev-g-crop.xml 5.6 KB

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