2.2.18 V4L2 Media Controller functions and data structures

int v4l2_mc_create_media_graph(struct media_device *mdev)
在图形上创建媒体控制器(Media Controller)的连接。
参数
struct media_device *mdev:指向media_device结构体的指针。
描述
在V4L2(Video4Linux2)端为常见的PC客户端硬件实体之间添加连接:
相机传感器、音频和视频PLL-IF解码器、调谐器、模拟电视解码器以及I/O实体(视频、VBI和软件定义无线电)。
注意:网络摄像头(Webcams)采用非常简单的模型:传感器直接连接到I/O实体。所有细节,如缩放器(scaler)和裁剪硬件(crop HW)都被隐藏起来。虽然这种映射对于以v4l2接口为中心的PC客户端硬件已足够,但对于以V4L2子设备为中心的相机硬件来说,不应使用此例程,因为它无法构建正确的图形。
int v4l_enable_media_source(struct video_device *vdev)
如果媒体源空闲,则将其保留以供独占使用。
参数
struct video_device *vdev:指向struct video_device的指针。
描述
此接口调用enable_source处理程序以确定媒体源是否空闲可用。enable_source处理程序负责检查媒体源是否空闲,并在视频设备关联的媒体实体之间启动一个管道。这个接口应该从改变源配置的v4l2-core和dvb-core接口中调用。
返回值
成功时返回零,否则返回负错误代码。
void v4l_disable_media_source(struct video_device *vdev)
释放媒体源。
参数
struct video_device *vdev:指向struct video_device的指针。
描述
此接口调用disable_source处理程序来释放媒体源。disable_source处理程序停止视频设备关联的媒体实体和媒体源之间的活动媒体管道。
返回值
成功时返回零,否则返回负错误代码。
int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, struct media_pad *sink, u32 flags)
从源子设备创建基于fwnode的链接到目标子设备的pad。
参数
struct v4l2_subdev *src_sd:指向源子设备的指针。
struct media_pad *sink:指向目标子设备的pad的指针。
u32 flags:链接的标志位。
描述
此函数从源子设备到单个目标pad搜索fwnode端点连接,并将适当的连接转换为与该pad的媒体链接。该函数可以由目标子设备在其v4l2-async notifier subdev绑定回调中调用,以从绑定的源子设备创建链接。
flags参数指定链接的标志。调用者应确保无论创建多少个链接,标志都是有效的。例如,设置MEDIA_LNK_FL_ENABLED标志将导致所有创建的链接都处于启用状态,如果创建多个链接,则无效。
注意:调用此函数的任何目标子设备必须实现.get_fwnode_pad媒体操作,以验证传递给目标的端点是否由目标拥有。
成功时返回0,失败时返回负错误代码。
int v4l2_create_fwnode_links(struct v4l2_subdev *src_sd, struct v4l2_subdev *sink_sd)
从源子设备创建基于fwnode的链接到目标子设备。
参数
struct v4l2_subdev *src_sd:指向源子设备的指针。
struct v4l2_subdev *sink_sd:指向目标子设备的指针。
描述
此函数在源子设备和目标子设备之间搜索所有的fwnode端点连接,并将其转换为媒体链接。该函数可以由目标子设备在其v4l2-async notifier subdev绑定回调中调用,以创建从绑定的源子设备到目标子设备的所有链接。
注意:调用此函数的任何目标子设备必须实现.get_fwnode_pad媒体操作,以验证传递给目标的端点是否由目标拥有。
成功时返回0,失败时返回负错误代码。
int v4l2_pipeline_pm_get(struct media_entity *entity)
增加管道的使用计数。
参数
struct media_entity *entity:管道的根实体。
描述
更新管道中所有实体的使用计数,并开启所需的电源实体。
此函数旨在在视频节点打开时调用。它使用struct media_entity.use_count来跟踪电源状态。该函数的使用应与v4l2_pipeline_link_notify()成对使用。
成功时返回0,失败时返回负错误代码。
void v4l2_pipeline_pm_put(struct media_entity *entity)
减少管道的使用计数。
参数
struct media_entity *entity:管道的根实体。
描述
更新管道中所有实体的使用计数,并关闭不再使用的电源实体。
该函数旨在在视频节点释放时调用。它使用struct media_entity.use_count来跟踪电源状态。该函数的使用应与v4l2_pipeline_link_notify()成对使用。
int v4l2_pipeline_link_notify(struct media_link *link, u32 flags, unsigned int notification)
链接管理通知回调函数
参数
struct media_link *link:链接对象
u32 flags:将被应用的新链接标志
unsigned int notification:链接状态变化的通知类型(MEDIA_DEV_NOTIFY_*)
描述
通过更新源和目标端的所有实体的使用计数来响应已启动管道上的链接管理。相应的实体将被开启或关闭电源。该函数的使用应与v4l2_pipeline_pm_{get, put}()成对使用。
成功时返回0,失败时返回负错误代码。关闭电源实体被假设永远不会失败。该函数不会因为断开事件而失败。

