智能客服
你问我答,随时在线为你解决问题
FileName |
Description |
|---|---|
dmsdp_camera_handler.h |
南向Camera适配接口。 |
DMSDPGetCameraHandler Camera方法获取接口。
形式:int32_t DMSDPGetCameraHandler(DMSDPCameraHandler* cameraHandler)
参数:[in] na [out] cameraHandler
输出:0表示成功,<0表示失败。
描述:获取Camera功能方法,存放在DMSDPCameraHandler结构体中。
Type |
Method |
|---|---|
int32_t |
(*RegisterSendDataCallback)(const char* id, uint32_t idLen, const DMSDPSendBackDataCB cb) 注册获取Camera图像回调函数。 |
int32_t |
(*OpenCamera)(const DMSDPCameraParam* param) 打开Camera获取图像。 |
int32_t |
(*CloseCamera)(const char* id, uint32_t idLen) 关闭Camera。 |
int32_t |
(*UpdateConfig)(const char* id, uint32_t idLen, int32_t key, char* value, uint32_t valLen) 更新Camera配置。 |
int32_t |
(*GetCameraCapability)(DMSDPCameraCapabilities** capabilities, uint32_t* num) 查询Camera能力信息。 |
const char* |
(*GetCameraCapabilityString)(uint32_t* len) 查询Camera能力信息。 |
void |
(*Release)(int32_t type, void* ptr, uint32_t num) 释放资源。 |
int32_t |
(*RegisterListener)(const DMSDPListener* listener) 注册监听。 |
int32_t |
(*BusinessControl)(uint32_t cmd, void* inputPara, uint32_t inLen, void* outputPara, uint32_t outLen) 业务控制。 |
Method |
|---|
int32_t (*RegisterSendDataCallback)(const char* id, uint32_t idLen, const DMSDPSendBackDataCB cb) 注册获取Camera图像回调函数。 |
Parameters
Name |
Description |
|---|---|
id |
Camera ID。 |
idLen |
Camera ID长度。 |
cb |
回调函数。 typedef int32_t (*DMSDPSendBackDataCB)(const uint8_t* buffer, uint32_t len, int32_t type) buffer:视频流数据地址 len:视频流长度 type:视频流类型(DMSDPCameraDataType) typedef enum { H264 = 1, H265 = 2, RGB565 = 4, NV21 = 17 } DMSDPCameraDataType; |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,<0失败。 |
Method |
|---|
int32_t (*OpenCamera)(const DMSDPCameraParam* param) 打开Camera获取图像。 |
Parameters
Name |
Description |
|---|---|
| param |
打开camera的参数对象,定义如下: typedef struct { /* id of camera */ const char* id; uint32_t idLen; /* frame width */ uint32_t width; /* frame height */ uint32_t height; /* fps */ uint32_t fps; /* DMSDPCameraDataType */ uint32_t dataFormat; } DMSDPCameraParam; |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,<0失败。 |
Method |
|---|
int32_t (*CloseCamera)(const char* id, uint32_t idLen) 关闭Camera。 |
Parameters
Name |
Description |
|---|---|
id |
Camera ID。 |
idLen |
Camera ID长度。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,<0失败。 |
Method |
|---|
int32_t (*UpdateConfig)(const char* id, uint32_t idLen, int32_t key, char* value, uint32_t valLen) 更新Camera配置。 |
Parameters
Name |
Description |
|---|---|
id |
Camera ID。 |
idLen |
Camera ID长度。 |
| key |
参数类型。 typedef enum { FPS, } DSMDPCameraConfigKey; |
value |
参数字符串。 |
valLen |
参数长度。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,<0失败。 |
Method |
|---|
int32_t (*GetCameraCapability)(DMSDPCameraCapabilities** capabilities, uint32_t* num) 查询Camera能力信息。 |
Parameters
Name |
Description |
|---|---|
char* id |
Camera ID。 |
uint32_t idLen |
Camera ID长度。 |
DMSDPCameraAbility* abilities typedef struct { uint32_t min; uint32_t max; } DMSDPFpsRange; typedef struct { uint32_t width; uint32_t height; } DMSDPSize; typedef struct { DMSDPFpsRange*supportFpsRanges; uint32_t fpsRangeNum; DMSDPSize* supportSizes; uint32_t sizeNum; DMSDPCameraDataType dataType; } DMSDPCameraAbility; |
Camera能力。 supportFpsRanges:帧率范围列表。 FpsRange:1000的整数倍,例如,20-30pfs{20000, 30000}。 fpsRangeNum:列表个数。 supportSizes:分辨率列表。 DMSDPSize:分辨率长度和宽度,例如1280*720为{1280, 720}。 sizeNum:列表个数。 dataType:支持的帧类型。 typedef enum { H264 = 1, H265 = 2, RGB565 = 4, NV21 = 17 } DMSDPCameraDataType; 注:H264/H265只选择其中一个,RGB565/NV21只选择其中一种,视频编码方式传输和原始视频帧方式中分别只能选择一个。 |
uint32_t abilityNum; |
能力集个数,每种类型1个。 |
DMSDPExtendInfos extendInfos typedef struct { char* key; uint32_t keyLen; char* value; uint32_t valueLen; } DMSDPExtendInfo; typedef struct { DMSDPExtendInfo* infos; uint32_t num; } DMSDPExtendInfos; |
扩展信息,预留。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,<0失败。 |
Method |
|---|
const char* (*GetCameraCapabilityString)(uint32_t* len) 查询Camera能力信息。 |
Parameters
Name |
Description |
|---|---|
len |
Camera能力Json字符串长度。 |
Return
Type |
Description |
|---|---|
const char* |
Camera的属性信息的集合字符串。 |
Method |
|---|
void (*Release)(int32_t type, void* ptr, uint32_t num) 释放资源。 |
Parameters
Name |
Description |
|---|---|
type |
释放资源类型: typedef enum { RELEASE_TYPE_QUERY_ABLITIY = 1 } DMSDPCameraReleaseType; 对应QueryCameraCapability |
ptr |
对应DMSDPCameraCapabilities* capabilities。 |
num |
Camera个数。 |
Method |
|---|
int32_t (*RegisterListener)(const DMSDPListener* listener) 注册监听。 |
Parameters
Name |
Description |
|---|---|
| listener |
监听回调列表。 dmsdp_business.h: typedef struct { int32_t (*UpdateServiceStatus)(const char* id, uint32_t idLen, const DMSDPServiceStatus status); int32_t (*UpdateServiceAction)(const char* id, uint32_t idLen, DMSDPServiceAction* action); } DMSDPListener; typedef enum { /* 外设连接到设备上,比如插入USB Camera */ PLUGIN = 1, /* 外设和设备断开连接,比如USB Camera从车技拔出 */ UNPLUG, /* 外设链接在设备上,处于空闲可用状态 */ AVAILABLE, /* 外设连接在设备上,处于业务运行中,其他应用要用需要抢占 */ UNAVAILABLE, } DMSDPServiceStatus; |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,<0失败。 |
Method |
|---|
int32_t (*BusinessControl)(uint32_t cmd, void* inputPara, uint32_t inLen, void* outputPara, uint32_t outLen) 业务控制。 |
Parameters
Name |
Description |
|---|---|
| cmd |
命令字(预留扩展)。 typedef enum { MSDP_BUSINESS_CTRL_RESERVED = 0 } DMSDPBusinessControlCmd; |
inputPara |
输入参数。 |
inLen |
输入参数长度。 |
outputPara |
输出参数。 |
outLen |
输出参数长度。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,<0失败。 |