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 .. c:function:: int ioctl( int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp )
19 :name: VIDIOC_ENUM_FRAMESIZES
26 File descriptor returned by :ref:`open() <func-open>`.
29 Pointer to struct :c:type:`v4l2_frmsizeenum`
30 that contains an index and pixel format and receives a frame width
37 This ioctl allows applications to enumerate all frame sizes (i. e. width
38 and height in pixels) that the device supports for the given pixel
41 The supported pixel formats can be obtained by using the
42 :ref:`VIDIOC_ENUM_FMT` function.
44 The return value and the content of the ``v4l2_frmsizeenum.type`` field
45 depend on the type of frame sizes the device supports. Here are the
46 semantics of the function for the different cases:
48 - **Discrete:** The function returns success if the given index value
49 (zero-based) is valid. The application should increase the index by
50 one for each call until ``EINVAL`` is returned. The
51 ``v4l2_frmsizeenum.type`` field is set to
52 ``V4L2_FRMSIZE_TYPE_DISCRETE`` by the driver. Of the union only the
53 ``discrete`` member is valid.
55 - **Step-wise:** The function returns success if the given index value
56 is zero and ``EINVAL`` for any other index value. The
57 ``v4l2_frmsizeenum.type`` field is set to
58 ``V4L2_FRMSIZE_TYPE_STEPWISE`` by the driver. Of the union only the
59 ``stepwise`` member is valid.
61 - **Continuous:** This is a special case of the step-wise type above.
62 The function returns success if the given index value is zero and
63 ``EINVAL`` for any other index value. The ``v4l2_frmsizeenum.type``
64 field is set to ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` by the driver. Of
65 the union only the ``stepwise`` member is valid and the
66 ``step_width`` and ``step_height`` values are set to 1.
68 When the application calls the function with index zero, it must check
69 the ``type`` field to determine the type of frame size enumeration the
70 device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does
71 it make sense to increase the index value to receive more frame sizes.
75 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 .. c:type:: v4l2_frmsize_discrete
95 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
97 .. flat-table:: struct v4l2_frmsize_discrete
104 - Width of the frame [pixel].
107 - Height of the frame [pixel].
111 .. c:type:: v4l2_frmsize_stepwise
113 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
115 .. flat-table:: struct v4l2_frmsize_stepwise
122 - Minimum frame width [pixel].
125 - Maximum frame width [pixel].
128 - Frame width step size [pixel].
131 - Minimum frame height [pixel].
134 - Maximum frame height [pixel].
137 - Frame height step size [pixel].
141 .. c:type:: v4l2_frmsizeenum
143 .. tabularcolumns:: |p{1.4cm}|p{5.9cm}|p{2.3cm}|p{8.0cm}|
145 .. flat-table:: struct v4l2_frmsizeenum
152 - IN: Index of the given frame size in the enumeration.
156 - IN: Pixel format for which the frame sizes are enumerated.
160 - OUT: Frame size type the device supports.
164 - OUT: Frame size with the given index.
166 - struct :c:type:`v4l2_frmsize_discrete`
170 - struct :c:type:`v4l2_frmsize_stepwise`
176 - Reserved space for future use. Must be zeroed by drivers and
185 .. c:type:: v4l2_frmsizetypes
187 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
189 .. flat-table:: enum v4l2_frmsizetypes
194 * - ``V4L2_FRMSIZE_TYPE_DISCRETE``
196 - Discrete frame size.
197 * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS``
199 - Continuous frame size.
200 * - ``V4L2_FRMSIZE_TYPE_STEPWISE``
202 - Step-wise defined frame size.
208 On success 0 is returned, on error -1 and the ``errno`` variable is set
209 appropriately. The generic error codes are described at the
210 :ref:`Generic Error Codes <gen-errors>` chapter.