1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
10 .. _VIDIOC_ENUM_FRAMESIZES:
12 ****************************
13 ioctl VIDIOC_ENUM_FRAMESIZES
14 ****************************
19 VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes
25 .. c:function:: int ioctl( int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp )
26 :name: VIDIOC_ENUM_FRAMESIZES
33 File descriptor returned by :ref:`open() <func-open>`.
36 Pointer to struct :c:type:`v4l2_frmsizeenum`
37 that contains an index and pixel format and receives a frame width
44 This ioctl allows applications to enumerate all frame sizes (i. e. width
45 and height in pixels) that the device supports for the given pixel
48 The supported pixel formats can be obtained by using the
49 :ref:`VIDIOC_ENUM_FMT` function.
51 The return value and the content of the ``v4l2_frmsizeenum.type`` field
52 depend on the type of frame sizes the device supports. Here are the
53 semantics of the function for the different cases:
55 - **Discrete:** The function returns success if the given index value
56 (zero-based) is valid. The application should increase the index by
57 one for each call until ``EINVAL`` is returned. The
58 ``v4l2_frmsizeenum.type`` field is set to
59 ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
60 ``discrete`` member is valid.
62 - **Step-wise:** The function returns success if the given index value
63 is zero and ``EINVAL`` for any other index value. The
64 ``v4l2_frmsizeenum.type`` field is set to
65 ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
66 ``stepwise`` member is valid.
68 - **Continuous:** This is a special case of the step-wise type above.
69 The function returns success if the given index value is zero and
70 ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
71 field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
72 the union only the ``stepwise`` member is valid and the
73 ``step_width`` and ``step_height`` values are set to 1.
75 When the application calls the function with index zero, it must check
76 the ``type`` field to determine the type of frame size enumeration the
77 device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
78 it make sense to increase the index value to receive more frame sizes.
82 The order in which the frame sizes are returned has no special
83 meaning. In particular does it not say anything about potential default
86 Applications can assume that the enumeration data does not change
87 without any interaction from the application itself. This means that the
88 enumeration data is consistent if the application does not perform any
89 other ioctl calls while it runs the frame size enumeration.
95 In the structs below, *IN* denotes a value that has to be filled in by
96 the application, *OUT* denotes values that the driver fills in. The
97 application should zero out all members except for the *IN* fields.
100 .. c:type:: v4l2_frmsize_discrete
102 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
104 .. flat-table:: struct v4l2_frmsize_discrete
111 - Width of the frame [pixel].
114 - Height of the frame [pixel].
118 .. c:type:: v4l2_frmsize_stepwise
120 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
122 .. flat-table:: struct v4l2_frmsize_stepwise
129 - Minimum frame width [pixel].
132 - Maximum frame width [pixel].
135 - Frame width step size [pixel].
138 - Minimum frame height [pixel].
141 - Maximum frame height [pixel].
144 - Frame height step size [pixel].
148 .. c:type:: v4l2_frmsizeenum
150 .. tabularcolumns:: |p{1.4cm}|p{5.9cm}|p{2.3cm}|p{8.0cm}|
152 .. flat-table:: struct v4l2_frmsizeenum
159 - IN: Index of the given frame size in the enumeration.
163 - IN: Pixel format for which the frame sizes are enumerated.
167 - OUT: Frame size type the device supports.
171 - OUT: Frame size with the given index.
173 - struct :c:type:`v4l2_frmsize_discrete`
177 - struct :c:type:`v4l2_frmsize_stepwise`
183 - Reserved space for future use. Must be zeroed by drivers and
192 .. c:type:: v4l2_frmsizetypes
194 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
196 .. flat-table:: enum v4l2_frmsizetypes
201 * - ``V4L2_FRMSIZE_TYPE_DISCRETE``
203 - Discrete frame size.
204 * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
206 - Continuous frame size.
207 * - ``V4L2_FRMSIZE_TYPE_STEPWISE``
209 - Step-wise defined frame size.
215 On success 0 is returned, on error -1 and the ``errno`` variable is set
216 appropriately. The generic error codes are described at the
217 :ref:`Generic Error Codes <gen-errors>` chapter.