1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_ENUM_FRAMESIZES:
5 ****************************
6 ioctl VIDIOC_ENUM_FRAMESIZES
7 ****************************
12 VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_frmsizeenum *argp )
25 File descriptor returned by :ref:`open() <func-open>`.
28 VIDIOC_ENUM_FRAMESIZES
31 Pointer to a struct :ref:`v4l2_frmsizeenum <v4l2-frmsizeenum>`
32 that contains an index and pixel format and receives a frame width
39 This ioctl allows applications to enumerate all frame sizes (i. e. width
40 and height in pixels) that the device supports for the given pixel
43 The supported pixel formats can be obtained by using the
44 :ref:`VIDIOC_ENUM_FMT` function.
46 The return value and the content of the ``v4l2_frmsizeenum.type`` field
47 depend on the type of frame sizes the device supports. Here are the
48 semantics of the function for the different cases:
50 - **Discrete:** The function returns success if the given index value
51 (zero-based) is valid. The application should increase the index by
52 one for each call until ``EINVAL`` is returned. The
53 ``v4l2_frmsizeenum.type`` field is set to
54 ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
55 ``discrete`` member is valid.
57 - **Step-wise:** The function returns success if the given index value
58 is zero and ``EINVAL`` for any other index value. The
59 ``v4l2_frmsizeenum.type`` field is set to
60 ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
61 ``stepwise`` member is valid.
63 - **Continuous:** This is a special case of the step-wise type above.
64 The function returns success if the given index value is zero and
65 ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
66 field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
67 the union only the ``stepwise`` member is valid and the
68 ``step_width`` and ``step_height`` values are set to 1.
70 When the application calls the function with index zero, it must check
71 the ``type`` field to determine the type of frame size enumeration the
72 device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
73 it make sense to increase the index value to receive more frame sizes.
75 .. note:: The order in which the frame sizes are returned has no special
76 meaning. In particular does it not say anything about potential default
79 Applications can assume that the enumeration data does not change
80 without any interaction from the application itself. This means that the
81 enumeration data is consistent if the application does not perform any
82 other ioctl calls while it runs the frame size enumeration.
88 In the structs below, *IN* denotes a value that has to be filled in by
89 the application, *OUT* denotes values that the driver fills in. The
90 application should zero out all members except for the *IN* fields.
93 .. _v4l2-frmsize-discrete:
95 .. flat-table:: struct v4l2_frmsize_discrete
107 - Width of the frame [pixel].
115 - Height of the frame [pixel].
119 .. _v4l2-frmsize-stepwise:
121 .. flat-table:: struct v4l2_frmsize_stepwise
133 - Minimum frame width [pixel].
141 - Maximum frame width [pixel].
149 - Frame width step size [pixel].
157 - Minimum frame height [pixel].
165 - Maximum frame height [pixel].
173 - Frame height step size [pixel].
177 .. _v4l2-frmsizeenum:
179 .. flat-table:: struct v4l2_frmsizeenum
191 - IN: Index of the given frame size in the enumeration.
200 - IN: Pixel format for which the frame sizes are enumerated.
209 - OUT: Frame size type the device supports.
217 - OUT: Frame size with the given index.
222 - struct :ref:`v4l2_frmsize_discrete <v4l2-frmsize-discrete>`
231 - struct :ref:`v4l2_frmsize_stepwise <v4l2-frmsize-stepwise>`
244 - Reserved space for future use. Must be zeroed by drivers and
253 .. _v4l2-frmsizetypes:
255 .. flat-table:: enum v4l2_frmsizetypes
263 - ``V4L2_FRMSIZE_TYPE_DISCRETE``
267 - Discrete frame size.
271 - ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
275 - Continuous frame size.
279 - ``V4L2_FRMSIZE_TYPE_STEPWISE``
283 - Step-wise defined frame size.
289 On success 0 is returned, on error -1 and the ``errno`` variable is set
290 appropriately. The generic error codes are described at the
291 :ref:`Generic Error Codes <gen-errors>` chapter.