NetSDK 编程指导手册
V3.4.7
前言 I
前言
目的
欢迎使用 NetSDK(以下简称 SDK)编程指导手册。
SDK 是软件开发者在开发网络硬盘录像机、网络视频服务器、网络摄像机、网络球机和智能设备
等产品监控联网应用时的开发套件。
本文档详细描述了开发包中各个函数的功能、接口以及函数之间的调用关系,并提供了代码示例。
符号约定
在本文档中可能出现下列标志,它们所代表的含义如下。
符号
说明
表示是正文的附加信息,是对正文的强调和补充。
修订记录
日期
修订内容
2016-01-15
创建
2016-08-16
修订
目录 II
目录
前言........................................................................................................................................................I
目录...................................................................................................................................................... II
1 内容简介 ............................................................................................................................................ 1
1.1 概述 ......................................................................................................................................... 1
1.2 环境要求 .................................................................................................................................. 2
2 主要功能 ............................................................................................................................................ 3
2.1 SDK 初始化 ............................................................................................................................... 3
2.1.1 简介 ................................................................................................................................ 3
2.1.2 接口总览 ......................................................................................................................... 3
2.1.3 流程说明 ......................................................................................................................... 4
2.1.4 示例代码 ......................................................................................................................... 4
2.2 设备登录 .................................................................................................................................. 8
2.2.1 简介 ................................................................................................................................ 8
2.2.2 接口总览 ......................................................................................................................... 8
2.2.3 流程说明 ......................................................................................................................... 9
2.2.4 示例代码 ........................................................................................................................10
2.3 实时监视 .................................................................................................................................14
2.3.1 简介 ...............................................................................................................................14
2.3.2 接口总览 ........................................................................................................................14
2.3.3 流程说明 ........................................................................................................................14
2.3.4 示例代码 ........................................................................................................................17
2.4 录像回放 .................................................................................................................................28
2.4.1 简介 ...............................................................................................................................28
2.4.2 接口总览 ........................................................................................................................28
2.4.3 流程说明 ........................................................................................................................29
2.4.4 示例代码 ........................................................................................................................33
2.5 录像下载 .................................................................................................................................48
2.5.1 简介 ...............................................................................................................................48
2.5.2 接口总览 ........................................................................................................................48
2.5.3 流程说明 ........................................................................................................................49
2.5.4 示例代码 ........................................................................................................................54
2.6 云台控制 .................................................................................................................................69
2.6.1 简介 ...............................................................................................................................69
2.6.2 接口总览 ........................................................................................................................69
2.6.3 流程说明 ........................................................................................................................70
2.6.4 示例代码 ........................................................................................................................71
2.7 语音对讲 .................................................................................................................................87
2.7.1 简介 ...............................................................................................................................87
2.7.2 接口总览 ........................................................................................................................88
2.7.3 流程说明 ........................................................................................................................88
2.7.4 示例代码 ........................................................................................................................92
目录 III
2.8 视频抓图 ............................................................................................................................... 121
2.8.1 简介 ............................................................................................................................. 121
2.8.2 接口总览 ...................................................................................................................... 122
2.8.3 流程说明 ...................................................................................................................... 122
2.8.4 示例代码 ...................................................................................................................... 123
2.9 报警上报 ............................................................................................................................... 130
2.9.1 简介 ............................................................................................................................. 130
2.9.2 接口总览 ...................................................................................................................... 131
2.9.3 流程说明 ...................................................................................................................... 131
2.9.4 示例代码 ...................................................................................................................... 132
2.10 设备搜索.............................................................................................................................. 142
2.10.1 简介 ........................................................................................................................... 142
2.10.2 接口总览 .................................................................................................................... 142
2.10.3 流程说明 .................................................................................................................... 143
2.10.4 示例代码 .................................................................................................................... 144
2.11 智能事件上报与抓图 ............................................................................................................ 158
2.11.1 简介 ........................................................................................................................... 158
2.11.2 接口总览 .................................................................................................................... 158
2.11.3 流程说明 .................................................................................................................... 158
2.11.4 示例代码 .................................................................................................................... 160
3 回调函数定义 .................................................................................................................................. 171
3.1 fDisConnect............................................................................................................................. 171
3.2 fHaveReConnect ...................................................................................................................... 171
3.3 fRealDataCallBackEx ............................................................................................................... 172
3.4 fDownLoadPosCallBack ........................................................................................................... 173
3.5 fDataCallBack.......................................................................................................................... 174
3.6 fTimeDownLoadPosCallBack .................................................................................................... 175
3.7 fMessCallBack ......................................................................................................................... 176
3.8 fSearchDevicesCB.................................................................................................................... 177
3.9 fAnalyzerDataCallBack............................................................................................................. 178
3.10 fSnapRev ............................................................................................................................... 180
3.11 fRealPlayDisConnect .............................................................................................................. 181
3.12 pfAudioDataCallBack ............................................................................................................. 182
附录 1 结构体定义.............................................................................................................................. 183
NET_DEVICEINFO ............................................................................................................... 183
NET_PARAM ........................................................................................................................ 184
NET_DEVICEINFO_Ex ......................................................................................................... 185
tagVideoFrameParam .............................................................................................................. 186
tagCBPCMDataParam............................................................................................................. 187
NET_TIME............................................................................................................................ 188
NET_RECORDFILE_INFO..................................................................................................... 189
CFG_PTZ_PROTOCOL_CAPS_INFO ..................................................................................... 190
CFG_PTZ_MOTION_RANGE ................................................................................................ 194
CFG_PTZ_LIGHTING_CONTROL ......................................................................................... 194
DHDEV_TALKFORMAT_LIST .............................................................................................. 195
DHDEV_TALKDECODE_INFO ............................................................................................. 195
DHDEV_SYSTEM_ATTR_CFG.............................................................................................. 196
目录 IV
NET_SPEAK_PARAM ........................................................................................................... 198
NET_TALK_TRANSFER_PARAM ......................................................................................... 199
DEVICE_NET_INFO_EX ....................................................................................................... 199
MANUAL_SNAP_PARAMETER ............................................................................................ 201
OPR_RIGHT_EX ................................................................................................................... 202
OPR_RIGHT_NEW................................................................................................................ 202
NET_DEV_CHN_COUNT_INFO ............................................................................................ 202
NET_CHN_COUNT_INFO ..................................................................................................... 203
NET_IN_SNAP_CFG_CAPS................................................................................................... 204
NET_OUT_SNAP_CFG_CAPS ............................................................................................... 204
DH_RESOLUTION_INFO ...................................................................................................... 205
CFG_VIDEOENC_OPT .......................................................................................................... 205
CFG_VIDEO_FORMAT ......................................................................................................... 207
CFG_AUDIO_ENCODE_FORMAT ......................................................................................... 209
CFG_VIDEO_COVER............................................................................................................ 210
CFG_COVER_INFO .............................................................................................................. 210
CFG_RECT ........................................................................................................................... 211
CFG_RGBA .......................................................................................................................... 212
CFG_ENCODE_INFO ............................................................................................................ 212
SNAP_PARAMS .................................................................................................................... 214
DH_VERSION_INFO............................................................................................................. 214
DH_DSP_ENCODECAP......................................................................................................... 215
附录 2 枚举定义 ................................................................................................................................. 218
NET_DEVICE_TYPE............................................................................................................. 218
EM_LOGIN_SPAC_CAP_TYPE ............................................................................................. 219
DH_RealPlayType .................................................................................................................. 220
EM_QUERY_RECORD_TYPE ............................................................................................... 221
EM_USEDEV_MODE............................................................................................................ 221
EM_SUPPORT_FOCUS_MODE ............................................................................................. 222
DH_PTZ_ControlType ............................................................................................................ 222
DH_EXTPTZ_ControlType ..................................................................................................... 223
DH_TALK_CODING_TYPE ................................................................................................... 225
CtrlType ................................................................................................................................ 225
CFG_VIDEO_COMPRESSION ............................................................................................... 232
CFG_BITRATE_CONTROL ................................................................................................... 232
CFG_IMAGE_QUALITY ....................................................................................................... 233
CFG_H264_PROFILE_RANK................................................................................................. 233
CFG_AUDIO_FORMAT ......................................................................................................... 233
EM_REALPLAY_DISCONNECT_EVENT_TYPE .................................................................... 234
附录 3 接口函数定义 .......................................................................................................................... 235
CLIENT_Init.......................................................................................................................... 235
CLIENT_Cleanup ................................................................................................................... 236
CLIENT_GetSDKVersion........................................................................................................ 237
CLIENT_GetLastError ............................................................................................................ 237
CLIENT_SetAutoReconnect .................................................................................................... 238
CLIENT_SetConnectTime ....................................................................................................... 239
CLIENT_SetNetworkParam ..................................................................................................... 240