Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] V4L: Improve the selection API documentation

Make the VIDIOC_G/S_SELECTION ioctls documentation more consistent
with the rest of media Docbook, use capital letters where necessary
and correct few minor errors.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Sylwester Nawrocki and committed by
Mauro Carvalho Chehab
9080d5d3 1d531601

+76 -68
+6 -2
Documentation/DocBook/media/v4l/selection-api.xml
··· 52 52 </textobject> 53 53 </mediaobject> 54 54 </figure> 55 + 56 + For complete list of the available selection targets see table <xref 57 + linkend="v4l2-sel-target"/> 58 + 55 59 </section> 56 60 57 61 <section> ··· 190 186 191 187 <section> 192 188 193 - <title>Scaling control.</title> 189 + <title>Scaling control</title> 194 190 195 191 <para>An application can detect if scaling is performed by comparing the width 196 192 and the height of rectangles obtained using <constant> V4L2_SEL_TGT_CROP_ACTIVE ··· 204 200 205 201 <section> 206 202 207 - <title>Comparison with old cropping API.</title> 203 + <title>Comparison with old cropping API</title> 208 204 209 205 <para>The selection API was introduced to cope with deficiencies of previous 210 206 <link linkend="crop"> API </link>, that was designed to control simple capture
+55 -51
Documentation/DocBook/media/v4l/vidioc-g-selection.xml
··· 58 58 59 59 <para>The ioctls are used to query and configure selection rectangles.</para> 60 60 61 - <para> To query the cropping (composing) rectangle set <structfield> 62 - &v4l2-selection;::type </structfield> to the respective buffer type. Do not 63 - use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE 61 + <para> To query the cropping (composing) rectangle set &v4l2-selection; 62 + <structfield> type </structfield> field to the respective buffer type. 63 + Do not use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE 64 64 </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 65 65 </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of 66 66 <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is 67 - setting <structfield> &v4l2-selection;::target </structfield> to value 68 - <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> 67 + setting the value of &v4l2-selection; <structfield>target</structfield> field 68 + to <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> 69 69 V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref 70 70 linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional 71 - targets. Fields <structfield> &v4l2-selection;::flags </structfield> and 72 - <structfield> &v4l2-selection;::reserved </structfield> are ignored and they 73 - must be filled with zeros. The driver fills the rest of the structure or 71 + targets. The <structfield>flags</structfield> and <structfield>reserved 72 + </structfield> fields of &v4l2-selection; are ignored and they must be filled 73 + with zeros. The driver fills the rest of the structure or 74 74 returns &EINVAL; if incorrect buffer type or target was used. If cropping 75 75 (composing) is not supported then the active rectangle is not mutable and it is 76 - always equal to the bounds rectangle. Finally, structure <structfield> 77 - &v4l2-selection;::r </structfield> is filled with the current cropping 76 + always equal to the bounds rectangle. Finally, the &v4l2-rect; 77 + <structfield>r</structfield> rectangle is filled with the current cropping 78 78 (composing) coordinates. The coordinates are expressed in driver-dependent 79 79 units. The only exception are rectangles for images in raw formats, whose 80 80 coordinates are always expressed in pixels. </para> 81 81 82 - <para> To change the cropping (composing) rectangle set <structfield> 83 - &v4l2-selection;::type </structfield> to the respective buffer type. Do not 82 + <para> To change the cropping (composing) rectangle set the &v4l2-selection; 83 + <structfield>type</structfield> field to the respective buffer type. Do not 84 84 use multiplanar buffers. Use <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE 85 85 </constant> instead of <constant> V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 86 86 </constant>. Use <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT </constant> instead of 87 87 <constant> V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE </constant>. The next step is 88 - setting <structfield> &v4l2-selection;::target </structfield> to value 89 - <constant> V4L2_SEL_TGT_CROP_ACTIVE </constant> (<constant> 88 + setting the value of &v4l2-selection; <structfield>target</structfield> to 89 + <constant>V4L2_SEL_TGT_CROP_ACTIVE</constant> (<constant> 90 90 V4L2_SEL_TGT_COMPOSE_ACTIVE </constant>). Please refer to table <xref 91 91 linkend="v4l2-sel-target" /> or <xref linkend="selection-api" /> for additional 92 - targets. Set desired active area into the field <structfield> 93 - &v4l2-selection;::r </structfield>. Field <structfield> 94 - &v4l2-selection;::reserved </structfield> is ignored and must be filled with 95 - zeros. The driver may adjust the rectangle coordinates. An application may 96 - introduce constraints to control rounding behaviour. Set the field 97 - <structfield> &v4l2-selection;::flags </structfield> to one of values: 92 + targets. The &v4l2-rect; <structfield>r</structfield> rectangle need to be 93 + set to the desired active area. Field &v4l2-selection; <structfield> reserved 94 + </structfield> is ignored and must be filled with zeros. The driver may adjust 95 + coordinates of the requested rectangle. An application may 96 + introduce constraints to control rounding behaviour. The &v4l2-selection; 97 + <structfield>flags</structfield> field must be set to one of the following: 98 98 99 99 <itemizedlist> 100 100 <listitem> ··· 129 129 130 130 <orderedlist> 131 131 <listitem> 132 - <para>Satisfy constraints from <structfield>&v4l2-selection;::flags</structfield>.</para> 132 + <para>Satisfy constraints from &v4l2-selection; <structfield>flags</structfield>.</para> 133 133 </listitem> 134 134 <listitem> 135 135 <para>Adjust width, height, left, and top to hardware limits and alignments.</para> ··· 145 145 </listitem> 146 146 </orderedlist> 147 147 148 - On success the field <structfield> &v4l2-selection;::r </structfield> contains 148 + On success the &v4l2-rect; <structfield>r</structfield> field contains 149 149 the adjusted rectangle. When the parameters are unsuitable the application may 150 150 modify the cropping (composing) or image parameters and repeat the cycle until 151 151 satisfactory parameters have been negotiated. If constraints flags have to be ··· 162 162 <tbody valign="top"> 163 163 <row> 164 164 <entry><constant>V4L2_SEL_TGT_CROP_ACTIVE</constant></entry> 165 - <entry>0</entry> 166 - <entry>area that is currently cropped by hardware</entry> 165 + <entry>0x0000</entry> 166 + <entry>The area that is currently cropped by hardware.</entry> 167 167 </row> 168 168 <row> 169 169 <entry><constant>V4L2_SEL_TGT_CROP_DEFAULT</constant></entry> 170 - <entry>1</entry> 171 - <entry>suggested cropping rectangle that covers the "whole picture"</entry> 170 + <entry>0x0001</entry> 171 + <entry>Suggested cropping rectangle that covers the "whole picture".</entry> 172 172 </row> 173 173 <row> 174 174 <entry><constant>V4L2_SEL_TGT_CROP_BOUNDS</constant></entry> 175 - <entry>2</entry> 176 - <entry>limits for the cropping rectangle</entry> 175 + <entry>0x0002</entry> 176 + <entry>Limits for the cropping rectangle.</entry> 177 177 </row> 178 178 <row> 179 179 <entry><constant>V4L2_SEL_TGT_COMPOSE_ACTIVE</constant></entry> 180 - <entry>256</entry> 181 - <entry>area to which data are composed by hardware</entry> 180 + <entry>0x0100</entry> 181 + <entry>The area to which data is composed by hardware.</entry> 182 182 </row> 183 183 <row> 184 184 <entry><constant>V4L2_SEL_TGT_COMPOSE_DEFAULT</constant></entry> 185 - <entry>257</entry> 186 - <entry>suggested composing rectangle that covers the "whole picture"</entry> 185 + <entry>0x0101</entry> 186 + <entry>Suggested composing rectangle that covers the "whole picture".</entry> 187 187 </row> 188 188 <row> 189 189 <entry><constant>V4L2_SEL_TGT_COMPOSE_BOUNDS</constant></entry> 190 - <entry>258</entry> 191 - <entry>limits for the composing rectangle</entry> 190 + <entry>0x0102</entry> 191 + <entry>Limits for the composing rectangle.</entry> 192 192 </row> 193 193 <row> 194 194 <entry><constant>V4L2_SEL_TGT_COMPOSE_PADDED</constant></entry> 195 - <entry>259</entry> 196 - <entry>the active area and all padding pixels that are inserted or modified by the hardware</entry> 195 + <entry>0x0103</entry> 196 + <entry>The active area and all padding pixels that are inserted or modified by hardware.</entry> 197 197 </row> 198 198 </tbody> 199 199 </tgroup> ··· 209 209 <row> 210 210 <entry><constant>V4L2_SEL_FLAG_GE</constant></entry> 211 211 <entry>0x00000001</entry> 212 - <entry>indicate that adjusted rectangle must contain a rectangle from <structfield>&v4l2-selection;::r</structfield></entry> 212 + <entry>Indicates that the adjusted rectangle must contain the original 213 + &v4l2-selection; <structfield>r</structfield> rectangle.</entry> 213 214 </row> 214 215 <row> 215 216 <entry><constant>V4L2_SEL_FLAG_LE</constant></entry> 216 217 <entry>0x00000002</entry> 217 - <entry>indicate that adjusted rectangle must be inside a rectangle from <structfield>&v4l2-selection;::r</structfield></entry> 218 + <entry>Indicates that the adjusted rectangle must be inside the original 219 + &v4l2-rect; <structfield>r</structfield> rectangle.</entry> 218 220 </row> 219 221 </tbody> 220 222 </tgroup> ··· 247 245 <row> 248 246 <entry>__u32</entry> 249 247 <entry><structfield>type</structfield></entry> 250 - <entry>Type of the buffer (from &v4l2-buf-type;)</entry> 248 + <entry>Type of the buffer (from &v4l2-buf-type;).</entry> 251 249 </row> 252 250 <row> 253 251 <entry>__u32</entry> 254 252 <entry><structfield>target</structfield></entry> 255 - <entry>used to select between <link linkend="v4l2-sel-target"> cropping and composing rectangles </link></entry> 253 + <entry>Used to select between <link linkend="v4l2-sel-target"> cropping 254 + and composing rectangles</link>.</entry> 256 255 </row> 257 256 <row> 258 257 <entry>__u32</entry> 259 258 <entry><structfield>flags</structfield></entry> 260 - <entry>control over coordinates adjustments, refer to <link linkend="v4l2-sel-flags">selection flags</link></entry> 259 + <entry>Flags controlling the selection rectangle adjustments, refer to 260 + <link linkend="v4l2-sel-flags">selection flags</link>.</entry> 261 261 </row> 262 262 <row> 263 263 <entry>&v4l2-rect;</entry> 264 264 <entry><structfield>r</structfield></entry> 265 - <entry>selection rectangle</entry> 265 + <entry>The selection rectangle.</entry> 266 266 </row> 267 267 <row> 268 268 <entry>__u32</entry> 269 269 <entry><structfield>reserved[9]</structfield></entry> 270 - <entry>Reserved fields for future use</entry> 270 + <entry>Reserved fields for future use.</entry> 271 271 </row> 272 272 </tbody> 273 273 </tgroup> ··· 282 278 <varlistentry> 283 279 <term><errorcode>EINVAL</errorcode></term> 284 280 <listitem> 285 - <para>The buffer <structfield> &v4l2-selection;::type </structfield> 286 - or <structfield> &v4l2-selection;::target </structfield> is not supported, or 287 - the <structfield> &v4l2-selection;::flags </structfield> are invalid.</para> 281 + <para>Given buffer type <structfield>type</structfield> or 282 + the selection target <structfield>target</structfield> is not supported, 283 + or the <structfield>flags</structfield> argument is not valid.</para> 288 284 </listitem> 289 285 </varlistentry> 290 286 <varlistentry> 291 287 <term><errorcode>ERANGE</errorcode></term> 292 288 <listitem> 293 - <para>it is not possible to adjust a rectangle <structfield> 294 - &v4l2-selection;::r </structfield> that satisfies all contraints from 295 - <structfield> &v4l2-selection;::flags </structfield>.</para> 289 + <para>It is not possible to adjust &v4l2-rect; <structfield> 290 + r</structfield> rectangle to satisfy all contraints given in the 291 + <structfield>flags</structfield> argument.</para> 296 292 </listitem> 297 293 </varlistentry> 298 294 <varlistentry> 299 295 <term><errorcode>EBUSY</errorcode></term> 300 296 <listitem> 301 - <para>it is not possible to apply change of selection rectangle at the moment. 302 - Usually because streaming is in progress.</para> 297 + <para>It is not possible to apply change of the selection rectangle 298 + at the moment. Usually because streaming is in progress.</para> 303 299 </listitem> 304 300 </varlistentry> 305 301 </variablelist>
+15 -15
include/linux/videodev2.h
··· 762 762 763 763 /* Selection targets */ 764 764 765 - /* current cropping area */ 766 - #define V4L2_SEL_TGT_CROP_ACTIVE 0 767 - /* default cropping area */ 768 - #define V4L2_SEL_TGT_CROP_DEFAULT 1 769 - /* cropping bounds */ 770 - #define V4L2_SEL_TGT_CROP_BOUNDS 2 771 - /* current composing area */ 772 - #define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 773 - /* default composing area */ 774 - #define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 775 - /* composing bounds */ 776 - #define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 777 - /* current composing area plus all padding pixels */ 778 - #define V4L2_SEL_TGT_COMPOSE_PADDED 259 765 + /* Current cropping area */ 766 + #define V4L2_SEL_TGT_CROP_ACTIVE 0x0000 767 + /* Default cropping area */ 768 + #define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 769 + /* Cropping bounds */ 770 + #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 771 + /* Current composing area */ 772 + #define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100 773 + /* Default composing area */ 774 + #define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 775 + /* Composing bounds */ 776 + #define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 777 + /* Current composing area plus all padding pixels */ 778 + #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 779 779 780 780 /** 781 781 * struct v4l2_selection - selection info ··· 785 785 * @r: coordinates of selection window 786 786 * @reserved: for future use, rounds structure size to 64 bytes, set to zero 787 787 * 788 - * Hardware may use multiple helper window to process a video stream. 788 + * Hardware may use multiple helper windows to process a video stream. 789 789 * The structure is used to exchange this selection areas between 790 790 * an application and a driver. 791 791 */