Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Video Interface

Video Interface . More...

Topics

 Video pixel formats
 
 

Data Structures

struct  video_format
 Video format structure. More...
 
struct  video_format_cap
 Video format capability. More...
 
struct  video_caps
 Video format capabilities. More...
 
struct  video_buffer
 Video buffer structure. More...
 
struct  video_frmival
 Video frame interval structure. More...
 
struct  video_frmival_stepwise
 Video frame interval stepwise structure. More...
 
struct  video_frmival_enum
 Video frame interval enumeration structure. More...
 
struct  video_driver_api
 

Macros

#define LINE_COUNT_HEIGHT   (-1)
 
#define video_fourcc(a, b, c, d)
 

Typedefs

typedef int(* video_api_set_format_t) (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt)
 Set video format.
 
typedef int(* video_api_get_format_t) (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt)
 Get current video format.
 
typedef int(* video_api_set_frmival_t) (const struct device *dev, enum video_endpoint_id ep, struct video_frmival *frmival)
 Set video frame interval.
 
typedef int(* video_api_get_frmival_t) (const struct device *dev, enum video_endpoint_id ep, struct video_frmival *frmival)
 Get current video frame interval.
 
typedef int(* video_api_enum_frmival_t) (const struct device *dev, enum video_endpoint_id ep, struct video_frmival_enum *fie)
 List all supported frame intervals of a given format.
 
typedef int(* video_api_enqueue_t) (const struct device *dev, enum video_endpoint_id ep, struct video_buffer *buf)
 Enqueue a buffer in the driver’s incoming queue.
 
typedef int(* video_api_dequeue_t) (const struct device *dev, enum video_endpoint_id ep, struct video_buffer **buf, k_timeout_t timeout)
 Dequeue a buffer from the driver’s outgoing queue.
 
typedef int(* video_api_flush_t) (const struct device *dev, enum video_endpoint_id ep, bool cancel)
 Flush endpoint buffers, buffer are moved from incoming queue to outgoing queue.
 
typedef int(* video_api_stream_start_t) (const struct device *dev)
 Start the capture or output process.
 
typedef int(* video_api_stream_stop_t) (const struct device *dev)
 Stop the capture or output process.
 
typedef int(* video_api_set_ctrl_t) (const struct device *dev, unsigned int cid, void *value)
 Set a video control value.
 
typedef int(* video_api_get_ctrl_t) (const struct device *dev, unsigned int cid, void *value)
 Get a video control value.
 
typedef int(* video_api_get_caps_t) (const struct device *dev, enum video_endpoint_id ep, struct video_caps *caps)
 Get capabilities of a video endpoint.
 
typedef int(* video_api_set_signal_t) (const struct device *dev, enum video_endpoint_id ep, struct k_poll_signal *signal)
 Register/Unregister poll signal for buffer events.
 

Enumerations

enum  video_frmival_type { VIDEO_FRMIVAL_TYPE_DISCRETE = 1 , VIDEO_FRMIVAL_TYPE_STEPWISE = 2 }
 video_frmival_type enum More...
 
enum  video_endpoint_id { VIDEO_EP_NONE = -1 , VIDEO_EP_ALL = -2 , VIDEO_EP_IN = -3 , VIDEO_EP_OUT = -4 }
 video_endpoint_id enum More...
 
enum  video_signal_result { VIDEO_BUF_DONE , VIDEO_BUF_ABORTED , VIDEO_BUF_ERROR }
 video_event enum More...
 

Functions

static int video_set_format (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt)
 Set video format.
 
static int video_get_format (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt)
 Get video format.
 
static int video_set_frmival (const struct device *dev, enum video_endpoint_id ep, struct video_frmival *frmival)
 Set video frame interval.
 
static int video_get_frmival (const struct device *dev, enum video_endpoint_id ep, struct video_frmival *frmival)
 Get video frame interval.
 
static int video_enum_frmival (const struct device *dev, enum video_endpoint_id ep, struct video_frmival_enum *fie)
 List video frame intervals.
 
static int video_enqueue (const struct device *dev, enum video_endpoint_id ep, struct video_buffer *buf)
 Enqueue a video buffer.
 
static int video_dequeue (const struct device *dev, enum video_endpoint_id ep, struct video_buffer **buf, k_timeout_t timeout)
 Dequeue a video buffer.
 
static int video_flush (const struct device *dev, enum video_endpoint_id ep, bool cancel)
 Flush endpoint buffers.
 
static int video_stream_start (const struct device *dev)
 Start the video device function.
 
static int video_stream_stop (const struct device *dev)
 Stop the video device function.
 
static int video_get_caps (const struct device *dev, enum video_endpoint_id ep, struct video_caps *caps)
 Get the capabilities of a video endpoint.
 
