视频录制
提供远程启动和停止手动录像功能(仅支持 N9000)。
接口概览
流程说明
---
title: 视频录制
---
flowchart TD
A(设备SDK初始化<br><strong>NET_SDK_Init</strong>)
B(用户注册设备<br><strong>NET_SDK_Login</strong>或<br><strong>NET_SDK_LoginEx</strong>)
C("启动设备端手动录像<br><strong>NET_SDK_StartDVRRecord</strong>")
D("停止设备端手动录像<br><strong>NET_SDK_StopDVRRecord</strong>")
E(注销设备<br><strong>NET_SDK_Logout</strong>)
F(释放SDK资源<br><strong>NET_SDK_Cleanup</strong>)
B --> C --> E
A --> B --> D --> E --> F
Note
视频录制功能,提供手动录制和停止设备录像功能,仅N9000支持。
示例代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 | #include <afx.h>
#include <string>
#include <stdio.h>
#include <iostream>
#include "DVR_NET_SDK.h"
void StartRecord()
{
// Device information.
const std::string device_ip = "10.80.1.177";
const DWORD decice_port = 6036;
const std::string username = "admin";
const std::string password = "123456";
// Initialize SDK.
NET_SDK_Init();
NET_SDK_DEVICEINFO device_info{0};
DWORD errCode = 0;
// Device login.
int userid = NET_SDK_Login(const_cast<char *>(device_ip.c_str()), decice_port, const_cast<char *>(username.c_str()), const_cast<char *>(password.c_str()), &device_info);
if (userid > 0)
{
std::cout << "Login successful!" << std::endl;
}
else
{
errCode = NET_SDK_GetLastError();
std::cout << "Login failed!" << "Error code:" << errCode << std::endl;
NET_SDK_Cleanup();
return;
}
// Manually recording.
BOOL ret = NET_SDK_StartDVRRecord(userid, 0, 0);
if (ret)
{
std::cout << "Manual recording successful!" << std::endl;
}
else
{
errCode = NET_SDK_GetLastError();
std::cout << "Manual recording failed!" << "Error code:" << errCode << std::endl;
}
// Logout.
NET_SDK_Logout(userid);
// Release SDK resources.
NET_SDK_Cleanup();
return;
}
|