2.2.19 V4L2 Media Bus functions and data structures
enum v4l2_mbus_type

媒体总线类型
常量
V4L2_MBUS_UNKNOWN:未知的总线类型,没有 V4L2 媒体总线配置
V4L2_MBUS_PARALLEL:使用 hsync 和 vsync 的并行接口
V4L2_MBUS_BT656:带有嵌入同步的并行接口,也可以用于 BT.1120
V4L2_MBUS_CSI1:MIPI CSI-1 串行接口
V4L2_MBUS_CCP2:CCP2(紧凑型相机端口2)
V4L2_MBUS_CSI2_DPHY:带有 D-PHY 的 MIPI CSI-2 串行接口
V4L2_MBUS_CSI2_CPHY:带有 C-PHY 的 MIPI CSI-2 串行接口
V4L2_MBUS_INVALID:无效的总线类型(保持为最后一个)
struct v4l2_mbus_config
媒体总线配置
定义

struct v4l2_mbus_config {
    enum v4l2_mbus_type type;
    unsigned int flags;
};

成员
type(输入):接口类型
flags(输入/输出):配置标志,取决于类型
void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, const struct v4l2_mbus_framefmt *mbus_fmt)
辅助函数,从 struct v4l2_mbus_framefmt 填充 struct v4l2_pix_format 的字段。
参数
struct v4l2_pix_format *pix_fmt:指向要填充的 struct v4l2_pix_format 的指针
const struct v4l2_mbus_framefmt *mbus_fmt:指向要用作模板的 struct v4l2_mbus_framefmt 的指针。
void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt, const struct v4l2_pix_format *pix_fmt, u32 code)
辅助函数,根据 struct v4l2_pix_format 和数据格式代码填充 struct v4l2_mbus_framefmt。
参数
struct v4l2_mbus_framefmt *mbus_fmt:指向要填充的 struct v4l2_mbus_framefmt 的指针
const struct v4l2_pix_format *pix_fmt:指向要用作模板的 struct v4l2_pix_format 的指针
u32 code:数据格式代码(来自 enum v4l2_mbus_pixelcode)
void v4l2_fill_pix_format_mplane(struct v4l2_pix_format_mplane *pix_mp_fmt, const struct v4l2_mbus_framefmt *mbus_fmt)
辅助函数,根据媒体总线结构填充 struct v4l2_pix_format_mplane 的字段。
参数
struct v4l2_pix_format_mplane *pix_mp_fmt:指向要填充的 struct v4l2_pix_format_mplane 的指针
const struct v4l2_mbus_framefmt *mbus_fmt:指向要用作模板的 struct v4l2_mbus_framefmt 的指针。
void v4l2_fill_mbus_format_mplane(struct v4l2_mbus_framefmt *mbus_fmt, const struct v4l2_pix_format_mplane *pix_mp_fmt)
辅助函数,根据 struct v4l2_pix_format_mplane 填充 struct v4l2_mbus_framefmt 的字段。
参数
struct v4l2_mbus_framefmt *mbus_fmt:指向要填充的 struct v4l2_mbus_framefmt 的指针
const struct v4l2_pix_format_mplane *pix_mp_fmt:指向要用作模型的 struct v4l2_pix_format_mplane 的指针。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值