static int video_set_ctrl (const struct device *dev, unsigned int cid, void *value)
 Set the value of a control.
 
static int video_get_ctrl (const struct device *dev, unsigned int cid, void *value)
 Get the current value of a control.
 
static int video_set_signal (const struct device *dev, enum video_endpoint_id ep, struct k_poll_signal *signal)
 Register/Unregister k_poll signal for a video endpoint.
 
struct video_buffervideo_buffer_aligned_alloc (size_t size, size_t align)
 Allocate aligned video buffer.
 
struct video_buffervideo_buffer_alloc (size_t size)
 Allocate video buffer.
 
void video_buffer_release (struct video_buffer *buf)
 Release a video buffer.
 
static unsigned int video_pix_fmt_bpp (uint32_t pixfmt)
 Get number of bytes per pixel of a pixel format.
 

Detailed Description

Video Interface .

Since
2.1
Version
1.0.0

Macro Definition Documentation

◆ LINE_COUNT_HEIGHT

#define LINE_COUNT_HEIGHT   (-1)

◆ video_fourcc

#define video_fourcc ( a,
b,
c,
d )

#include <zephyr/drivers/video.h>

Value:
((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
irp nz macro MOVR cc d
Definition asm-macro-32-bit-gnu.h:11
__UINT32_TYPE__ uint32_t
Definition stdint.h:90

Typedef Documentation

◆ video_api_dequeue_t

typedef int(* video_api_dequeue_t) (const struct device *dev, enum video_endpoint_id ep, struct video_buffer **buf, k_timeout_t timeout)

#include <zephyr/drivers/video.h>

Dequeue a buffer from the driver’s outgoing queue.

See video_dequeue() for argument descriptions.

◆ video_api_enqueue_t

typedef int(* video_api_enqueue_t) (const struct device *dev, enum video_endpoint_id ep, struct video_buffer *buf)

#include <zephyr/drivers/video.h>

Enqueue a buffer in the driver’s incoming queue.

See video_enqueue() for argument descriptions.

◆ video_api_enum_frmival_t

typedef int(* video_api_enum_frmival_t) (const struct device *dev, enum video_endpoint_id ep, struct video_frmival_enum *fie)

#include <zephyr/drivers/video.h>

List all supported frame intervals of a given format.

See video_enum_frmival() for argument descriptions.

◆ video_api_flush_t

typedef int(* video_api_flush_t) (const struct device *dev, enum video_endpoint_id ep, bool cancel)

#include <zephyr/drivers/video.h>

Flush endpoint buffers, buffer are moved from incoming queue to outgoing queue.

See video_flush() for argument descriptions.

◆ video_api_get_caps_t

typedef int(* video_api_get_caps_t) (const struct device *dev, enum video_endpoint_id ep, struct video_caps *caps)

#include <zephyr/drivers/video.h>

Get capabilities of a video endpoint.

See video_get_caps() for argument descriptions.

◆ video_api_get_ctrl_t

typedef int(* video_api_get_ctrl_t) (const struct device *dev, unsigned int cid, void *value)

#include <zephyr/drivers/video.h>

Get a video control value.

See video_get_ctrl() for argument descriptions.

◆ video_api_get_format_t

typedef int(* video_api_get_format_t) (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt)

#include <zephyr/drivers/video.h>

Get current video format.

See video_get_format() for argument descriptions.

◆ video_api_get_frmival_t

typedef int(* video_api_get_frmival_t) (const struct device *dev, enum video_endpoint_id ep, struct video_frmival *frmival)

#include <zephyr/drivers/video.h>

Get current video frame interval.

See video_get_frmival() for argument descriptions.

◆ video_api_set_ctrl_t

typedef int(* video_api_set_ctrl_t) (const struct device *dev, unsigned int cid, void *value)

#include <zephyr/drivers/video.h>

Set a video control value.

See video_set_ctrl() for argument descriptions.

◆ video_api_set_format_t

typedef int(* video_api_set_format_t) (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt)

#include <zephyr/drivers/video.h>

Set video format.

See video_set_format() for argument descriptions.

◆ video_api_set_frmival_t

typedef int(* video_api_set_frmival_t) (const struct device *dev, enum video_endpoint_id ep, struct video_frmival *frmival)

#include <zephyr/drivers/video.h>

Set video frame interval.

See video_set_frmival() for argument descriptions.

◆ video_api_set_signal_t

typedef int(* video_api_set_signal_t) (const struct device *dev, enum video_endpoint_id ep, struct k_poll_signal *signal)

#include <zephyr/drivers/video.h>

Register/Unregister poll signal for buffer events.

See video_set_signal() for argument descriptions.

◆ video_api_stream_start_t

typedef int(* video_api_stream_start_t) (const struct device *dev)

#include <zephyr/drivers/video.h>

Start the capture or output process.

See video_stream_start() for argument descriptions.

◆ video_api_stream_stop_t

typedef int(* video_api_stream_stop_t) (const struct device *dev)

#include <zephyr/drivers/video.h>

Stop the capture or output process.

See video_stream_stop() for argument descriptions.

Enumeration Type Documentation

◆ video_endpoint_id

#include <zephyr/drivers/video.h>

video_endpoint_id enum

Identify the video device endpoint.

Enumerator
VIDEO_EP_NONE 

Targets some part of the video device not bound to an endpoint.

VIDEO_EP_ALL 

Targets all input or output endpoints of the device.

VIDEO_EP_IN 

Targets all input endpoints of the device: those consuming data.

VIDEO_EP_OUT 

Targets all output endpoints of the device: those producing data.

◆ video_frmival_type

#include <zephyr/drivers/video.h>

video_frmival_type enum

Supported frame interval type of a video device.

Enumerator
VIDEO_FRMIVAL_TYPE_DISCRETE 

discrete frame interval type

VIDEO_FRMIVAL_TYPE_STEPWISE 

stepwise frame interval type

◆ video_signal_result

#include <zephyr/drivers/video.h>

video_event enum

Identify video event.

Enumerator
VIDEO_BUF_DONE 
VIDEO_BUF_ABORTED 
VIDEO_BUF_ERROR 

Function Documentation

◆ video_buffer_aligned_alloc()

struct video_buffer * video_buffer_aligned_alloc ( size_t size,
size_t align )

#include <zephyr/drivers/video.h>

Allocate aligned video buffer.

Parameters
sizeSize of the video buffer (in bytes).
alignAlignment of the requested memory, must be a power of two.
Return values
pointerto allocated video buffer

◆ video_buffer_alloc()

struct video_buffer * video_buffer_alloc ( size_t size)

#include <zephyr/drivers/video.h>

Allocate video buffer.

Parameters
sizeSize of the video buffer (in bytes).
Return values
pointerto allocated video buffer

◆ video_buffer_release()

void video_buffer_release ( struct video_buffer * buf)

#include <zephyr/drivers/video.h>

Release a video buffer.

Parameters
bufPointer to the video buffer to release.

◆ video_dequeue()

static int video_dequeue ( const struct device * dev,
enum video_endpoint_id ep,
struct video_buffer ** buf,
k_timeout_t timeout )
inlinestatic

#include <zephyr/drivers/video.h>

Dequeue a video buffer.

Dequeue a filled (capturing) or displayed (output) buffer from the driver’s endpoint outgoing queue.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
bufPointer a video buffer pointer.
timeoutTimeout
Return values
0Is successful.
-EINVALIf parameters are invalid.
-EIOGeneral input / output error.

◆ video_enqueue()

static int video_enqueue ( const struct device * dev,
enum video_endpoint_id ep,
struct video_buffer * buf )
inlinestatic

#include <zephyr/drivers/video.h>

Enqueue a video buffer.

Enqueue an empty (capturing) or filled (output) video buffer in the driver’s endpoint incoming queue.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
bufPointer to the video buffer.
Return values
0Is successful.
-EINVALIf parameters are invalid.
-EIOGeneral input / output error.

◆ video_enum_frmival()

static int video_enum_frmival ( const struct device * dev,
enum video_endpoint_id ep,
struct video_frmival_enum * fie )
inlinestatic

#include <zephyr/drivers/video.h>

List video frame intervals.

List all supported video frame intervals of a given format.

Applications should fill the pixelformat, width and height fields of the video_frmival_enum struct first to form a query. Then, the index field is used to iterate through the supported frame intervals list.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
fiePointer to a video frame interval enumeration struct.
Return values
0If successful.
-ENOSYSIf API is not implemented.
-EINVALIf parameters are invalid.
-EIOGeneral input / output error.

◆ video_flush()

static int video_flush ( const struct device * dev,
enum video_endpoint_id ep,
bool cancel )
inlinestatic

#include <zephyr/drivers/video.h>

Flush endpoint buffers.

A call to flush finishes when all endpoint buffers have been moved from incoming queue to outgoing queue. Either because canceled or fully processed through the video function.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
cancelIf true, cancel buffer processing instead of waiting for completion.
Return values
0Is successful, -ERRNO code otherwise.

◆ video_get_caps()

static int video_get_caps ( const struct device * dev,
enum video_endpoint_id ep,
struct video_caps * caps )
inlinestatic

#include <zephyr/drivers/video.h>

Get the capabilities of a video endpoint.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
capsPointer to the video_caps struct to fill.
Return values
0Is successful, -ERRNO code otherwise.

◆ video_get_ctrl()

static int video_get_ctrl ( const struct device * dev,
unsigned int cid,
void * value )
inlinestatic

#include <zephyr/drivers/video.h>

Get the current value of a control.

This retrieve the value of a video control, value type depends on control ID, and must be interpreted accordingly.

Parameters
devPointer to the device structure for the driver instance.
cidControl ID.
valuePointer to the control value.
Return values
0Is successful.
-EINVALIf parameters are invalid.
-ENOTSUPIf format is not supported.
-EIOGeneral input / output error.

◆ video_get_format()

static int video_get_format ( const struct device * dev,
enum video_endpoint_id ep,
struct video_format * fmt )
inlinestatic

#include <zephyr/drivers/video.h>

Get video format.

Get video device current video format.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
fmtPointer to video format struct.
Return values
pointerto video format

◆ video_get_frmival()

static int video_get_frmival ( const struct device * dev,
enum video_endpoint_id ep,
struct video_frmival * frmival )
inlinestatic

#include <zephyr/drivers/video.h>

Get video frame interval.

Get current frame interval of the video device.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
frmivalPointer to a video frame interval struct.
Return values
0If successful.
-ENOSYSIf API is not implemented.
-EINVALIf parameters are invalid.
-EIOGeneral input / output error.

◆ video_pix_fmt_bpp()

static unsigned int video_pix_fmt_bpp ( uint32_t pixfmt)
inlinestatic

#include <zephyr/drivers/video.h>

Get number of bytes per pixel of a pixel format.

Parameters
pixfmtFourCC pixel format value (Video pixel formats).

◆ video_set_ctrl()

static int video_set_ctrl ( const struct device * dev,
unsigned int cid,
void * value )
inlinestatic

#include <zephyr/drivers/video.h>

Set the value of a control.

This set the value of a video control, value type depends on control ID, and must be interpreted accordingly.

Parameters
devPointer to the device structure for the driver instance.
cidControl ID.
valuePointer to the control value.
Return values
0Is successful.
-EINVALIf parameters are invalid.
-ENOTSUPIf format is not supported.
-EIOGeneral input / output error.

◆ video_set_format()

static int video_set_format ( const struct device * dev,
enum video_endpoint_id ep,
struct video_format * fmt )
inlinestatic

#include <zephyr/drivers/video.h>

Set video format.

Configure video device with a specific format.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
fmtPointer to a video format struct.
Return values
0Is successful.
-EINVALIf parameters are invalid.
-ENOTSUPIf format is not supported.
-EIOGeneral input / output error.

◆ video_set_frmival()

static int video_set_frmival ( const struct device * dev,
enum video_endpoint_id ep,
struct video_frmival * frmival )
inlinestatic

#include <zephyr/drivers/video.h>

Set video frame interval.

Configure video device with a specific frame interval.

Drivers must not return an error solely because the requested interval doesn’t match the device capabilities. They must instead modify the interval to match what the hardware can provide.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
frmivalPointer to a video frame interval struct.
Return values
0If successful.
-ENOSYSIf API is not implemented.
-EINVALIf parameters are invalid.
-EIOGeneral input / output error.

◆ video_set_signal()

static int video_set_signal ( const struct device * dev,
enum video_endpoint_id ep,
struct k_poll_signal * signal )
inlinestatic

#include <zephyr/drivers/video.h>

Register/Unregister k_poll signal for a video endpoint.

Register a poll signal to the endpoint, which will be signaled on frame completion (done, aborted, error). Registering a NULL poll signal unregisters any previously registered signal.

Parameters
devPointer to the device structure for the driver instance.
epEndpoint ID.
signalPointer to k_poll_signal
Return values
0Is successful, -ERRNO code otherwise.

◆ video_stream_start()

static int video_stream_start ( const struct device * dev)
inlinestatic

#include <zephyr/drivers/video.h>

Start the video device function.

video_stream_start is called to enter ‘streaming’ state (capture, output...). The driver may receive buffers with video_enqueue() before video_stream_start is called. If driver/device needs a minimum number of buffers before being able to start streaming, then driver set the min_vbuf_count to the related endpoint capabilities.

Return values
0Is successful.
-EIOGeneral input / output error.

◆ video_stream_stop()

static int video_stream_stop ( const struct device * dev)
inlinestatic

#include <zephyr/drivers/video.h>

Stop the video device function.

On video_stream_stop, driver must stop any transactions or wait until they finish.

Return values
0Is successful.
-EIOGeneral input / output error.