2016-06-30 21:18:56 +08:00
|
|
|
.. -*- coding: utf-8; mode: rst -*-
|
|
|
|
|
2016-07-02 00:42:29 +08:00
|
|
|
.. _VIDIOC_G_PARM:
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
**********************************
|
|
|
|
ioctl VIDIOC_G_PARM, VIDIOC_S_PARM
|
|
|
|
**********************************
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Name
|
2016-07-05 18:58:48 +08:00
|
|
|
====
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 18:58:48 +08:00
|
|
|
VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
|
|
|
|
Synopsis
|
2016-06-30 21:18:56 +08:00
|
|
|
========
|
|
|
|
|
2016-07-02 20:49:16 +08:00
|
|
|
.. cpp:function:: int ioctl( int fd, int request, v4l2_streamparm *argp )
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 18:58:48 +08:00
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Arguments
|
2016-06-30 21:18:56 +08:00
|
|
|
=========
|
|
|
|
|
|
|
|
``fd``
|
|
|
|
File descriptor returned by :ref:`open() <func-open>`.
|
|
|
|
|
|
|
|
``request``
|
|
|
|
VIDIOC_G_PARM, VIDIOC_S_PARM
|
|
|
|
|
|
|
|
``argp``
|
|
|
|
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Description
|
2016-06-30 21:18:56 +08:00
|
|
|
===========
|
|
|
|
|
|
|
|
The current video standard determines a nominal number of frames per
|
|
|
|
second. If less than this number of frames is to be captured or output,
|
|
|
|
applications can request frame skipping or duplicating on the driver
|
2016-07-04 23:56:17 +08:00
|
|
|
side. This is especially useful when using the :ref:`read() <func-read>` or
|
|
|
|
:ref:`write() <func-write>`, which are not augmented by timestamps or sequence
|
2016-06-30 21:18:56 +08:00
|
|
|
counters, and to avoid unnecessary data copying.
|
|
|
|
|
|
|
|
Further these ioctls can be used to determine the number of buffers used
|
|
|
|
internally by a driver in read/write mode. For implications see the
|
|
|
|
section discussing the :ref:`read() <func-read>` function.
|
|
|
|
|
|
|
|
To get and set the streaming parameters applications call the
|
2016-07-03 21:02:29 +08:00
|
|
|
:ref:`VIDIOC_G_PARM <VIDIOC_G_PARM>` and :ref:`VIDIOC_S_PARM <VIDIOC_G_PARM>` ioctl, respectively. They take a
|
2016-07-04 00:28:28 +08:00
|
|
|
pointer to a struct :ref:`struct v4l2_streamparm <v4l2-streamparm>` which contains a
|
2016-06-30 21:18:56 +08:00
|
|
|
union holding separate parameters for input and output devices.
|
|
|
|
|
|
|
|
|
|
|
|
.. _v4l2-streamparm:
|
|
|
|
|
|
|
|
.. flat-table:: struct v4l2_streamparm
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 1 1 1 2
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``type``
|
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
-
|
2016-06-30 21:18:56 +08:00
|
|
|
- The buffer (stream) type, same as struct
|
2016-07-05 03:25:48 +08:00
|
|
|
:ref:`v4l2_format <v4l2-format>` ``type``, set by the
|
|
|
|
application. See :ref:`v4l2-buf-type`
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 2
|
|
|
|
|
|
|
|
- union
|
|
|
|
|
|
|
|
- ``parm``
|
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
-
|
|
|
|
-
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 3
|
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
-
|
2016-06-30 21:18:56 +08:00
|
|
|
- struct :ref:`v4l2_captureparm <v4l2-captureparm>`
|
|
|
|
|
|
|
|
- ``capture``
|
|
|
|
|
|
|
|
- Parameters for capture devices, used when ``type`` is
|
2016-07-05 03:25:48 +08:00
|
|
|
``V4L2_BUF_TYPE_VIDEO_CAPTURE``.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 4
|
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
-
|
2016-06-30 21:18:56 +08:00
|
|
|
- struct :ref:`v4l2_outputparm <v4l2-outputparm>`
|
|
|
|
|
|
|
|
- ``output``
|
|
|
|
|
|
|
|
- Parameters for output devices, used when ``type`` is
|
2016-07-05 03:25:48 +08:00
|
|
|
``V4L2_BUF_TYPE_VIDEO_OUTPUT``.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 5
|
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
-
|
2016-06-30 21:18:56 +08:00
|
|
|
- __u8
|
|
|
|
|
2016-07-13 02:20:11 +08:00
|
|
|
- ``raw_data``\ \[200\]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- A place holder for future extensions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _v4l2-captureparm:
|
|
|
|
|
|
|
|
.. flat-table:: struct v4l2_captureparm
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 1 1 2
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``capability``
|
|
|
|
|
|
|
|
- See :ref:`parm-caps`.
|
|
|
|
|
|
|
|
- .. row 2
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``capturemode``
|
|
|
|
|
|
|
|
- Set by drivers and applications, see :ref:`parm-flags`.
|
|
|
|
|
|
|
|
- .. row 3
|
|
|
|
|
|
|
|
- struct :ref:`v4l2_fract <v4l2-fract>`
|
|
|
|
|
|
|
|
- ``timeperframe``
|
|
|
|
|
|
|
|
- This is the desired period between successive frames captured by
|
2016-07-05 03:25:48 +08:00
|
|
|
the driver, in seconds. The field is intended to skip frames on
|
|
|
|
the driver side, saving I/O bandwidth.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
Applications store here the desired frame period, drivers return
|
|
|
|
the actual frame period, which must be greater or equal to the
|
|
|
|
nominal frame period determined by the current video standard
|
|
|
|
(struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
|
|
|
|
field). Changing the video standard (also implicitly by switching
|
|
|
|
the video input) may reset this parameter to the nominal frame
|
|
|
|
period. To reset manually applications can just set this field to
|
|
|
|
zero.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
Drivers support this function only when they set the
|
|
|
|
``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 4
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``extendedmode``
|
|
|
|
|
|
|
|
- Custom (driver specific) streaming parameters. When unused,
|
2016-07-05 03:25:48 +08:00
|
|
|
applications and drivers must set this field to zero. Applications
|
|
|
|
using this field should check the driver name and version, see
|
|
|
|
:ref:`querycap`.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 5
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``readbuffers``
|
|
|
|
|
|
|
|
- Applications set this field to the desired number of buffers used
|
2016-07-05 03:25:48 +08:00
|
|
|
internally by the driver in :ref:`read() <func-read>` mode.
|
|
|
|
Drivers return the actual number of buffers. When an application
|
|
|
|
requests zero buffers, drivers should just return the current
|
|
|
|
setting rather than the minimum or an error code. For details see
|
|
|
|
:ref:`rw`.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 6
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
2016-07-13 02:20:11 +08:00
|
|
|
- ``reserved``\ \[4\]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- Reserved for future extensions. Drivers and applications must set
|
2016-07-05 03:25:48 +08:00
|
|
|
the array to zero.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _v4l2-outputparm:
|
|
|
|
|
|
|
|
.. flat-table:: struct v4l2_outputparm
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 1 1 2
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``capability``
|
|
|
|
|
|
|
|
- See :ref:`parm-caps`.
|
|
|
|
|
|
|
|
- .. row 2
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``outputmode``
|
|
|
|
|
|
|
|
- Set by drivers and applications, see :ref:`parm-flags`.
|
|
|
|
|
|
|
|
- .. row 3
|
|
|
|
|
|
|
|
- struct :ref:`v4l2_fract <v4l2-fract>`
|
|
|
|
|
|
|
|
- ``timeperframe``
|
|
|
|
|
|
|
|
- This is the desired period between successive frames output by the
|
2016-07-05 03:25:48 +08:00
|
|
|
driver, in seconds.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 4
|
|
|
|
|
|
|
|
- :cspan:`2`
|
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
The field is intended to repeat frames on the driver side in
|
|
|
|
:ref:`write() <func-write>` mode (in streaming mode timestamps
|
|
|
|
can be used to throttle the output), saving I/O bandwidth.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
Applications store here the desired frame period, drivers return
|
|
|
|
the actual frame period, which must be greater or equal to the
|
|
|
|
nominal frame period determined by the current video standard
|
|
|
|
(struct :ref:`v4l2_standard <v4l2-standard>` ``frameperiod``
|
|
|
|
field). Changing the video standard (also implicitly by switching
|
|
|
|
the video output) may reset this parameter to the nominal frame
|
|
|
|
period. To reset manually applications can just set this field to
|
|
|
|
zero.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
Drivers support this function only when they set the
|
|
|
|
``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 5
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``extendedmode``
|
|
|
|
|
|
|
|
- Custom (driver specific) streaming parameters. When unused,
|
2016-07-05 03:25:48 +08:00
|
|
|
applications and drivers must set this field to zero. Applications
|
|
|
|
using this field should check the driver name and version, see
|
|
|
|
:ref:`querycap`.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 6
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``writebuffers``
|
|
|
|
|
|
|
|
- Applications set this field to the desired number of buffers used
|
2016-07-05 03:25:48 +08:00
|
|
|
internally by the driver in :ref:`write() <func-write>` mode. Drivers
|
|
|
|
return the actual number of buffers. When an application requests
|
|
|
|
zero buffers, drivers should just return the current setting
|
|
|
|
rather than the minimum or an error code. For details see
|
|
|
|
:ref:`rw`.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 7
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
2016-07-13 02:20:11 +08:00
|
|
|
- ``reserved``\ \[4\]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- Reserved for future extensions. Drivers and applications must set
|
2016-07-05 03:25:48 +08:00
|
|
|
the array to zero.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _parm-caps:
|
|
|
|
|
|
|
|
.. flat-table:: Streaming Parameters Capabilites
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 3 1 4
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- ``V4L2_CAP_TIMEPERFRAME``
|
|
|
|
|
|
|
|
- 0x1000
|
|
|
|
|
|
|
|
- The frame skipping/repeating controlled by the ``timeperframe``
|
2016-07-05 03:25:48 +08:00
|
|
|
field is supported.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _parm-flags:
|
|
|
|
|
|
|
|
.. flat-table:: Capture Parameters Flags
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 3 1 4
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- ``V4L2_MODE_HIGHQUALITY``
|
|
|
|
|
|
|
|
- 0x0001
|
|
|
|
|
|
|
|
- High quality imaging mode. High quality mode is intended for still
|
2016-07-05 03:25:48 +08:00
|
|
|
imaging applications. The idea is to get the best possible image
|
|
|
|
quality that the hardware can deliver. It is not defined how the
|
|
|
|
driver writer may achieve that; it will depend on the hardware and
|
|
|
|
the ingenuity of the driver writer. High quality mode is a
|
|
|
|
different mode from the regular motion video capture modes. In
|
|
|
|
high quality mode:
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
- The driver may be able to capture higher resolutions than for
|
|
|
|
motion capture.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
- The driver may support fewer pixel formats than motion capture
|
|
|
|
(eg; true color).
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
- The driver may capture and arithmetically combine multiple
|
|
|
|
successive fields or frames to remove color edge artifacts and
|
|
|
|
reduce the noise in the video data.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
- The driver may capture images in slices like a scanner in order
|
|
|
|
to handle larger format images than would otherwise be
|
|
|
|
possible.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
- An image capture operation may be significantly slower than
|
|
|
|
motion capture.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
- Moving objects in the image might have excessive motion blur.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
- Capture might only work through the :ref:`read() <func-read>` call.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Return Value
|
2016-06-30 21:18:56 +08:00
|
|
|
============
|
|
|
|
|
|
|
|
On success 0 is returned, on error -1 and the ``errno`` variable is set
|
|
|
|
appropriately. The generic error codes are described at the
|
|
|
|
:ref:`Generic Error Codes <gen-errors>` chapter.
|