7.37. ioctl VIDIOC_G_PARM, VIDIOC_S_PARM¶
7.37.1. Name¶
VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters
7.37.2. Synopsis¶
-
VIDIOC_G_PARM
¶
int ioctl(int fd, VIDIOC_G_PARM, v4l2_streamparm *argp)
-
VIDIOC_S_PARM
¶
int ioctl(int fd, VIDIOC_S_PARM, v4l2_streamparm *argp)
7.37.3. Arguments¶
fd
File descriptor returned by
open()
.argp
Pointer to struct
v4l2_streamparm
.
7.37.4. Description¶
Applications can request a different frame interval. The capture or output device will be reconfigured to support the requested frame interval if possible. Optionally drivers may choose to skip or repeat frames to achieve the requested frame interval.
For stateful encoders (see Memory-to-Memory Stateful Video Encoder Interface) this represents the frame interval that is typically embedded in the encoded video stream.
Changing the frame interval shall never change the format. Changing the format, on the other hand, may change the frame interval.
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 read()
function.
To get and set the streaming parameters applications call the
VIDIOC_G_PARM and
VIDIOC_S_PARM ioctl, respectively. They take a
pointer to a struct v4l2_streamparm
which contains a
union holding separate parameters for input and output devices.
-
v4l2_streamparm
¶
__u32 |
|
The buffer (stream) type, same as struct
|
union { |
|
|
struct |
|
Parameters for capture devices, used when |
struct |
|
Parameters for output devices, used when |
__u8 |
|
A place holder for future extensions. |
} |
-
v4l2_captureparm
¶
__u32 |
|
|
__u32 |
|
Set by drivers and applications, see Capture Parameters Flags. |
struct |
|
This is the desired period between successive frames captured by the driver, in seconds. |
This will configure the speed at which the video source (e.g. a sensor) generates video frames. If the speed is fixed, then the driver may choose to skip or repeat frames in order to achieve the requested frame rate. For stateful encoders (see Memory-to-Memory Stateful Video Encoder Interface) this represents the frame interval that is typically embedded in the encoded video stream. Applications store here the desired frame period, drivers return the actual frame period. 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. Drivers support this function only when they set the
|
||
__u32 |
|
Custom (driver specific) streaming parameters. When unused, applications and drivers must set this field to zero. Applications using this field should check the driver name and version, see Querying Capabilities. |
__u32 |
|
Applications set this field to the desired number of buffers used
internally by the driver in |
__u32 |
|
Reserved for future extensions. Drivers and applications must set the array to zero. |
-
v4l2_outputparm
¶
__u32 |
|
|
__u32 |
|
Set by drivers and applications, see Capture Parameters Flags. |
struct |
|
This is the desired period between successive frames output by the driver, in seconds. |
The field is intended to repeat frames on the driver side in
For stateful encoders (see Memory-to-Memory Stateful Video Encoder Interface) this represents the frame interval that is typically embedded in the encoded video stream and it provides a hint to the encoder of the speed at which raw frames are queued up to the encoder. Applications store here the desired frame period, drivers return the actual frame period. 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. Drivers support this function only when they set the
|
||
__u32 |
|
Custom (driver specific) streaming parameters. When unused, applications and drivers must set this field to zero. Applications using this field should check the driver name and version, see Querying Capabilities. |
__u32 |
|
Applications set this field to the desired number of buffers used
internally by the driver in |
__u32 |
|
Reserved for future extensions. Drivers and applications must set the array to zero. |
|
0x1000 |
The frame period can be modified by setting the |
|
0x0001 |
High quality imaging mode. High quality mode is intended for still 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:
|
7.37.5. Return Value¶
On success 0 is returned, on error -1 and the errno
variable is set
appropriately. The generic error codes are described at the
Generic Error Codes chapter.