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

Main header file for video driver API. More...

#include <stddef.h>
#include <stdint.h>
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/dlist.h>
#include <zephyr/types.h>
#include <zephyr/video/video.h>

Go to the source code of this file.

Data Structures

struct  video_device
 Storage type for a wrapper type around a video device. More...
struct  video_ctrl
 Storage type for video controls. More...
struct  video_driver_api
 @driver_ops{Video} More...

Macros

#define VIDEO_CTRL_FLAG_READ_ONLY   BIT(0)
 Control is read-only.
#define VIDEO_CTRL_FLAG_WRITE_ONLY   BIT(1)
 Control is write-only.
#define VIDEO_CTRL_FLAG_VOLATILE   BIT(2)
 Control that needs a freshly read as constantly updated by HW.
#define VIDEO_CTRL_FLAG_INACTIVE   BIT(3)
 Control is inactive, e.g.
#define VIDEO_CTRL_FLAG_UPDATE   BIT(4)
 Control that affects other controls, e.g.

Typedefs

typedef int(* video_api_format_t) (const struct device *dev, struct video_format *fmt)
 @def_driverbackendgroup{Video,video_interface}
typedef int(* video_api_frmival_t) (const struct device *dev, struct video_frmival *frmival)
 Callback API to set or get video frame interval.
typedef int(* video_api_enum_frmival_t) (const struct device *dev, struct video_frmival_enum *fie)
 Callback API to enumerate supported frame intervals for a format.
typedef int(* video_api_enqueue_t) (const struct device *dev, struct video_buffer *buf)
 Callback API to enqueue a buffer in the driver incoming queue.
typedef int(* video_api_dequeue_t) (const struct device *dev, struct video_buffer **buf, k_timeout_t timeout)
 Callback API to dequeue a buffer from the driver outgoing queue.
typedef int(* video_api_flush_t) (const struct device *dev, bool cancel)
 Callback API to flush endpoint buffers.
typedef int(* video_api_set_stream_t) (const struct device *dev, bool enable, enum video_buf_type type)
 Callback API to control stream status.
typedef int(* video_api_ctrl_t) (const struct device *dev, uint32_t cid)
 Callback API to set or get a video control value.
typedef int(* video_api_get_caps_t) (const struct device *dev, struct video_caps *caps)
 Callback API to get capabilities of a video endpoint.
typedef int(* video_api_transform_cap_t) (const struct device *const dev, const struct video_format_cap *const cap, struct video_format_cap *const res_cap, enum video_buf_type type, uint16_t ind)
 Callback API to transform a format capability across m2m device endpoints.
typedef int(* video_api_set_signal_t) (const struct device *dev, struct k_poll_signal *sig)
 Callback API to register or unregister poll signal for buffer events.
typedef int(* video_api_selection_t) (const struct device *dev, struct video_selection *sel)
 Callback API to set or get video selection (crop/compose).

Enumerations

enum  video_ctrl_type {
  VIDEO_CTRL_TYPE_BOOLEAN = 1 , VIDEO_CTRL_TYPE_INTEGER = 2 , VIDEO_CTRL_TYPE_INTEGER64 = 3 , VIDEO_CTRL_TYPE_MENU = 4 ,
  VIDEO_CTRL_TYPE_STRING = 5 , VIDEO_CTRL_TYPE_INTEGER_MENU = 6
}
 Type of video control. More...

Functions

struct video_devicevideo_find_vdev (const struct device *dev)
 Find the video_device associated with a video device.
static int video_driver_set_format (const struct device *dev, struct video_format *fmt)
 Set video format of a driver.
static int video_driver_get_format (const struct device *dev, struct video_format *fmt)
 Get video format of a driver.
static int video_driver_set_frmival (const struct device *dev, struct video_frmival *frmival)
 Apply a video frame interval to a driver.
static int video_driver_get_frmival (const struct device *dev, struct video_frmival *frmival)
 Get video frame interval of a driver.
static int video_driver_enum_frmival (const struct device *dev, struct video_frmival_enum *fie)
 List video frame intervals.
static int video_driver_enqueue (const struct device *dev, struct video_buffer *vbuf)
 Pass a video buffer to a driver.
static int video_driver_dequeue (const struct device *dev, struct video_buffer **vbuf, k_timeout_t timeout)
 Dequeue a video buffer from a driver.
