Linux 4.8.3
[linux/fpc-iii.git] / Documentation / media / uapi / v4l / vidioc-g-parm.rst
blob7116e0decddc817021fb8216b79e48f608be4a43
1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_G_PARM:
5 **********************************
6 ioctl VIDIOC_G_PARM, VIDIOC_S_PARM
7 **********************************
9 Name
10 ====
12 VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters
15 Synopsis
16 ========
18 .. cpp:function:: int ioctl( int fd, int request, v4l2_streamparm *argp )
21 Arguments
22 =========
24 ``fd``
25     File descriptor returned by :ref:`open() <func-open>`.
27 ``request``
28     VIDIOC_G_PARM, VIDIOC_S_PARM
30 ``argp``
33 Description
34 ===========
36 The current video standard determines a nominal number of frames per
37 second. If less than this number of frames is to be captured or output,
38 applications can request frame skipping or duplicating on the driver
39 side. This is especially useful when using the :ref:`read() <func-read>` or
40 :ref:`write() <func-write>`, which are not augmented by timestamps or sequence
41 counters, and to avoid unnecessary data copying.
43 Further these ioctls can be used to determine the number of buffers used
44 internally by a driver in read/write mode. For implications see the
45 section discussing the :ref:`read() <func-read>` function.
47 To get and set the streaming parameters applications call the
48 :ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, respectively. They take a
49 pointer to a struct :ref:`struct v4l2_streamparm <v4l2-streamparm>` which contains a
50 union holding separate parameters for input and output devices.
53 .. _v4l2-streamparm:
55 .. flat-table:: struct v4l2_streamparm
56     :header-rows:  0
57     :stub-columns: 0
58     :widths:       1 1 1 2
61     -  .. row 1
63        -  __u32
65        -  ``type``
67        -
68        -  The buffer (stream) type, same as struct
69           :ref:`v4l2_format <v4l2-format>` ``type``, set by the
70           application. See :ref:`v4l2-buf-type`
72     -  .. row 2
74        -  union
76        -  ``parm``
78        -
79        -
81     -  .. row 3
83        -
84        -  struct :ref:`v4l2_captureparm <v4l2-captureparm>`
86        -  ``capture``
88        -  Parameters for capture devices, used when ``type`` is
89           ``V4L2_BUF_TYPE_VIDEO_CAPTURE``.
91     -  .. row 4
93        -
94        -  struct :ref:`v4l2_outputparm <v4l2-outputparm>`
96        -  ``output``
98        -  Parameters for output devices, used when ``type`` is
99           ``V4L2_BUF_TYPE_VIDEO_OUTPUT``.
101     -  .. row 5
103        -
104        -  __u8
106        -  ``raw_data``\ [200]
108        -  A place holder for future extensions.
112 .. _v4l2-captureparm:
114 .. flat-table:: struct v4l2_captureparm
115     :header-rows:  0
116     :stub-columns: 0
117     :widths:       1 1 2
120     -  .. row 1
122        -  __u32
124        -  ``capability``
126        -  See :ref:`parm-caps`.
128     -  .. row 2
130        -  __u32
132        -  ``capturemode``
134        -  Set by drivers and applications, see :ref:`parm-flags`.
136     -  .. row 3
138        -  struct :ref:`v4l2_fract <v4l2-fract>`
140        -  ``timeperframe``
142        -  This is the desired period between successive frames captured by
143           the driver, in seconds. The field is intended to skip frames on
144           the driver side, saving I/O bandwidth.
146           Applications store here the desired frame period, drivers return
147           the actual frame period, which must be greater or equal to the
148           nominal frame period determined by the current video standard
149           (struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
150           field). Changing the video standard (also implicitly by switching
151           the video input) may reset this parameter to the nominal frame
152           period. To reset manually applications can just set this field to
153           zero.
155           Drivers support this function only when they set the
156           ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
158     -  .. row 4
160        -  __u32
162        -  ``extendedmode``
164        -  Custom (driver specific) streaming parameters. When unused,
165           applications and drivers must set this field to zero. Applications
166           using this field should check the driver name and version, see
167           :ref:`querycap`.
169     -  .. row 5
171        -  __u32
173        -  ``readbuffers``
175        -  Applications set this field to the desired number of buffers used
176           internally by the driver in :ref:`read() <func-read>` mode.
177           Drivers return the actual number of buffers. When an application
178           requests zero buffers, drivers should just return the current
179           setting rather than the minimum or an error code. For details see
180           :ref:`rw`.
182     -  .. row 6
184        -  __u32
186        -  ``reserved``\ [4]
188        -  Reserved for future extensions. Drivers and applications must set
189           the array to zero.
193 .. _v4l2-outputparm:
195 .. flat-table:: struct v4l2_outputparm
196     :header-rows:  0
197     :stub-columns: 0
198     :widths:       1 1 2
201     -  .. row 1
203        -  __u32
205        -  ``capability``
207        -  See :ref:`parm-caps`.
209     -  .. row 2
211        -  __u32
213        -  ``outputmode``
215        -  Set by drivers and applications, see :ref:`parm-flags`.
217     -  .. row 3
219        -  struct :ref:`v4l2_fract <v4l2-fract>`
221        -  ``timeperframe``
223        -  This is the desired period between successive frames output by the
224           driver, in seconds.
226     -  .. row 4
228        -  :cspan:`2`
230           The field is intended to repeat frames on the driver side in
231           :ref:`write() <func-write>` mode (in streaming mode timestamps
232           can be used to throttle the output), saving I/O bandwidth.
234           Applications store here the desired frame period, drivers return
235           the actual frame period, which must be greater or equal to the
236           nominal frame period determined by the current video standard
237           (struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
238           field). Changing the video standard (also implicitly by switching
239           the video output) may reset this parameter to the nominal frame
240           period. To reset manually applications can just set this field to
241           zero.
243           Drivers support this function only when they set the
244           ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
246     -  .. row 5
248        -  __u32
250        -  ``extendedmode``
252        -  Custom (driver specific) streaming parameters. When unused,
253           applications and drivers must set this field to zero. Applications
254           using this field should check the driver name and version, see
255           :ref:`querycap`.
257     -  .. row 6
259        -  __u32
261        -  ``writebuffers``
263        -  Applications set this field to the desired number of buffers used
264           internally by the driver in :ref:`write() <func-write>` mode. Drivers
265           return the actual number of buffers. When an application requests
266           zero buffers, drivers should just return the current setting
267           rather than the minimum or an error code. For details see
268           :ref:`rw`.
270     -  .. row 7
272        -  __u32
274        -  ``reserved``\ [4]
276        -  Reserved for future extensions. Drivers and applications must set
277           the array to zero.
281 .. _parm-caps:
283 .. flat-table:: Streaming Parameters Capabilites
284     :header-rows:  0
285     :stub-columns: 0
286     :widths:       3 1 4
289     -  .. row 1
291        -  ``V4L2_CAP_TIMEPERFRAME``
293        -  0x1000
295        -  The frame skipping/repeating controlled by the ``timeperframe``
296           field is supported.
300 .. _parm-flags:
302 .. flat-table:: Capture Parameters Flags
303     :header-rows:  0
304     :stub-columns: 0
305     :widths:       3 1 4
308     -  .. row 1
310        -  ``V4L2_MODE_HIGHQUALITY``
312        -  0x0001
314        -  High quality imaging mode. High quality mode is intended for still
315           imaging applications. The idea is to get the best possible image
316           quality that the hardware can deliver. It is not defined how the
317           driver writer may achieve that; it will depend on the hardware and
318           the ingenuity of the driver writer. High quality mode is a
319           different mode from the regular motion video capture modes. In
320           high quality mode:
322           -  The driver may be able to capture higher resolutions than for
323              motion capture.
325           -  The driver may support fewer pixel formats than motion capture
326              (eg; true color).
328           -  The driver may capture and arithmetically combine multiple
329              successive fields or frames to remove color edge artifacts and
330              reduce the noise in the video data.
332           -  The driver may capture images in slices like a scanner in order
333              to handle larger format images than would otherwise be
334              possible.
336           -  An image capture operation may be significantly slower than
337              motion capture.
339           -  Moving objects in the image might have excessive motion blur.
341           -  Capture might only work through the :ref:`read() <func-read>` call.
344 Return Value
345 ============
347 On success 0 is returned, on error -1 and the ``errno`` variable is set
348 appropriately. The generic error codes are described at the
349 :ref:`Generic Error Codes <gen-errors>` chapter.