The fields of
video_hw_if are described in some more detail below. Some fields are optional and can be set to
NULL if not needed.
int open(void *hdl, int flags)
optional, is called when the video device is opened. It should initialize the hardware for I/O. Every successful call to open is matched by a call to close. Return 0 on success, otherwise an error code.
void close(void *hdl)
optional, is called when the audio device is closed.
const char * get_devname(void *hdl)
mandatory, returns a NUL-terminated string naming the device, e.g. a vendor and product model name.
int enum_format(void *hdl, uint32_t index, struct video_format *format);
mandatory, called with an index from 0 to max_index - 1. Fills format with the format description at that index. Returns 0 on success, otherwise an error code.
int get_format(void *hdl, struct video_format *format)
mandatory, fills format with the current video format. There should be a default format so this function works before and streaming has begun. Returns 0 on success, otherwise an error code.
int set_format(void *hdl, struct video_format *format)
mandatory, sets the format of the video stream based on format. Fills format with the actual format used which may not be the same as requested. Returns 0 on success, otherwise an error code.
int try_format(void *hdl, struct video_format *format)
optional, like set_format but does not actually change the stream format, just checks what is available. Returns 0 on success, otherwise an error code.
int start_transfer(void *hdl)
mandatory, starts the capture of video frames. Incoming video data must be submitted to the video layer with repeated calls to video_submit_payload().
int stop_transfer(void *hdl)
int control_iter_init(void *hdl, struct video_control_iter *)
Does nothing at this time.
int control_iter_next(void *hdl, struct video_control_iter *)
Does nothing at this time.
int get_control_group(void *hdl, struct video_control_group *)
int set_control_group(void *hdl, struct video_control_group *)