static int video_driver_flush (const struct device *dev, bool cancel)
 Flush endpoint buffers from a driver.
static int video_driver_set_stream (const struct device *dev, bool enable, enum video_buf_type type)
 Start or stop the video driver function.
static int video_driver_get_volatile_ctrl (const struct device *dev, uint32_t cid)
 Get a volatile video control value of a driver.
static int video_driver_set_ctrl (const struct device *dev, uint32_t cid)
 Set a video control value of a driver.
static int video_driver_get_caps (const struct device *dev, struct video_caps *caps)
 Get the capabilities of a video driver endpoint.
static int video_driver_transform_cap (const struct device *const dev, const struct video_format_cap *const cap, struct video_format_cap *const res_cap, enum video_buf_type type, uint16_t ind)
 Transform a video format capability from one end to the other end of a m2m video device.
static int video_driver_set_signal (const struct device *dev, struct k_poll_signal *sig)
 Register/Unregister k_poll signal for a video endpoint.
static int video_driver_set_selection (const struct device *dev, struct video_selection *sel)
 Set video selection (crop/compose).
static int video_driver_get_selection (const struct device *dev, struct video_selection *sel)
 Get video selection (crop/compose).

MIPI CSI-2 Data Types

Standard MIPI CSI-2 data type identifiers for camera sensor interfaces

These constants define the data type field values used in MIPI CSI-2 packet headers to identify the format and encoding of transmitted image data. The data type field is 6 bits wide, allowing values from 0x00 to 0x3F.

#define VIDEO_MIPI_CSI2_DT_NULL   0x10
 NULL data type - used for padding or synchronization.
#define VIDEO_MIPI_CSI2_DT_BLANKING   0x11
 Blanking data - horizontal/vertical blanking information.
#define VIDEO_MIPI_CSI2_DT_EMBEDDED_8   0x12
 Embedded 8-bit data - sensor metadata or configuration data.
#define VIDEO_MIPI_CSI2_DT_YUV420_8   0x18
 YUV 4:2:0 format with 8 bits per component.
#define VIDEO_MIPI_CSI2_DT_YUV420_10   0x19
 YUV 4:2:0 format with 10 bits per component.
#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_8   0x1c
 YUV 4:2:0 CSPS (Chroma Shifted Pixel Sampling) 8-bit format.
#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_10   0x1d
 YUV 4:2:0 CSPS (Chroma Shifted Pixel Sampling) 10-bit format.
#define VIDEO_MIPI_CSI2_DT_YUV422_8   0x1e
 YUV 4:2:2 format with 8 bits per component.
#define VIDEO_MIPI_CSI2_DT_YUV422_10   0x1f
 YUV 4:2:2 format with 10 bits per component.
#define VIDEO_MIPI_CSI2_DT_RGB444   0x20
 RGB format with 4 bits per color component.
#define VIDEO_MIPI_CSI2_DT_RGB555   0x21
 RGB format with 5 bits per color component.
#define VIDEO_MIPI_CSI2_DT_RGB565   0x22
 RGB format with 5-6-5 bits per R-G-B components.
#define VIDEO_MIPI_CSI2_DT_RGB666   0x23
 RGB format with 6 bits per color component.
#define VIDEO_MIPI_CSI2_DT_RGB888   0x24
 RGB format with 8 bits per color component.
#define VIDEO_MIPI_CSI2_DT_RAW6   0x28
 Raw sensor data with 6 bits per pixel.
#define VIDEO_MIPI_CSI2_DT_RAW7   0x29
 Raw sensor data with 7 bits per pixel.
#define VIDEO_MIPI_CSI2_DT_RAW8   0x2a
 Raw sensor data with 8 bits per pixel.
#define VIDEO_MIPI_CSI2_DT_RAW10   0x2b
 Raw sensor data with 10 bits per pixel.
#define VIDEO_MIPI_CSI2_DT_RAW12   0x2c
 Raw sensor data with 12 bits per pixel.
#define VIDEO_MIPI_CSI2_DT_RAW14   0x2d
 Raw sensor data with 14 bits per pixel.
#define VIDEO_MIPI_CSI2_DT_USER(n)
 User-defined data type generator macro.
static uint8_t video_mipi_data_type (uint32_t pixfmt)
 Map pixel formats to their MIPI data type equivalent.

Detailed Description

Main header file for video driver API.