Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
video.h File Reference

Public APIs for Video. More...

#include <zephyr/device.h>
#include <stddef.h>
#include <zephyr/kernel.h>
#include <zephyr/types.h>
#include <zephyr/drivers/video-controls.h>

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_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))
 
Bayer formats
#define VIDEO_PIX_FMT_BGGR8   video_fourcc('B', 'G', 'G', 'R') /* 8 BGBG.. GRGR.. */
 BGGR8 pixel format.
 
#define VIDEO_PIX_FMT_GBRG8   video_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
 GBRG8 pixel format.
 
#define VIDEO_PIX_FMT_GRBG8   video_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
 GRBG8 pixel format.
 
#define VIDEO_PIX_FMT_RGGB8   video_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
 RGGB8 pixel format.
 
RGB formats
#define VIDEO_PIX_FMT_RGB565   video_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
 RGB565 pixel format.
 
#define VIDEO_PIX_FMT_XRGB32   video_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */
 XRGB32 pixel format.
 
YUV formats
#define VIDEO_PIX_FMT_YUYV   video_fourcc('Y', 'U', 'Y', 'V') /* 16 Y0-Cb0 Y1-Cr0 */
 YUYV pixel format.
 
#define VIDEO_PIX_FMT_XYUV32   video_fourcc('X', 'Y', 'U', 'V') /* 32 XYUV-8-8-8-8 */
 XYUV32 pixel format.
 
JPEG formats
#define VIDEO_PIX_FMT_JPEG   video_fourcc('J', 'P', 'E', 'G') /* 8 JPEG */
 JPEG pixel format.
 

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_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_endpoint_id { VIDEO_EP_NONE , VIDEO_EP_ANY , VIDEO_EP_IN , VIDEO_EP_OUT }
 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_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.
 

Detailed Description

Public APIs for Video.