Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
|
|
4.1.99 |
Public APIs for Video. More...
Go to the source code of this file.
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) |
Four-character-code uniquely identifying the pixel format. | |
#define | VIDEO_FOURCC_FROM_STR(str) |
Convert a four-character-string to a four-character-code. | |
#define | VIDEO_FOURCC_TO_STR(fourcc) |
Convert a four-character-code to a four-character-string. | |
Bayer formats (R, G, B channels). | |
The full color information is spread over multiple pixels. When the format includes more than 8-bit per pixel, a strategy becomes needed to pack the bits over multiple bytes, as illustrated for each format. The number above the 'R', 'r', 'G', 'g', 'B', 'b' are hints about which pixel number the following bits belong to. | |
#define | VIDEO_PIX_FMT_BGGR8 VIDEO_FOURCC('B', 'A', '8', '1') |
#define | VIDEO_PIX_FMT_GBRG8 VIDEO_FOURCC('G', 'B', 'R', 'G') |
#define | VIDEO_PIX_FMT_GRBG8 VIDEO_FOURCC('G', 'R', 'B', 'G') |
#define | VIDEO_PIX_FMT_RGGB8 VIDEO_FOURCC('R', 'G', 'G', 'B') |
#define | VIDEO_PIX_FMT_SBGGR10P VIDEO_FOURCC('p', 'B', 'A', 'A') |
#define | VIDEO_PIX_FMT_SGBRG10P VIDEO_FOURCC('p', 'G', 'A', 'A') |
#define | VIDEO_PIX_FMT_SGRBG10P VIDEO_FOURCC('p', 'g', 'A', 'A') |
#define | VIDEO_PIX_FMT_SRGGB10P VIDEO_FOURCC('p', 'R', 'A', 'A') |
#define | VIDEO_PIX_FMT_SBGGR12P VIDEO_FOURCC('p', 'B', 'C', 'C') |
#define | VIDEO_PIX_FMT_SGBRG12P VIDEO_FOURCC('p', 'G', 'C', 'C') |
#define | VIDEO_PIX_FMT_SGRBG12P VIDEO_FOURCC('p', 'g', 'C', 'C') |
#define | VIDEO_PIX_FMT_SRGGB12P VIDEO_FOURCC('p', 'R', 'C', 'C') |
#define | VIDEO_PIX_FMT_SBGGR14P VIDEO_FOURCC('p', 'B', 'E', 'E') |
#define | VIDEO_PIX_FMT_SGBRG14P VIDEO_FOURCC('p', 'G', 'E', 'E') |
#define | VIDEO_PIX_FMT_SGRBG14P VIDEO_FOURCC('p', 'g', 'E', 'E') |
#define | VIDEO_PIX_FMT_SRGGB14P VIDEO_FOURCC('p', 'R', 'E', 'E') |
Grayscale formats | |
Luminance (Y) channel only, in various bit depth and packing. When the format includes more than 8-bit per pixel, a strategy becomes needed to pack the bits over multiple bytes, as illustrated for each format. The number above the 'Y', 'y' are hints about which pixel number the following bits belong to. | |
#define | VIDEO_PIX_FMT_GREY VIDEO_FOURCC('G', 'R', 'E', 'Y') |
Same as Y8 (8-bit luma-only) following the standard FOURCC naming, or L8 in some graphics libraries. | |
#define | VIDEO_PIX_FMT_Y10P VIDEO_FOURCC('Y', '1', '0', 'P') |
#define | VIDEO_PIX_FMT_Y12P VIDEO_FOURCC('Y', '1', '2', 'P') |
#define | VIDEO_PIX_FMT_Y14P VIDEO_FOURCC('Y', '1', '4', 'P') |
RGB formats | |
Per-color (R, G, B) channels. | |
#define | VIDEO_PIX_FMT_RGB565X VIDEO_FOURCC('R', 'G', 'B', 'R') |
5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0]. | |
#define | VIDEO_PIX_FMT_RGB565 VIDEO_FOURCC('R', 'G', 'B', 'P') |
5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0]. | |
#define | VIDEO_PIX_FMT_XRGB32 VIDEO_FOURCC('B', 'X', '2', '4') |
The first byte is empty (X) for each pixel. | |
YUV formats | |
Luminance (Y) and chrominance (U, V) channels. | |
#define | VIDEO_PIX_FMT_YUYV VIDEO_FOURCC('Y', 'U', 'Y', 'V') |
There is either a missing channel per pixel, U or V. | |
#define | VIDEO_PIX_FMT_XYUV32 VIDEO_FOURCC('X', 'Y', 'U', 'V') |
The first byte is empty (X) for each pixel. | |
Compressed formats | |
#define | VIDEO_PIX_FMT_JPEG VIDEO_FOURCC('J', 'P', 'E', 'G') |
Both JPEG (single frame) and Motion-JPEG (MJPEG, multiple JPEG frames concatenated) | |
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_set_stream_t) (const struct device *dev, bool enable) |
Start or stop streaming on the video device. | |
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_buffer * | video_buffer_aligned_alloc (size_t size, size_t align, k_timeout_t timeout) |
Allocate aligned video buffer. | |
struct video_buffer * | video_buffer_alloc (size_t size, k_timeout_t timeout) |
Allocate video buffer. | |
void | video_buffer_release (struct video_buffer *buf) |
Release a video buffer. | |
int | video_format_caps_index (const struct video_format_cap *fmts, const struct video_format *fmt, size_t *idx) |
Search for a format that matches in a list of capabilities. | |
static uint64_t | video_frmival_nsec (const struct video_frmival *frmival) |
Compute the difference between two frame intervals. | |
void | video_closest_frmival_stepwise (const struct video_frmival_stepwise *stepwise, const struct video_frmival *desired, struct video_frmival *match) |
Find the closest match to a frame interval value within a stepwise frame interval. | |
void | video_closest_frmival (const struct device *dev, enum video_endpoint_id ep, struct video_frmival_enum *match) |
Find the closest match to a frame interval value within a video device. | |
static unsigned int | video_bits_per_pixel (uint32_t pixfmt) |
Get number of bits per pixel of a pixel format. | |
Public APIs for Video.