2.27. V4L2 常用函数和数据结构¶
-
int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def)¶
参数
struct v4l2_queryctrl *qctrl
要填充的
struct v4l2_queryctrl
的指针s32 min
控件的最小值
s32 max
控件的最大值
s32 step
控件步长
s32 def
控件的默认值
描述
填充查询控件的 struct v4l2_queryctrl
字段。
注意
此函数假定已填充 qctrl->id 字段。
如果 V4L2 核心不知道该控件,则返回 -EINVAL,成功则返回 0。
-
enum v4l2_i2c_tuner_type¶
指定在搜索 I2C 设备时应使用的调谐器地址范围。
常量
ADDRS_RADIO
无线电调谐器地址。表示以下 I2C 地址:0x10(如果使用 tea5761 支持编译)和 0x60。
ADDRS_DEMOD
解调器调谐器地址。表示以下 I2C 地址:0x42、0x43、0x4a 和 0x4b。
ADDRS_TV
电视调谐器地址。表示以下 I2C 地址:0x42、0x43、0x4a、0x4b、0x60、0x61、0x62、0x63 和 0x64。
ADDRS_TV_WITH_DEMOD
如果存在解调器,则为电视调谐器地址,这会将解调器使用的地址从候选列表Excluded。表示以下 I2C 地址:0x60、0x61、0x62、0x63 和 0x64。
注意
以上所有 I2C 地址都使用 7 位表示法。
-
struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, struct i2c_adapter *adapter, const char *client_type, u8 addr, const unsigned short *probe_addrs)¶
加载 i2c 模块并返回初始化的
struct v4l2_subdev
。
参数
struct v4l2_device *v4l2_dev
指向
struct v4l2_device
的指针struct i2c_adapter *adapter
指向 struct i2c_adapter 的指针
const char *client_type
适配器上芯片的名称。
u8 addr
I2C 地址。如果为零,它将使用 probe_addrs
const unsigned short *probe_addrs
包含地址列表的数组。此类数组中的最后一个条目应为
I2C_CLIENT_END
。
描述
返回 struct v4l2_subdev
指针。
-
struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, struct i2c_adapter *adapter, struct i2c_board_info *info, const unsigned short *probe_addrs)¶
加载 i2c 模块并返回初始化的
struct v4l2_subdev
。
参数
struct v4l2_device *v4l2_dev
指向
struct v4l2_device
的指针struct i2c_adapter *adapter
指向 struct i2c_adapter 的指针
struct i2c_board_info *info
指向
struct i2c_board_info
的指针,用于替换 irq、platform_data 和 addr 参数。const unsigned short *probe_addrs
包含地址列表的数组。此类数组中的最后一个条目应为
I2C_CLIENT_END
。
描述
返回 struct v4l2_subdev
指针。
-
void v4l2_i2c_subdev_set_name(struct v4l2_subdev *sd, struct i2c_client *client, const char *devname, const char *postfix)¶
为 I²C 子设备设置名称
参数
struct v4l2_subdev *sd
指向
struct v4l2_subdev
的指针struct i2c_client *client
指向
struct i2c_client
的指针const char *devname
设备名称;如果为 NULL,将使用 I²C 设备驱动程序的名称
const char *postfix
子设备特定字符串,放在 I²C 设备名称之后;可以为 NULL
-
void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, const struct v4l2_subdev_ops *ops)¶
使用来自 i2c_client 结构的数据初始化
struct v4l2_subdev
。
参数
struct v4l2_subdev *sd
指向
struct v4l2_subdev
的指针struct i2c_client *client
指向
struct i2c_client
的指针const struct v4l2_subdev_ops *ops
指向
struct v4l2_subdev_ops
的指针
-
unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd)¶
返回
struct v4l2_subdev
的 i2c 客户端地址。
-
const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type)¶
返回要探测的 I2C 调谐器地址列表。
-
void v4l2_i2c_subdev_unregister(struct v4l2_subdev *sd)¶
注销 v4l2_subdev
参数
struct v4l2_subdev *sd
指向
struct v4l2_subdev
的指针
-
struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, struct spi_controller *ctlr, struct spi_board_info *info)¶
加载 spi 模块并返回初始化的
struct v4l2_subdev
。
参数
struct v4l2_device *v4l2_dev
指向
struct v4l2_device
的指针。struct spi_controller *ctlr
指向
struct spi_controller
的指针。struct spi_board_info *info
指向
struct spi_board_info
的指针。
描述
返回 struct v4l2_subdev
指针。
-
void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, const struct v4l2_subdev_ops *ops)¶
使用来自 spi_device 结构的数据初始化 v4l2_subdev。
参数
struct v4l2_subdev *sd
指向
struct v4l2_subdev
的指针struct spi_device *spi
指向
struct spi_device
的指针。const struct v4l2_subdev_ops *ops
指向
struct v4l2_subdev_ops
的指针
-
void v4l2_spi_subdev_unregister(struct v4l2_subdev *sd)¶
注销 v4l2_subdev
参数
struct v4l2_subdev *sd
指向
struct v4l2_subdev
的指针
-
void v4l_bound_align_image(unsigned int *width, unsigned int wmin, unsigned int wmax, unsigned int walign, unsigned int *height, unsigned int hmin, unsigned int hmax, unsigned int halign, unsigned int salign)¶
根据给定的约束调整视频尺寸。
参数
unsigned int *width
指向宽度的指针,如果需要,将进行调整。
unsigned int wmin
最小宽度。
unsigned int wmax
最大宽度。
unsigned int walign
宽度上的最低有效位。
unsigned int *height
指向高度的指针,如果需要,将进行调整。
unsigned int hmin
最小高度。
unsigned int hmax
最大高度。
unsigned int halign
高度上的最低有效位。
unsigned int salign
图像大小的最低有效位(例如,
)。
描述
裁剪图像以使 width 在 wmin 和 wmax 之间,并且 height 在 hmin 和 hmax 之间(含)。
此外,width 将是 的倍数,height 将是
的倍数,并且总大小
将是
的倍数。
注意
可以缩小或放大裁剪矩形以适合对齐约束。
wmax 不得小于 wmin。
hmax 不得小于 hmin。
对齐方式不得太高,以至于允许的范围内没有可能的图像大小。
wmin 和 hmin 必须至少为 1(不要使用 0)。
对于 walign、halign 和 salign,如果您不关心某个对齐方式,请指定
0
,因为和一个字节的对齐方式相当于不对齐。
如果您只想向下调整,请指定一个与初始值相同的最大值。
-
v4l2_find_nearest_size_conditional¶
v4l2_find_nearest_size_conditional (array, array_size, width_field, height_field, width, height, func, context)
在驱动程序特定结构的数组中包含的一组离散分辨率中查找最接近的尺寸,并有条件地排除某些模式
参数
数组
驱动程序特定的图像大小数组
array_size
驱动程序特定的图像大小数组的长度
width_field
驱动程序特定结构中宽度字段的名称
height_field
驱动程序特定结构中高度字段的名称
width
所需宽度
height
所需高度
func
如果返回 false,则忽略模式
context
函数的上下文
描述
查找最接近的分辨率,以最大限度地减少请求的分辨率和支持的分辨率之间的宽度和高度差异。驱动程序特定结构中宽度和高度字段的大小必须等于 u32 的大小,即四个字节。对于考虑的每种模式都会调用 func,如果 func 对其返回 false,则忽略该模式。
返回最佳匹配,如果数组的长度为零,则返回 NULL。
-
v4l2_find_nearest_size¶
v4l2_find_nearest_size (array, array_size, width_field, height_field, width, height)
在驱动程序特定结构的数组中包含的一组离散分辨率中查找最接近的尺寸
参数
数组
驱动程序特定的图像大小数组
array_size
驱动程序特定的图像大小数组的长度
width_field
驱动程序特定结构中宽度字段的名称
height_field
驱动程序特定结构中高度字段的名称
width
所需宽度
height
所需高度
描述
查找最接近的分辨率,以最大限度地减少请求的分辨率和支持的分辨率之间的宽度和高度差异。驱动程序特定结构中宽度和高度字段的大小必须等于 u32 的大小,即四个字节。
返回最佳匹配,如果数组的长度为零,则返回 NULL。
-
int v4l2_g_parm_cap(struct video_device *vdev, struct v4l2_subdev *sd, struct v4l2_streamparm *a)¶
vidioc_g_parm 的辅助例程,通过调用给定子设备的 get_frame_interval 操作来填充此信息。它仅适用于 V4L2_BUF_TYPE_VIDEO_CAPTURE(_MPLANE),因此函数名称中包含 _cap。
参数
struct video_device *vdev
struct video_device
指针。用于确定设备容量。struct v4l2_subdev *sd
子设备指针。
struct v4l2_streamparm *a
VIDIOC_G_PARM 参数。
-
int v4l2_s_parm_cap(struct video_device *vdev, struct v4l2_subdev *sd, struct v4l2_streamparm *a)¶
vidioc_s_parm 的辅助例程,通过调用给定子设备的 set_frame_interval 操作来填充此信息。它仅适用于 V4L2_BUF_TYPE_VIDEO_CAPTURE(_MPLANE),因此函数名称中包含 _cap。
参数
struct video_device *vdev
struct video_device
指针。用于确定设备容量。struct v4l2_subdev *sd
子设备指针。
struct v4l2_streamparm *a
VIDIOC_S_PARM 参数。
-
enum v4l2_pixel_encoding¶
指定像素编码值
常量
V4L2_PIXEL_ENC_UNKNOWN
像素编码未知/未初始化
V4L2_PIXEL_ENC_YUV
像素编码为 YUV
V4L2_PIXEL_ENC_RGB
像素编码为 RGB
V4L2_PIXEL_ENC_BAYER
像素编码为 Bayer
-
struct v4l2_format_info¶
有关 V4L2 格式的信息
定义:
struct v4l2_format_info {
u32 format;
u8 pixel_enc;
u8 mem_planes;
u8 comp_planes;
u8 bpp[4];
u8 bpp_div[4];
u8 hdiv;
u8 vdiv;
u8 block_w[4];
u8 block_h[4];
};
成员
格式
4CC 格式标识符 (V4L2_PIX_FMT_*)
pixel_enc
像素编码(请参阅上面的
enum v4l2_pixel_encoding
)mem_planes
内存平面数量,包括 alpha 平面(1 到 4)。
comp_planes
组件平面数量,包括 alpha 平面(1 到 4)。
bpp
每个平面的每像素字节数组
bpp_div
每个平面的每像素字节除数数组,以支持小数像素大小。
hdiv
水平色度二次采样因子
vdiv
垂直色度二次采样因子
block_w
每个平面的宏块像素宽度(可选)
block_h
每个平面的宏块像素高度(可选)
-
v4l2_get_link_freq¶
v4l2_get_link_freq (pad, mul, div)
从发射器获取链路速率
参数
pad
发射器的媒体填充(或非 MC 用户的控制处理程序或出于兼容性原因,请勿在新代码中使用)
mul
像素速率和链路频率之间的乘数。D-PHY 上的每像素位数,并行上的每时钟采样数。否则为 0。
div
像素速率和链路频率之间的除数。D-PHY 上的数据通道数量乘以 2,并行上为 1。否则为 0。
描述
此函数旨在从发射器子设备获取链路频率。它返回链路速率,无论是来自发射器实现的 V4L2_CID_LINK_FREQ 控件,还是根据发射器实现的 V4L2_CID_PIXEL_RATE 计算的值。
返回值
>0:链路频率
-ENOENT
:未找到链路频率或像素速率控件-EINVAL
:链路频率值无效
-
int v4l2_link_freq_to_bitmap(struct device *dev, const u64 *fw_link_freqs, unsigned int num_of_fw_link_freqs, const s64 *driver_link_freqs, unsigned int num_of_driver_link_freqs, unsigned long *bitmap)¶
计算平台支持的链路频率
参数
struct device *dev
const u64 *fw_link_freqs
固件中的链路频率数组
unsigned int num_of_fw_link_freqs
fw_link_freqs 中的条目数
const s64 *driver_link_freqs
驱动程序支持的链路频率数组
unsigned int num_of_driver_link_freqs
driver_link_freqs 中的条目数
unsigned long *bitmap
在 fw_link_freqs 中找到的驱动程序支持的链路频率的位图
描述
此函数检查系统固件中启用了哪些驱动程序支持的链路频率,并在 bitmap 中设置相应的位(首先将其清零)。
返回值
0
:成功-ENOENT
:在驱动程序支持的链路频率和固件中可用的链路频率之间未找到匹配项。-ENODATA
:固件中未指定链路频率。
-
struct v4l2_ioctl_ops¶
描述每个 V4L2 ioctl 的操作
定义:
struct v4l2_ioctl_ops {
int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
int (*vidioc_enum_fmt_meta_out)(struct file *file, void *fh, struct v4l2_fmtdesc *f);
int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_g_fmt_meta_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_s_fmt_meta_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_try_fmt_meta_out)(struct file *file, void *fh, struct v4l2_format *f);
int (*vidioc_reqbufs)(struct file *file, void *fh, struct v4l2_requestbuffers *b);
int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
int (*vidioc_qbuf)(struct file *file, void *fh, struct v4l2_buffer *b);
int (*vidioc_expbuf)(struct file *file, void *fh, struct v4l2_exportbuffer *e);
int (*vidioc_dqbuf)(struct file *file, void *fh, struct v4l2_buffer *b);
int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b);
int (*vidioc_remove_bufs)(struct file *file, void *fh, struct v4l2_remove_buffers *d);
int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
int (*vidioc_g_fbuf)(struct file *file, void *fh, struct v4l2_framebuffer *a);
int (*vidioc_s_fbuf)(struct file *file, void *fh, const struct v4l2_framebuffer *a);
int (*vidioc_streamon)(struct file *file, void *fh, enum v4l2_buf_type i);
int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
int (*vidioc_enum_input)(struct file *file, void *fh, struct v4l2_input *inp);
int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
int (*vidioc_enum_output)(struct file *file, void *fh, struct v4l2_output *a);
int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, struct v4l2_query_ext_ctrl *a);
int (*vidioc_g_ext_ctrls)(struct file *file, void *fh, struct v4l2_ext_controls *a);
int (*vidioc_s_ext_ctrls)(struct file *file, void *fh, struct v4l2_ext_controls *a);
int (*vidioc_try_ext_ctrls)(struct file *file, void *fh, struct v4l2_ext_controls *a);
int (*vidioc_querymenu)(struct file *file, void *fh, struct v4l2_querymenu *a);
int (*vidioc_enumaudio)(struct file *file, void *fh, struct v4l2_audio *a);
int (*vidioc_g_audio)(struct file *file, void *fh, struct v4l2_audio *a);
int (*vidioc_s_audio)(struct file *file, void *fh, const struct v4l2_audio *a);
int (*vidioc_enumaudout)(struct file *file, void *fh, struct v4l2_audioout *a);
int (*vidioc_g_audout)(struct file *file, void *fh, struct v4l2_audioout *a);
int (*vidioc_s_audout)(struct file *file, void *fh, const struct v4l2_audioout *a);
int (*vidioc_g_modulator)(struct file *file, void *fh, struct v4l2_modulator *a);
int (*vidioc_s_modulator)(struct file *file, void *fh, const struct v4l2_modulator *a);
int (*vidioc_g_pixelaspect)(struct file *file, void *fh, int buf_type, struct v4l2_fract *aspect);
int (*vidioc_g_selection)(struct file *file, void *fh, struct v4l2_selection *s);
int (*vidioc_s_selection)(struct file *file, void *fh, struct v4l2_selection *s);
int (*vidioc_g_jpegcomp)(struct file *file, void *fh, struct v4l2_jpegcompression *a);
int (*vidioc_s_jpegcomp)(struct file *file, void *fh, const struct v4l2_jpegcompression *a);
int (*vidioc_g_enc_index)(struct file *file, void *fh, struct v4l2_enc_idx *a);
int (*vidioc_encoder_cmd)(struct file *file, void *fh, struct v4l2_encoder_cmd *a);
int (*vidioc_try_encoder_cmd)(struct file *file, void *fh, struct v4l2_encoder_cmd *a);
int (*vidioc_decoder_cmd)(struct file *file, void *fh, struct v4l2_decoder_cmd *a);
int (*vidioc_try_decoder_cmd)(struct file *file, void *fh, struct v4l2_decoder_cmd *a);
int (*vidioc_g_parm)(struct file *file, void *fh, struct v4l2_streamparm *a);
int (*vidioc_s_parm)(struct file *file, void *fh, struct v4l2_streamparm *a);
int (*vidioc_g_tuner)(struct file *file, void *fh, struct v4l2_tuner *a);
int (*vidioc_s_tuner)(struct file *file, void *fh, const struct v4l2_tuner *a);
int (*vidioc_g_frequency)(struct file *file, void *fh, struct v4l2_frequency *a);
int (*vidioc_s_frequency)(struct file *file, void *fh, const struct v4l2_frequency *a);
int (*vidioc_enum_freq_bands)(struct file *file, void *fh, struct v4l2_frequency_band *band);
int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh, struct v4l2_sliced_vbi_cap *a);
int (*vidioc_log_status)(struct file *file, void *fh);
int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh, const struct v4l2_hw_freq_seek *a);
#ifdef CONFIG_VIDEO_ADV_DEBUG;
int (*vidioc_g_register)(struct file *file, void *fh, struct v4l2_dbg_register *reg);
int (*vidioc_s_register)(struct file *file, void *fh, const struct v4l2_dbg_register *reg);
int (*vidioc_g_chip_info)(struct file *file, void *fh, struct v4l2_dbg_chip_info *chip);
#endif;
int (*vidioc_enum_framesizes)(struct file *file, void *fh, struct v4l2_frmsizeenum *fsize);
int (*vidioc_enum_frameintervals)(struct file *file, void *fh, struct v4l2_frmivalenum *fival);
int (*vidioc_s_dv_timings)(struct file *file, void *fh, struct v4l2_dv_timings *timings);
int (*vidioc_g_dv_timings)(struct file *file, void *fh, struct v4l2_dv_timings *timings);
int (*vidioc_query_dv_timings)(struct file *file, void *fh, struct v4l2_dv_timings *timings);
int (*vidioc_enum_dv_timings)(struct file *file, void *fh, struct v4l2_enum_dv_timings *timings);
int (*vidioc_dv_timings_cap)(struct file *file, void *fh, struct v4l2_dv_timings_cap *cap);
int (*vidioc_g_edid)(struct file *file, void *fh, struct v4l2_edid *edid);
int (*vidioc_s_edid)(struct file *file, void *fh, struct v4l2_edid *edid);
int (*vidioc_subscribe_event)(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub);
int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub);
long (*vidioc_default)(struct file *file, void *fh, bool valid_prio, unsigned int cmd, void *arg);
};
成员
vidioc_querycap
指向实现 VIDIOC_QUERYCAP ioctl 的函数的指针
vidioc_enum_fmt_vid_cap
指向为单平面和多平面模式下的视频捕获实现 VIDIOC_ENUM_FMT ioctl 逻辑的函数的指针
vidioc_enum_fmt_vid_overlay
指向为视频叠加实现 VIDIOC_ENUM_FMT ioctl 逻辑的函数的指针
vidioc_enum_fmt_vid_out
指向为单平面和多平面模式下的视频输出实现 VIDIOC_ENUM_FMT ioctl 逻辑的函数的指针
vidioc_enum_fmt_sdr_cap
指向为软件定义无线电捕获实现 VIDIOC_ENUM_FMT ioctl 逻辑的函数的指针
vidioc_enum_fmt_sdr_out
指向为软件定义无线电输出实现 VIDIOC_ENUM_FMT ioctl 逻辑的函数的指针
vidioc_enum_fmt_meta_cap
指向为元数据捕获实现 VIDIOC_ENUM_FMT ioctl 逻辑的函数的指针
vidioc_enum_fmt_meta_out
指向为元数据输出实现 VIDIOC_ENUM_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vid_cap
指向为单平面模式下的视频捕获实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vid_overlay
指向为视频叠加实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vid_out
指向为单平面模式下的视频输出实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vid_out_overlay
指向为视频叠加输出实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vbi_cap
指向为原始 VBI 捕获实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vbi_out
指向为原始 VBI 输出实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_sliced_vbi_cap
指向为切片 VBI 捕获实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_sliced_vbi_out
指向为切片 VBI 输出实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vid_cap_mplane
指向为多平面模式下的视频捕获实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_vid_out_mplane
指向为多平面模式下的视频输出实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_sdr_cap
指向为软件定义无线电捕获实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_sdr_out
指向为软件定义无线电输出实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_meta_cap
指向为元数据捕获实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_g_fmt_meta_out
指向为元数据输出实现 VIDIOC_G_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vid_cap
指向为单平面模式下的视频捕获实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vid_overlay
指向为视频叠加实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vid_out
指向为单平面模式下的视频输出实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vid_out_overlay
指向为视频叠加输出实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vbi_cap
指向为原始 VBI 捕获实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vbi_out
指向为原始 VBI 输出实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_sliced_vbi_cap
指向为切片 VBI 捕获实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_sliced_vbi_out
指向为切片 VBI 输出实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vid_cap_mplane
指向为多平面模式下的视频捕获实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_vid_out_mplane
指向为多平面模式下的视频输出实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_sdr_cap
指向为软件定义无线电捕获实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_sdr_out
指向为软件定义无线电输出实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_meta_cap
指向为元数据捕获实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_s_fmt_meta_out
指向为元数据输出实现 VIDIOC_S_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vid_cap
指向为单平面模式下的视频捕获实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vid_overlay
指向为视频叠加实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vid_out
指向为单平面模式下的视频输出实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vid_out_overlay
指向为视频叠加输出实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vbi_cap
指向为原始 VBI 捕获实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vbi_out
指向为原始 VBI 输出实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_sliced_vbi_cap
指向为切片 VBI 捕获实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_sliced_vbi_out
指向为切片 VBI 输出实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vid_cap_mplane
指向为多平面模式下的视频捕获实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_vid_out_mplane
指向为多平面模式下的视频输出实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_sdr_cap
指向为软件定义无线电捕获实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_sdr_out
指向为软件定义无线电输出实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_meta_cap
指向为元数据捕获实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_try_fmt_meta_out
指向为元数据输出实现 VIDIOC_TRY_FMT ioctl 逻辑的函数的指针
vidioc_reqbufs
指向实现 VIDIOC_REQBUFS ioctl 的函数的指针
vidioc_querybuf
指向实现 VIDIOC_QUERYBUF ioctl 的函数的指针
vidioc_qbuf
指向实现 VIDIOC_QBUF ioctl 的函数的指针
vidioc_expbuf
指向实现 VIDIOC_EXPBUF ioctl 的函数的指针
vidioc_dqbuf
指向实现 VIDIOC_DQBUF ioctl 的函数的指针
vidioc_create_bufs
指向实现 VIDIOC_CREATE_BUFS ioctl 的函数的指针
vidioc_prepare_buf
指向实现 VIDIOC_PREPARE_BUF ioctl 的函数的指针
vidioc_remove_bufs
指向实现 VIDIOC_REMOVE_BUFS ioctl 的函数的指针
vidioc_overlay
指向实现 VIDIOC_OVERLAY ioctl 的函数的指针
vidioc_g_fbuf
指向实现 VIDIOC_G_FBUF ioctl 的函数的指针
vidioc_s_fbuf
指向实现 VIDIOC_S_FBUF ioctl 的函数的指针
vidioc_streamon
指向实现 VIDIOC_STREAMON ioctl 的函数的指针
vidioc_streamoff
指向实现 VIDIOC_STREAMOFF ioctl 的函数的指针
vidioc_g_std
指向实现 VIDIOC_G_STD ioctl 的函数的指针
vidioc_s_std
指向实现 VIDIOC_S_STD ioctl 的函数的指针
vidioc_querystd
指向实现 VIDIOC_QUERYSTD ioctl 的函数的指针
vidioc_enum_input
指向实现 VIDIOC_ENUM_INPUT ioctl 的函数的指针
vidioc_g_input
指向实现 VIDIOC_G_INPUT ioctl 的函数的指针
vidioc_s_input
指向实现 VIDIOC_S_INPUT ioctl 的函数的指针
vidioc_enum_output
指向实现 VIDIOC_ENUM_OUTPUT ioctl 的函数的指针
vidioc_g_output
指向实现 VIDIOC_G_OUTPUT ioctl 的函数的指针
vidioc_s_output
指向实现 VIDIOC_S_OUTPUT ioctl 的函数的指针
vidioc_query_ext_ctrl
指向实现 VIDIOC_QUERY_EXT_CTRL ioctl 的函数的指针
vidioc_g_ext_ctrls
指向实现 VIDIOC_G_EXT_CTRLS ioctl 的函数的指针
vidioc_s_ext_ctrls
指向实现 VIDIOC_S_EXT_CTRLS ioctl 的函数的指针
vidioc_try_ext_ctrls
指向实现 VIDIOC_TRY_EXT_CTRLS ioctl 的函数的指针
vidioc_querymenu
指向实现 VIDIOC_QUERYMENU ioctl 的函数的指针
vidioc_enumaudio
指向实现 VIDIOC_ENUMAUDIO ioctl 的函数的指针
vidioc_g_audio
指向实现 VIDIOC_G_AUDIO ioctl 的函数的指针
vidioc_s_audio
指向实现 VIDIOC_S_AUDIO ioctl 的函数的指针
vidioc_enumaudout
指向实现 VIDIOC_ENUMAUDOUT ioctl 的函数的指针
vidioc_g_audout
指向实现 VIDIOC_G_AUDOUT ioctl 的函数的指针
vidioc_s_audout
指向实现 VIDIOC_S_AUDOUT ioctl 的函数的指针
vidioc_g_modulator
指向实现 VIDIOC_G_MODULATOR ioctl 的函数的指针
vidioc_s_modulator
指向实现 VIDIOC_S_MODULATOR ioctl 的函数的指针
vidioc_g_pixelaspect
指向实现 VIDIOC_CROPCAP ioctl 的 pixelaspect 部分的函数的指针
vidioc_g_selection
指向实现 VIDIOC_G_SELECTION ioctl 的函数的指针
vidioc_s_selection
指向实现 VIDIOC_S_SELECTION ioctl 的函数的指针
vidioc_g_jpegcomp
指向实现 VIDIOC_G_JPEGCOMP ioctl 的函数的指针
vidioc_s_jpegcomp
指向实现 VIDIOC_S_JPEGCOMP ioctl 的函数的指针
vidioc_g_enc_index
指向实现 VIDIOC_G_ENC_INDEX ioctl 的函数的指针
vidioc_encoder_cmd
指向实现 VIDIOC_ENCODER_CMD ioctl 的函数的指针
vidioc_try_encoder_cmd
指向实现 VIDIOC_TRY_ENCODER_CMD ioctl 的函数的指针
vidioc_decoder_cmd
指向实现 VIDIOC_DECODER_CMD ioctl 的函数的指针
vidioc_try_decoder_cmd
指向实现 VIDIOC_TRY_DECODER_CMD ioctl 的函数的指针
vidioc_g_parm
指向实现 VIDIOC_G_PARM ioctl 的函数的指针
vidioc_s_parm
指向实现 VIDIOC_S_PARM ioctl 的函数的指针
vidioc_g_tuner
指向实现 VIDIOC_G_TUNER ioctl 的函数的指针
vidioc_s_tuner
指向实现 VIDIOC_S_TUNER ioctl 的函数的指针
vidioc_g_frequency
指向实现 VIDIOC_G_FREQUENCY ioctl 的函数的指针
vidioc_s_frequency
指向实现 VIDIOC_S_FREQUENCY ioctl 的函数的指针
vidioc_enum_freq_bands
指向实现 VIDIOC_ENUM_FREQ_BANDS ioctl 的函数的指针
vidioc_g_sliced_vbi_cap
指向实现 VIDIOC_G_SLICED_VBI_CAP ioctl 的函数的指针
vidioc_log_status
指向实现 VIDIOC_LOG_STATUS ioctl 的函数的指针
vidioc_s_hw_freq_seek
指向实现 VIDIOC_S_HW_FREQ_SEEK ioctl 的函数的指针
vidioc_g_register
指向实现 VIDIOC_DBG_G_REGISTER ioctl 的函数的指针
vidioc_s_register
指向实现 VIDIOC_DBG_S_REGISTER ioctl 的函数的指针
vidioc_g_chip_info
指向实现 VIDIOC_DBG_G_CHIP_INFO ioctl 的函数的指针
vidioc_enum_framesizes
指向实现 VIDIOC_ENUM_FRAMESIZES ioctl 的函数的指针
vidioc_enum_frameintervals
指向实现 VIDIOC_ENUM_FRAMEINTERVALS ioctl 的函数的指针
vidioc_s_dv_timings
指向实现 VIDIOC_S_DV_TIMINGS ioctl 的函数的指针
vidioc_g_dv_timings
指向实现 VIDIOC_G_DV_TIMINGS ioctl 的函数的指针
vidioc_query_dv_timings
指向实现 VIDIOC_QUERY_DV_TIMINGS ioctl 的函数的指针
vidioc_enum_dv_timings
指向实现 VIDIOC_ENUM_DV_TIMINGS ioctl 的函数的指针
vidioc_dv_timings_cap
指向实现 VIDIOC_DV_TIMINGS_CAP ioctl 的函数的指针
vidioc_g_edid
指向实现 VIDIOC_G_EDID ioctl 的函数的指针
vidioc_s_edid
指向实现 VIDIOC_S_EDID ioctl 的函数的指针
vidioc_subscribe_event
指向实现 VIDIOC_SUBSCRIBE_EVENT ioctl 的函数的指针
vidioc_unsubscribe_event
指向实现 VIDIOC_UNSUBSCRIBE_EVENT ioctl 的函数的指针
vidioc_default
用于允许其他 ioctl
-
const char *v4l2_norm_to_name(v4l2_std_id id)¶
从模拟电视标准 ID 获取辅助例程。
参数
v4l2_std_id id
模拟电视标准 ID。
返回值
返回一个包含模拟电视标准名称的字符串。如果找不到该标准,或者如果 id 指向多个标准,则返回“Unknown”。
-
void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod)¶
用默认帧速率分数填充
v4l2_fract
结构指针的辅助例程。
参数
int id
模拟电视标准 ID。
struct v4l2_fract *frameperiod
要填充的 struct
v4l2_fract
指针
-
int v4l2_video_std_construct(struct v4l2_standard *vs, int id, const char *name)¶
根据 id 参数填充
v4l2_standard
结构的字段的辅助例程。
参数
struct v4l2_standard *vs
要填充的 struct
v4l2_standard
指针int id
模拟电视标准 ID。
const char *name
要使用的标准的名称
描述
注意
此辅助例程已过时。不应在新驱动程序上使用。
-
int v4l_video_std_enumstd(struct v4l2_standard *vs, v4l2_std_id id)¶
根据 id 和 vs->index 参数填充
v4l2_standard
结构的字段的辅助例程。
参数
struct v4l2_standard *vs
要填充的 struct
v4l2_standard
指针。v4l2_std_id id
模拟电视标准 ID。
-
void v4l_printk_ioctl(const char *prefix, unsigned int cmd)¶
以人类可读的格式打印 ioctl 的辅助例程。
参数
const char *prefix
要添加到 ioctl 打印的前缀。
unsigned int cmd
ioctl 名称
描述
注意
如果 prefix != NULL
,则它将首先发出 printk(KERN_DEBUG "``s
: ", prefix)``。
-
long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)¶
用于 64 位处理器的 32 位兼容性层
参数
struct file *file
指向 struct
file
的指针。unsigned int cmd
Ioctl 名称。
unsigned long arg
Ioctl 参数。
-
v4l2_kioctl¶
Typedef:用于传递 ioctl 处理程序的 Typedef。
语法
long v4l2_kioctl (struct file *file, unsigned int cmd, void *arg)
参数
struct file *file
指向 struct
file
的指针。unsigned int cmd
Ioctl 名称。
void *arg
Ioctl 参数。
-
long int video_usercopy(struct file *file, unsigned int cmd, unsigned long int arg, v4l2_kioctl func)¶
发出 ioctl 时,将数据从用户空间内存复制到用户空间内存。
参数
struct file *file
指向 struct
file
的指针。unsigned int cmd
Ioctl 名称。
unsigned long int arg
Ioctl 参数。
v4l2_kioctl func
将处理 ioctl 的函数
描述
注意
此例程应仅在 V4L2 核心中使用。
参数
struct file *file
指向 struct
file
的指针。unsigned int cmd
Ioctl 名称。
unsigned long int arg
Ioctl 参数。
描述
用于处理 ioctl 的方法。应用于填充所有 V4L2 驱动程序上的 v4l2_ioctl_ops.unlocked_ioctl
。