设为首页 加入收藏

TOP

uvc摄像头代码解析6(二)
2015-11-21 01:42:23 来源: 作者: 【 】 浏览:12
Tags:uvc 摄像头 代码 解析
minal %u.\n", forward->id); ?
? ? ? ? ? ? ? ? return -EINVAL; ?
? ? ? ? ? ? } ?
? ? ? ? ? ? list_add_tail(&forward->chain, &chain->entities); //添加uvc实体到uvc视频链的entities中 ?
? ? ? ? ? ? if (uvc_trace_param & UVC_TRACE_PROBE) { ?
? ? ? ? ? ? ? ? if (!found) ?
? ? ? ? ? ? ? ? ? ? printk(" (->"); ?
? ? ? ? ? ? ? ? printk(" OT %d", forward->id); ?
? ? ? ? ? ? ? ? found = 1; ?
? ? ? ? ? ? } ?
? ? ? ? ? ? break; ?
? ? ? ? } ?
? ? } ?
? ? if (found) ?
? ? ? ? printk(")"); ?
? ? return 0; ?
} ?
10.3.3 向后扫描实体
[cpp] ?
static int uvc_scan_chain_backward(struct uvc_video_chain *chain,struct uvc_entity **_entity) ?
{ ?
? ? struct uvc_entity *entity = *_entity; ?
? ? struct uvc_entity *term; ?
? ? int id = -EINVAL, i; ?
? ? switch (UVC_ENTITY_TYPE(entity)) { ?
? ? case UVC_VC_EXTENSION_UNIT: //扩展Unit ?
? ? case UVC_VC_PROCESSING_UNIT: ? ?//处理Unit处理Unit的输入Terminal个数只能为1 ?
? ? ? ? id = entity->baSourceID[0]; ?//获取输入pin(Unit/Terminal)的ID ?
? ? ? ? break; ?
? ? case UVC_VC_SELECTOR_UNIT: ?//选择器实体 ?
? ? ? ? /* Single-input selector units are ignored. */ ?
? ? ? ? if (entity->bNrInPins == 1) { ? ?//若输入pin个数为1 ?
? ? ? ? ? ? id = entity->baSourceID[0]; ?//获取输入in(Unit/Terminal)的ID ?
? ? ? ? ? ? break; ?
? ? ? ? } ?
? ? ? ? if (uvc_trace_param & UVC_TRACE_PROBE) ?
? ? ? ? ? ? printk(" <- IT"); ?
? ? ? ? chain->selector = entity; ? ?//uvc视频链的selector对象指向uvc实体 ?
? ? ? ? for (i = 0; i < entity->bNrInPins; ++i) { //总共有多少个输入pin ?
? ? ? ? ? ? id = entity->baSourceID[i]; ?//获取输入in(Unit/Terminal)的ID ?
? ? ? ? ? ? term = uvc_entity_by_id(chain->dev, id); //获取对应的输入pin实体 ?
? ? ? ? ? ? if (term == NULL || !UVC_ENTITY_IS_ITERM(term)) { ?
? ? ? ? ? ? ? ? uvc_trace(UVC_TRACE_DESCR, "Selector unit %d input %d isn't connected to an input terminal\n", entity->id, i); ?
? ? ? ? ? ? ? ? return -1; ?
? ? ? ? ? ? } ?
? ? ? ? ? ? if (uvc_trace_param & UVC_TRACE_PROBE) ?
? ? ? ? ? ? ? ? printk(" %d", term->id); ?
? ? ? ? ? ? list_add_tail(&term->chain, &chain->entities); ? ?//添加uvc实体到uvc视频链的entities链表 ?
? ? ? ? ? ? uvc_scan_chain_forward(chain, term, entity); ? ?//向前扫描实体 ?
? ? ? ? } ?
? ? ? ? if (uvc_trace_param & UVC_TRACE_PROBE) ?
? ? ? ? ? ? printk("\n"); ?
? ? ? ? id = 0; ?
? ? ? ? break; ?
? ? case UVC_ITT_VENDOR_SPECIFIC: ?
? ? case UVC_ITT_CAMERA: ?
? ? case UVC_ITT_MEDIA_TRANSPORT_INPUT: ?
? ? case UVC_OTT_VENDOR_SPECIFIC: ?
? ? case UVC_OTT_DISPLAY: ?
? ? case UVC_OTT_MEDIA_TRANSPORT_OUTPUT: ?
? ? case UVC_TT_STREAMING: ?
? ? ? ? id = UVC_ENTITY_IS_OTERM(entity) ? entity->baSourceID[0] : 0; ?
? ? ? ? break; ?
? ? } ?
? ? if (id <= 0) { ?
? ? ? ? *_entity = NULL; ?
? ? ? ? return id; ?
? ? } ?
? ? entity = uvc_entity_by_id(chain->dev, id); ?
? ? if (entity == NULL) { ?
? ? ? ? uvc_trace(UVC_TRACE_DESCR, "Found reference to unknown entity %d.\n", id); ?
? ? ? ? return -EINVAL; ?
? ? } ?
? ? *_entity = entity; ?
? ? return 0; ?
} ?
注意到trace打印的语句会发现有一条
[cpp] ?
uvcvideo: Scanning UVC chain: OT 2 <- XU 5 <- XU 4 <- PU 3 <- IT 1 ?
可以看到这些Unit和Terminal是如何组建起来的
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇hdu 4726 Kia's Calculation 下一篇uvc摄像头代码解析7

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: