[media] docs-rst: add tabularcolumns to all tables
[cascardo/linux.git] / Documentation / media / uapi / v4l / vidioc-enum-frameintervals.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _VIDIOC_ENUM_FRAMEINTERVALS:
4
5 ********************************
6 ioctl VIDIOC_ENUM_FRAMEINTERVALS
7 ********************************
8
9 Name
10 ====
11
12 VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals
13
14
15 Synopsis
16 ========
17
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_frmivalenum *argp )
19
20
21 Arguments
22 =========
23
24 ``fd``
25     File descriptor returned by :ref:`open() <func-open>`.
26
27 ``request``
28     VIDIOC_ENUM_FRAMEINTERVALS
29
30 ``argp``
31     Pointer to a struct :ref:`v4l2_frmivalenum <v4l2-frmivalenum>`
32     structure that contains a pixel format and size and receives a frame
33     interval.
34
35
36 Description
37 ===========
38
39 This ioctl allows applications to enumerate all frame intervals that the
40 device supports for the given pixel format and frame size.
41
42 The supported pixel formats and frame sizes can be obtained by using the
43 :ref:`VIDIOC_ENUM_FMT` and
44 :ref:`VIDIOC_ENUM_FRAMESIZES` functions.
45
46 The return value and the content of the ``v4l2_frmivalenum.type`` field
47 depend on the type of frame intervals the device supports. Here are the
48 semantics of the function for the different cases:
49
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_frmivalenum.type` field is set to
54    `V4L2_FRMIVAL_TYPE_DISCRETE` by the driver. Of the union only
55    the `discrete` member is valid.
56
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_frmivalenum.type`` field is set to
60    ``V4L2_FRMIVAL_TYPE_STEPWISE`` by the driver. Of the union only the
61    ``stepwise`` member is valid.
62
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_frmivalenum.type``
66    field is set to ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` by the driver. Of
67    the union only the ``stepwise`` member is valid and the ``step``
68    value is set to 1.
69
70 When the application calls the function with index zero, it must check
71 the ``type`` field to determine the type of frame interval enumeration
72 the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type
73 does it make sense to increase the index value to receive more frame
74 intervals.
75
76 .. note::
77
78    The order in which the frame intervals are returned has no
79    special meaning. In particular does it not say anything about potential
80    default frame intervals.
81
82 Applications can assume that the enumeration data does not change
83 without any interaction from the application itself. This means that the
84 enumeration data is consistent if the application does not perform any
85 other ioctl calls while it runs the frame interval enumeration.
86
87 .. note::
88
89    **Frame intervals and frame rates:** The V4L2 API uses frame
90    intervals instead of frame rates. Given the frame interval the frame
91    rate can be computed as follows:
92
93    ::
94
95        frame_rate = 1 / frame_interval
96
97
98 Structs
99 =======
100
101 In the structs below, *IN* denotes a value that has to be filled in by
102 the application, *OUT* denotes values that the driver fills in. The
103 application should zero out all members except for the *IN* fields.
104
105
106 .. _v4l2-frmival-stepwise:
107
108 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
109
110 .. flat-table:: struct v4l2_frmival_stepwise
111     :header-rows:  0
112     :stub-columns: 0
113     :widths:       1 1 2
114
115
116     -  .. row 1
117
118        -  struct :ref:`v4l2_fract <v4l2-fract>`
119
120        -  ``min``
121
122        -  Minimum frame interval [s].
123
124     -  .. row 2
125
126        -  struct :ref:`v4l2_fract <v4l2-fract>`
127
128        -  ``max``
129
130        -  Maximum frame interval [s].
131
132     -  .. row 3
133
134        -  struct :ref:`v4l2_fract <v4l2-fract>`
135
136        -  ``step``
137
138        -  Frame interval step size [s].
139
140
141
142 .. _v4l2-frmivalenum:
143
144 .. flat-table:: struct v4l2_frmivalenum
145     :header-rows:  0
146     :stub-columns: 0
147
148
149     -  .. row 1
150
151        -  __u32
152
153        -  ``index``
154
155        -
156        -  IN: Index of the given frame interval in the enumeration.
157
158     -  .. row 2
159
160        -  __u32
161
162        -  ``pixel_format``
163
164        -
165        -  IN: Pixel format for which the frame intervals are enumerated.
166
167     -  .. row 3
168
169        -  __u32
170
171        -  ``width``
172
173        -
174        -  IN: Frame width for which the frame intervals are enumerated.
175
176     -  .. row 4
177
178        -  __u32
179
180        -  ``height``
181
182        -
183        -  IN: Frame height for which the frame intervals are enumerated.
184
185     -  .. row 5
186
187        -  __u32
188
189        -  ``type``
190
191        -
192        -  OUT: Frame interval type the device supports.
193
194     -  .. row 6
195
196        -  union
197
198        -
199        -
200        -  OUT: Frame interval with the given index.
201
202     -  .. row 7
203
204        -
205        -  struct :ref:`v4l2_fract <v4l2-fract>`
206
207        -  ``discrete``
208
209        -  Frame interval [s].
210
211     -  .. row 8
212
213        -
214        -  struct :ref:`v4l2_frmival_stepwise <v4l2-frmival-stepwise>`
215
216        -  ``stepwise``
217
218        -
219
220     -  .. row 9
221
222        -  __u32
223
224        -  ``reserved[2]``
225
226        -
227        -  Reserved space for future use. Must be zeroed by drivers and
228           applications.
229
230
231
232 Enums
233 =====
234
235
236 .. _v4l2-frmivaltypes:
237
238 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
239
240 .. flat-table:: enum v4l2_frmivaltypes
241     :header-rows:  0
242     :stub-columns: 0
243     :widths:       3 1 4
244
245
246     -  .. row 1
247
248        -  ``V4L2_FRMIVAL_TYPE_DISCRETE``
249
250        -  1
251
252        -  Discrete frame interval.
253
254     -  .. row 2
255
256        -  ``V4L2_FRMIVAL_TYPE_CONTINUOUS``
257
258        -  2
259
260        -  Continuous frame interval.
261
262     -  .. row 3
263
264        -  ``V4L2_FRMIVAL_TYPE_STEPWISE``
265
266        -  3
267
268        -  Step-wise defined frame interval.
269
270
271 Return Value
272 ============
273
274 On success 0 is returned, on error -1 and the ``errno`` variable is set
275 appropriately. The generic error codes are described at the
276 :ref:`Generic Error Codes <gen-errors>` chapter.