Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Video Interface. More...
Data Structures | |
struct | video_format |
video format structure More... | |
struct | video_format_cap |
video format capability More... | |
struct | video_caps |
video capabilities More... | |
struct | video_buffer |
video buffer structure More... | |
struct | video_driver_api |
Macros | |
#define | video_fourcc(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) |
#define | VIDEO_PIX_FMT_BGGR8 video_fourcc('B', 'G', 'G', 'R') /* 8 BGBG.. GRGR.. */ |
#define | VIDEO_PIX_FMT_GBRG8 video_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
#define | VIDEO_PIX_FMT_GRBG8 video_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ |
#define | VIDEO_PIX_FMT_RGGB8 video_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ |
#define | VIDEO_PIX_FMT_RGB565 video_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ |
#define | VIDEO_PIX_FMT_JPEG video_fourcc('J', 'P', 'E', 'G') /* 8 JPEG */ |
#define | VIDEO_PIX_FMT_YUYV video_fourcc('Y', 'U', 'Y', 'V') /* 16 YUYV */ |
#define | VIDEO_PIX_FMT_YVYU video_fourcc('Y', 'V', 'Y', 'U') /* 16 YVYU */ |
#define | VIDEO_PIX_FMT_VYVU video_fourcc('V', 'Y', 'V', 'U') /* 16 VYVU */ |
#define | VIDEO_PIX_FMT_UYVY video_fourcc('U', 'Y', 'V', 'Y') /* 16 UYVY */ |
Typedefs | |
typedef int(* | video_api_set_format_t) (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt) |
Set video format See video_set_format() for argument descriptions. More... | |
typedef int(* | video_api_get_format_t) (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt) |
get current video format See video_get_format() for argument descriptions. More... | |
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. See video_enqueue() for argument descriptions. More... | |
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. See video_dequeue() for argument descriptions. More... | |
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. See video_flush() for argument descriptions. More... | |
typedef int(* | video_api_stream_start_t) (const struct device *dev) |
Start the capture or output process. See video_stream_start() for argument descriptions. More... | |
typedef int(* | video_api_stream_stop_t) (const struct device *dev) |
Stop the capture or output process. See video_stream_stop() for argument descriptions. More... | |
typedef int(* | video_api_set_ctrl_t) (const struct device *dev, unsigned int cid, void *value) |
set a video control value. See video_set_ctrl() for argument descriptions. More... | |
typedef int(* | video_api_get_ctrl_t) (const struct device *dev, unsigned int cid, void *value) |
get a video control value. See video_get_ctrl() for argument descriptions. More... | |
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. See video_get_caps() for argument descriptions. More... | |
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. See video_set_signal() for argument descriptions. More... | |
Enumerations | |
enum | video_endpoint_id { VIDEO_EP_NONE , VIDEO_EP_ANY , VIDEO_EP_IN , VIDEO_EP_OUT } |
video_endpoint_id enum Identify the video device endpoint. More... | |
enum | video_signal_result { VIDEO_BUF_DONE , VIDEO_BUF_ABORTED , VIDEO_BUF_ERROR } |
video_event enum Identify video event. More... | |
Functions | |
static int | video_set_format (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt) |
Set video format. More... | |
static int | video_get_format (const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt) |
Get video format. More... | |
static int | video_enqueue (const struct device *dev, enum video_endpoint_id ep, struct video_buffer *buf) |
Enqueue a video buffer. More... | |
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. More... | |
static int | video_flush (const struct device *dev, enum video_endpoint_id ep, bool cancel) |
Flush endpoint buffers. More... | |
static int | video_stream_start (const struct device *dev) |
Start the video device function. More... | |
static int | video_stream_stop (const struct device *dev) |
Stop the video device function. More... | |
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. More... | |
static int | video_set_ctrl (const struct device *dev, unsigned int cid, void *value) |
Set the value of a control. More... | |
static int | video_get_ctrl (const struct device *dev, unsigned int cid, void *value) |
Get the current value of a control. More... | |
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. More... | |
struct video_buffer * | video_buffer_alloc (size_t size) |
Allocate video buffer. More... | |
void | video_buffer_release (struct video_buffer *buf) |
Release a video buffer. More... | |
Video Interface.
#define video_fourcc | ( | a, | |
b, | |||
c, | |||
d | |||
) | ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_BGGR8 video_fourcc('B', 'G', 'G', 'R') /* 8 BGBG.. GRGR.. */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_GBRG8 video_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_GRBG8 video_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_JPEG video_fourcc('J', 'P', 'E', 'G') /* 8 JPEG */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_RGB565 video_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_RGGB8 video_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_UYVY video_fourcc('U', 'Y', 'V', 'Y') /* 16 UYVY */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_VYVU video_fourcc('V', 'Y', 'V', 'U') /* 16 VYVU */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_YUYV video_fourcc('Y', 'U', 'Y', 'V') /* 16 YUYV */ |
#include <include/drivers/video.h>
#define VIDEO_PIX_FMT_YVYU video_fourcc('Y', 'V', 'Y', 'U') /* 16 YVYU */ |
#include <include/drivers/video.h>
video_api_dequeue_t |
#include <include/drivers/video.h>
Dequeue a buffer from the driver’s outgoing queue. See video_dequeue() for argument descriptions.
video_api_enqueue_t |
#include <include/drivers/video.h>
Enqueue a buffer in the driver’s incoming queue. See video_enqueue() for argument descriptions.
video_api_flush_t |
#include <include/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 |
#include <include/drivers/video.h>
Get capabilities of a video endpoint. See video_get_caps() for argument descriptions.
video_api_get_ctrl_t |
#include <include/drivers/video.h>
get a video control value. See video_get_ctrl() for argument descriptions.
video_api_get_format_t |
#include <include/drivers/video.h>
get current video format See video_get_format() for argument descriptions.
video_api_set_ctrl_t |
#include <include/drivers/video.h>
set a video control value. See video_set_ctrl() for argument descriptions.
video_api_set_format_t |
#include <include/drivers/video.h>
Set video format See video_set_format() for argument descriptions.
video_api_set_signal_t |
#include <include/drivers/video.h>
Register/Unregister poll signal for buffer events. See video_set_signal() for argument descriptions.
video_api_stream_start_t |
#include <include/drivers/video.h>
Start the capture or output process. See video_stream_start() for argument descriptions.
video_api_stream_stop_t |
#include <include/drivers/video.h>
Stop the capture or output process. See video_stream_stop() for argument descriptions.
enum video_endpoint_id |
#include <include/drivers/video.h>
video_endpoint_id enum Identify the video device endpoint.
Enumerator | |
---|---|
VIDEO_EP_NONE | |
VIDEO_EP_ANY | |
VIDEO_EP_IN | |
VIDEO_EP_OUT |
enum video_signal_result |
#include <include/drivers/video.h>
video_event enum Identify video event.
Enumerator | |
---|---|
VIDEO_BUF_DONE | |
VIDEO_BUF_ABORTED | |
VIDEO_BUF_ERROR |
struct video_buffer * video_buffer_alloc | ( | size_t | size | ) |
#include <include/drivers/video.h>
Allocate video buffer.
size | Size of the video buffer. |
pointer | to allocated video buffer |
void video_buffer_release | ( | struct video_buffer * | buf | ) |
#include <include/drivers/video.h>
Release a video buffer.
buf | Pointer to the video buffer to release. |
|
inlinestatic |
#include <include/drivers/video.h>
Dequeue a video buffer.
Dequeue a filled (capturing) or displayed (output) buffer from the driver’s enpoint outgoing queue.
dev | Pointer to the device structure for the driver instance. |
ep | Endpoint ID. |
buf | Pointer a video buffer pointer. |
timeout | Timeout |
0 | Is successful. |
-EINVAL | If parameters are invalid. |
-EIO | General input / output error. |
|
inlinestatic |
#include <include/drivers/video.h>
Enqueue a video buffer.
Enqueue an empty (capturing) or filled (output) video buffer in the driver’s endpoint incoming queue.
dev | Pointer to the device structure for the driver instance. |
ep | Endpoint ID. |
buf | Pointer to the video buffer. |
0 | Is successful. |
-EINVAL | If parameters are invalid. |
-EIO | General input / output error. |
|
inlinestatic |
#include <include/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.
dev | Pointer to the device structure for the driver instance. |
ep | Endpoint ID. |
cancel | If true, cancel buffer processing instead of waiting for completion. |
0 | Is successful, -ERRNO code otherwise. |
|
inlinestatic |
#include <include/drivers/video.h>
Get the capabilities of a video endpoint.
dev | Pointer to the device structure for the driver instance. |
ep | Endpoint ID. |
caps | Pointer to the video_caps struct to fill. |
0 | Is successful, -ERRNO code otherwise. |
|
inlinestatic |
#include <include/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.
dev | Pointer to the device structure for the driver instance. |
cid | Control ID. |
value | Pointer to the control value. |
0 | Is successful. |
-EINVAL | If parameters are invalid. |
-ENOTSUP | If format is not supported. |
-EIO | General input / output error. |
|
inlinestatic |
#include <include/drivers/video.h>
Get video format.
Get video device current video format.
dev | Pointer to the device structure for the driver instance. |
ep | Endpoint ID. |
fmt | Pointer to video format struct. |
pointer | to video format |
|
inlinestatic |
#include <include/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.
dev | Pointer to the device structure for the driver instance. |
cid | Control ID. |
value | Pointer to the control value. |
0 | Is successful. |
-EINVAL | If parameters are invalid. |
-ENOTSUP | If format is not supported. |
-EIO | General input / output error. |
|
inlinestatic |
#include <include/drivers/video.h>
Set video format.
Configure video device with a specific format.
dev | Pointer to the device structure for the driver instance. |
ep | Endpoint ID. |
fmt | Pointer to a video format struct. |
0 | Is successful. |
-EINVAL | If parameters are invalid. |
-ENOTSUP | If format is not supported. |
-EIO | General input / output error. |
|
inlinestatic |
#include <include/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.
dev | Pointer to the device structure for the driver instance. |
ep | Endpoint ID. |
signal | Pointer to k_poll_signal |
0 | Is successful, -ERRNO code otherwise. |
|
inlinestatic |
#include <include/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.
0 | Is successful. |
-EIO | General input / output error. |
|
inlinestatic |
#include <include/drivers/video.h>
Stop the video device function.
On video_stream_stop, driver must stop any transactions or wait until they finish.
0 | Is successful. |
-EIO | General input / output error. |