MetadataTag在CamX中有两种体现,可以是预定义的AndroidTag或是自定义VendorTag
VendorTag在HAL中定义,用来支持Camx和Chi所需的额外metadata
VendorTag类型有三种:
- hwVendorTagInfo
- componentvendortaginfo
- coreVendorTagInfo
根据不同具体情况添加对应的VendorTag
通过VendorTag访问metadata的接口在每一层(layer)中都不一样,下面是一个如何在APP中设置metadata,并通过使用VendorTag得不同层中的metadata的Sample Code(所有的操作都在 processRequests 阶段)。
例:
添加一个VendorTag,用于控制超夜Feature:
//由于项目中超夜的Feature用的是RawHdr Feature实现的,所以相关代码使用的都是"HDR",实际功能是用于控制超夜Feature
\chi-cdk\api\common\chivendortagdefines.h
添加CHIVENDORTAGDATA Static变量:
\camx\src\api\vendortag\camxvendortagdefines.h
这一段可以添加在 camxvendortagdefines.h 的 g_HwVendorTagSections[ ]
也可以添加在 chivendortagdefines.h 的 g_VendorTagSectionDataChiOverride[ ]
添加在Camx中是HWVendorTag,最好还是加在chivendortagdefines.h
\camx\src\core\chi\camxchicontext.cpp
\chi-cdk\core\chiutils\chxdefs.h
\chi-cdk\core\chiframework\chxextensionmodule.cpp
\chi-cdk\oem\qcom\feature2\chifeature2graphselector\chifeature2graphselector.cpp
选择FeatureGraph前解析pAppSettings
(1).\chi-cdk\oem\qcom\feature2\chifeature2graphselector\chifeature2graphselector.h
TEnable:用于标识HDR状态的枚举,实际超夜只用到了 T_OFF 和 T_ON 两个状态
m_hdrEnable:用于记录上层传下来的HDR状态的变量
(2).\chi-cdk\oem\qcom\feature2\chifeature2graphselector\chifeature2graphselector.cpp
判断HDR状态后,被其他函数调用
(3).\chi-cdk\oem\qcom\feature2\chifeature2graphselector\chifeature2graphselector.cpp
在拍照时选择FeatureGraph的函数中调用 isHDREanble()
VendorTag加完,编译,Push So之后,
可以使用命令: adb shell dumpsys media.camera > D:\temp\media.camera.txt 检查Tag是否有正常添加