Name

VIDIOC_DQEVENT — Dequeue event

Synopsis

int ioctl(int fd,
 int request,
 struct v4l2_event *argp);
 

Arguments

fd

File descriptor returned by open().

request

VIDIOC_DQEVENT

argp

Description

Dequeue an event from a video device. No input is required for this ioctl. All the fields of the struct v4l2_event structure are filled by the driver. The file handle will also receive exceptions which the application may get by e.g. using the select system call.

Table A.12. struct v4l2_event

__u32type Type of the event.
unionu  
 struct v4l2_event_vsyncvsyncEvent data for event V4L2_EVENT_VSYNC.
 struct v4l2_event_ctrlctrlEvent data for event V4L2_EVENT_CTRL.
 struct v4l2_event_frame_syncframe_syncEvent data for event V4L2_EVENT_FRAME_SYNC.
 struct v4l2_event_motion_detmotion_detEvent data for event V4L2_EVENT_MOTION_DET.
 struct v4l2_event_src_changesrc_changeEvent data for event V4L2_EVENT_SOURCE_CHANGE.
 __u8data[64]Event data. Defined by the event type. The union should be used to define easily accessible type for events.
__u32pending Number of pending events excluding this one.
__u32sequence Event sequence number. The sequence number is incremented for every subscribed event that takes place. If sequence numbers are not contiguous it means that events have been lost.
struct timespectimestamp Event timestamp.
u32id The ID associated with the event source. If the event does not have an associated ID (this depends on the event type), then this is 0.
__u32reserved[8] Reserved for future extensions. Drivers must set the array to zero.

Table A.13. struct v4l2_event_vsync

__u8fieldThe upcoming field. See enum v4l2_field.

Table A.14. struct v4l2_event_ctrl

__u32changes A bitmask that tells what has changed. See Table A.18, “Changes”.
__u32type The type of the control. See enum v4l2_ctrl_type.
union (anonymous)   
 __s32valueThe 32-bit value of the control for 32-bit control types. This is 0 for string controls since the value of a string cannot be passed using VIDIOC_DQEVENT.
 __s64value64The 64-bit value of the control for 64-bit control types.
__u32flags The control flags. See Table A.98, “Control Flags”.
__s32minimum The minimum value of the control. See struct v4l2_queryctrl.
__s32maximum The maximum value of the control. See struct v4l2_queryctrl.
__s32step The step value of the control. See struct v4l2_queryctrl.
__s32default_value The default value value of the control. See struct v4l2_queryctrl.

Table A.15. struct v4l2_event_frame_sync

__u32frame_sequence The sequence number of the frame being received.

Table A.16. struct v4l2_event_src_change

__u32changes A bitmask that tells what has changed. See Table A.19, “Source Changes”.

Table A.17. struct v4l2_event_motion_det

__u32flags Currently only one flag is available: if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the frame_sequence field is valid, otherwise that field should be ignored.
__u32frame_sequence The sequence number of the frame being received. Only valid if the V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ flag was set.
__u32region_mask The bitmask of the regions that reported motion. There is at least one region. If this field is 0, then no motion was detected at all. If there is no V4L2_CID_DETECT_MD_REGION_GRID control (see the section called “Detect Control Reference”) to assign a different region to each cell in the motion detection grid, then that all cells are automatically assigned to the default region 0.

Table A.18. Changes

V4L2_EVENT_CTRL_CH_VALUE0x0001This control event was triggered because the value of the control changed. Special case: if a button control is pressed, then this event is sent as well, even though there is not explicit value associated with a button control.
V4L2_EVENT_CTRL_CH_FLAGS0x0002This control event was triggered because the control flags changed.
V4L2_EVENT_CTRL_CH_RANGE0x0004This control event was triggered because the minimum, maximum, step or the default value of the control changed.

Table A.19. Source Changes

V4L2_EVENT_SRC_CH_RESOLUTION0x0001This event gets triggered when a resolution change is detected at an input. This can come from an input connector or from a video decoder.

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.