drivers/video: Correct the code style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-12-04 03:46:15 +08:00 committed by archer
parent 21e35362a3
commit 243983328a
7 changed files with 445 additions and 534 deletions

File diff suppressed because it is too large Load Diff

View File

@ -21,23 +21,23 @@
/****************************************************************************
* Included Files
****************************************************************************/
#include "video_framebuff.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
#include "video_framebuff.h"
/****************************************************************************
* Private Functions
****************************************************************************/
static void init_buf_chain(video_framebuff_t *fbuf)
{
int i;
vbuf_container_t *tmp;
int i;
fbuf->vbuf_empty = fbuf->vbuf_alloced;
fbuf->vbuf_next = NULL;
@ -53,14 +53,15 @@ static void init_buf_chain(video_framebuff_t *fbuf)
}
}
static inline int is_last_one(video_framebuff_t *fbuf)
static inline bool is_last_one(video_framebuff_t *fbuf)
{
return fbuf->vbuf_top == fbuf->vbuf_tail ? 1 : 0;
return fbuf->vbuf_top == fbuf->vbuf_tail;
}
static inline vbuf_container_t *dequeue_vbuf_unsafe(video_framebuff_t *fbuf)
{
vbuf_container_t *ret = fbuf->vbuf_top;
if (is_last_one(fbuf))
{
fbuf->vbuf_top = NULL;
@ -125,7 +126,7 @@ vbuf_container_t *video_framebuff_get_container(video_framebuff_t *fbuf)
nxmutex_lock(&fbuf->lock_empty);
ret = fbuf->vbuf_empty;
if (ret)
if (ret != NULL)
{
fbuf->vbuf_empty = ret->next;
ret->next = NULL;
@ -150,7 +151,7 @@ void video_framebuff_queue_container(video_framebuff_t *fbuf,
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->vbuf_top)
if (fbuf->vbuf_top != NULL)
{
fbuf->vbuf_tail->next = tgt;
fbuf->vbuf_tail = tgt;
@ -179,8 +180,8 @@ void video_framebuff_queue_container(video_framebuff_t *fbuf,
vbuf_container_t *video_framebuff_dq_valid_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret = NULL;
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->vbuf_top != NULL && fbuf->vbuf_top != fbuf->vbuf_next)
@ -189,15 +190,14 @@ vbuf_container_t *video_framebuff_dq_valid_container(video_framebuff_t *fbuf)
}
leave_critical_section(flags);
return ret;
}
vbuf_container_t *video_framebuff_get_vacant_container
(video_framebuff_t *fbuf)
vbuf_container_t *
video_framebuff_get_vacant_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret;
irqstate_t flags;
flags = enter_critical_section();
ret = fbuf->vbuf_curr = fbuf->vbuf_next;
@ -209,7 +209,7 @@ vbuf_container_t *video_framebuff_get_vacant_container
void video_framebuff_capture_done(video_framebuff_t *fbuf)
{
fbuf->vbuf_curr = NULL;
if (fbuf->vbuf_next)
if (fbuf->vbuf_next != NULL)
{
fbuf->vbuf_next = fbuf->vbuf_next->next;
if (fbuf->vbuf_next == fbuf->vbuf_top) /* RING mode case. */
@ -249,8 +249,8 @@ void video_framebuff_change_mode(video_framebuff_t *fbuf,
vbuf_container_t *video_framebuff_pop_curr_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret = NULL;
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->vbuf_top != NULL)
@ -259,6 +259,5 @@ vbuf_container_t *video_framebuff_pop_curr_container(video_framebuff_t *fbuf)
}
leave_critical_section(flags);
return ret;
}

View File

@ -35,7 +35,7 @@
struct vbuf_container_s
{
struct v4l2_buffer buf; /* Buffer information */
struct vbuf_container_s *next; /* pointer to next buffer */
struct vbuf_container_s *next; /* Pointer to next buffer */
};
typedef struct vbuf_container_s vbuf_container_t;

View File

@ -49,7 +49,7 @@
* Public Types
****************************************************************************/
/* structure for validate_frame_setting() and start_capture() */
/* Structure for validate_frame_setting() and start_capture() */
typedef struct imgdata_format_s
{

View File

@ -94,7 +94,7 @@
#define IMGSENSOR_CLIP_INDEX_WIDTH (2)
#define IMGSENSOR_CLIP_INDEX_HEIGHT (3)
/* bit definition for IMGSENSOR_ID_3A_LOCK */
/* Bit definition for IMGSENSOR_ID_3A_LOCK */
#define IMGSENSOR_LOCK_EXPOSURE (1 << 0)
#define IMGSENSOR_LOCK_WHITE_BALANCE (1 << 1)
@ -125,7 +125,7 @@
* Public Types
****************************************************************************/
/* enumeration for VIDEO_ID_COLORFX */
/* Enumeration for VIDEO_ID_COLORFX */
typedef enum imgsensor_colorfx_e
{
@ -148,28 +148,28 @@ typedef enum imgsensor_colorfx_e
IMGSENSOR_COLORFX_PASTEL = 16,
} imgsensor_colorfx_t;
/* enumeration for IMGSENSOR_ID_EXPOSURE_AUTO */
/* Enumeration for IMGSENSOR_ID_EXPOSURE_AUTO */
typedef enum imgsensor_exposure_auto_type_e
{
/* exposure time:auto, iris aperture:auto */
/* Exposure time:auto, iris aperture:auto */
IMGSENSOR_EXPOSURE_AUTO = 0,
/* exposure time:manual, iris aperture:manual */
/* Exposure time:manual, iris aperture:manual */
IMGSENSOR_EXPOSURE_MANUAL = 1,
/* exposure time:manual, iris aperture:auto */
/* Exposure time:manual, iris aperture:auto */
IMGSENSOR_EXPOSURE_SHUTTER_PRIORITY = 2,
/* exposure time:auto, iris aperture:manual */
/* Exposure time:auto, iris aperture:manual */
IMGSENSOR_EXPOSURE_APERTURE_PRIORITY = 3
} imgsensor_exposure_auto_type_t;
/* enumeration for IMGSENSOR_ID_AUTO_N_PRESET_WHITE_BALANCE */
/* Enumeration for IMGSENSOR_ID_AUTO_N_PRESET_WHITE_BALANCE */
typedef enum imgsensor_white_balance_e
{
@ -185,7 +185,7 @@ typedef enum imgsensor_white_balance_e
IMGSENSOR_WHITE_BALANCE_SHADE = 9,
} imgsensor_white_balance_t;
/* enumeration for IMGSENSOR_ID_ISO_SENSITIVITY_AUTO */
/* Enumeration for IMGSENSOR_ID_ISO_SENSITIVITY_AUTO */
typedef enum imgsensor_iso_sensitivity_auto_type_e
{
@ -193,7 +193,7 @@ typedef enum imgsensor_iso_sensitivity_auto_type_e
IMGSENSOR_ISO_SENSITIVITY_AUTO = 1,
} imgsensor_iso_sensitivity_auto_type_t;
/* enumeration for IMGSENSOR_ID_EXPOSURE_METERING */
/* Enumeration for IMGSENSOR_ID_EXPOSURE_METERING */
typedef enum imgsensor_exposure_metering_e
{
@ -203,7 +203,7 @@ typedef enum imgsensor_exposure_metering_e
IMGSENSOR_EXPOSURE_METERING_MATRIX = 3,
} imgsensor_exposure_metering_t;
/* enumeration for IMGSENSOR_ID_FLASH_LED_MODE */
/* Enumeration for IMGSENSOR_ID_FLASH_LED_MODE */
typedef enum imgsensor_flash_led_mode_e
{
@ -212,7 +212,7 @@ typedef enum imgsensor_flash_led_mode_e
IMGSENSOR_FLASH_LED_MODE_TORCH = 2,
} imgsensor_flash_led_mode_t;
/* enumeration for get_supported_value() */
/* Enumeration for get_supported_value() */
typedef enum imgsensor_ctrl_type_e
{
@ -229,7 +229,7 @@ typedef enum imgsensor_ctrl_type_e
IMGSENSOR_CTRL_TYPE_U32 = 0x0102,
} imgsensor_ctrl_type_t;
/* enumeration for stream */
/* Enumeration for stream */
typedef enum imgsensor_stream_type_e
{
@ -237,7 +237,7 @@ typedef enum imgsensor_stream_type_e
IMGSENSOR_STREAM_TYPE_STILL = 1,
} imgsensor_stream_type_t;
/* structure for validate_frame_setting() and start_capture() */
/* Structure for validate_frame_setting() and start_capture() */
typedef struct imgsensor_format_s
{
@ -252,7 +252,7 @@ typedef struct imgsensor_interval_s
uint32_t denominator;
} imgsensor_interval_t;
/* structure for get_supported_value() */
/* Structure for get_supported_value() */
typedef struct imgsensor_capability_range_s
{
@ -279,7 +279,7 @@ typedef struct imgsensor_capability_elems_s
typedef struct imgsensor_supported_value_s
{
imgsensor_ctrl_type_t type; /* control type */
imgsensor_ctrl_type_t type; /* Control type */
union
{
/* Use 'range' member in the following types cases.

View File

@ -30,9 +30,10 @@
****************************************************************************/
#include <stdint.h>
#include <sys/time.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/video/video_controls.h>
#include <sys/time.h>
#ifdef __cplusplus
extern "C"
@ -337,7 +338,7 @@ extern "C"
#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2')
#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')
/* two planes -- one Y, one Cr + Cb interleaved */
/* Two planes -- one Y, one Cr + Cb interleaved */
#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')
#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1')
@ -346,7 +347,7 @@ extern "C"
#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4')
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2')
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
/* Two non contiguous planes - one Y, one Cr + Cb interleaved */
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2')
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1')
@ -355,7 +356,7 @@ extern "C"
#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2')
#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2')
/* three planes - Y Cb, Cr */
/* Three planes - Y Cb, Cr */
#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9')
#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9')
@ -364,7 +365,7 @@ extern "C"
#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2')
#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P')
/* three non contiguous planes - Y, Cb, Cr */
/* Three non contiguous planes - Y, Cb, Cr */
#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2')
#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'M', '2', '1')
@ -418,7 +419,7 @@ extern "C"
#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
#define V4L2_PIX_FMT_HSV32 v4l2_fourcc('H', 'S', 'V', '4')
/* compressed formats */
/* Compressed formats */
#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G')
#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G')
@ -467,7 +468,8 @@ extern "C"
/* Values for v4l2_std_id */
/* one bit for each */
/* One bit for each */
#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
@ -497,6 +499,7 @@ extern "C"
#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
/* ATSC/HDTV */
#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
@ -507,26 +510,32 @@ extern "C"
/* "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
* Missing here.
*/
#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
V4L2_STD_NTSC_M_JP |\
#define V4L2_STD_NTSC (V4L2_STD_NTSC_M | \
V4L2_STD_NTSC_M_JP | \
V4L2_STD_NTSC_M_KR)
/* Secam macros */
#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
V4L2_STD_SECAM_K |\
#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D | \
V4L2_STD_SECAM_K | \
V4L2_STD_SECAM_K1)
/* All Secam Standards */
#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
V4L2_STD_SECAM_G |\
V4L2_STD_SECAM_H |\
V4L2_STD_SECAM_DK |\
V4L2_STD_SECAM_L |\
#define V4L2_STD_SECAM (V4L2_STD_SECAM_B | \
V4L2_STD_SECAM_G | \
V4L2_STD_SECAM_H | \
V4L2_STD_SECAM_DK | \
V4L2_STD_SECAM_L | \
V4L2_STD_SECAM_LC)
/* PAL macros */
#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
V4L2_STD_PAL_B1 |\
#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B | \
V4L2_STD_PAL_B1 | \
V4L2_STD_PAL_G)
#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
V4L2_STD_PAL_D1 |\
#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D | \
V4L2_STD_PAL_D1 | \
V4L2_STD_PAL_K)
/* "Common" PAL - This macro is there to be compatible with the old
@ -534,55 +543,60 @@ extern "C"
* Several PAL standards are missing here: /M, /N and /Nc
*/
#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
V4L2_STD_PAL_DK |\
V4L2_STD_PAL_H |\
#define V4L2_STD_PAL (V4L2_STD_PAL_BG | \
V4L2_STD_PAL_DK | \
V4L2_STD_PAL_H | \
V4L2_STD_PAL_I)
/* Chroma "agnostic" standards */
#define V4L2_STD_B (V4L2_STD_PAL_B |\
V4L2_STD_PAL_B1 |\
#define V4L2_STD_B (V4L2_STD_PAL_B | \
V4L2_STD_PAL_B1 | \
V4L2_STD_SECAM_B)
#define V4L2_STD_G (V4L2_STD_PAL_G |\
#define V4L2_STD_G (V4L2_STD_PAL_G | \
V4L2_STD_SECAM_G)
#define V4L2_STD_H (V4L2_STD_PAL_H |\
#define V4L2_STD_H (V4L2_STD_PAL_H | \
V4L2_STD_SECAM_H)
#define V4L2_STD_L (V4L2_STD_SECAM_L |\
#define V4L2_STD_L (V4L2_STD_SECAM_L | \
V4L2_STD_SECAM_LC)
#define V4L2_STD_GH (V4L2_STD_G |\
#define V4L2_STD_GH (V4L2_STD_G | \
V4L2_STD_H)
#define V4L2_STD_DK (V4L2_STD_PAL_DK |\
#define V4L2_STD_DK (V4L2_STD_PAL_DK | \
V4L2_STD_SECAM_DK)
#define V4L2_STD_BG (V4L2_STD_B |\
#define V4L2_STD_BG (V4L2_STD_B | \
V4L2_STD_G)
#define V4L2_STD_MN (V4L2_STD_PAL_M |\
V4L2_STD_PAL_N |\
V4L2_STD_PAL_Nc |\
#define V4L2_STD_MN (V4L2_STD_PAL_M | \
V4L2_STD_PAL_N | \
V4L2_STD_PAL_Nc | \
V4L2_STD_NTSC)
/* Standards where MTS/BTSC stereo could be found */
#define V4L2_STD_MTS (V4L2_STD_NTSC_M |\
V4L2_STD_PAL_M |\
V4L2_STD_PAL_N |\
#define V4L2_STD_MTS (V4L2_STD_NTSC_M | \
V4L2_STD_PAL_M | \
V4L2_STD_PAL_N | \
V4L2_STD_PAL_Nc)
/* Standards for Countries with 60Hz Line frequency */
#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
V4L2_STD_PAL_60 |\
V4L2_STD_NTSC |\
V4L2_STD_NTSC_443)
/* Standards for Countries with 50Hz Line frequency */
#define V4L2_STD_625_50 (V4L2_STD_PAL |\
V4L2_STD_PAL_N |\
V4L2_STD_PAL_Nc |\
V4L2_STD_SECAM)
#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
#define V4L2_STD_525_60 (V4L2_STD_PAL_M | \
V4L2_STD_PAL_60 | \
V4L2_STD_NTSC | \
V4L2_STD_NTSC_443)
/* Standards for Countries with 50Hz Line frequency */
#define V4L2_STD_625_50 (V4L2_STD_PAL | \
V4L2_STD_PAL_N | \
V4L2_STD_PAL_Nc | \
V4L2_STD_SECAM)
#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB | \
V4L2_STD_ATSC_16_VSB)
/* Macros with none and all analog standards */
#define V4L2_STD_UNKNOWN 0
#define V4L2_STD_ALL (V4L2_STD_525_60 |\
#define V4L2_STD_ALL (V4L2_STD_525_60 | \
V4L2_STD_625_50)
/****************************************************************************
@ -595,10 +609,10 @@ extern "C"
struct v4l2_capability
{
uint8_t driver[16]; /* name of driver module(e.g. "bttv" */
uint8_t card[32]; /* name of the card(e.g. "Yoyodyne TV/FM" */
uint8_t bus_info[32]; /* name of the bus(e.g. "PCI:0000:05:06.0" */
uint32_t version; /* version number of the driver */
uint8_t driver[16]; /* Name of driver module(e.g. "bttv" */
uint8_t card[32]; /* Name of the card(e.g. "Yoyodyne TV/FM" */
uint8_t bus_info[32]; /* Name of the bus(e.g. "PCI:0000:05:06.0" */
uint32_t version; /* Version number of the driver */
uint32_t capabilities; /* Available capabilities of the physical device */
uint32_t device_caps; /* Device capabilities of the opened device */
};
@ -616,24 +630,24 @@ enum v4l2_capabilities
V4L2_CAP_SLICED_VBI_OUTPUT = 0x00000080, /* Is a sliced VBI output device */
V4L2_CAP_RDS_CAPTURE = 0x00000100, /* RDS data capture */
V4L2_CAP_VIDEO_OUTPUT_OVERLAY = 0x00000200, /* Can do video output overlay */
V4L2_CAP_HW_FREQ_SEEK = 0x00000400, /* Can do hardware frequency seek */
V4L2_CAP_HW_FREQ_SEEK = 0x00000400, /* Can do hardware frequency seek */
V4L2_CAP_RDS_OUTPUT = 0x00000800, /* Is an RDS encoder */
V4L2_CAP_VIDEO_CAPTURE_MPLANE = 0x00001000, /* Is a video capture device that supports multiplanar formats */
V4L2_CAP_VIDEO_OUTPUT_MPLANE = 0x00002000, /* Is a video output device that supports multiplanar formats */
V4L2_CAP_VIDEO_M2M_MPLANE = 0x00004000, /* Is a video mem-to-mem device that supports multiplanar formats */
V4L2_CAP_VIDEO_M2M = 0x00008000, /* Is a video mem-to-mem device */
V4L2_CAP_TUNER = 0x00010000, /* has a tuner */
V4L2_CAP_AUDIO = 0x00020000, /* has audio support */
V4L2_CAP_RADIO = 0x00040000, /* is a radio device */
V4L2_CAP_MODULATOR = 0x00080000, /* has a modulator */
V4L2_CAP_TUNER = 0x00010000, /* Has a tuner */
V4L2_CAP_AUDIO = 0x00020000, /* Has audio support */
V4L2_CAP_RADIO = 0x00040000, /* Is a radio device */
V4L2_CAP_MODULATOR = 0x00080000, /* Has a modulator */
V4L2_CAP_SDR_CAPTURE = 0x00100000, /* Is a SDR capture device */
V4L2_CAP_EXT_PIX_FORMAT = 0x00200000, /* Supports the extended pixel format */
V4L2_CAP_SDR_OUTPUT = 0x00400000, /* Is a SDR output device */
V4L2_CAP_READWRITE = 0x01000000, /* read/write systemcalls */
V4L2_CAP_ASYNCIO = 0x02000000, /* async I/O */
V4L2_CAP_STREAMING = 0x04000000, /* streaming I/O ioctls */
V4L2_CAP_READWRITE = 0x01000000, /* Read/write systemcalls */
V4L2_CAP_ASYNCIO = 0x02000000, /* Async I/O */
V4L2_CAP_STREAMING = 0x04000000, /* Streaming I/O ioctls */
V4L2_CAP_TOUCH = 0x10000000, /* Is a touch device */
V4L2_CAP_DEVICE_CAPS = 0x80000000, /* sets device capabilities field */
V4L2_CAP_DEVICE_CAPS = 0x80000000, /* Sets device capabilities field */
};
/* Rectangle information */
@ -661,8 +675,8 @@ struct v4l2_rect
struct v4l2_fract
{
uint32_t numerator; /* numerator */
uint32_t denominator; /* denominator */
uint32_t numerator; /* Numerator */
uint32_t denominator; /* Denominator */
};
/* V4L2 selection info for VIDIOC_S_SELECTION and VIDIOC_G_SELECTION.
@ -696,30 +710,30 @@ struct v4l2_standard
enum v4l2_buf_type
{
V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, /* single-planar video capture stream */
V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, /* single-planar video output stream */
V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, /* video overlay */
V4L2_BUF_TYPE_VBI_CAPTURE = 4, /* raw VBI capture stream */
V4L2_BUF_TYPE_VBI_OUTPUT = 5, /* raw VBI output stream */
V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, /* sliced VBI capture stream */
V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, /* sliced VBI output stream */
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, /* video output overlay */
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, /* multi-planar video capture stream */
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, /* multi-planar video output stream */
V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, /* Single-planar video capture stream */
V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, /* Single-planar video output stream */
V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, /* Video overlay */
V4L2_BUF_TYPE_VBI_CAPTURE = 4, /* Raw VBI capture stream */
V4L2_BUF_TYPE_VBI_OUTPUT = 5, /* Raw VBI output stream */
V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, /* Sliced VBI capture stream */
V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, /* Sliced VBI output stream */
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, /* Video output overlay */
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, /* Multi-planar video capture stream */
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, /* Multi-planar video output stream */
V4L2_BUF_TYPE_SDR_CAPTURE = 11, /* Software Defined Radio capture stream */
V4L2_BUF_TYPE_SDR_OUTPUT = 12, /* Software Defined Radio output stream */
V4L2_BUF_TYPE_META_CAPTURE = 13, /* metadata capture */
V4L2_BUF_TYPE_META_CAPTURE = 13, /* Metadata capture */
V4L2_BUF_TYPE_PRIVATE = 0x80, /* Deprecated, do not use */
V4L2_BUF_TYPE_STILL_CAPTURE = 0x81 /* single-planar still capture stream */
V4L2_BUF_TYPE_STILL_CAPTURE = 0x81 /* Single-planar still capture stream */
};
/* Memory I/O method. Currently, support only V4L2_MEMORY_USERPTR. */
enum v4l2_memory
{
V4L2_MEMORY_MMAP = 1, /* memory mapping I/O */
V4L2_MEMORY_USERPTR = 2, /* user pointer I/O */
V4L2_MEMORY_OVERLAY = 3, /* overlay I/O */
V4L2_MEMORY_MMAP = 1, /* Memory mapping I/O */
V4L2_MEMORY_USERPTR = 2, /* User pointer I/O */
V4L2_MEMORY_OVERLAY = 3, /* Overlay I/O */
V4L2_MEMORY_DMABUF = 4, /* DMA shared buffer I/O */
};
@ -727,16 +741,16 @@ enum v4l2_memory
enum v4l2_field
{
V4L2_FIELD_ANY = 0, /* driver can choose from none, */
V4L2_FIELD_NONE = 1, /* this device has no fields ... */
V4L2_FIELD_TOP = 2, /* top field only */
V4L2_FIELD_BOTTOM = 3, /* bottom field only */
V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one */
V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into */
V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field */
V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field */
V4L2_FIELD_ANY = 0, /* Driver can choose from none, */
V4L2_FIELD_NONE = 1, /* This device has no fields ... */
V4L2_FIELD_TOP = 2, /* Top field only */
V4L2_FIELD_BOTTOM = 3, /* Bottom field only */
V4L2_FIELD_INTERLACED = 4, /* Both fields interlaced */
V4L2_FIELD_SEQ_TB = 5, /* Both fields sequential into one */
V4L2_FIELD_SEQ_BT = 6, /* Same as above + bottom-top order */
V4L2_FIELD_ALTERNATE = 7, /* Both fields alternating into */
V4L2_FIELD_INTERLACED_TB = 8, /* Both fields interlaced, top field */
V4L2_FIELD_INTERLACED_BT = 9, /* Both fields interlaced, top field */
};
/* Buffer mode */
@ -797,23 +811,23 @@ typedef struct v4l2_plane v4l2_plane_t;
struct v4l2_buffer
{
uint16_t index; /* buffer id */
uint16_t index; /* Buffer id */
uint16_t type; /* enum #v4l2_buf_type */
uint32_t bytesused; /* Driver sets the image size */
uint16_t flags; /* buffer flags. */
uint16_t field; /* the field order of the image */
struct timeval timestamp; /* frame timestamp */
struct v4l2_timecode timecode; /* frame timecode */
uint16_t sequence; /* frame sequence number */
uint16_t flags; /* Buffer flags. */
uint16_t field; /* The field order of the image */
struct timeval timestamp; /* Frame timestamp */
struct v4l2_timecode timecode; /* Frame timecode */
uint16_t sequence; /* Frame sequence number */
uint16_t memory; /* enum #v4l2_memory */
union
{
uint32_t offset;
unsigned long userptr; /* address of buffer */
unsigned long userptr; /* Address of buffer */
struct v4l2_plane *planes;
int fd;
} m;
uint32_t length; /* user set the buffer size */
uint32_t length; /* User set the buffer size */
};
typedef struct v4l2_buffer v4l2_buffer_t;
@ -874,7 +888,7 @@ struct v4l2_frmsizeenum
};
};
/* type of frame interval enumeration */
/* Type of frame interval enumeration */
enum v4l2_frmivaltypes
{
@ -883,7 +897,7 @@ enum v4l2_frmivaltypes
V4L2_FRMIVAL_TYPE_STEPWISE = 3, /* Step value */
};
/* frame interval enumeration with stepwise format */
/* Frame interval enumeration with stepwise format */
struct v4l2_frmival_stepwise
{
@ -913,13 +927,13 @@ struct v4l2_pix_format
{
uint16_t width; /* Image width in pixels */
uint16_t height; /* Image height in pixels */
uint32_t pixelformat; /* The pixel format or type of compression. */
uint32_t pixelformat; /* The pixel format or type of compression. */
uint32_t field; /* enum #v4l2_field */
uint32_t bytesperline; /* for padding, zero if unused */
uint32_t bytesperline; /* For padding, zero if unused */
uint32_t sizeimage; /* Size in bytes of the buffer to hold a complete image */
uint32_t colorspace; /* Image colorspace */
uint32_t priv; /* private data, depends on pixelformat */
uint32_t flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */
uint32_t priv; /* Private data, depends on pixelformat */
uint32_t flags; /* Format flags (V4L2_PIX_FMT_FLAG_*) */
union
{
uint32_t ycbcr_enc; /* enum v4l2_ycbcr_encoding */
@ -936,7 +950,7 @@ struct v4l2_format
uint32_t type; /* enum #v4l2_buf_type. */
union
{
struct v4l2_pix_format pix; /* image format */
struct v4l2_pix_format pix; /* Image format */
} fmt;
};
@ -1003,7 +1017,7 @@ struct v4l2_queryctrl
char name[32]; /* Name of control */
int32_t minimum; /* Minimum value */
int32_t maximum; /* Maximum value */
uint32_t step; /* step */
uint32_t step; /* Step */
int32_t default_value; /* Default value */
uint32_t flags; /* Flag */};
@ -1015,24 +1029,24 @@ struct v4l2_query_ext_ctrl
char name[32]; /* Name of control */
int64_t minimum; /* Minimum value */
int64_t maximum; /* Maximum value */
uint64_t step; /* step */
uint64_t step; /* Step */
int64_t default_value; /* Default value */
uint32_t flags; /* Flag */
uint32_t elem_size; /* size of each element */
uint32_t elems; /* number of elements */
uint32_t nr_of_dims; /* number of dimensions */
uint32_t elem_size; /* Size of each element */
uint32_t elems; /* Number of elements */
uint32_t nr_of_dims; /* Number of dimensions */
uint32_t dims[V4L2_CTRL_MAX_DIMS]; /* Dimensions */
};
struct v4l2_querymenu
{
uint16_t ctrl_class; /* camera control class */
uint16_t id; /* camera control id */
uint32_t index; /* index of menu. */
uint16_t ctrl_class; /* Camera control class */
uint16_t id; /* Camera control id */
uint32_t index; /* Index of menu. */
union
{
char name[32]; /* name of menu */
int64_t value; /* value of menu */
char name[32]; /* Name of menu */
int64_t value; /* Value of menu */
};
};
@ -1060,40 +1074,40 @@ enum v4l2_input_type
enum v4l2_input_status
{
/* field 'status' - general */
/* Field 'status' - general */
V4L2_IN_ST_NO_POWER = 0x00000001, /* Attached device is off */
V4L2_IN_ST_NO_SIGNAL = 0x00000002,
V4L2_IN_ST_NO_COLOR = 0x00000004,
/* field 'status' - sensor orientation */
/* Field 'status' - sensor orientation */
/* If sensor is mounted upside down set both bits */
V4L2_IN_ST_HFLIP = 0x00000010, /* Frames are flipped horizontally */
V4L2_IN_ST_VFLIP = 0x00000020, /* Frames are flipped vertically */
/* field 'status' - analog */
/* Field 'status' - analog */
V4L2_IN_ST_NO_H_LOCK = 0x00000100, /* No horizontal sync lock */
V4L2_IN_ST_COLOR_KILL = 0x00000200, /* Color killer is active */
V4L2_IN_ST_NO_V_LOCK = 0x00000400, /* No vertical sync lock */
V4L2_IN_ST_NO_STD_LOCK = 0x00000800, /* No standard format lock */
/* field 'status' - digital */
/* Field 'status' - digital */
V4L2_IN_ST_NO_SYNC = 0x00010000, /* No synchronization lock */
V4L2_IN_ST_NO_EQU = 0x00020000, /* No equalizer lock */
V4L2_IN_ST_NO_CARRIER = 0x00040000, /* Carrier recovery failed */
/* field 'status' - VCR and set-top box */
/* Field 'status' - VCR and set-top box */
V4L2_IN_ST_MACROVISION = 0x01000000, /* Macrovision detected */
V4L2_IN_ST_NO_ACCESS = 0x02000000, /* Conditional access denied */
V4L2_IN_ST_VTR = 0x04000000, /* VTR time constant */
};
/* capabilities flags */
/* Capabilities flags */
enum v4l2_input_capabilities
{
@ -1128,7 +1142,7 @@ enum v4l2_output_type
V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY = 3,
};
/* capabilities flags */
/* Capabilities flags */
enum v4l2_output_capabilities
{
@ -1148,14 +1162,14 @@ struct v4l2_control
int32_t value;
};
/* structure for each control of
/* Structure for each control of
* ioctl(VIDIOC_G_EXT_CTRLS / VIDIOC_S_EXT_CTRLS)
*/
struct v4l2_ext_control
{
uint16_t id; /* camera control id */
uint16_t size; /* size of value(not use) */
uint16_t id; /* Camera control id */
uint16_t size; /* Size of value(not use) */
union
{
int32_t value; /* QUERY_EXT_CTRL type = INTEGER, xxx */
@ -1172,36 +1186,36 @@ struct v4l2_ext_controls
{
union
{
uint16_t ctrl_class; /* camera control class */
uint16_t ctrl_class; /* Camera control class */
uint16_t which;
};
uint16_t count; /* number of requests */
uint16_t error_idx; /* index in that error occurred */
struct v4l2_ext_control *controls; /* each control information */
uint16_t count; /* Number of requests */
uint16_t error_idx; /* Index in that error occurred */
struct v4l2_ext_control *controls; /* Each control information */
};
/* Structure for V4SIOC_S_EXT_CTRLS and V4SIOC_G_EXT_CTRLS */
struct v4s_ext_controls_scene
{
enum v4l2_scene_mode mode; /* scene mode to be controled */
struct v4l2_ext_controls control; /* same as VIDIOC_S_EXT_CTRLS */
enum v4l2_scene_mode mode; /* Scene mode to be controled */
struct v4l2_ext_controls control; /* Same as VIDIOC_S_EXT_CTRLS */
};
/* Structure for V4SIOC_QUERY_EXT_CTRL */
struct v4s_query_ext_ctrl_scene
{
enum v4l2_scene_mode mode; /* scene mode to be queried */
struct v4l2_query_ext_ctrl control; /* same as VIDIOC_QUERY_EXT_CTRL */
enum v4l2_scene_mode mode; /* Scene mode to be queried */
struct v4l2_query_ext_ctrl control; /* Same as VIDIOC_QUERY_EXT_CTRL */
};
/* Structure for V4SIOC_QUERYMENU */
struct v4s_querymenu_scene
{
enum v4l2_scene_mode mode; /* scene mode to be queried */
struct v4l2_querymenu menu; /* same as VIDIOC_QUERYMENU */
enum v4l2_scene_mode mode; /* Scene mode to be queried */
struct v4l2_querymenu menu; /* Same as VIDIOC_QUERYMENU */
};
/****************************************************************************
@ -1212,7 +1226,7 @@ struct v4s_querymenu_scene
*
* param [in] devpath: path to video device
*
* return On success, 0 is returned. On failure,
* Return on success, 0 is returned. On failure,
* negative value is returned.
*/
@ -1220,7 +1234,7 @@ int video_initialize(FAR const char *devpath);
/* Uninitialize video driver.
*
* return On success, 0 is returned. On failure,
* Return on success, 0 is returned. On failure,
* negative value is returned.
*/

View File

@ -56,14 +56,14 @@
#define V4L2_CID_COLOR_KILLER (15) /**< Color killer */
#define V4L2_CID_COLORFX (16) /**< Color effect */
/** enumeration for V4L2_CID_COLORFX */
/** Enumeration for V4L2_CID_COLORFX */
enum v4l2_colorfx
{
V4L2_COLORFX_NONE = 0, /**< no effect */
V4L2_COLORFX_NONE = 0, /**< No effect */
V4L2_COLORFX_BW = 1, /**< Black/white */
V4L2_COLORFX_SEPIA = 2, /**< Sepia */
V4L2_COLORFX_NEGATIVE = 3, /**< positive/negative inversion */
V4L2_COLORFX_NEGATIVE = 3, /**< Positive/negative inversion */
V4L2_COLORFX_EMBOSS = 4, /**< Emboss */
V4L2_COLORFX_SKETCH = 5, /**< Sketch */
V4L2_COLORFX_SKY_BLUE = 6, /**< Sky blue */
@ -85,23 +85,23 @@ enum v4l2_colorfx
#define V4L2_CID_EXPOSURE_AUTO (0) /**< Auto exposure */
/** enumeration for V4L2_CID_EXPOSURE_AUTO */
/** Enumeration for V4L2_CID_EXPOSURE_AUTO */
enum v4l2_exposure_auto_type
{
/** exposure time:auto, iris aperture:auto */
/** Exposure time:auto, iris aperture:auto */
V4L2_EXPOSURE_AUTO = 0,
/** exposure time:manual, iris aperture:manual */
/** Exposure time:manual, iris aperture:manual */
V4L2_EXPOSURE_MANUAL = 1,
/** exposure time:manual, iris aperture:auto */
/** Exposure time:manual, iris aperture:auto */
V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
/** exposure time:auto, iris aperture:manual */
/** Exposure time:auto, iris aperture:manual */
V4L2_EXPOSURE_APERTURE_PRIORITY = 3
};
@ -120,7 +120,7 @@ enum v4l2_exposure_auto_type
#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (10) /**< Preset white balance */
/** enumeration for V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE */
/** Enumeration for V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE */
enum v4l2_auto_n_preset_white_balance
{
@ -142,7 +142,7 @@ enum v4l2_auto_n_preset_white_balance
#define V4L2_CID_ISO_SENSITIVITY (13) /**< ISO sensitivity */
#define V4L2_CID_ISO_SENSITIVITY_AUTO (14) /**< Auto ISO sensitivity */
/** enumeration for V4L2_CID_ISO_SENSITIVITY_AUTO */
/** Enumeration for V4L2_CID_ISO_SENSITIVITY_AUTO */
enum v4l2_iso_sensitivity_auto_type
{
@ -152,7 +152,7 @@ enum v4l2_iso_sensitivity_auto_type
#define V4L2_CID_EXPOSURE_METERING (15) /**< Exposure metering */
/** enumeration for V4L2_CID_EXPOSURE_METERING */
/** Enumeration for V4L2_CID_EXPOSURE_METERING */
enum v4l2_exposure_metering
{
@ -164,7 +164,7 @@ enum v4l2_exposure_metering
#define V4L2_CID_SCENE_MODE (16) /**< Scene selection */
/** enumeration for V4L2_CID_SCENE_MODE */
/** Enumeration for V4L2_CID_SCENE_MODE */
enum v4l2_scene_mode
{
@ -206,7 +206,7 @@ enum v4l2_scene_mode
#define V4L2_CID_FLASH_LED_MODE (0)
/** enumeration for V4L2_CID_FLASH_LED_MODE */
/** Enumeration for V4L2_CID_FLASH_LED_MODE */
enum v4l2_flash_led_mode
{