This commit is contained in:
2024-10-09 14:40:18 +08:00
commit 8d55048f7b
39 changed files with 160756 additions and 0 deletions

123
src/DataTime.h Normal file
View File

@@ -0,0 +1,123 @@
#pragma once
#include <iostream>
#include <string>
//
class DateTime
{
public:
DateTime(int year, int month, int day, int hour, int minute, int second)
{
SetDateTime(year, month, day, hour, minute, second);
}
DateTime()
{
SetDateTime(0, 0, 0, 0, 0, 0);
}
~DateTime() {}
// Set date and time
void SetDateTime(int year, int month, int day, int hour, int minute, int second)
{
m_year = year;
m_month = month;
m_day = day;
m_hour = hour;
m_minute = minute;
m_second = second;
}
//copy constructor
DateTime(const DateTime& other)
{
m_year = other.m_year;
m_month = other.m_month;
m_day = other.m_day;
m_hour = other.m_hour;
m_minute = other.m_minute;
m_second = other.m_second;
}
DateTime& operator=(const DateTime& other)
{
m_year = other.m_year;
m_month = other.m_month;
m_day = other.m_day;
m_hour = other.m_hour;
m_minute = other.m_minute;
m_second = other.m_second;
return *this;
}
// Get date and time
std::string GetDateTime()
{
return std::to_string(m_year) + "-" + std::to_string(m_month) + "-" + std::to_string(m_day) + " " + std::to_string(m_hour) + ":" + std::to_string(m_minute) + ":" + std::to_string(m_second);
}
// 比较两个对象
int CompareTo(DateTime other)
{
if (m_year != other.m_year)
{
return m_year < other.m_year ? -1 : 1;
}
if (m_month != other.m_month)
{
return m_month < other.m_month ? -1 : 1;
}
if (m_day != other.m_day)
{
return m_day < other.m_day ? -1 : 1;
}
if (m_hour != other.m_hour)
{
return m_hour < other.m_hour ? -1 : 1;
}
if (m_minute != other.m_minute)
{
return m_minute < other.m_minute ? -1 : 1;
}
if (m_second != other.m_second)
{
return m_second < other.m_second ? -1 : 1;
}
return 0;
}
// < Operator overwrite
bool operator<(const DateTime& other)
{
return CompareTo(other) < 0;
}
// > Operator overwrite
bool operator>(const DateTime& other)
{
return CompareTo(other) > 0;
}
// == Operator overwrite
bool operator==(const DateTime& other)
{
return CompareTo(other) == 0;
}
// 访问私有成员
int& year() { return m_year; }
int& month() { return m_month; }
int& day() { return m_day; }
int& hour() { return m_hour; }
int& minute() { return m_minute; }
int& second() { return m_second; }
private:
int m_year;
int m_month;
int m_day;
int m_hour;
int m_minute;
int m_second;
};

43
src/DecisionPlatform.h Normal file
View File

@@ -0,0 +1,43 @@
#pragma once
#include <thread>
#include <chrono>
#define SLEEP(x) std::this_thread::sleep_for(std::chrono::seconds(x));
#ifdef _WIN32_
#include <windows.h>
#ifdef OmnimatrixExport
#define Omnimatrix __declspec(dllexport)
#else
#define Omnimatrix __declspec(dllimport)
#endif
#define STRCPY(Dst, Len, Src) strcpy_s(Dst, Len, Src)
#define LOCAL_TIME(in, out) localtime_s(in,out);
#define LOCAL_MIN MIN(a,b)
#define LOCAL_MAX MAX(a,b)
#endif
#ifdef _LINUX_
#include "unistd.h"
#include <stdint.h>
#ifdef Omnimatrix
#define Omnimatrix __attribute__((visibility("default")))
#else
#define Omnimatrix __attribute__((visibility("default")))
#endif
#define LOCAL_TIME(in, out) localtime_r(out,in )
#define STRCPY(Dst,Len ,Src ) strcpy(Dst, Src)
#endif

178
src/FormatTrans.cpp Normal file
View File

@@ -0,0 +1,178 @@
#include <cassert>
#include <sstream>
#include <iomanip>
#include "FormatTrans.h"
float HEX2DEC(WORD Hex)
{
BYTE bai = Hex >> 12;
Hex = Hex - bai * std::pow(16, 3);
BYTE shi = Hex >> 8;
Hex = Hex - shi * pow(16, 2);
BYTE ge = Hex >> 4;
Hex = Hex - ge * pow(16, 1);
BYTE xiao = Hex;
return bai * pow(10, 2) + shi * pow(10, 1) + ge * pow(10, 0) + xiao * pow(10, -1);
}
WORD DEC2HEX(float Dec)
{
BYTE bai = Dec / pow(10, 2);
Dec = Dec - bai * pow(10, 2);
BYTE shi = Dec / pow(10, 1);
Dec = Dec - shi * pow(10, 1);
BYTE ge = Dec / pow(10, 0);
Dec = Dec - ge * pow(10, 0);
BYTE xiao = Dec / pow(10, -1);
return bai * pow(16, 3) + shi * pow(16, 2) + ge * pow(16, 1) + xiao * pow(16, 0);
}
/***********************************
function: IsHexChar
desc: 判断字符是否在0-9a-f之间
input char-字符
Output
return: 字符索引如8-8a-10如果
不是,返回-1
***********************************/
int IsHexChar(char hc)
{
if('0'<=hc && hc<='9')
return (int(hc)-int('0'));
else if('a'<=hc && hc<='f')
return (int(hc)-int('a')+10);
else if('A'<=hc && hc<='F')
return (int(hc)-int('A')+10);
return -1;
}
/**************************************
function: Hex2Char
desc: 16进制数转化为字符
Input: hex-16进制字符串形式2字符
Output:
return: ascii字符
**************************************/
unsigned char Hex2Char(const std::string &hex)
{
assert(hex.length() == 2);
int high = IsHexChar(hex[0]);
int low = IsHexChar(hex[1]);
if(high == -1 || low == -1)
return '\0';
int asc = high*16+low;
// char b = toascii(asc);
return asc;
}
/****************************
function: Hex2String
desc: 16进制字符串转化为ascii字符串
Input: hex-16进制字符串
Output:
return: ascii字符串
*****************************/
std::string Hex2String(const std::string &hex)
{
assert(hex.length()%2 == 0);
std::string hstr;
for(int i=0; i<hex.length(); i+=2)
{
std::string tmp = hex.substr(i,2);
hstr.append(1,Hex2Char(tmp));
}
return hstr;
}
/****************************************
functionPrepareHexString
desc: 去掉字符串里的空格0x
Input: str普通字符串
Output:
return: 去掉空格和0x的字符串
****************************************/
std::string PrepareHexString(std::string str)
{
//先删除空格
int i=0;
while(i != str.length())
{
i = str.find(' ',i);
if(i == -1)
break;
str = str.erase(i,1);
}
//删除0x
i = 0;
std::string tmp("0x");
while(i != str.length())
{
i = str.find(tmp,i);
if(i == -1)
break;
str = str.erase(i,2);
}
//删除0X
i = 0;
tmp = "0X";
while(i != str.length())
{
i = str.find(tmp,i);
if(i == -1)
break;
str = str.erase(i,2);
}
if(str.length()%2 != 0)
str.append(1,'0');
str = Hex2String(str);
return str;
}
// 十进制转十六进制
std::string decimalToHexadecimal(int decimal) {
std::stringstream ss;
ss << std::hex << decimal;
return ss.str();
}
// 十六进制转十进制
int hexadecimalToDecimal(const std::string& hexadecimal) {
return std::stoi(hexadecimal, nullptr, 16);
}
std::string charToHex(char value) {
int intValue = static_cast<int>(value);
if (intValue < 0) {
intValue = 256 + intValue;
}
std::stringstream ss;
ss << std::setw(2) << std::setfill('0') << std::hex << std::uppercase << intValue;
return ss.str();
}
std::string verify(const std::string& hexStr){
// 准备字符串去掉空格和0x
std::string preparedStr = PrepareHexString(hexStr);
// 计算校验码
int sum = 0;
for (size_t i = 1; i < 6; i += 1) {
int temp = int(static_cast<unsigned char>(preparedStr[i]));
sum += temp;
}
// 取模并转换为16进制
int checksum = sum % 0x100;
std::string hex = decimalToHexadecimal(checksum);
if (hex.length() == 1){
hex = "0" + hex;
}
return hex;
}

26
src/FormatTrans.h Normal file
View File

@@ -0,0 +1,26 @@
// 用于为海康球机PTZ值转换的函数
#pragma once
#include "DecisionPlatform.h"
#include <cmath>
#include <string>
typedef unsigned char BYTE;
typedef unsigned short WORD;
float HEX2DEC(WORD Hex);
WORD DEC2HEX(float Dec);
std::string Hex2String(const std::string &hex);
std::string PrepareHexString(std::string str);
// 十进制转十六进制
std::string decimalToHexadecimal(int decimal);
// 十六进制转十进制
int hexadecimalToDecimal(const std::string& hexadecimal);
std::string charToHex(char value);
std::string verify(const std::string& hexStr);

377
src/HIKBallCamera.cpp Normal file
View File

@@ -0,0 +1,377 @@
#include "HIKBallCamera.h"
#include "FormatTrans.h"
#include <vector>
#include <sstream>
HIKBallCamera::HIKBallCamera(){
};
struct PTZ{
float P;
float T;
float Z;
};
PTZ PTZDATA;
std::vector<std::string> velocity = {"0a","14","1e","28","32","3c","ff"};
bool HIKBallCamera::InitBallCamera(std::string ip, std::string port, std::string username, std::string password, std::string BallMachineType)
{
int res = Login(ip, port, username, password);
if (res != 0){
std::cout << "Incorrect Login" << std::endl;
return false;
}
m_Channel = DeviceInfo.byStartChan;
this->BallMachineType = BallMachineType;
//建立透明通道
NET_DVR_SERIALSTART_V40 struSerialParam = { 0 };
struSerialParam.dwSize = sizeof(struSerialParam);
struSerialParam.dwSerialType = 2;//1:232串口2:485串口
struSerialParam.bySerialNum = 1;//串口编号设备支持多个RS232串口时有效
lTranHandle = NET_DVR_SerialStart_V40(LoginID, &struSerialParam, sizeof(struSerialParam), g_fSerialDataCallBack, NULL);//设置回调函数获取透传数据
if (lTranHandle < 0)
{
printf("NET_DVR_SerialStart error, %d\n", NET_DVR_GetLastError());
NET_DVR_Logout(LoginID);
NET_DVR_Cleanup();
return false;
}
return true;
}
//回调透传数据函数的外部实现
void CALLBACK HIKBallCamera::g_fSerialDataCallBack(LONG lSerialHandle, LONG lChannel, char *pRecvDataBuffer, DWORD dwBufSize, void *pUser)
{
std::string type = charToHex(pRecvDataBuffer[3]);
if (type=="59"){
PTZDATA.P = float(hexadecimalToDecimal(charToHex(pRecvDataBuffer[4])+charToHex(pRecvDataBuffer[5])))/100.0;
}else if (type == "5B"){
PTZDATA.T = float(hexadecimalToDecimal(charToHex(pRecvDataBuffer[4])+charToHex(pRecvDataBuffer[5])))/100.0;
}else if (type == "5D"){
PTZDATA.Z = float(hexadecimalToDecimal(charToHex(pRecvDataBuffer[4])+charToHex(pRecvDataBuffer[5])))/100.0;
}
}
bool HIKBallCamera::PtzControl(int command, int stop, int speed)
{
bool Ret = false;
//use HIK SDK to control the ball camera
Ret = NET_DVR_PTZControlWithSpeed_Other(LoginID,m_Channel, command, stop, speed);
//get the error code
if(!Ret)
{
std::cout << "PTZ control failed! Error code: " << NET_DVR_GetLastError() << std::endl;
return false;
}
return true;
}
bool HIKBallCamera::PtzControlLeft(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 04 "+velocity[speed - 1]+" 00";
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(PAN_LEFT, state, speed);
}
}
bool HIKBallCamera::PtzControlRight(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 02 "+velocity[speed - 1]+" 00";
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(PAN_RIGHT, 0, speed);
}
}
bool HIKBallCamera::PtzControlUp(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 08 00 "+velocity[speed - 1];
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(TILT_UP, 0, speed);
}
}
bool HIKBallCamera::PtzControlDown(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 10 00 "+velocity[speed - 1];
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(TILT_DOWN, 0, speed);
}
}
bool HIKBallCamera::PtzControlZoomIn(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
SerialSend(PrepareHexString("ff 01 00 20 00 00 21"));
return true;
}else{
return PtzControl(ZOOM_IN, 0, speed);
}
}
bool HIKBallCamera::PtzControlZoomOut(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
SerialSend(PrepareHexString("ff 01 00 40 00 00 41"));
return true;
}else{
return PtzControl(ZOOM_OUT, 0, speed);
}
}
bool HIKBallCamera::PtzControlFocusAdd(int speed,int state){
if (BallMachineType=="BuKongQiu") {
std::cout << "ff 01 01 00 00 00 02" << std::endl;
SerialSend(PrepareHexString("ff 01 01 00 00 00 02"));
return true;
}else{
return PtzControl(ZOOM_OUT, 1, speed);
}
}
bool HIKBallCamera::PtzControlFocusSub(int speed,int state){
if (BallMachineType=="BuKongQiu") {
std::cout << "ff 01 00 80 00 00 81" << std::endl;
SerialSend(PrepareHexString("ff 01 00 80 00 00 81"));
return true;
}else{
return PtzControl(ZOOM_OUT, 1, speed);
}
}
bool HIKBallCamera::PtzControlStop(){
SerialSend(PrepareHexString("ff 01 00 00 00 00 01"));
return true;
}
bool HIKBallCamera::PtzControlUpLeft(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 0c "+velocity[speed - 1]+" " + velocity[speed - 1];
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(UP_LEFT, state, speed);
}
}
bool HIKBallCamera::PtzControlUpRight(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 0a "+velocity[speed - 1]+" " + velocity[speed - 1];
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(UP_RIGHT, 0, speed);
}
}
bool HIKBallCamera::PtzControlDownLeft(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 14 "+velocity[speed - 1]+" " + velocity[speed - 1];
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(DOWN_LEFT, 0, speed);
}
}
bool HIKBallCamera::PtzControlDownRight(int speed,int state)
{
if (BallMachineType=="BuKongQiu") {
std::string buf = "ff 01 00 12 "+velocity[speed - 1]+" " + velocity[speed - 1];
buf = buf +" "+ verify(buf);
SerialSend(PrepareHexString(buf));
return true;
}else{
return PtzControl(DOWN_RIGHT, 0, speed);
}
}
std::string addSpacesEveryTwoWords(const std::string& hex) {
std::ostringstream result;
int len = hex.length();
// 如果十六进制字符串的长度是奇数,则在前面添加一个 0
std::string paddedHex = (len % 2 == 1) ? "0" + hex : hex;
// 遍历字符串,每两个字符分割一次
for (size_t i = 0; i < paddedHex.length(); i += 2) {
if (i != 0) {
result << " ";
}
result << paddedHex.substr(i, 2);
}
return result.str();
}
std::string padding(const std::string& hex){
if (hex.length()==2){
return "00 "+hex;
} else{
return hex;
}
}
// PTZ 跳转到指定位置
bool HIKBallCamera::PtzGotoPut(int Action, float P, float T, float Z)
{
if (BallMachineType=="BuKongQiu"){
std::string pHex = decimalToHexadecimal(P * 100);
pHex = padding(addSpacesEveryTwoWords(pHex));
std::string tHex = decimalToHexadecimal(T * 100);
tHex = padding(addSpacesEveryTwoWords(tHex));
std::string zHex = decimalToHexadecimal(Z * 100);
zHex = padding(addSpacesEveryTwoWords(zHex));
std::string pBuf = "ff 01 00 4b "+ pHex;
std::string tBuf = "ff 01 00 4d "+ tHex;
std::string zBuf = "ff 01 00 4f "+ zHex;
pBuf = pBuf+" "+verify(pBuf);
tBuf = tBuf+" "+verify(tBuf);
zBuf = zBuf+" "+verify(zBuf);
switch (Action) {
case 1:
SerialSend(PrepareHexString(pBuf)); // 设置 P
SerialSend(PrepareHexString(tBuf)); // 设置 T
SerialSend(PrepareHexString(zBuf)); // 设置 Z
break;
case 2:
SerialSend(PrepareHexString(pBuf)); // 设置 P
break;
case 3:
SerialSend(PrepareHexString(tBuf)); // 设置 T
break;
case 4:
SerialSend(PrepareHexString(zBuf)); // 设置 Z
break;
case 5:
SerialSend(PrepareHexString(pBuf)); // 设置 P
SerialSend(PrepareHexString(tBuf)); // 设置 T
break;
default:
break;
}
return true;
}else{
NET_DVR_PTZPOS ptzPosCurrent;
ptzPosCurrent.wPanPos = DEC2HEX(P);
ptzPosCurrent.wTiltPos = DEC2HEX(T);
ptzPosCurrent.wAction = 5;
bool b = NET_DVR_SetDVRConfig(LoginID, NET_DVR_SET_PTZPOS, m_Channel, &ptzPosCurrent, sizeof(NET_DVR_PTZPOS));
return b;
}
}
bool HIKBallCamera::SerialSend(const std::string& hex){
char m_DataBuf[50];
int m_DataLen;
int len = hex.length();
m_DataLen = len<1024 ? len : 1024;
memcpy(m_DataBuf,hex.c_str(),m_DataLen);
return NET_DVR_SerialSend(lTranHandle,1, m_DataBuf, m_DataLen);
}
bool HIKBallCamera::PtzGet(float* posP, float* posT, float* posZ) {
if (BallMachineType=="BuKongQiu"){
SerialSend(PrepareHexString("ff 01 00 51 00 00 52"));
SerialSend(PrepareHexString("ff 01 00 53 00 00 54"));
SerialSend(PrepareHexString("ff 01 00 55 00 00 56"));
SLEEP(1);
*posP = PTZDATA.P;
*posT = PTZDATA.T;
*posZ = PTZDATA.Z;
return true;
}else{
NET_DVR_PTZPOS ptzPosCurrent;
DWORD dwtmp;
bool b = NET_DVR_GetDVRConfig(LoginID, NET_DVR_GET_PTZPOS, m_Channel, &ptzPosCurrent, sizeof(NET_DVR_PTZPOS),&dwtmp);
float P = HEX2DEC(ptzPosCurrent.wPanPos);
float T = HEX2DEC(ptzPosCurrent.wTiltPos);
float Z = HEX2DEC(ptzPosCurrent.wZoomPos);
posP = &P;
posT = &T;
posZ = &Z;
return b;
}
}
bool HIKBallCamera::CmdSwitch(int direction,int speed,int state){
bool Res = false;
switch (direction) {
case PTZ_LEFT:
Res = PtzControlLeft(speed,state);
break;
case PTZ_RIGHT:
Res = PtzControlRight(speed,state);
break;
case PTZ_UP:
Res = PtzControlUp(speed,state);
break;
case PTZ_DOWN:
Res = PtzControlDown(speed,state);
break;
case PTZ_UP_LEFT:
Res = PtzControlUpLeft(speed,state);
break;
case PTZ_UP_RIGHT:
Res = PtzControlUpRight(speed,state);
break;
case PTZ_DOWN_LEFT:
Res = PtzControlDownLeft(speed,state);
break;
case PTZ_DOWN_RIGHT:
Res = PtzControlDownRight(speed,state);
break;
case PTZ_ZOOM_IN:
Res = PtzControlZoomIn(speed,state);
break;
case PTZ_ZOOM_OUT:
Res = PtzControlZoomOut(speed,state);
break;
case PTZ_Focus_Far:
Res = PtzControlFocusSub(speed,state);
break;
case PTZ_Focus_Near:
Res = PtzControlFocusAdd(speed,state);
break;
}
return Res;
}
bool HIKBallCamera::StopBus(int direction) {
if (BallMachineType=="BuKongQiu"){
return PtzControlStop();
}
return CmdSwitch(direction,0,1);
}
bool HIKBallCamera::StartBus(int direction, int speed) {
return CmdSwitch(direction,speed,0);
}

65
src/HIKBallCamera.h Normal file
View File

@@ -0,0 +1,65 @@
#pragma once
#include "HIKBase.h"
#define PTZ_LEFT 1 // 云台向左
#define PTZ_RIGHT 2 // 云台向右
#define PTZ_UP 3 // 云台向上
#define PTZ_DOWN 4 // 云台向下
#define PTZ_UP_LEFT 5 // 云台左上
#define PTZ_UP_RIGHT 6 // 云台右上
#define PTZ_DOWN_LEFT 7 // 云台左下
#define PTZ_DOWN_RIGHT 8 // 云台右下
#define PTZ_ZOOM_IN 9 // 云台放大
#define PTZ_ZOOM_OUT 10 // 云台缩小
#define PTZ_Focus_Far 11 // 云台聚焦+
#define PTZ_Focus_Near 12 // 云台聚焦-
class HIKBallCamera : public HIKBase
{
public:
HIKBallCamera();
bool InitBallCamera(std::string ip, std::string port, std::string username, std::string password, std::string BallMachineType);
bool PtzGotoPut(int Action, float P, float T, float Z = 0);
bool PtzGet(float *posP, float *posT, float *posZ);
bool StopBus(int direction);
bool StartBus(int direction,int speed);
private:
LONG lTranHandle;
std::string BallMachineType;
int m_Channel;
private:
bool PtzControlUp(int speed,int state);
bool PtzControlDown(int speed,int state);
bool PtzControlLeft(int speed,int state);
bool PtzControlRight(int speed,int state);
bool PtzControlUpLeft(int speed,int state);
bool PtzControlUpRight(int speed,int state);
bool PtzControlDownLeft(int speed,int state);
bool PtzControlDownRight(int speed,int state);
bool PtzControlZoomIn(int speed,int state);
bool PtzControlZoomOut(int speed,int state);
bool PtzControlFocusAdd(int speed,int state);
bool PtzControlFocusSub(int speed,int state);
private:
/**
* @brief 使用海康485透传接口发送透传数据
*
* @param hex 十六进制透传数据字符串
**/
bool SerialSend(const std::string& hex);
private:
/**
* @brief PTZ 控制相关的 Switch 集合
*
* @param direction PTZ 方向
* @param speed PTZ 速度
* @param state PTZ 启停状态
**/
bool CmdSwitch(int direction,int speed,int state);
bool PtzControl(int command, int stop, int speed);
bool PtzControlStop();
void static CALLBACK g_fSerialDataCallBack(LONG lSerialHandle, LONG lChannel, char *pRecvDataBuffer, DWORD dwBufSize, void *pUser);
};

37
src/HIKBase.cpp Normal file
View File

@@ -0,0 +1,37 @@
#include "HIKBase.h"
#include <memory>
#include <cstring>
#include <chrono>
HIKBase::HIKBase()
{
memset(&DeviceInfo, 0, sizeof(DeviceInfo));
}
HIKBase::~HIKBase() = default;
int HIKBase::Login(std::string ip, std::string port, std::string username, std::string password)
{
Ip = ip;
Port = port;
Username = username;
Password = password;
LoginID = NET_DVR_Login_V30((char *)Ip.c_str(), atoi(Port.c_str()), (char *)Username.c_str(), (char *)Password.c_str(), &DeviceInfo);
std::cout << LoginID <<std::endl;
return LoginID;
}
void HIKBase::Logout()
{
if (LoginID >= 0)
{
NET_DVR_Logout(LoginID);
LoginID = -1;
}
}
bool HK_DVR_Init(){
return NET_DVR_Init();
}

33
src/HIKBase.h Normal file
View File

@@ -0,0 +1,33 @@
#pragma once
#include <iostream>
#include <HCNetSDK.h>
#include <iostream>
#include <string>
class HIKBase
{
public:
HIKBase();
~HIKBase();
int Login(std::string ip, std::string port, std::string username, std::string password);
void Logout();
protected:
LONG LoginID;
NET_DVR_DEVICEINFO_V30 DeviceInfo;
private:
//Hik login info
std::string Ip;//Hik Device IP
std::string Port;//Hik Device Port
std::string Username;//Hik Device Username
std::string Password;//Hik Device Password
//after login, Hik Device ID
int DeviceID;
};
bool HK_DVR_Init();

292
src/HIKNvr.cpp Normal file
View File

@@ -0,0 +1,292 @@
#define NOMINMAX
#include "./date/date.h"
#include "HIKNvr.h"
#include <ctime>
#include <iostream>
#include <chrono>
HIKNvr::HIKNvr(){
}
/**
* @brief Initializes the NVR with the given login information and channel.
*
* @param ip The IP address of the NVR.
* @param port The port number of the NVR.
* @param username The username for logging into the NVR.
* @param password The password for logging into the NVR.
* @param channel The channel number to set for the NVR.
*/
bool HIKNvr::InitNvr(std::string ip, std::string port, std::string username, std::string password, int channel)
{
if (Login(ip, port, username, password) == 0){
m_Channel = channel + 32;
return true;
}
return false;
}
bool HIKNvr::GetNvrUTCDiff(){
NET_DVR_NETAPPCFG struNAC = {0};
DWORD ZoneSize = 0;
NET_DVR_GetDVRConfig(LoginID, NET_DVR_GET_NETAPPCFG, 0, &struNAC, sizeof(NET_DVR_NETAPPCFG), &ZoneSize);
int nDiffHour = struNAC.struNtpClientParam.cTimeDifferenceH;
int nDiffMin = struNAC.struNtpClientParam.cTimeDifferenceM;
nDiffTotalMin = (nDiffHour < 0 ? -1 : 1) * (abs(nDiffHour) * 60 + nDiffMin);
return true;
}
/**
* @brief 用年和月查询日
*
* @param select_time The selected time.
* @param available_date_vec The available date vector.
* @return true if the time region is found, false otherwise.
*/
int HIKNvr::CheckTimeRegionWithMonth(DateTime select_time,std::vector<int>& available_date_vec)
{
DateTime DateNow(select_time);
// 查当月
NET_DVR_MRD_SEARCH_PARAM struSearchParam = {0};
NET_DVR_MRD_SEARCH_RESULT struSearchResult = {0};
struSearchParam.dwSize = sizeof(NET_DVR_MRD_SEARCH_PARAM);
struSearchParam.wYear = DateNow.year();
struSearchParam.byMonth = DateNow.month();
struSearchParam.struStreamInfo.dwChannel = m_Channel; // channel
struSearchParam.byLocalOrUTC = true; // 0:local time, 1:UTC time (时区)
struSearchParam.byDrawFrame = 0; // 0:不抽帧1:抽帧
struSearchParam.byStreamType = 0;// 0:主码流1:子码流
// 查记录
if (!NET_DVR_GetDeviceConfig(this->LoginID, NET_DVR_GET_MONTHLY_RECORD_DISTRIBUTION, 0, &struSearchParam, sizeof(struSearchParam), NULL, &struSearchResult, sizeof(struSearchResult)))
{
int n = NET_DVR_GetLastError();
return n == NET_DVR_NETWORK_FAIL_CONNECT ? NVR_ERR_CONNECT_7 : NVR_ERR_HIK;
}
for (int i = 0; i < 32; i++)
{
if (struSearchResult.byRecordDistribution[i])
{
available_date_vec.push_back(i + 1);
}
}
return NVR_SUC;
}
/**
* @brief Check if a given time falls within the available time range for the current day.
*
* @param select_time The time to check.
* @param available_time_vec A vector of available time ranges for the current day.
* @return true if the given time falls within the available time range, false otherwise.
*/
int HIKNvr::CheckTimeRegionWithDay(DateTime select_time, std::vector<TimeRecord> &available_time_vec)
{
int nRet = NVR_SUC;
GetNvrUTCDiff();
DateTime DateNow(select_time);
int nYear = DateNow.year();
int nMonth = DateNow.month();
int nDay = DateNow.day();
NET_DVR_FILECOND FileCond;
FileCond.dwFileType = 0xff;// 0xff:所有文件
FileCond.dwIsLocked = 0xff;// 0xff:所有文件
FileCond.dwUseCardNo = 0; //不使用卡号
FileCond.lChannel = m_Channel;//通道号
FileCond.struStartTime.dwYear = DateNow.year();
FileCond.struStartTime.dwMonth = DateNow.month();
FileCond.struStartTime.dwDay = DateNow.day();
FileCond.struStartTime.dwHour = 0;
FileCond.struStartTime.dwMinute = 0;
FileCond.struStartTime.dwSecond = 0;
FileCond.struStopTime.dwYear = DateNow.year();
FileCond.struStopTime.dwMonth = DateNow.month();
FileCond.struStopTime.dwDay = DateNow.day();
FileCond.struStopTime.dwHour = 23;
FileCond.struStopTime.dwMinute = 59;
FileCond.struStopTime.dwSecond = 59;
available_time_vec.clear();
LONG hFindHandle = NET_DVR_FindFile_V30(LoginID, &FileCond);
if (-1 == hFindHandle)
{
nRet = NET_DVR_GetLastError();
return nRet == NET_DVR_NETWORK_FAIL_CONNECT?NVR_ERR_CONNECT_7:NVR_ERR_HIK;
}
else
{
NET_DVR_FINDDATA_V30 FindData; // 查找到的文件信息
nRet = NET_DVR_FindNextFile_V30(hFindHandle, &FindData);
int ItemIndex = 0;
while (nRet > 0)
{
if (NET_DVR_FILE_EXCEPTION == nRet)//查找文件时异常
{
break;
}
else if (NET_DVR_FILE_NOFIND == nRet)//没有文件
{
break;
}
else if (NET_DVR_NOMOREFILE == nRet) // 查找结束
{
break;
}
else if (NET_DVR_ISFINDING == nRet) // 正在查找
{
nRet = NET_DVR_FindNextFile_V30(hFindHandle, &FindData);
//请求过快会出读错误。同时也是参考海康sdk写法。
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
else if (NET_DVR_FILE_SUCCESS == nRet) // 获取文件信息成功
{
// 保存文件信息
TimeRecord tR;
if (nDay != FindData.struStartTime.dwDay)//起始不在今日
{
tR.TimeStart.SetDateTime(FindData.struStartTime.dwYear, FindData.struStartTime.dwMonth, nDay, 0, 0, 0);
}
else//起始在今日
{
tR.TimeStart.SetDateTime(FindData.struStartTime.dwYear, FindData.struStartTime.dwMonth, FindData.struStartTime.dwDay, FindData.struStartTime.dwHour, FindData.struStartTime.dwMinute, FindData.struStartTime.dwSecond);
}
if (nDay != FindData.struStopTime.dwDay)//结束不在今日
{
tR.TimeEnd.SetDateTime(FindData.struStartTime.dwYear, FindData.struStartTime.dwMonth, FindData.struStartTime.dwDay, 23, 59, 59);
}
else//结束在今日
{
tR.TimeEnd.SetDateTime(FindData.struStopTime.dwYear, FindData.struStopTime.dwMonth, FindData.struStopTime.dwDay,
FindData.struStopTime.dwHour, FindData.struStopTime.dwMinute, FindData.struStopTime.dwSecond);
}
date::sys_days original_date_start{date::year{tR.TimeStart.year()} / date::month{static_cast<unsigned int>(tR.TimeStart.month())} / date::day{static_cast<unsigned int>(tR.TimeStart.day())}};
date::sys_time<std::chrono::seconds> original_time_start{date::sys_days{original_date_start} + std::chrono::hours{tR.TimeStart.hour()} + std::chrono::minutes{tR.TimeStart.minute()} + std::chrono::seconds{tR.TimeStart.minute()}};
date::sys_time<std::chrono::seconds> utc_plus_8_time_start = original_time_start - std::chrono::minutes{nDiffTotalMin};
date::sys_days original_date_end{date::year{tR.TimeEnd.year()} / date::month{static_cast<unsigned int>(tR.TimeEnd.month())} / date::day{static_cast<unsigned int>(tR.TimeEnd.day())}};
date::sys_time<std::chrono::seconds> original_time_end{date::sys_days{original_date_end} + std::chrono::hours{tR.TimeEnd.hour()} + std::chrono::minutes{tR.TimeEnd.minute()} + std::chrono::seconds{tR.TimeEnd.minute()}};
date::sys_time<std::chrono::seconds> utc_plus_8_time_end = original_time_end - std::chrono::minutes{nDiffTotalMin};
// 计算时间点到1970-01-01 00:00:00 UTC的时间间隔即时间戳
std::chrono::seconds timestamp = std::chrono::duration_cast<std::chrono::seconds>(utc_plus_8_time_start.time_since_epoch());
tR.tmTimeStart = timestamp.count();
timestamp = std::chrono::duration_cast<std::chrono::seconds>(utc_plus_8_time_end.time_since_epoch());
tR.tmTimeEnd = timestamp.count();
available_time_vec.emplace_back(tR);
nRet = NET_DVR_FindNextFile_V30(hFindHandle, &FindData);
}
}
// 关闭查找,释放句柄
NET_DVR_FindClose_V30(hFindHandle);
}
return NVR_SUC;
}
/**
* @brief Get the time region based on the selected time and value.
*
* @param SelectTime The selected time.
* @param Value The value used to calculate the time region.
* @param TimeStart The start time of the time region.
* @param TimeEnd The end time of the time region.
* @return true if the time region is found, false otherwise.
*/
bool HIKNvr::GetTimeRegion(DateTime SelectTime, int Value, DateTime &TimeStart, DateTime &TimeEnd)
{
int nYear = SelectTime.year();
int nMonth = SelectTime.month();
int nDay = SelectTime.day();
// 时间格式 转换,找时间区间
int nHour = Value / 3600;
int nMinute = Value / 60 - 60 * nHour;
int nSecond = Value - (nMinute + 60 * nHour) * 60;
TimeStart = SelectTime;
TimeStart.hour() = nHour;
TimeStart.minute() = nMinute;
TimeStart.second() = nSecond;
bool bHave = false;
for (auto it : m_TimeRecords)
{
if (it.IsInRecord(TimeStart))
{
bHave = true;
TimeEnd = it.TimeEnd;
break;
}
}
return bHave;
}
/**
* @brief Turn the time to json.
*
* @param Time The time to be turned to json.
* @param pAvailableDateVec The available date vector.
* @return nlohmann::json& The json object.
*/
nlohmann::json HIKNvr::TimeToJson(DateTime Time, std::vector<int> *pAvailableDateVec)
{
nlohmann::json Message;
//year and month
Message["year"] = Time.year();
Message["month"] = Time.month();
//date
if (pAvailableDateVec != nullptr)
{
nlohmann::json data;
for (auto date : *pAvailableDateVec)
{
data.push_back(date);
}
Message["day"] = data;
}
return Message;
}
/**
* @brief Converts available time slots in a day to JSON format.
*
* @param Time The date and time of the day.
* @param pAvailableTimeVec A pointer to a vector of available time slots.
* @return nlohmann::json& A reference to the JSON object containing the converted time slots.
*/
nlohmann::json HIKNvr::TimeToJsonInDay(DateTime Time, std::vector<TimeRecord> *pAvailableTimeVec)
{
nlohmann::json Message;
if(pAvailableTimeVec != nullptr)
{
for(auto time : *pAvailableTimeVec)
{
nlohmann::json data;
data["begin"] = time.tmTimeStart;
data["end"] = time.tmTimeEnd;
Message.push_back(data);
}
}
return Message;
}

59
src/HIKNvr.h Normal file
View File

@@ -0,0 +1,59 @@
#pragma once
#include "json.hpp"
#include "HIKBase.h"
#include "DecisionPlatform.h"
#include "DataTime.h"
#include <vector>
#define NVR_SUC 0
#define NVR_ERR_HIK 6
#define NVR_ERR_CONNECT_7 7
struct TimeRecord
{
DateTime TimeStart;
DateTime TimeEnd;
long long tmTimeStart;
long long tmTimeEnd;
// 目前是针对每天记录比对所以只比对time即可。
bool IsInRecord(DateTime time_in)
{
if (TimeStart < time_in && TimeEnd > time_in)
{
return true;
}
return false;
}
};
class HIKNvr : public HIKBase
{
public:
HIKNvr();
//初始化 Nvr
bool InitNvr(std::string ip, std::string port, std::string username, std::string password, int channel);
//按月查询
int CheckTimeRegionWithMonth(DateTime select_time, std::vector<int> &available_date_vec);
//按日查询
int CheckTimeRegionWithDay(DateTime select_time, std::vector<TimeRecord> &available_time_vec);
//though input SelectTime get the time region
bool GetTimeRegion(DateTime select_time,int value ,DateTime &time_start,DateTime &time_end);
bool GetNvrUTCDiff();
int nDiffTotalMin;
public:
// 将时间转换成json
nlohmann::json TimeToJson(DateTime Time,std::vector<int> *pAvailableDateVec);
nlohmann::json TimeToJsonInDay(DateTime Time,std::vector<TimeRecord> *pAvailableTimeVec);
private:
//record the time in the Nvr
std::vector<TimeRecord> m_TimeRecords;
//Nvr channel
int m_Channel;
};

34
src/date/chrono_io.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef CHRONO_IO_H
#define CHRONO_IO_H
// The MIT License (MIT)
//
// Copyright (c) 2016, 2017 Howard Hinnant
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Our apologies. When the previous paragraph was written, lowercase had not yet
// been invented (that would involve another several millennia of evolution).
// We did not mean to shout.
// This functionality has moved to "date.h"
#include "date.h"
#endif // CHRONO_IO_H

8234
src/date/date.h Normal file

File diff suppressed because it is too large Load Diff

3031
src/date/islamic.h Normal file

File diff suppressed because it is too large Load Diff

1761
src/date/iso_week.h Normal file

File diff suppressed because it is too large Load Diff

3052
src/date/julian.h Normal file

File diff suppressed because it is too large Load Diff

950
src/date/ptz.h Normal file
View File

@@ -0,0 +1,950 @@
#ifndef PTZ_H
#define PTZ_H
// The MIT License (MIT)
//
// Copyright (c) 2017 Howard Hinnant
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// This header allows Posix-style time zones as specified for TZ here:
// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
//
// Posix::time_zone can be constructed with a posix-style string and then used in
// a zoned_time like so:
//
// zoned_time<system_clock::duration, Posix::time_zone> zt{"EST5EDT,M3.2.0,M11.1.0",
// system_clock::now()};
// or:
//
// Posix::time_zone tz{"EST5EDT,M3.2.0,M11.1.0"};
// zoned_time<system_clock::duration, Posix::time_zone> zt{tz, system_clock::now()};
//
// In C++17 CTAD simplifies this to:
//
// Posix::time_zone tz{"EST5EDT,M3.2.0,M11.1.0"};
// zoned_time zt{tz, system_clock::now()};
//
// Extension to the Posix rules to allow a constant daylight saving offset:
//
// If the rule set is missing (everything starting with ','), then
// there must be exactly one abbreviation (std or daylight) with
// length 3 or greater, and that will be used as the constant offset. If
// there are two, the std abbreviation is silently set to "", and the
// result is constant daylight saving. If there are zero abbreviations
// with no rule set, an exception is thrown.
//
// Example:
// "EST5" yields a constant offset of -5h with 0h save and "EST abbreviation.
// "5EDT" yields a constant offset of -4h with 1h save and "EDT" abbreviation.
// "EST5EDT" and "5EDT4" are both equal to "5EDT".
//
// Note, Posix-style time zones are not recommended for all of the reasons described here:
// https://stackoverflow.com/tags/timezone/info
//
// They are provided here as a non-trivial custom time zone example, and if you really
// have to have Posix time zones, you're welcome to use this one.
#include "date/tz.h"
#include <algorithm>
#include <cctype>
#include <ostream>
#include <string>
namespace Posix
{
namespace detail
{
#if HAS_STRING_VIEW
using string_t = std::string_view;
#else // !HAS_STRING_VIEW
using string_t = std::string;
#endif // !HAS_STRING_VIEW
class rule;
void throw_invalid(const string_t& s, unsigned i, const string_t& message);
unsigned read_date(const string_t& s, unsigned i, rule& r);
unsigned read_name(const string_t& s, unsigned i, std::string& name);
unsigned read_signed_time(const string_t& s, unsigned i, std::chrono::seconds& t);
unsigned read_unsigned_time(const string_t& s, unsigned i, std::chrono::seconds& t);
unsigned read_unsigned(const string_t& s, unsigned i, unsigned limit, unsigned& u,
const string_t& message = string_t{});
class rule
{
enum {off, J, M, N};
date::month m_;
date::weekday wd_;
unsigned short n_ : 14;
unsigned short mode_ : 2;
std::chrono::duration<std::int32_t> time_ = std::chrono::hours{2};
public:
rule() : mode_(off) {}
bool ok() const {return mode_ != off;}
date::local_seconds operator()(date::year y) const;
std::string to_string() const;
friend std::ostream& operator<<(std::ostream& os, const rule& r);
friend unsigned read_date(const string_t& s, unsigned i, rule& r);
friend bool operator==(const rule& x, const rule& y);
};
inline
bool
operator==(const rule& x, const rule& y)
{
if (x.mode_ != y.mode_)
return false;
switch (x.mode_)
{
case rule::J:
case rule::N:
return x.n_ == y.n_;
case rule::M:
return x.m_ == y.m_ && x.n_ == y.n_ && x.wd_ == y.wd_;
default:
return true;
}
}
inline
bool
operator!=(const rule& x, const rule& y)
{
return !(x == y);
}
inline
date::local_seconds
rule::operator()(date::year y) const
{
using date::local_days;
using date::January;
using date::days;
using date::last;
using sec = std::chrono::seconds;
date::local_seconds t;
switch (mode_)
{
case J:
t = local_days{y/January/0} + days{n_ + (y.is_leap() && n_ > 59)} + sec{time_};
break;
case M:
t = (n_ == 5 ? local_days{y/m_/wd_[last]} : local_days{y/m_/wd_[n_]}) + sec{time_};
break;
case N:
t = local_days{y/January/1} + days{n_} + sec{time_};
break;
default:
assert(!"rule called with bad mode");
}
return t;
}
inline
std::string
rule::to_string() const
{
using namespace std::chrono;
auto print_offset = [](seconds off)
{
std::string nm;
if (off != hours{2})
{
date::hh_mm_ss<seconds> offset{off};
nm = '/';
nm += std::to_string(offset.hours().count());
if (offset.minutes() != minutes{0} || offset.seconds() != seconds{0})
{
nm += ':';
if (offset.minutes() < minutes{10})
nm += '0';
nm += std::to_string(offset.minutes().count());
if (offset.seconds() != seconds{0})
{
nm += ':';
if (offset.seconds() < seconds{10})
nm += '0';
nm += std::to_string(offset.seconds().count());
}
}
}
return nm;
};
std::string nm;
switch (mode_)
{
case rule::J:
nm = 'J';
nm += std::to_string(n_);
break;
case rule::M:
nm = 'M';
nm += std::to_string(static_cast<unsigned>(m_));
nm += '.';
nm += std::to_string(n_);
nm += '.';
nm += std::to_string(wd_.c_encoding());
break;
case rule::N:
nm = std::to_string(n_);
break;
default:
break;
}
nm += print_offset(time_);
return nm;
}
inline
std::ostream&
operator<<(std::ostream& os, const rule& r)
{
switch (r.mode_)
{
case rule::J:
os << 'J' << r.n_ << date::format(" %T", r.time_);
break;
case rule::M:
if (r.n_ == 5)
os << r.m_/r.wd_[date::last];
else
os << r.m_/r.wd_[r.n_];
os << date::format(" %T", r.time_);
break;
case rule::N:
os << r.n_ << date::format(" %T", r.time_);
break;
default:
break;
}
return os;
}
} // namespace detail
class time_zone
{
std::string std_abbrev_;
std::string dst_abbrev_ = {};
std::chrono::seconds offset_;
std::chrono::seconds save_ = std::chrono::hours{1};
detail::rule start_rule_;
detail::rule end_rule_;
public:
explicit time_zone(const detail::string_t& name);
template <class Duration>
date::sys_info get_info(date::sys_time<Duration> st) const;
template <class Duration>
date::local_info get_info(date::local_time<Duration> tp) const;
template <class Duration>
date::sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_sys(date::local_time<Duration> tp) const;
template <class Duration>
date::sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_sys(date::local_time<Duration> tp, date::choose z) const;
template <class Duration>
date::local_time<typename std::common_type<Duration, std::chrono::seconds>::type>
to_local(date::sys_time<Duration> tp) const;
friend std::ostream& operator<<(std::ostream& os, const time_zone& z);
const time_zone* operator->() const {return this;}
std::string name() const;
friend bool operator==(const time_zone& x, const time_zone& y);
private:
date::sys_seconds get_start(date::year y) const;
date::sys_seconds get_prev_start(date::year y) const;
date::sys_seconds get_next_start(date::year y) const;
date::sys_seconds get_end(date::year y) const;
date::sys_seconds get_prev_end(date::year y) const;
date::sys_seconds get_next_end(date::year y) const;
date::sys_info contant_offset() const;
};
inline
date::sys_seconds
time_zone::get_start(date::year y) const
{
return date::sys_seconds{(start_rule_(y) - offset_).time_since_epoch()};
}
inline
date::sys_seconds
time_zone::get_prev_start(date::year y) const
{
return date::sys_seconds{(start_rule_(--y) - offset_).time_since_epoch()};
}
inline
date::sys_seconds
time_zone::get_next_start(date::year y) const
{
return date::sys_seconds{(start_rule_(++y) - offset_).time_since_epoch()};
}
inline
date::sys_seconds
time_zone::get_end(date::year y) const
{
return date::sys_seconds{(end_rule_(y) - (offset_ + save_)).time_since_epoch()};
}
inline
date::sys_seconds
time_zone::get_prev_end(date::year y) const
{
return date::sys_seconds{(end_rule_(--y) - (offset_ + save_)).time_since_epoch()};
}
inline
date::sys_seconds
time_zone::get_next_end(date::year y) const
{
return date::sys_seconds{(end_rule_(++y) - (offset_ + save_)).time_since_epoch()};
}
inline
date::sys_info
time_zone::contant_offset() const
{
using date::year;
using date::sys_info;
using date::sys_days;
using date::January;
using date::December;
using date::last;
using std::chrono::minutes;
sys_info r;
r.begin = sys_days{year::min()/January/1};
r.end = sys_days{year::max()/December/last};
if (std_abbrev_.size() > 0)
{
r.abbrev = std_abbrev_;
r.offset = offset_;
r.save = {};
}
else
{
r.abbrev = dst_abbrev_;
r.offset = offset_ + save_;
r.save = date::ceil<minutes>(save_);
}
return r;
}
inline
time_zone::time_zone(const detail::string_t& s)
{
using detail::read_name;
using detail::read_signed_time;
using detail::throw_invalid;
auto i = read_name(s, 0, std_abbrev_);
auto std_name_i = i;
auto abbrev_name_i = i;
i = read_signed_time(s, i, offset_);
offset_ = -offset_;
if (i != s.size())
{
i = read_name(s, i, dst_abbrev_);
abbrev_name_i = i;
if (i != s.size())
{
if (s[i] != ',')
{
i = read_signed_time(s, i, save_);
save_ = -save_ - offset_;
}
if (i != s.size())
{
if (s[i] != ',')
throw_invalid(s, i, "Expecting end of string or ',' to start rule");
++i;
i = read_date(s, i, start_rule_);
if (i == s.size() || s[i] != ',')
throw_invalid(s, i, "Expecting ',' and then the ending rule");
++i;
i = read_date(s, i, end_rule_);
if (i != s.size())
throw_invalid(s, i, "Found unexpected trailing characters");
}
}
}
if (start_rule_.ok())
{
if (std_abbrev_.size() < 3)
throw_invalid(s, std_name_i, "Zone with rules must have a std"
" abbreviation of length 3 or greater");
if (dst_abbrev_.size() < 3)
throw_invalid(s, abbrev_name_i, "Zone with rules must have a daylight"
" abbreviation of length 3 or greater");
}
else
{
if (dst_abbrev_.size() >= 3)
{
std_abbrev_.clear();
}
else if (std_abbrev_.size() < 3)
{
throw_invalid(s, std_name_i, "Zone must have at least one abbreviation"
" of length 3 or greater");
}
else
{
dst_abbrev_.clear();
save_ = {};
}
}
}
template <class Duration>
date::sys_info
time_zone::get_info(date::sys_time<Duration> st) const
{
using date::sys_info;
using date::year_month_day;
using date::sys_days;
using date::floor;
using date::ceil;
using date::days;
using date::year;
using date::January;
using date::December;
using date::last;
using std::chrono::minutes;
sys_info r{};
r.offset = offset_;
if (start_rule_.ok())
{
auto y = year_month_day{floor<days>(st)}.year();
if (st >= get_next_start(y))
++y;
else if (st < get_prev_end(y))
--y;
auto start = get_start(y);
auto end = get_end(y);
if (start <= end) // (northern hemisphere)
{
if (start <= st && st < end)
{
r.begin = start;
r.end = end;
r.offset += save_;
r.save = ceil<minutes>(save_);
r.abbrev = dst_abbrev_;
}
else if (st < start)
{
r.begin = get_prev_end(y);
r.end = start;
r.abbrev = std_abbrev_;
}
else // st >= end
{
r.begin = end;
r.end = get_next_start(y);
r.abbrev = std_abbrev_;
}
}
else // end < start (southern hemisphere)
{
if (end <= st && st < start)
{
r.begin = end;
r.end = start;
r.abbrev = std_abbrev_;
}
else if (st < end)
{
r.begin = get_prev_start(y);
r.end = end;
r.offset += save_;
r.save = ceil<minutes>(save_);
r.abbrev = dst_abbrev_;
}
else // st >= start
{
r.begin = start;
r.end = get_next_end(y);
r.offset += save_;
r.save = ceil<minutes>(save_);
r.abbrev = dst_abbrev_;
}
}
}
else
r = contant_offset();
assert(r.begin <= st && st < r.end);
return r;
}
template <class Duration>
date::local_info
time_zone::get_info(date::local_time<Duration> tp) const
{
using date::local_info;
using date::year_month_day;
using date::days;
using date::sys_days;
using date::sys_seconds;
using date::year;
using date::ceil;
using date::January;
using date::December;
using date::last;
using std::chrono::seconds;
using std::chrono::minutes;
local_info r{};
using date::floor;
if (start_rule_.ok())
{
auto y = year_month_day{floor<days>(tp)}.year();
auto start = get_start(y);
auto end = get_end(y);
auto utcs = sys_seconds{floor<seconds>(tp - offset_).time_since_epoch()};
auto utcd = sys_seconds{floor<seconds>(tp - (offset_ + save_)).time_since_epoch()};
auto northern = start <= end;
if ((utcs < start) != (utcd < start))
{
if (northern)
r.first.begin = get_prev_end(y);
else
r.first.begin = end;
r.first.end = start;
r.first.offset = offset_;
r.first.abbrev = std_abbrev_;
r.second.begin = start;
if (northern)
r.second.end = end;
else
r.second.end = get_next_end(y);
r.second.abbrev = dst_abbrev_;
r.second.offset = offset_ + save_;
r.second.save = ceil<minutes>(save_);
r.result = save_ > seconds{0} ? local_info::nonexistent
: local_info::ambiguous;
}
else if ((utcs < end) != (utcd < end))
{
if (northern)
r.first.begin = start;
else
r.first.begin = get_prev_start(y);
r.first.end = end;
r.first.offset = offset_ + save_;
r.first.save = ceil<minutes>(save_);
r.first.abbrev = dst_abbrev_;
r.second.begin = end;
if (northern)
r.second.end = get_next_start(y);
else
r.second.end = start;
r.second.abbrev = std_abbrev_;
r.second.offset = offset_;
r.result = save_ > seconds{0} ? local_info::ambiguous
: local_info::nonexistent;
}
else
r.first = get_info(utcs);
}
else
r.first = contant_offset();
return r;
}
template <class Duration>
date::sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
time_zone::to_sys(date::local_time<Duration> tp) const
{
using date::local_info;
using date::sys_time;
using date::ambiguous_local_time;
using date::nonexistent_local_time;
auto i = get_info(tp);
if (i.result == local_info::nonexistent)
throw nonexistent_local_time(tp, i);
else if (i.result == local_info::ambiguous)
throw ambiguous_local_time(tp, i);
return sys_time<Duration>{tp.time_since_epoch()} - i.first.offset;
}
template <class Duration>
date::sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
time_zone::to_sys(date::local_time<Duration> tp, date::choose z) const
{
using date::local_info;
using date::sys_time;
using date::choose;
auto i = get_info(tp);
if (i.result == local_info::nonexistent)
{
return i.first.end;
}
else if (i.result == local_info::ambiguous)
{
if (z == choose::latest)
return sys_time<Duration>{tp.time_since_epoch()} - i.second.offset;
}
return sys_time<Duration>{tp.time_since_epoch()} - i.first.offset;
}
template <class Duration>
date::local_time<typename std::common_type<Duration, std::chrono::seconds>::type>
time_zone::to_local(date::sys_time<Duration> tp) const
{
using date::local_time;
using std::chrono::seconds;
using LT = local_time<typename std::common_type<Duration, seconds>::type>;
auto i = get_info(tp);
return LT{(tp + i.offset).time_since_epoch()};
}
inline
std::ostream&
operator<<(std::ostream& os, const time_zone& z)
{
using date::operator<<;
os << '{';
os << z.std_abbrev_ << ", " << z.dst_abbrev_ << date::format(", %T, ", z.offset_)
<< date::format("%T, [", z.save_) << z.start_rule_ << ", " << z.end_rule_ << ")}";
return os;
}
inline
std::string
time_zone::name() const
{
using namespace date;
using namespace std::chrono;
auto print_abbrev = [](std::string const& nm)
{
if (std::any_of(nm.begin(), nm.end(),
[](char c)
{
return !std::isalpha(c);
}))
{
return '<' + nm + '>';
}
return nm;
};
auto print_offset = [](seconds off)
{
std::string nm;
hh_mm_ss<seconds> offset{-off};
if (offset.is_negative())
nm += '-';
nm += std::to_string(offset.hours().count());
if (offset.minutes() != minutes{0} || offset.seconds() != seconds{0})
{
nm += ':';
if (offset.minutes() < minutes{10})
nm += '0';
nm += std::to_string(offset.minutes().count());
if (offset.seconds() != seconds{0})
{
nm += ':';
if (offset.seconds() < seconds{10})
nm += '0';
nm += std::to_string(offset.seconds().count());
}
}
return nm;
};
auto nm = print_abbrev(std_abbrev_);
nm += print_offset(offset_);
if (!dst_abbrev_.empty())
{
nm += print_abbrev(dst_abbrev_);
if (save_ != hours{1})
nm += print_offset(offset_+save_);
if (start_rule_.ok())
{
nm += ',';
nm += start_rule_.to_string();
nm += ',';
nm += end_rule_.to_string();
}
}
return nm;
}
inline
bool
operator==(const time_zone& x, const time_zone& y)
{
return x.std_abbrev_ == y.std_abbrev_ &&
x.dst_abbrev_ == y. dst_abbrev_ &&
x.offset_ == y.offset_ &&
x.save_ == y.save_ &&
x.start_rule_ == y.start_rule_ &&
x.end_rule_ == y.end_rule_;
}
inline
bool
operator!=(const time_zone& x, const time_zone& y)
{
return !(x == y);
}
namespace detail
{
inline
void
throw_invalid(const string_t& s, unsigned i, const string_t& message)
{
throw std::runtime_error(std::string("Invalid time_zone initializer.\n") +
std::string(message) + ":\n" +
std::string(s) + '\n' +
"\x1b[1;32m" +
std::string(i, '~') + '^' +
std::string(i < s.size() ? s.size()-i-1 : 0, '~') +
"\x1b[0m");
}
inline
unsigned
read_date(const string_t& s, unsigned i, rule& r)
{
using date::month;
using date::weekday;
if (i == s.size())
throw_invalid(s, i, "Expected rule but found end of string");
if (s[i] == 'J')
{
++i;
unsigned n;
i = read_unsigned(s, i, 3, n, "Expected to find the Julian day [1, 365]");
if (!(1 <= n && n <= 365))
throw_invalid(s, i-1, "Expected Julian day to be in the range [1, 365]");
r.mode_ = rule::J;
r.n_ = n;
}
else if (s[i] == 'M')
{
++i;
unsigned m;
i = read_unsigned(s, i, 2, m, "Expected to find month [1, 12]");
if (!(1 <= m && m <= 12))
throw_invalid(s, i-1, "Expected month to be in the range [1, 12]");
if (i == s.size() || s[i] != '.')
throw_invalid(s, i, "Expected '.' after month");
++i;
unsigned n;
i = read_unsigned(s, i, 1, n, "Expected to find week number [1, 5]");
if (!(1 <= n && n <= 5))
throw_invalid(s, i-1, "Expected week number to be in the range [1, 5]");
if (i == s.size() || s[i] != '.')
throw_invalid(s, i, "Expected '.' after weekday index");
++i;
unsigned wd;
i = read_unsigned(s, i, 1, wd, "Expected to find day of week [0, 6]");
if (wd > 6)
throw_invalid(s, i-1, "Expected day of week to be in the range [0, 6]");
r.mode_ = rule::M;
r.m_ = month{m};
r.wd_ = weekday{wd};
r.n_ = n;
}
else if (std::isdigit(s[i]))
{
unsigned n;
i = read_unsigned(s, i, 3, n);
if (n > 365)
throw_invalid(s, i-1, "Expected Julian day to be in the range [0, 365]");
r.mode_ = rule::N;
r.n_ = n;
}
else
throw_invalid(s, i, "Expected 'J', 'M', or a digit to start rule");
if (i != s.size() && s[i] == '/')
{
++i;
std::chrono::seconds t;
i = read_unsigned_time(s, i, t);
r.time_ = t;
}
return i;
}
inline
unsigned
read_name(const string_t& s, unsigned i, std::string& name)
{
if (i == s.size())
throw_invalid(s, i, "Expected a name but found end of string");
if (s[i] == '<')
{
++i;
while (true)
{
if (i == s.size())
throw_invalid(s, i,
"Expected to find closing '>', but found end of string");
if (s[i] == '>')
break;
name.push_back(s[i]);
++i;
}
++i;
}
else
{
while (i != s.size() && std::isalpha(s[i]))
{
name.push_back(s[i]);
++i;
}
}
return i;
}
inline
unsigned
read_signed_time(const string_t& s, unsigned i,
std::chrono::seconds& t)
{
if (i == s.size())
throw_invalid(s, i, "Expected to read signed time, but found end of string");
bool negative = false;
if (s[i] == '-')
{
negative = true;
++i;
}
else if (s[i] == '+')
++i;
i = read_unsigned_time(s, i, t);
if (negative)
t = -t;
return i;
}
inline
unsigned
read_unsigned_time(const string_t& s, unsigned i, std::chrono::seconds& t)
{
using std::chrono::seconds;
using std::chrono::minutes;
using std::chrono::hours;
if (i == s.size())
throw_invalid(s, i, "Expected to read unsigned time, but found end of string");
unsigned x;
i = read_unsigned(s, i, 2, x, "Expected to find hours [0, 24]");
if (x > 24)
throw_invalid(s, i-1, "Expected hours to be in the range [0, 24]");
t = hours{x};
if (i != s.size() && s[i] == ':')
{
++i;
i = read_unsigned(s, i, 2, x, "Expected to find minutes [0, 59]");
if (x > 59)
throw_invalid(s, i-1, "Expected minutes to be in the range [0, 59]");
t += minutes{x};
if (i != s.size() && s[i] == ':')
{
++i;
i = read_unsigned(s, i, 2, x, "Expected to find seconds [0, 59]");
if (x > 59)
throw_invalid(s, i-1, "Expected seconds to be in the range [0, 59]");
t += seconds{x};
}
}
return i;
}
inline
unsigned
read_unsigned(const string_t& s, unsigned i, unsigned limit, unsigned& u,
const string_t& message)
{
if (i == s.size() || !std::isdigit(s[i]))
throw_invalid(s, i, message);
u = static_cast<unsigned>(s[i] - '0');
unsigned count = 1;
for (++i; count < limit && i != s.size() && std::isdigit(s[i]); ++i, ++count)
u = u * 10 + static_cast<unsigned>(s[i] - '0');
return i;
}
} // namespace detail
} // namespace Posix
namespace date
{
template <>
struct zoned_traits<Posix::time_zone>
{
#if HAS_STRING_VIEW
static
Posix::time_zone
locate_zone(std::string_view name)
{
return Posix::time_zone{name};
}
#else // !HAS_STRING_VIEW
static
Posix::time_zone
locate_zone(const std::string& name)
{
return Posix::time_zone{name};
}
static
Posix::time_zone
locate_zone(const char* name)
{
return Posix::time_zone{name};
}
#endif // !HAS_STRING_VIEW
};
} // namespace date
#endif // PTZ_H

3151
src/date/solar_hijri.h Normal file

File diff suppressed because it is too large Load Diff

4073
src/date/tz.cpp Normal file

File diff suppressed because it is too large Load Diff

2792
src/date/tz.h Normal file

File diff suppressed because it is too large Load Diff

316
src/date/tz_private.h Normal file
View File

@@ -0,0 +1,316 @@
#ifndef TZ_PRIVATE_H
#define TZ_PRIVATE_H
// The MIT License (MIT)
//
// Copyright (c) 2015, 2016 Howard Hinnant
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Our apologies. When the previous paragraph was written, lowercase had not yet
// been invented (that would involve another several millennia of evolution).
// We did not mean to shout.
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
#include "tz.h"
#else
#include "date.h"
#include <vector>
#endif
namespace date
{
namespace detail
{
#if !USE_OS_TZDB
enum class tz {utc, local, standard};
//forward declare to avoid warnings in gcc 6.2
class MonthDayTime;
std::istream& operator>>(std::istream& is, MonthDayTime& x);
std::ostream& operator<<(std::ostream& os, const MonthDayTime& x);
class MonthDayTime
{
private:
struct pair
{
#if defined(_MSC_VER) && (_MSC_VER < 1900)
pair() : month_day_(date::jan / 1), weekday_(0U) {}
pair(const date::month_day& month_day, const date::weekday& weekday)
: month_day_(month_day), weekday_(weekday) {}
#endif
date::month_day month_day_;
date::weekday weekday_;
};
enum Type {month_day, month_last_dow, lteq, gteq};
Type type_{month_day};
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
union U
#else
struct U
#endif
{
date::month_day month_day_;
date::month_weekday_last month_weekday_last_;
pair month_day_weekday_;
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
U() : month_day_{date::jan/1} {}
#else
U() :
month_day_(date::jan/1),
month_weekday_last_(date::month(0U), date::weekday_last(date::weekday(0U)))
{}
#endif // !defined(_MSC_VER) || (_MSC_VER >= 1900)
U& operator=(const date::month_day& x);
U& operator=(const date::month_weekday_last& x);
U& operator=(const pair& x);
} u;
std::chrono::hours h_{0};
std::chrono::minutes m_{0};
std::chrono::seconds s_{0};
tz zone_{tz::local};
public:
MonthDayTime() = default;
MonthDayTime(local_seconds tp, tz timezone);
MonthDayTime(const date::month_day& md, tz timezone);
date::day day() const;
date::month month() const;
tz zone() const {return zone_;}
void canonicalize(date::year y);
sys_seconds
to_sys(date::year y, std::chrono::seconds offset, std::chrono::seconds save) const;
sys_days to_sys_days(date::year y) const;
sys_seconds to_time_point(date::year y) const;
int compare(date::year y, const MonthDayTime& x, date::year yx,
std::chrono::seconds offset, std::chrono::minutes prev_save) const;
friend std::istream& operator>>(std::istream& is, MonthDayTime& x);
friend std::ostream& operator<<(std::ostream& os, const MonthDayTime& x);
};
// A Rule specifies one or more set of datetimes without using an offset.
// Multiple dates are specified with multiple years. The years in effect
// go from starting_year_ to ending_year_, inclusive. starting_year_ <=
// ending_year_. save_ is in effect for times from the specified time
// onward, including the specified time. When the specified time is
// local, it uses the save_ from the chronologically previous Rule, or if
// there is none, 0.
//forward declare to avoid warnings in gcc 6.2
class Rule;
bool operator==(const Rule& x, const Rule& y);
bool operator<(const Rule& x, const Rule& y);
bool operator==(const Rule& x, const date::year& y);
bool operator<(const Rule& x, const date::year& y);
bool operator==(const date::year& x, const Rule& y);
bool operator<(const date::year& x, const Rule& y);
bool operator==(const Rule& x, const std::string& y);
bool operator<(const Rule& x, const std::string& y);
bool operator==(const std::string& x, const Rule& y);
bool operator<(const std::string& x, const Rule& y);
std::ostream& operator<<(std::ostream& os, const Rule& r);
class Rule
{
private:
std::string name_;
date::year starting_year_{0};
date::year ending_year_{0};
MonthDayTime starting_at_;
std::chrono::minutes save_{0};
std::string abbrev_;
public:
Rule() = default;
explicit Rule(const std::string& s);
Rule(const Rule& r, date::year starting_year, date::year ending_year);
const std::string& name() const {return name_;}
const std::string& abbrev() const {return abbrev_;}
const MonthDayTime& mdt() const {return starting_at_;}
const date::year& starting_year() const {return starting_year_;}
const date::year& ending_year() const {return ending_year_;}
const std::chrono::minutes& save() const {return save_;}
static void split_overlaps(std::vector<Rule>& rules);
friend bool operator==(const Rule& x, const Rule& y);
friend bool operator<(const Rule& x, const Rule& y);
friend bool operator==(const Rule& x, const date::year& y);
friend bool operator<(const Rule& x, const date::year& y);
friend bool operator==(const date::year& x, const Rule& y);
friend bool operator<(const date::year& x, const Rule& y);
friend bool operator==(const Rule& x, const std::string& y);
friend bool operator<(const Rule& x, const std::string& y);
friend bool operator==(const std::string& x, const Rule& y);
friend bool operator<(const std::string& x, const Rule& y);
friend std::ostream& operator<<(std::ostream& os, const Rule& r);
private:
date::day day() const;
date::month month() const;
static void split_overlaps(std::vector<Rule>& rules, std::size_t i, std::size_t& e);
static bool overlaps(const Rule& x, const Rule& y);
static void split(std::vector<Rule>& rules, std::size_t i, std::size_t k,
std::size_t& e);
};
inline bool operator!=(const Rule& x, const Rule& y) {return !(x == y);}
inline bool operator> (const Rule& x, const Rule& y) {return y < x;}
inline bool operator<=(const Rule& x, const Rule& y) {return !(y < x);}
inline bool operator>=(const Rule& x, const Rule& y) {return !(x < y);}
inline bool operator!=(const Rule& x, const date::year& y) {return !(x == y);}
inline bool operator> (const Rule& x, const date::year& y) {return y < x;}
inline bool operator<=(const Rule& x, const date::year& y) {return !(y < x);}
inline bool operator>=(const Rule& x, const date::year& y) {return !(x < y);}
inline bool operator!=(const date::year& x, const Rule& y) {return !(x == y);}
inline bool operator> (const date::year& x, const Rule& y) {return y < x;}
inline bool operator<=(const date::year& x, const Rule& y) {return !(y < x);}
inline bool operator>=(const date::year& x, const Rule& y) {return !(x < y);}
inline bool operator!=(const Rule& x, const std::string& y) {return !(x == y);}
inline bool operator> (const Rule& x, const std::string& y) {return y < x;}
inline bool operator<=(const Rule& x, const std::string& y) {return !(y < x);}
inline bool operator>=(const Rule& x, const std::string& y) {return !(x < y);}
inline bool operator!=(const std::string& x, const Rule& y) {return !(x == y);}
inline bool operator> (const std::string& x, const Rule& y) {return y < x;}
inline bool operator<=(const std::string& x, const Rule& y) {return !(y < x);}
inline bool operator>=(const std::string& x, const Rule& y) {return !(x < y);}
struct zonelet
{
enum tag {has_rule, has_save, is_empty};
std::chrono::seconds gmtoff_;
tag tag_ = has_rule;
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
union U
#else
struct U
#endif
{
std::string rule_;
std::chrono::minutes save_;
~U() {}
U() {}
U(const U&) {}
U& operator=(const U&) = delete;
} u;
std::string format_;
date::year until_year_{0};
MonthDayTime until_date_;
sys_seconds until_utc_;
local_seconds until_std_;
local_seconds until_loc_;
std::chrono::minutes initial_save_{0};
std::string initial_abbrev_;
std::pair<const Rule*, date::year> first_rule_{nullptr, date::year::min()};
std::pair<const Rule*, date::year> last_rule_{nullptr, date::year::max()};
~zonelet();
zonelet();
zonelet(const zonelet& i);
zonelet& operator=(const zonelet&) = delete;
};
#else // USE_OS_TZDB
struct ttinfo
{
std::int32_t tt_gmtoff;
unsigned char tt_isdst;
unsigned char tt_abbrind;
unsigned char pad[2];
};
static_assert(sizeof(ttinfo) == 8, "");
struct expanded_ttinfo
{
std::chrono::seconds offset;
std::string abbrev;
bool is_dst;
};
struct transition
{
sys_seconds timepoint;
const expanded_ttinfo* info;
transition(sys_seconds tp, const expanded_ttinfo* i = nullptr)
: timepoint(tp)
, info(i)
{}
friend
std::ostream&
operator<<(std::ostream& os, const transition& t)
{
using date::operator<<;
os << t.timepoint << "Z ";
if (t.info->offset >= std::chrono::seconds{0})
os << '+';
os << make_time(t.info->offset);
if (t.info->is_dst > 0)
os << " daylight ";
else
os << " standard ";
os << t.info->abbrev;
return os;
}
};
#endif // USE_OS_TZDB
} // namespace detail
} // namespace date
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#include "tz.h"
#endif
#endif // TZ_PRIVATE_H

View File

@@ -0,0 +1,111 @@
#ifndef DATA_TYPE_H
#define DATA_TYPE_H
#define FRAME_HEAD_MAGIC 0x03211546
#define SYSTEM_SYNC_ID 2
#ifdef __LINUX__
typedef unsigned char UCHAR;
typedef unsigned char* PBYTE;
typedef char* LPTSTR;
typedef unsigned short USHORT;
typedef int HANDLE;
typedef unsigned long ULONG;
typedef unsigned long DWORD;
#endif //#ifdef __LINUX__
typedef struct tagFrameInfo{
ULONG SyncId; /* 00000000000000000000000000010b */
ULONG Magic;
USHORT FrameType; /* I frames , P frames or BBP frames Audio frames or dsp status etc */
ULONG Length; /*lenth include this header */
ULONG FrameNumber; /* serial number of this frame */
UCHAR Breakable; /* indicate if stream breakable, you could restart new file(with PktSysHeader) if true */
/*ULONG Ack;*/
ULONG PTS; /* system clock when this frames is processed */
}TMFRAME_HEADER, *PTMFRAME_HEADER;
typedef enum {
StandardNone = 0x80000000,
StandardNTSC = 0x00000001,
StandardPAL = 0x00000002,
StandardSECAM = 0x00000004,
} VideoStandard_t;
typedef enum {
PktError = 0,
PktIFrames = 0x0001,
PktPFrames = 0x0002,
PktBBPFrames = 0x0004,
PktAudioFrames = 0x0008,
PktMotionDetection = 0x00010,
PktDspStatus = 0x00020,
PktOrigImage = 0x00040,
PktSysHeader = 0x00080,
PktBPFrames = 0x00100,
PktSFrames = 0x00200,
PktSubIFrames = 0x00400,
PktSubPFrames = 0x00800,
PktSubBBPFrames = 0x01000,
PktSubSysHeader = 0x02000
}FrameType_t;
typedef struct tagVersion{
ULONG DspVersion, DspBuildNum;
ULONG DriverVersion, DriverBuildNum;
ULONG SDKVersion, SDKBuildNum;
}VERSION_INFO, *PVERSION_INFO;
typedef enum {
ENC_CIF_FORMAT = 0,
ENC_QCIF_FORMAT = 1,
ENC_2CIF_FORMAT = 2,
ENC_4CIF_FORMAT = 3,
ENC_QQCIF_FORMAT = 4,
ENC_CIFQCIF_FORMAT =5,
ENC_CIFQQCIF_FORMAT =6,
ENC_DCIF_FORMAT =7,
ENC_VGA_FORMAT=8
}PictureFormat_t;
typedef struct tagMotionData{
PictureFormat_t PicFormat;
ULONG HorizeBlocks;
ULONG VerticalBlocks;
ULONG BlockSize;
}MOTION_DATA_HEADER, *PMOTION_DATA_HEADER;
#define _OSD_BASE 0x9000 /*base address of special character*/
#define _OSD_YEAR4 (_OSD_BASE+0) /*show year time by length of 4 , for example: 2005*/
#define _OSD_YEAR2 (_OSD_BASE+1) /*show year time by length of 2, for example: 05 */
#define _OSD_MONTH3 (_OSD_BASE+2) /*show month time in English, for example: Jan*/
#define _OSD_MONTH2 (_OSD_BASE+3) /*show month time by two Arabic numerals, for example: 07*/
#define _OSD_DAY (_OSD_BASE+4) /*show day time by two Arabic numerals, for example: 31*/
#define _OSD_WEEK3 (_OSD_BASE+5) /*show week time in English: MON<4F><4E>SUN*/
#define _OSD_CWEEK1 (_OSD_BASE+6) /*show week time in Chinese GB code*/
#define _OSD_HOUR24 (_OSD_BASE+7) /*show 24 hours clock: 00<30><30>23 */
#define _OSD_HOUR12 (_OSD_BASE+8) /*show 12 hours clock: 00<30><30>12*/
#define _OSD_MINUTE (_OSD_BASE+9) /*show minute time by length of 2: 00<30><30>59*/
#define _OSD_SECOND (_OSD_BASE+10) /*show second time by length of 2: 00<30><30>59*/
#define _OSD_MILISECOND (_OSD_BASE+11) /*show millisecond time by length of 3: 000~999*/
#define _OSD_APM (_OSD_BASE+14) /*show a.m. or p.m. by length of 2 bit, AM or PM*/
//For new added APIs to set OSD: SetEncoderOsdDisplayMode, SetDecoderOsdDisplayMode and SetDisplayOsdDisplayMode in v6.0 SDK, we use new basic address of special character.
#define _OSD_BASE_EX 0x90000 /*base address of special character*/
#define _OSD_YEAR4_EX (_OSD_BASE_EX+0) /*the same as _OSD_YEAR4*/
#define _OSD_YEAR2_EX (_OSD_BASE_EX+1) /*the same as _OSD_YEAR2*/
#define _OSD_MONTH3_EX (_OSD_BASE_EX+2) /*the same as _OSD_MONTH3*/
#define _OSD_MONTH2_EX (_OSD_BASE_EX+3) /*the same as _OSD_MONTH2*/
#define _OSD_DAY_EX (_OSD_BASE_EX+4) /*the same as _OSD_DAY*/
#define _OSD_WEEK3_EX (_OSD_BASE_EX+5) /*the same as _OSD_WEEK3*/
#define _OSD_CWEEK1_EX (_OSD_BASE_EX+6) /*the same as _OSD_CWEEK1*/
#define _OSD_HOUR24_EX (_OSD_BASE_EX+7) /*the same as _OSD_HOUR24*/
#define _OSD_HOUR12_EX (_OSD_BASE_EX+8) /*the same as _OSD_HOUR12*/
#define _OSD_MINUTE_EX (_OSD_BASE_EX+9) /*the same as _OSD_MINUTE*/
#define _OSD_SECOND_EX (_OSD_BASE_EX+10) /*the same as _OSD_SECOND*/
#define _OSD_MILISECOND_EX (_OSD_BASE_EX+11) /*the same as _OSD_MILISECOND*/
#define _OSD_APM_EX (_OSD_BASE_EX+14) /*the same as _OSD_APM*/
#endif

View File

@@ -0,0 +1,451 @@
///////////////////////////////////////////////////////////////////////////
// DS-40xxHC/HF BOARD SYSTEM SDK //
///////////////////////////////////////////////////////////////////////////
#ifndef DECODECARD_SDK_H
#define DECODECARD_SDK_H
#include "datatype.h"
#define DLLEXPORT_API extern "C" __declspec(dllexport)
#define ERR_WAIT_TIMEOUT 0xc0000001
#define ERR_INVALID_HANDLE 0xc0000002
#define ERR_INVALID_ARGUMENT 0xc0000003
#define ERR_DDRAW_CREATE_FAILED 0xc0000004
#define ERR_DDRAW_CAPS_FAULT 0xc0000005
#define ERR_SET_COOPERATIVELEVEL_FAILED 0xc0000006
#define ERR_PRIMARY_SURFACE_CREATE_FAILED 0xc0000007
#define ERR_GET_OVERLAY_ADDRESS_FAILED 0xc0000008
#define ERR_OVERLAY_SURFACE_CREATE_FAILED 0xc0000009
#define ERR_OVERLAY_UPDATE_FAILED 0xc000000a
#define ERR_TMMAN_FAILURE 0xc000000b
#define ERR_CHANNELMAGIC_MISMATCH 0xc000000c
#define ERR_CALLBACK_REGISTERED 0xc000000d
#define ERR_QUEUE_OVERFLOW 0xc000000e
#define ERR_STREAM_THREAD_FAILURE 0xc000000f
#define ERR_THREAD_STOP_ERROR 0xc0000010
#define ERR_NOT_SUPPORT 0xc0000011
#define ERR_OUTOF_MEMORY 0xc0000012
#define ERR_DSP_BUSY 0xc0000013
#define ERR_DATA_ERROR 0xc0000014
#define ERR_KERNEL 0xc0000016
#define ERR_OFFSCREEN_CREATE_FAILED 0xc0000017
#define ERR_MULTICLOCK_FAILURE 0xc0000018
#define ERR_INVALID_DEVICE 0xc0000019
#define ERR_INVALID_DRIVER 0xc000001a
//error code for MD card
#define HWERR_SUCCESS 0
#define HWERR_ALLOCATE_MEMORY 0xc1000001
#define HWERR_INVALID_HANDLE 0xc1000002
#define HWERR_DDRAW_CREATE_FAILED 0xc1000003
#define HWERR_DDRAW_CAPS_FAULT 0xc1000004
#define HWERR_SET_COOPERATIVELEVEL_FAILED 0xc1000005
#define HWERR_PRIMARY_SURFACE_CREATE_FAILED 0xc1000006
#define HWERR_OVERLAY_CREATE_FAILED 0xc1000007
#define HWERR_GET_OVERLAY_ADDRESS_FAILED 0xc1000008
#define HWERR_OVERLAY_UPDATE_FAILED 0xc1000009
#define HWERR_SURFACE_NULL 0xc100000a
#define HWERR_FILEHEADER_UNKNOWN 0xc100000b
#define HWERR_CREATE_FILE_FAILED 0xc100000c
#define HWERR_FILE_SIZE_ZERO 0xc100000d
#define HWERR_FILE_SIZE_INVALID 0xc100000d
#define HWERR_CREATE_OBJ_FAILED 0xc100000e
#define HWERR_CHANNELMAGIC_MISMATCH 0xc100000f
#define HWERR_PARA_OVER 0xc1000010
#define HWERR_ORDER 0xc1000011
#define HWERR_COMMAND 0xc1000012
#define HWERR_UNSUPPORTED 0xc1000013
#define HWERR_DSPOPEN 0xc1000014
#define HWERR_DSPLOAD 0xc1000015
#define HWERR_ALLOCATE_DSPMEMORY 0xc1000016
#define HWERR_DSPCHECHER 0xc1000017
#define HWERR_IMGFILE_UNKNOWN 0xc1000018
#define HWERR_INVALID_FILE 0xc1000019
//standart
#define HW_PAL 2
#define HW_NTSC 1
//jump direction
#define HW_JUMP_FORWARD 309
#define HW_JUMP_BACKWARD 310
typedef enum tagTypeVideoFormat
{
vdfRGB8A_233 = 0x00000001,
vdfRGB8R_332 = 0x00000002,
vdfRGB15Alpha = 0x00000004,
vdfRGB16 = 0x00000008,
vdfRGB24 = 0x00000010,
vdfRGB24Alpha = 0x00000020,
vdfYUV420Planar = 0x00000040,
vdfYUV422Planar = 0x00000080,
vdfYUV411Planar = 0x00000100,
vdfYUV420Interspersed = 0x00000200,
vdfYUV422Interspersed = 0x00000400,
vdfYUV411Interspersed = 0x00000800,
vdfYUV422Sequence = 0x00001000, /* U0, Y0, V0, Y1: For VO overlay */
vdfYUV422SequenceAlpha = 0x00002000,
/* U0, Y0, V0, Y1: For VO overlay, with low bit for alpha blending */
vdfMono = 0x00004000, /* 8 bit monochrome */
vdfYUV444Planar = 0x00008000,
}TypeVideoFormat;
typedef enum _BitrateControlType_t
{
brCBR = 0,
brVBR = 1,
}BitrateControlType_t;
typedef enum _BOARD_TYPE_DS
{
DS400XM =0,
DS400XH =1,
DS4004HC =2,
DS4008HC =3,
DS4016HC =4,
DS4001HF =5,
DS4004HF =6,
DS4002MD =7,
DS4004MD =8, //4004MD
DS4016HCS =9, //4016HCS
DS4002HT =10, //4002HT
DS4004HT =11, //4004HT
DS4008HT =12, //4008HT
DS4004HC_PLUS =13, //4004HC+
DS4008HC_PLUS =14, //4008HC+
DS4016HC_PLUS =15, //4016HC+
DS4008HF =16, //4008HF
DS4008MD =17, //4008MD
DS4008HS =18, //4008HS
DS4016HS =19, //4016HS
INVALID_BOARD_TYPE =0xffffffff,
}BOARD_TYPE_DS;
#define STREAM_TYPE_VIDEO 1
#define STREAM_TYPE_AUDIO 2
#define STREAM_TYPE_AVSYNC 3
#define DRAWFUN(x) void (CALLBACK* x)(long nPort,HDC hDc,LONG nUser)
typedef void (*LOGRECORD_CALLBACK)(char *str, void *context);
typedef int (*STREAM_READ_CALLBACK)(ULONG channelNumber, void *context);
typedef int (*STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber,void *DataBuf,DWORD Length,int FrameType,void *context);
typedef struct tagChannelCapability{
UCHAR bAudioPreview;
UCHAR bAlarmIO;
UCHAR bWatchDog;
}CHANNEL_CAPABILITY, *PCHANNEL_CAPABILITY;
typedef struct tagFramsStatistics{
ULONG VideoFrames;
ULONG AudioFrames;
ULONG FramesLost;
ULONG QueueOverflow;
ULONG CurBps;
}FRAMES_STATISTICS, *PFRAMES_STATISTICS;
DLLEXPORT_API int __stdcall InitDSPs();
DLLEXPORT_API int __stdcall DeInitDSPs();
DLLEXPORT_API HANDLE __stdcall ChannelOpen(int ChannelNum);
DLLEXPORT_API int __stdcall ChannelClose(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetTotalChannels();
DLLEXPORT_API int __stdcall GetTotalDSPs();
DLLEXPORT_API int __stdcall StartVideoPreview(HANDLE hChannelHandle,HWND WndHandle, RECT *rect, BOOLEAN bOverlay, int VideoFormat, int FrameRate);
DLLEXPORT_API int __stdcall StopVideoPreview(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetVideoPara(HANDLE hChannelHandle, int Brightness, int Contrast, int Saturation, int Hue);
DLLEXPORT_API int __stdcall GetVideoPara(HANDLE hChannelHandle, VideoStandard_t *VideoStandard, int *Brightness, int *Contrast, int *Saturation, int *Hue);
DLLEXPORT_API int __stdcall GetVideoSignal(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetSDKVersion(PVERSION_INFO VersionInfo);
DLLEXPORT_API int __stdcall GetCapability(HANDLE hChannelHandle, CHANNEL_CAPABILITY *Capability);
DLLEXPORT_API int __stdcall GetLastErrorNum(HANDLE hChannelHandle, ULONG *DspError, ULONG *SdkError);
DLLEXPORT_API int __stdcall SetStreamType(HANDLE hChannelHandle, USHORT Type);
DLLEXPORT_API int __stdcall GetStreamType(HANDLE hChannelHandle, USHORT *StreamType);
DLLEXPORT_API int __stdcall GetFramesStatistics(HANDLE hChannelHandle, PFRAMES_STATISTICS framesStatistics);
DLLEXPORT_API int __stdcall StartMotionDetection(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetBoardInfo(HANDLE hChannelHandle, ULONG *BoardType, UCHAR *SerialNo);
DLLEXPORT_API int __stdcall StopMotionDetection(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetOriginalImage(HANDLE hChannelHandle, UCHAR *ImageBuf, ULONG *Size);
DLLEXPORT_API int __stdcall RegisterLogRecordCallback(LOGRECORD_CALLBACK LogRecordFunc, void *Context);
DLLEXPORT_API int __stdcall SetAudioPreview(HANDLE hChannelHandle, BOOL bEnable);
DLLEXPORT_API int __stdcall ReadStreamData(HANDLE hChannelHandle, void *DataBuf, DWORD *Length, int *FrameType);
DLLEXPORT_API int __stdcall RegisterMessageNotifyHandle(HWND hWnd, UINT MessageId);
DLLEXPORT_API int __stdcall StartVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall StopVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetIBPMode(HANDLE hChannelHandle, int KeyFrameIntervals, int BFrames, int PFrames, int FrameRate);
DLLEXPORT_API int __stdcall SetDefaultQuant(HANDLE hChannelHandle, int IQuantVal, int PQuantVal, int BQuantVal);
DLLEXPORT_API int __stdcall SetOsd(HANDLE hChannelHandle, BOOL Enable);
DLLEXPORT_API int __stdcall SetLogo(HANDLE hChannelHandle, int x, int y, int w, int h, unsigned char *yuv);
DLLEXPORT_API int __stdcall StopLogo(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetupMotionDetection(HANDLE hChannelHandle, RECT *RectList, int iAreas);
DLLEXPORT_API int __stdcall MotionAnalyzer(HANDLE hChannelHandle, char *MotionData, int iThreshold, int *iResult);
DLLEXPORT_API int __stdcall LoadYUVFromBmpFile(char *FileName, unsigned char *yuv, int BufLen, int *Width, int *Height);
DLLEXPORT_API int __stdcall SaveYUVToBmpFile(char *FileName, unsigned char *yuv, int Width, int Height);
DLLEXPORT_API int __stdcall CaptureIFrame(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall RegisterStreamReadCallback(STREAM_READ_CALLBACK StreamReadCallback, void *Context);
DLLEXPORT_API int __stdcall AdjustMotionDetectPrecision(HANDLE hChannelHandle,
int iGrade, int iFastMotionDetectFps,
int iSlowMotionDetectFps);
DLLEXPORT_API int __stdcall SetupBitrateControl(HANDLE hChannelHandle, ULONG MaxBps);
DLLEXPORT_API int __stdcall SetOverlayColorKey(COLORREF DestColorKey);
DLLEXPORT_API int __stdcall SetOsdDisplayMode(HANDLE hChannelHandle, int Brightness, BOOL Translucent, int parameter, USHORT *Format1, USHORT *Format2);
DLLEXPORT_API int __stdcall SetLogoDisplayMode(HANDLE hChannelHandle, COLORREF ColorKey, BOOL Translucent, int TwinkleInterval);
DLLEXPORT_API int __stdcall SetEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat);
DLLEXPORT_API int __stdcall SetVideoStandard(HANDLE hChannelHandle, VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall RestoreOverlay();
DLLEXPORT_API int __stdcall ResetDSP(int DspNumber);
DLLEXPORT_API int __stdcall GetSoundLevel(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetBitrateControlMode(HANDLE hChannelHandle, BitrateControlType_t brc);
DLLEXPORT_API int __stdcall SetupNotifyThreshold(HANDLE hChannelHandle, int iFramesThreshold);
DLLEXPORT_API int __stdcall SetupSubChannel(HANDLE hChannelHandle, int iSubChannel);
DLLEXPORT_API int __stdcall GetSubChannelStreamType(void *DataBuf, int FrameType);
//add for HC/HF
DLLEXPORT_API int __stdcall RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback,void *Context);
DLLEXPORT_API int __stdcall RegisterDrawFun(DWORD nport, DRAWFUN(DrawFun),LONG nUser);
DLLEXPORT_API int __stdcall SetupMask(HANDLE hChannelHandle, RECT *rectList, int iAreas);
DLLEXPORT_API int __stdcall StopMask(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetSubEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat);
DLLEXPORT_API int __stdcall StartSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall StopSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetupDateTime(HANDLE hChannelHandle, SYSTEMTIME *now);
/*
<20><><EFBFBD><EFBFBD>Ϊ1.7<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD>ܡ<EFBFBD>
<20>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĺ<DEB8><C4BA><EFBFBD><EFBFBD>ơ<EFBFBD>
*/
//ԭʼͼ<CABC><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef void (*IMAGE_STREAM_CALLBACK)(UINT channelNumber,void *context );
DLLEXPORT_API int __stdcall SetImageStream(HANDLE hChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer);
DLLEXPORT_API int __stdcall RegisterImageStreamCallback(IMAGE_STREAM_CALLBACK,void *context);
/*
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD>
(x,y)Ϊϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD><CFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼͼ<CABC><CDBC><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>
x<><78><EFBFBD><EFBFBD>Ϊ2<CEAA><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(x,y)<29><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA>йأ<D0B9><D8A3><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻ƥ<EBB2BB>
<20><><EFBFBD>ܻᵼ<DCBB><E1B5BC>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
DLLEXPORT_API int __stdcall SetInputVideoPosition(HANDLE hChannel,UINT x,UINT y);
DLLEXPORT_API int __stdcall StopRegisterDrawFun(DWORD nport);
/*
3.0
*/
#define SERIAL_NUMBER_LENGTH 12 //<2F><EFBFBD><E5BFA8><EFBFBD>кų<D0BA><C5B3><EFBFBD>
typedef struct tagDS_BOARD_DETAIL
{
BOARD_TYPE_DS type; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD>
BYTE sn[16]; //<2F><><EFBFBD>к<EFBFBD>
UINT dspCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DSP<53><50><EFBFBD><EFBFBD>
UINT firstDspIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB>DSP<53><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT encodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstEncodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT decodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDecodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT displayChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDisplayChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DS_BOARD_DETAIL;
typedef struct tagDSP_DETAIL
{
UINT encodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstEncodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT decodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDecodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT displayChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDisplayChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DSP_DETAIL;
DLLEXPORT_API unsigned int __stdcall GetBoardCount();
DLLEXPORT_API int __stdcall GetBoardDetail(UINT boardNum,DS_BOARD_DETAIL *pBoardDetail);
DLLEXPORT_API unsigned int __stdcall GetDspCount();
DLLEXPORT_API int __stdcall GetDspDetail(UINT dspNum,DSP_DETAIL *pDspDetail);
DLLEXPORT_API unsigned int __stdcall GetEncodeChannelCount();
DLLEXPORT_API unsigned int __stdcall GetDecodeChannelCount();
DLLEXPORT_API unsigned int __stdcall GetDisplayChannelCount();
DLLEXPORT_API int __stdcall SetDefaultVideoStandard(VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall SetVideoDetectPrecision(HANDLE hChannel,unsigned int value);
DLLEXPORT_API int __stdcall SetSubStreamType(HANDLE hChannelHandle, USHORT Type);
DLLEXPORT_API int __stdcall GetSubStreamType(HANDLE hChannelHandle, USHORT *StreamType);
#define MAX_DISPLAY_REGION 16
typedef struct tagREGION_PARAM
{
UINT left;
UINT top;
UINT width;
UINT height;
COLORREF color;
UINT param;
}REGION_PARAM;
DLLEXPORT_API int __stdcall SetDisplayStandard(UINT nDisplayChannel,VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall SetDisplayRegion(UINT nDisplayChannel,UINT nRegionCount,REGION_PARAM *pParam,UINT nReserved);
DLLEXPORT_API int __stdcall ClearDisplayRegion(UINT nDisplayChannel,UINT nRegionFlag);
DLLEXPORT_API int __stdcall SetDisplayRegionPosition(UINT nDisplayChannel,UINT nRegion,UINT nLeft,UINT nTop);
DLLEXPORT_API int __stdcall FillDisplayRegion(UINT nDisplayChannel,UINT nRegion,unsigned char *pImage);
DLLEXPORT_API int __stdcall SetEncoderVideoExtOutput(UINT nEncodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderVideoExtOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderVideoOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderAudioOutput(UINT nDecodeChannel,BOOL bOpen,UINT nOutputChannel);
//3.1
DLLEXPORT_API int __stdcall SetDeInterlace(HANDLE hChannelHandle,UINT mode,UINT level);
DLLEXPORT_API int __stdcall SetPreviewOverlayMode(BOOL bTrue);
//DECODE functions for DS4002MD
#if defined( _WINDLL)
#define PLAYER_API extern "C"__declspec(dllexport)
#else
#define PLAYER_API extern "C" __declspec(dllimport)
#endif
typedef struct tagDISPLAY_PARA
{
long bToScreen;
long bToVideoOut;
long nLeft;
long nTop;
long nWidth;
long nHeight;
long nReserved;
}DISPLAY_PARA,*PDISPLAY_PARA;
//Version info
typedef struct tagVERSION{
ULONG DspVersion, DspBuildNum;
ULONG DriverVersion, DriverBuildNum;
ULONG SDKVersion, SDKBuildNum;
}HW_VERSION, *PHW_VERSION;
//init part
PLAYER_API int __stdcall HW_InitDirectDraw(HWND hParent,COLORREF colorKey);
PLAYER_API int __stdcall HW_ReleaseDirectDraw();
PLAYER_API int __stdcall HW_InitDecDevice(long *pDeviceTotal);
PLAYER_API int __stdcall HW_ReleaseDecDevice();
PLAYER_API int __stdcall HW_ChannelOpen(long nChannelNum,HANDLE* phChannel);
PLAYER_API int __stdcall HW_ChannelClose(HANDLE hChannel);
//open part
PLAYER_API int __stdcall HW_OpenStream(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize);
DLLEXPORT_API int __stdcall HW_ResetStream(HANDLE hChannel);
PLAYER_API int __stdcall HW_CloseStream(HANDLE hChannel);
PLAYER_API int __stdcall HW_InputData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
PLAYER_API int __stdcall HW_OpenFile(HANDLE hChannel,LPTSTR sFileName);
PLAYER_API int __stdcall HW_CloseFile(HANDLE hChannel);
//play part
PLAYER_API int __stdcall HW_SetDisplayPara(HANDLE hChannel,DISPLAY_PARA *pPara);
PLAYER_API int __stdcall HW_Play(HANDLE hChannel);
PLAYER_API int __stdcall HW_Stop(HANDLE hChannel);
PLAYER_API int __stdcall HW_Pause(HANDLE hChannel,ULONG bPause);
//sound part
PLAYER_API int __stdcall HW_PlaySound(HANDLE hChannel);
PLAYER_API int __stdcall HW_StopSound(HANDLE hChannel);
PLAYER_API int __stdcall HW_SetVolume(HANDLE hChannel,ULONG nVolume);
//overlay part
PLAYER_API int __stdcall HW_RefreshSurface();
PLAYER_API int __stdcall HW_RestoreSurface();
PLAYER_API int __stdcall HW_ClearSurface();
PLAYER_API int __stdcall HW_ZoomOverlay(RECT* pSrcClientRect, RECT* pDecScreenRect);
//cut file
PLAYER_API int __stdcall HW_StartCapFile(HANDLE hChannel,LPTSTR sFileName);
PLAYER_API int __stdcall HW_StopCapFile(HANDLE hChannel);
//capture picture
PLAYER_API int __stdcall HW_GetYV12Image(HANDLE hChannel, PBYTE pBuffer, ULONG nSize);
PLAYER_API int __stdcall HW_GetPictureSize(HANDLE hChannel,ULONG* pWidth, ULONG* pHeight);
PLAYER_API int __stdcall HW_ConvertToBmpFile(BYTE * pBuf,ULONG nSize,ULONG nWidth,ULONG nHeight,char *sFileName,ULONG nReserved);
//setting and getting part
PLAYER_API int __stdcall HW_Jump(HANDLE hChannel,ULONG nDirection);
PLAYER_API int __stdcall HW_SetJumpInterval(HANDLE hChannel,ULONG nSecond);
PLAYER_API int __stdcall HW_GetSpeed(HANDLE hChannel,long *pSpeed);
PLAYER_API int __stdcall HW_SetSpeed(HANDLE hChannel,long nSpeed);
PLAYER_API int __stdcall HW_SetPlayPos(HANDLE hChannel,ULONG nPos);
PLAYER_API int __stdcall HW_GetPlayPos(HANDLE hChannel,ULONG* pPos);
PLAYER_API int __stdcall HW_GetVersion(PHW_VERSION pVersion);
PLAYER_API int __stdcall HW_GetCurrentFrameRate(HANDLE hChannel,ULONG* pFrameRate);
PLAYER_API int __stdcall HW_GetCurrentFrameNum(HANDLE hChannel,ULONG* pFrameNum);
PLAYER_API int __stdcall HW_GetFileTotalFrames(HANDLE hChannel,ULONG* pTotalFrames);
PLAYER_API int __stdcall HW_GetFileTime(HANDLE hChannel, ULONG* pFileTime);
PLAYER_API int __stdcall HW_GetCurrentFrameTime(HANDLE hChannel,ULONG* pFrameTime);
PLAYER_API int __stdcall HW_GetPlayedFrames(HANDLE hChannel,ULONG *pDecVFrames);
PLAYER_API int __stdcall HW_GetDeviceSerialNo(HANDLE hChannel,ULONG *pDeviceSerialNo);
PLAYER_API int __stdcall HW_SetFileEndMsg(HANDLE hChannel,HWND hWnd,UINT nMsg);
PLAYER_API int __stdcall HW_SetStreamOpenMode(HANDLE hChannel,ULONG nMode);
PLAYER_API int __stdcall HW_GetStreamOpenMode(HANDLE hChannel,ULONG *pMode);
PLAYER_API int __stdcall HW_SetVideoOutStandard(HANDLE hChannel,ULONG nStandard);
PLAYER_API int __stdcall HW_SetDspDeadlockMsg(HWND hWnd,UINT nMsg);
PLAYER_API int __stdcall HW_GetChannelNum(long nDspNum,long *pChannelNum,ULONG nNumsToGet,ULONG * pNumsGotten);
PLAYER_API int __stdcall HW_ResetDsp(long nDspNum);
PLAYER_API int __stdcall HW_SetAudioPreview(HANDLE hChannel, BOOL bEnable);
//////////////////////////////////////////////
PLAYER_API int __stdcall HW_OpenStreamEx(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize);
PLAYER_API int __stdcall HW_CloseStreamEx(HANDLE hChannel);
PLAYER_API int __stdcall HW_InputVideoData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
PLAYER_API int __stdcall HW_InputAudioData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
//4.0
PLAYER_API int __stdcall SetOsdDisplayModeEx(HANDLE hChannelHandle,int color,BOOL Translucent,int param,int nLineCount,USHORT **Format);
typedef void (*MOTION_DETECTION_CALLBACK)(ULONG channelNumber,BOOL bMotionDetected,void *context);
PLAYER_API int __stdcall SetupMotionDetectionEx(HANDLE hChannelHandle,int iGrade,int iFastMotionDetectFps,
int iSlowMotionDetectFps,UINT delay,RECT *RectList, int iAreas,
MOTION_DETECTION_CALLBACK MotionDetectionCallback,int reserved);
PLAYER_API int __stdcall GetJpegImage(HANDLE hChannelHandle,UCHAR *ImageBuf,ULONG *Size,UINT nQuality);
//WatchDog
PLAYER_API int __stdcall SetWatchDog(UINT boardNumber,BOOL bEnable);
//4.1
typedef void (*FILE_REF_DONE_CALLBACK)(UINT nChannel,UINT nSize);
PLAYER_API int __stdcall HW_SetFileRef(HANDLE hChannel,BOOL bEnable,FILE_REF_DONE_CALLBACK FileRefDoneCallback);
PLAYER_API int __stdcall HW_LocateByAbsoluteTime(HANDLE hChannel,SYSTEMTIME time);
PLAYER_API int __stdcall HW_LocateByFrameNumber(HANDLE hChannel,UINT frmNum);
PLAYER_API int __stdcall HW_GetCurrentAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pTime);
PLAYER_API int __stdcall HW_GetFileAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pStartTime,SYSTEMTIME *pEndTime);
//4.2
DLLEXPORT_API int __stdcall HW_ImportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize);
DLLEXPORT_API int __stdcall HW_ExportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize);
DLLEXPORT_API int __stdcall SetDisplayVideoCapture(UINT nDisplayChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer);
DLLEXPORT_API int __stdcall RegisterDisplayVideoCaptureCallback(IMAGE_STREAM_CALLBACK DisplayVideoCaptureCallback,void *context);
DLLEXPORT_API int __stdcall SetDisplayVideoBrightness(UINT chan,int Brightness);
DLLEXPORT_API int __stdcall SetChannelStreamCRC(HANDLE hChannel,BOOL bEnable);
DLLEXPORT_API int __stdcall SetSubChannelStreamCRC(HANDLE hChannel,BOOL bEnable);
DLLEXPORT_API int __stdcall HW_SetDecoderPostProcess(HANDLE hChannel,UINT param);
//
typedef void (*DECODER_VIDEO_CAPTURE_CALLBACK)(UINT nChannelNumber,void *DataBuf,UINT width,UINT height,UINT nFrameNum,UINT nFrameTime,SYSTEMTIME *pFrameAbsoluteTime,void *context);
DLLEXPORT_API int __stdcall RegisterDecoderVideoCaptureCallback(DECODER_VIDEO_CAPTURE_CALLBACK DecoderVideoCaptureCallback,void *context);
DLLEXPORT_API int __stdcall HW_SetDecoderVideoCapture(HANDLE hChannel,BOOL bStart,UINT param);
DLLEXPORT_API int __stdcall HW_InputDataByFrame(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
/*
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD>Ľӿ<EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD>޸ġ<DEB8>
*/
typedef struct
{
short x,y,width,height;
}FACE_AREA_DEMO;
typedef struct
{
FACE_AREA_DEMO faceArea;
FACE_AREA_DEMO leftEyeArea;
FACE_AREA_DEMO rightEyeArea;
FACE_AREA_DEMO leftPupilArea;
FACE_AREA_DEMO rightPupilArea;
FACE_AREA_DEMO noseArea;
FACE_AREA_DEMO mouthArea;
}FACE_INFO_DEMO;
typedef void (*FACE_DETECTION_DEMO_CALLBACK)(UINT nChannel,UINT nFaceCount,FACE_INFO_DEMO *pFaceInfo,
char *pData,UINT nDataSize,UINT nImageWidth,UINT nImageHeight);
DLLEXPORT_API int __stdcall SetFaceDetectionDemo(HANDLE hChannelHandle,BOOL bEnable,
UINT nFrameInterval,FACE_DETECTION_DEMO_CALLBACK pFunc,
BOOL bCompress,UINT nCompressQuality,BOOL bLocateEyePos);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,760 @@
#ifndef _PLAYM4_H_
#define _PLAYM4_H_
#if defined( _WINDLL)
#define PLAYM4_API extern "C" __declspec(dllexport)
#else
#define PLAYM4_API extern "C" __declspec(dllimport)
#endif
//Max channel numbers
#define PLAYM4_MAX_SUPPORTS 500
//Wave coef range;
#define MIN_WAVE_COEF -100
#define MAX_WAVE_COEF 100
//Timer type
#define TIMER_1 1 //Only 16 timers for every process.Default TIMER;
#define TIMER_2 2 //Not limit;But the precision less than TIMER_1;
//BUFFER AND DATA TYPE
#define BUF_VIDEO_SRC (1) //mixed input,total src buffer size;splited input,video src buffer size
#define BUF_AUDIO_SRC (2) //mixed input,not defined;splited input,audio src buffer size
#define BUF_VIDEO_RENDER (3) //video render node count
#define BUF_AUDIO_RENDER (4) //audio render node count
#define BUF_VIDEO_DECODED (5) //video decoded node count to render
#define BUF_AUDIO_DECODED (6) //audio decoded node count to render
#define BUF_DISPLAY_NODE (7) //display node
//Error code
#define PLAYM4_NOERROR 0 //no error
#define PLAYM4_PARA_OVER 1 //input parameter is invalid;
#define PLAYM4_ORDER_ERROR 2 //The order of the function to be called is error.
#define PLAYM4_TIMER_ERROR 3 //Create multimedia clock failed;
#define PLAYM4_DEC_VIDEO_ERROR 4 //Decode video data failed.
#define PLAYM4_DEC_AUDIO_ERROR 5 //Decode audio data failed.
#define PLAYM4_ALLOC_MEMORY_ERROR 6 //Allocate memory failed.
#define PLAYM4_OPEN_FILE_ERROR 7 //Open the file failed.
#define PLAYM4_CREATE_OBJ_ERROR 8 //Create thread or event failed
#define PLAYM4_CREATE_DDRAW_ERROR 9 //Create DirectDraw object failed.
#define PLAYM4_CREATE_OFFSCREEN_ERROR 10 //failed when creating off-screen surface.
#define PLAYM4_BUF_OVER 11 //buffer is overflow
#define PLAYM4_CREATE_SOUND_ERROR 12 //failed when creating audio device.
#define PLAYM4_SET_VOLUME_ERROR 13 //Set volume failed
#define PLAYM4_SUPPORT_FILE_ONLY 14 //The function only support play file.
#define PLAYM4_SUPPORT_STREAM_ONLY 15 //The function only support play stream.
#define PLAYM4_SYS_NOT_SUPPORT 16 //System not support.
#define PLAYM4_FILEHEADER_UNKNOWN 17 //No file header.
#define PLAYM4_VERSION_INCORRECT 18 //The version of decoder and encoder is not adapted.
#define PLAYM4_INIT_DECODER_ERROR 19 //Initialize decoder failed.
#define PLAYM4_CHECK_FILE_ERROR 20 //The file data is unknown.
#define PLAYM4_INIT_TIMER_ERROR 21 //Initialize multimedia clock failed.
#define PLAYM4_BLT_ERROR 22 //Blt failed.
#define PLAYM4_UPDATE_ERROR 23 //Update failed.
#define PLAYM4_OPEN_FILE_ERROR_MULTI 24 //openfile error, streamtype is multi
#define PLAYM4_OPEN_FILE_ERROR_VIDEO 25 //openfile error, streamtype is video
#define PLAYM4_JPEG_COMPRESS_ERROR 26 //JPEG compress error
#define PLAYM4_EXTRACT_NOT_SUPPORT 27 //Don't support the version of this file.
#define PLAYM4_EXTRACT_DATA_ERROR 28 //extract video data failed.
#define PLAYM4_SECRET_KEY_ERROR 29 //Secret key is error //add 20071218
#define PLAYM4_DECODE_KEYFRAME_ERROR 30 //add by hy 20090318
#define PLAYM4_NEED_MORE_DATA 31 //add by hy 20100617
#define PLAYM4_INVALID_PORT 32 //add by cj 20100913
#define PLAYM4_NOT_FIND 33 //add by cj 20110428
#define PLAYM4_NEED_LARGER_BUFFER 34 //add by pzj 20130528
#define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown;
//<2F><><EFBFBD>۹<EFBFBD><DBB9>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
#define PLAYM4_FEC_ERR_NOTENABLE 101 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // <20>Ӷ˿<D3B6>û<EFBFBD>з<EFBFBD><D0B7><EFBFBD>
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // û<>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ӧ<EFBFBD>˿ڵIJ<DAB5><C4B2><EFBFBD>
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // <20>Ӷ˿<D3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // <20>ð<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>
#define PLAYM4_FEC_ERR_INVALIDWND 106 // <20>Ƿ<EFBFBD><C7B7>Ĵ<EFBFBD><C4B4><EFBFBD>
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZλ<5A><CEBB>Խ<EFBFBD><D4BD>
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // Բ<>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>Ƿ<EFBFBD>
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // ָ<><D6B8><EFBFBD>İ<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD>֧<EFBFBD><D6A7>
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // <20><><EFBFBD>ſ<EFBFBD><C5BF>˿<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_FEC_ERR_PARAMVALID 111 // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // <20>Ƿ<EFBFBD><C7B7>Ӷ˿<D3B6>
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ<54><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΧԽ<CEA7><D4BD>
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵĽ<D6B5><C4BD><EFBFBD>ͨ<EFBFBD><CDA8>Ϊ<EFBFBD>ĸ<EFBFBD>
#define PLAYM4_FEC_ERR_ENABLED 115 //<2F>ö˿<C3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D<33><44><EFBFBD><EFBFBD>û<EFBFBD>п<EFBFBD><D0BF><EFBFBD>
//Max display regions.
#define MAX_DISPLAY_WND 4
//Display type
#define DISPLAY_NORMAL 0x00000001
#define DISPLAY_QUARTER 0x00000002
#define DISPLAY_YC_SCALE 0x00000004 //add by gb 20091116
#define DISPLAY_NOTEARING 0x00000008
//Display buffers
#define MAX_DIS_FRAMES 50
#define MIN_DIS_FRAMES 1
//Locate by
#define BY_FRAMENUM 1
#define BY_FRAMETIME 2
//Source buffer
#define SOURCE_BUF_MAX 1024*100000
#define SOURCE_BUF_MIN 1024*50
//Stream type
#define STREAME_REALTIME 0
#define STREAME_FILE 1
//frame type
#define T_AUDIO16 101
#define T_AUDIO8 100
#define T_UYVY 1
#define T_YV12 3
#define T_RGB32 7
//capability
#define SUPPORT_DDRAW 1
#define SUPPORT_BLT 2
#define SUPPORT_BLTFOURCC 4
#define SUPPORT_BLTSHRINKX 8
#define SUPPORT_BLTSHRINKY 16
#define SUPPORT_BLTSTRETCHX 32
#define SUPPORT_BLTSTRETCHY 64
#define SUPPORT_SSE 128
#define SUPPORT_MMX 256
// <20><><EFBFBD>º궨<C2BA><EAB6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HIK_MEDIAINFO<46>
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO<46><EFBFBD><E1B9B9><EFBFBD><EFBFBD>
// ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>ʽ
#define SYSTEM_NULL 0x0 // û<><C3BB>ϵͳ<CFB5><EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
#define SYSTEM_HIK 0x1 // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
#define SYSTEM_MPEG2_PS 0x2 // PS<50><53>װ
#define SYSTEM_MPEG2_TS 0x3 // TS<54><53>װ
#define SYSTEM_RTP 0x4 // rtp<74><70>װ
#define SYSTEM_RTPHIK 0x401 // rtp<74><70>װ
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define VIDEO_NULL 0x0 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
#define VIDEO_H264 0x1 // <20><><EFBFBD><EFBFBD>H.264
#define VIDEO_MPEG4 0x3 // <20><>׼MPEG4
#define VIDEO_MJPEG 0x4
#define VIDEO_AVC264 0x0100
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define AUDIO_NULL 0x0000 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
#define AUDIO_ADPCM 0x1000 // ADPCM
#define AUDIO_MPEG 0x2000 // MPEG ϵ<><CFB5><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>MPEG<45><47>Ƶ
#define AUDIO_AAC 0X2001 // AAC <20><><EFBFBD><EFBFBD>
// Gϵ<47><CFB5><EFBFBD><EFBFBD>Ƶ
#define AUDIO_RAW_DATA8 0x7000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ8k<38><6B>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>
#define AUDIO_RAW_UDATA16 0x7001 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16k<36><6B>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>L16
#define AUDIO_G711_U 0x7110
#define AUDIO_G711_A 0x7111
#define AUDIO_G722_1 0x7221
#define AUDIO_G723_1 0x7231
#define AUDIO_G726_U 0x7260
#define AUDIO_G726_A 0x7261
#define AUDIO_G726_16 0x7262
#define AUDIO_G729 0x7290
#define AUDIO_AMR_NB 0x3000
#define SYNCDATA_VEH 1 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
#define SYNCDATA_IVS 2 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
//motion flow type
#define MOTION_FLOW_NONE 0
#define MOTION_FLOW_CPU 1
#define MOTION_FLOW_GPU 2
//<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define ENCRYPT_AES_3R_VIDEO 1
#define ENCRYPT_AES_10R_VIDEO 2
#define ENCRYPT_AES_3R_AUDIO 1
#define ENCRYPT_AES_10R_AUDIO 2
//Frame position
typedef struct{
long nFilePos;
long nFrameNum;
long nFrameTime;
long nErrorFrameNum;
SYSTEMTIME *pErrorTime;
long nErrorLostFrameNum;
long nErrorFrameSize;
}FRAME_POS,*PFRAME_POS;
//Frame Info
typedef struct{
long nWidth;
long nHeight;
long nStamp;
long nType;
long nFrameRate;
DWORD dwFrameNum;
}FRAME_INFO;
typedef struct
{
long nPort; //ͨ<><CDA8><EFBFBD><EFBFBD>
char *pBuf; //<2F><><EFBFBD>صĵ<D8B5>һ·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
unsigned int nBufLen; //<2F><><EFBFBD>صĵ<D8B5>һ·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С
char *pBuf1; //<2F><><EFBFBD>صĵڶ<C4B5>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
unsigned int nBufLen1; //<2F><><EFBFBD>صĵڶ<C4B5>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С
char *pBuf2; //<2F><><EFBFBD>صĵ<D8B5><C4B5><EFBFBD>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
unsigned int nBufLen2; //<2F><><EFBFBD>صĵ<D8B5><C4B5><EFBFBD>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С
unsigned int nWidth; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int nHeight; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int nStamp; //ʱ<><CAB1><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
unsigned int nType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void *pUser; //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
unsigned int reserved[4]; //<2F><><EFBFBD><EFBFBD>
}DISPLAY_INFO_YUV;
//Frame
typedef struct{
char *pDataBuf;
long nSize;
long nFrameNum;
BOOL bIsAudio;
long nReserved;
}FRAME_TYPE;
//Watermark Info //add by gb 080119
typedef struct{
char *pDataBuf;
long nSize;
long nFrameNum;
BOOL bRsaRight;
long nReserved;
}WATERMARK_INFO;
typedef struct SYNCDATA_INFO
{
DWORD dwDataType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD>Ŀǰ<C4BF>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
DWORD dwDataLen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
BYTE* pData; //ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݽṹ<DDBD><E1B9B9>ָ<EFBFBD><D6B8>,<2C><><EFBFBD><EFBFBD>IVS_INFO<46>
} SYNCDATA_INFO;
#ifndef _HIK_MEDIAINFO_FLAG_
#define _HIK_MEDIAINFO_FLAG_
typedef struct _HIK_MEDIAINFO_ // modified by gb 080425
{
unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information
unsigned short media_version; // <20><EFBFBD>ţ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>ĿǰΪ0x0101,<2C><>1.01<EFBFBD><EFBFBD><EFBFBD>01<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>01<EFBFBD><EFBFBD><EFBFBD>Ӱ汾<EFBFBD>š<EFBFBD>
unsigned short device_id; // <20>豸ID<49><44><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>/<2F><><EFBFBD><EFBFBD>
unsigned short system_format; // ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>
unsigned short video_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned short audio_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned char audio_channels; // ͨ<><CDA8><EFBFBD><EFBFBD>
unsigned char audio_bits_per_sample; // <20><>λ<EFBFBD><CEBB>
unsigned int audio_samplesrate; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int audio_bitrate; // ѹ<><D1B9><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>,<2C><>λ<EFBFBD><CEBB>bit
unsigned int reserved[4]; // <20><><EFBFBD><EFBFBD>
}HIK_MEDIAINFO;
#endif
typedef struct
{
long nPort;
char * pBuf;
long nBufLen;
long nWidth;
long nHeight;
long nStamp;
long nType;
long nUser;
}DISPLAY_INFO;
typedef struct
{
long nPort;
char *pVideoBuf;
long nVideoBufLen;
char *pPriBuf;
long nPriBufLen;
long nWidth;
long nHeight;
long nStamp;
long nType;
long nUser;
}DISPLAY_INFOEX;
typedef struct PLAYM4_SYSTEM_TIME //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
{
DWORD dwYear; //<2F><>
DWORD dwMon; //<2F><>
DWORD dwDay; //<2F><>
DWORD dwHour; //ʱ
DWORD dwMin; //<2F><>
DWORD dwSec; //<2F><>
DWORD dwMs; //<2F><><EFBFBD><EFBFBD>
} PLAYM4_SYSTEM_TIME;
//ENCRYPT Info
typedef struct{
long nVideoEncryptType; //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long nAudioEncryptType; //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long nSetSecretKey; //<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ã<EFBFBD>1<EFBFBD><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>0<EFBFBD><30>ʾû<CABE><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ
}ENCRYPT_INFO;
//////////////////////////////////////////////////////////////////////////////
//API
//////////////////////////////////////////////////////////////////////////////
////////////////ver 1.0///////////////////////////////////////
//Initialize DirecDraw.Now invalid.
PLAYM4_API BOOL __stdcall PlayM4_InitDDraw(HWND hWnd);
//Release directDraw; Now invalid.
PLAYM4_API BOOL __stdcall PlayM4_RealeseDDraw();
PLAYM4_API BOOL __stdcall PlayM4_OpenFile(LONG nPort,LPSTR sFileName);
PLAYM4_API BOOL __stdcall PlayM4_CloseFile(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Play(LONG nPort, HWND hWnd);
PLAYM4_API BOOL __stdcall PlayM4_Stop(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Pause(LONG nPort,DWORD nPause);
PLAYM4_API BOOL __stdcall PlayM4_Fast(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Slow(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OneByOne(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayPos(LONG nPort,float fRelativePos);
PLAYM4_API float __stdcall PlayM4_GetPlayPos(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndMsg(LONG nPort,HWND hWnd,UINT nMsg);
PLAYM4_API BOOL __stdcall PlayM4_SetVolume(LONG nPort,WORD nVolume);
PLAYM4_API BOOL __stdcall PlayM4_StopSound();
PLAYM4_API BOOL __stdcall PlayM4_PlaySound(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
PLAYM4_API BOOL __stdcall PlayM4_InputData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_CloseStream(LONG nPort);
PLAYM4_API int __stdcall PlayM4_GetCaps();
PLAYM4_API DWORD __stdcall PlayM4_GetFileTime(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTime(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedFrames(LONG nPort);
//23
////////////////ver 2.0 added///////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBack(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2));
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBackYUV(LONG nPort, void (CALLBACK* DisplayCBFun)(DISPLAY_INFO_YUV *pstDisplayInfo), BOOL bTrue, void* pUser);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBack(LONG nPort,void (CALLBACK* DisplayCBFun)(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved));
PLAYM4_API BOOL __stdcall PlayM4_ConvertToBmpFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
PLAYM4_API DWORD __stdcall PlayM4_GetFileTotalFrames(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameRate(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTimeEx(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayedTimeEx(LONG nPort,DWORD nTime);
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameNum(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetStreamOpenMode(LONG nPort,DWORD nMode);
PLAYM4_API DWORD __stdcall PlayM4_GetFileHeadLength();
PLAYM4_API DWORD __stdcall PlayM4_GetSdkVersion();
//11
////////////////ver 2.2 added///////////////////////////////////////
PLAYM4_API DWORD __stdcall PlayM4_GetLastError(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlay(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayMode(LONG nPort,BOOL bOverlay,COLORREF colorKey);
PLAYM4_API BOOL __stdcall PlayM4_GetPictureSize(LONG nPort,LONG *pWidth,LONG *pHeight);
PLAYM4_API BOOL __stdcall PlayM4_SetPicQuality(LONG nPort,BOOL bHighQuality);
PLAYM4_API BOOL __stdcall PlayM4_PlaySoundShare(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_StopSoundShare(LONG nPort);
//7
////////////////ver 2.4 added///////////////////////////////////////
PLAYM4_API LONG __stdcall PlayM4_GetStreamOpenMode(LONG nPort);
PLAYM4_API LONG __stdcall PlayM4_GetOverlayMode(LONG nPort);
PLAYM4_API COLORREF __stdcall PlayM4_GetColorKey(LONG nPort);
PLAYM4_API WORD __stdcall PlayM4_GetVolume(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_GetPictureQuality(LONG nPort,BOOL *bHighQuality);
PLAYM4_API DWORD __stdcall PlayM4_GetSourceBufferRemain(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBuffer(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetSourceBufCallBack(LONG nPort,DWORD nThreShold,void (CALLBACK * SourceBufCallBack)(long nPort,DWORD nBufSize,DWORD dwUser,void*pResvered),DWORD dwUser,void *pReserved);
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBufFlag(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayBuf(LONG nPort,DWORD nNum);
PLAYM4_API DWORD __stdcall PlayM4_GetDisplayBuf(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OneByOneBack(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetFileRefCallBack(LONG nPort, void (__stdcall *pFileRefDone)(DWORD nPort,DWORD nUser),DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetCurrentFrameNum(LONG nPort,DWORD nFrameNum);
PLAYM4_API BOOL __stdcall PlayM4_GetKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
PLAYM4_API BOOL __stdcall PlayM4_GetNextKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
#if (WINVER >= 0x0400)
//Note: These funtion must be builded under win2000 or above with Microsoft Platform sdk.
// You can download the sdk from "http://www.microsoft.com/msdownload/platformsdk/sdkupdate/";
PLAYM4_API BOOL __stdcall PlayM4_InitDDrawDevice();
PLAYM4_API void __stdcall PlayM4_ReleaseDDrawDevice();
PLAYM4_API DWORD __stdcall PlayM4_GetDDrawDeviceTotalNums();
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDevice(LONG nPort,DWORD nDeviceNum);
//PLAYM4_API BOOL __stdcall PlayM4_GetDDrawDeviceInfo(DWORD nDeviceNum,LPSTR lpDriverDescription,DWORD nDespLen,LPSTR lpDriverName ,DWORD nNameLen,HMONITOR *hhMonitor);
PLAYM4_API int __stdcall PlayM4_GetCapsEx(DWORD nDDrawDeviceNum);
#endif
PLAYM4_API BOOL __stdcall PlayM4_ThrowBFrameNum(LONG nPort,DWORD nNum);
//23
////////////////ver 2.5 added///////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayType(LONG nPort,LONG nType);
PLAYM4_API long __stdcall PlayM4_GetDisplayType(LONG nPort);
//2
////////////////ver 3.0 added///////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetDecCBStream(LONG nPort,DWORD nStream);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayRegion(LONG nPort,DWORD nRegionNum, RECT *pSrcRect, HWND hDestWnd, BOOL bEnable);
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlayEx(LONG nPort,DWORD nRegionNum);
#if (WINVER >= 0x0400)
//Note: The funtion must be builded under win2000 or above with Microsoft Platform sdk.
// You can download the sdk from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/;
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDeviceEx(LONG nPort,DWORD nRegionNum,DWORD nDeviceNum);
#endif
//4
/////////////////v3.2 added/////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_GetRefValue(LONG nPort,BYTE *pBuffer, DWORD *pSize);
PLAYM4_API BOOL __stdcall PlayM4_SetRefValue(LONG nPort,BYTE *pBuffer, DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamEx(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
PLAYM4_API BOOL __stdcall PlayM4_CloseStreamEx(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_InputVideoData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_InputAudioData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_RegisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
PLAYM4_API BOOL __stdcall PlayM4_RigisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
//8
//////////////////v3.4/////////////////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetTimerType(LONG nPort,DWORD nTimerType,DWORD nReserved);
PLAYM4_API BOOL __stdcall PlayM4_GetTimerType(LONG nPort,DWORD *pTimerType,DWORD *pReserved);
PLAYM4_API BOOL __stdcall PlayM4_ResetBuffer(LONG nPort,DWORD nBufType);
PLAYM4_API DWORD __stdcall PlayM4_GetBufferValue(LONG nPort,DWORD nBufType);
//////////////////V3.6/////////////////////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_AdjustWaveAudio(LONG nPort,LONG nCoefficient);
PLAYM4_API BOOL __stdcall PlayM4_SetVerifyCallBack(LONG nPort, DWORD nBeginTime, DWORD nEndTime, void (__stdcall * funVerify)(long nPort, FRAME_POS * pFilePos, DWORD bIsVideo, DWORD nUser), DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetAudioCallBack(LONG nPort, void (__stdcall * funAudio)(long nPort, char * pAudioBuf, long nSize, long nStamp, long nType, long nUser), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetEncTypeChangeCallBack(LONG nPort,void(CALLBACK *funEncChange)(long nPort,long nUser),long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetColor(LONG nPort, DWORD nRegionNum, int nBrightness, int nContrast, int nSaturation, int nHue);
PLAYM4_API BOOL __stdcall PlayM4_GetColor(LONG nPort, DWORD nRegionNum, int *pBrightness, int *pContrast, int *pSaturation, int *pHue);
PLAYM4_API BOOL __stdcall PlayM4_SetEncChangeMsg(LONG nPort,HWND hWnd,UINT nMsg);
PLAYM4_API BOOL __stdcall PlayM4_GetOriginalFrameCallBack(LONG nPort, BOOL bIsChange,BOOL bNormalSpeed,long nStartFrameNum,long nStartStamp,long nFileHeader,void(CALLBACK *funGetOrignalFrame)(long nPort,FRAME_TYPE *frameType, long nUser),long nUser);
PLAYM4_API BOOL __stdcall PlayM4_GetFileSpecialAttr(LONG nPort, DWORD *pTimeStamp,DWORD *pFileNum ,DWORD *pReserved);
PLAYM4_API DWORD __stdcall PlayM4_GetSpecialData(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetCheckWatermarkCallBack(LONG nPort,void(CALLBACK* funCheckWatermark)(long nPort,WATERMARK_INFO* pWatermarkInfo,DWORD nUser),DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetImageSharpen(LONG nPort,DWORD nLevel);
PLAYM4_API BOOL __stdcall PlayM4_SetDecodeFrameType(LONG nPort,DWORD nFrameType);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayMode(LONG nPort,BOOL bNormal);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayFlipMode(LONG nPort,BOOL bTrue);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayPriInfoFlag(LONG nPort, DWORD nIntelType, BOOL bTrue,const char *pFontPath);
//PLAYM4_API DWORD __stdcall PlayM4_GetAbsFrameNum(LONG nPort);
//////////////////V4.7.0.0//////////////////////////////////////////////////////
////convert yuv to jpeg
PLAYM4_API BOOL __stdcall PlayM4_ConvertToJpegFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
PLAYM4_API BOOL __stdcall PlayM4_SetJpegQuality(long nQuality);
//set deflash
PLAYM4_API BOOL __stdcall PlayM4_SetDeflash(LONG nPort,BOOL bDefalsh);
//PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackEx(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2), char* pDest, long nDestSize);
//////////////////V4.8.0.0/////////////////////////////////////////////////////////
//check discontinuous frame number as error data?
PLAYM4_API BOOL __stdcall PlayM4_CheckDiscontinuousFrameNum(LONG nPort, BOOL bCheck);
//get bmp or jpeg
PLAYM4_API BOOL __stdcall PlayM4_GetBMP(LONG nPort,PBYTE pBitmap,DWORD nBufSize,DWORD* pBmpSize);
PLAYM4_API BOOL __stdcall PlayM4_GetJPEG(LONG nPort,PBYTE pJpeg,DWORD nBufSize,DWORD* pJpegSize);
//dec call back mend
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackMend(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nUser,long nReserved2), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetSecretKey(LONG nPort, LONG lKeyType, char *pSecretKey, LONG lKeyLen);
// add by gb 2007-12-23
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndCallback(LONG nPort, void(CALLBACK*FileEndCallback)(long nPort, void *pUser), void *pUser);
// add by gb 080131 version 4.9.0.1
PLAYM4_API BOOL __stdcall PlayM4_GetPort(LONG* nPort);
PLAYM4_API BOOL __stdcall PlayM4_FreePort(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBackEx(LONG nPort,void (CALLBACK* DisplayCBFun)(DISPLAY_INFO *pstDisplayInfo), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SkipErrorData(LONG nPort, BOOL bSkip);
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackExMend(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char* pBuf, long nSize, FRAME_INFO* pFrameInfo,
long nUser, long nReserved2), char* pDest, long nDestSize, long nUser);
//reverse play add by chenjie 110609
PLAYM4_API BOOL __stdcall PlayM4_ReversePlay(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_GetSystemTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
//PLAYM4_API BOOL __stdcall PlayM4_SetDecodeERC(long nPort, unsigned int nLevel);
#ifndef PLAYM4_SESSION_INFO_TAG
#define PLAYM4_SESSION_INFO_TAG
//nProtocolType
#define PLAYM4_PROTOCOL_RTSP 1
//nSessionInfoType
#define PLAYM4_SESSION_INFO_SDP 1
typedef struct _PLAYM4_SESSION_INFO_ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>
{
int nSessionInfoType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>SDP<44><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7BAA3>˽<EFBFBD><CBBD><EFBFBD><EFBFBD>Ϣͷ
int nSessionInfoLen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
unsigned char* pSessionInfoData; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
} PLAYM4_SESSION_INFO;
#endif
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamAdvanced(LONG nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, DWORD nBufPoolSize);
#define R_ANGLE_0 -1 //<2F><><EFBFBD><EFBFBD>ת
#define R_ANGLE_L90 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30>
#define R_ANGLE_R90 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30>
#define R_ANGLE_180 2 //<2F><>ת180<38><30>
PLAYM4_API BOOL __stdcall PlayM4_SetRotateAngle(LONG nPort, DWORD nRegionNum, DWORD dwType);
#ifndef PLAYM4_ADDITION_INFO_TAG
#define PLAYM4_ADDITION_INFO_TAG
typedef struct _PLAYM4_ADDITION_INFO_ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>
{
BYTE* pData; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DWORD dwDatalen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
DWORD dwDataType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DWORD dwTimeStamp; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
} PLAYM4_ADDITION_INFO;
#endif
//dwGroupIndex <20><>Լ<EFBFBD><D4BC>ȡֵ0~3<><33><EFBFBD><EFBFBD>һ<EFBFBD>汾ȡ<E6B1BE><C8A1>ͬ<EFBFBD><CDAC>ֻ<EFBFBD><D6BB>ͬ<EFBFBD><CDAC>closestream<61><6D><EFBFBD><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_SetSycGroup(LONG nPort, DWORD dwGroupIndex);
//<2F>ݲ<EFBFBD>ʵ<EFBFBD>ִ˺<D6B4><CBBA><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʼʱ<CABC>һ<E4B2BB>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣬ͬһ<CDAC><D2BB><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ·
PLAYM4_API BOOL __stdcall PlayM4_SetSycStartTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
// <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صĽӿ<C4BD>
#ifndef FISH_EYE_TAG
#define FISH_EYE_TAG
// <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
typedef enum tagFECPlaceType
{
FEC_PLACE_WALL = 0x1, // <20><>װ<EFBFBD><D7B0>ʽ (<28><><EFBFBD><EFBFBD>ˮƽ)
FEC_PLACE_FLOOR = 0x2, // <20><><EFBFBD>氲װ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
FEC_PLACE_CEILING = 0x3, // <20><>װ<EFBFBD><D7B0>ʽ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
}FECPLACETYPE;
typedef enum tagFECCorrectType
{
FEC_CORRECT_PTZ = 0x100, // PTZ
FEC_CORRECT_180 = 0x200, // 180<38>Ƚ<EFBFBD><C8BD><EFBFBD> <20><><EFBFBD><EFBFBD>Ӧ2P<32><50>
FEC_CORRECT_360 = 0x300, // 360ȫ<30><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ӧ1P<31><50>
FEC_CORRECT_LAT = 0x400 //γ<><CEB3>չ<EFBFBD><D5B9>
}FECCORRECTTYPE;
typedef struct tagCycleParam
{
float fRadiusLeft; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
float fRadiusRight; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
float fRadiusTop; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
float fRadiusBottom; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
}CYCLEPARAM;
typedef struct tagPTZParam
{
float fPTZPositionX; // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> X<><58><EFBFBD><EFBFBD>
float fPTZPositionY; // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> Y<><59><EFBFBD><EFBFBD>
}PTZPARAM;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*********************************************
********************************************/
// <20><><EFBFBD>±<EFBFBD><C2B1>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define FEC_UPDATE_RADIUS 0x1
#define FEC_UPDATE_PTZZOOM 0x2
#define FEC_UPDATE_WIDESCANOFFSET 0x4
#define FEC_UPDATE_PTZPARAM 0x8
typedef struct tagFECParam
{
unsigned int nUpDateType; // <20><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>
unsigned int nPlaceAndCorrect; // <20><>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1>SetParam<61><6D>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ч,<2C><>ֵ<EFBFBD><D6B5>ʾ<EFBFBD><CABE>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>ĺ<EFBFBD>
PTZPARAM stPTZParam; // PTZ У<><D0A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
CYCLEPARAM stCycleParam; // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Բ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
float fZoom; // PTZ <20><>ʾ<EFBFBD>ķ<EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD>
float fWideScanOffset; // 180<38><30><EFBFBD><EFBFBD>360<36><30>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ƫ<EFBFBD>ƽǶ<C6BD>
int nResver[16]; // <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
}FISHEYEPARAM;
typedef void (__stdcall * FISHEYE_CallBack )( void* pUser , unsigned int nSubPort , unsigned int nCBType , void * hDC , unsigned int nWidth , unsigned int nHeight);
#endif
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_FEC_Enable(LONG nPort);
// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
PLAYM4_API BOOL __stdcall PlayM4_FEC_Disable(LONG nPort);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6> [1~31]
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetPort(LONG nPort, unsigned int* nSubPort,FECPLACETYPE emPlaceType,FECCORRECTTYPE emCorrectType);
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6>
PLAYM4_API BOOL __stdcall PlayM4_FEC_DelPort(LONG nPort , unsigned int nSubPort);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>л<EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetWnd(LONG nPort , unsigned int nSubPort , void * hWnd);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۴<EFBFBD><DBB4>ڵĻ<DAB5>ͼ<EFBFBD>ص<EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetCallBack(LONG nPort , unsigned int nSubPort , FISHEYE_CallBack cbFunc , void * pUser);
//motionflow
PLAYM4_API BOOL __stdcall PlayM4_MotionFlow(LONG nPort, DWORD dwAdjustType);
//ͼ<><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD>
#ifndef PLAYM4_HIKVIE_TAG
#define PLAYM4_HIKVIE_TAG
typedef struct _PLAYM4_VIE_DYNPARAM_
{
int moduFlag; //<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><E3B7A8><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9A3AC>PLAYM4_VIE_MODULES<45>ж<EFBFBD><D0B6><EFBFBD>
//<2F><> PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>ú󣬱<C3BA><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>
//PLAYM4_VIE_MODU_ADJ
int brightVal; //<2F><><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-255, 255]
int contrastVal; //<2F>Աȶȵ<C8B6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
int colorVal; //<2F><><EFBFBD>Ͷȵ<CDB6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
//PLAYM4_VIE_MODU_EHAN
int toneScale; //<2F>˲<EFBFBD><CBB2><EFBFBD>Χ<EFBFBD><CEA7>[0, 100]
int toneGain; //<2F>Աȶȵ<C8B6><C8B5>ڣ<EFBFBD>ȫ<EFBFBD>ֶԱȶ<D4B1><C8B6><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
int toneOffset; //<2F><><EFBFBD>ȵ<EFBFBD><C8B5>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵƫ<D6B5>ƣ<EFBFBD>[-255, 255]
int toneColor; //<2F><>ɫ<EFBFBD><C9AB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
//PLAYM4_VIE_MODU_DEHAZE
int dehazeLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
int dehazeTrans; //͸<><CDB8>ֵ<EFBFBD><D6B5>[0, 255]
int dehazeBright; //<2F><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD><EFBFBD>[0, 255]
//PLAYM4_VIE_MODU_DENOISE
int denoiseLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
//PLAYM4_VIE_MODU_SHARPEN
int usmAmount; //<2F><><EFBFBD><EFBFBD>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
int usmRadius; //<2F>񻯰뾶<F1BBAFB0><EBBEB6>[1, 15]
int usmThreshold; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[0, 255]
//PLAYM4_VIE_MODU_DEBLOCK
int deblockLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 100]
//PLAYM4_VIE_MODU_LENS
int lensWarp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255]
int lensZoom; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255]
//PLAYM4_VIE_MODU_CRB
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
} PLAYM4_VIE_PARACONFIG;
typedef enum _PLAYM4_VIE_MODULES
{
PLAYM4_VIE_MODU_ADJ = 0x00000001, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_VIE_MODU_EHAN = 0x00000002, //<2F>ֲ<EFBFBD><D6B2><EFBFBD>ǿģ<C7BF><C4A3>
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //ȥ<><C8A5>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //ȥ<><C8A5>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //ȥ<><C8A5><EFBFBD>˲<EFBFBD>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_CRB = 0x00000040, //ɫ<><C9AB>ƽ<EFBFBD><C6BD>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_LENS = 0x00000080, //<2F><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
}PLAYM4_VIE_MODULES;
#endif
//<2F><><EFBFBD>ùر<C3B9>/<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
//dwModuFlag<61><67>ӦPLAYM4_VIE_MODULES<45><53>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9BFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵIJ<CFB5><C4B2><EFBFBD>;
//<2F>ر<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>õIJ<C3B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӿڵ<D3BF><DAB5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸýӿڿ<D3BF><DABF><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>󣻷<EFBFBD><F3A3BBB7>򣬷<EFBFBD><F2A3ACB7>ش<EFBFBD><D8B4><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetModuConfig(LONG lPort,int nModuFlag,BOOL bEnable);
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULLȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>16*16<31><36><EFBFBD><EFBFBD>
//<2F><>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD>˵4<CBB5><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><E6B1BE><EFBFBD><EFBFBD>ֻ֧<D6BB><D6A7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>ͱ<EFBFBD><CDB1><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetRegion(LONG lPort,LONG lRegNum,RECT* pRect);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetModuConfig(LONG lPort,int* pdwModuFlag);
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
//δ<><CEB4><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//<2F><><EFBFBD><EFBFBD>Ƶͬ<C6B5><CDAC><EFBFBD>ӿ<EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio);
// ˽<><CBBD><EFBFBD><EFBFBD>Ϣģ<CFA2><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef enum _PLAYM4_PRIDATA_RENDER
{
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //<2F><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
PLAYM4_RENDER_MD = 0x00000002, //<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS<4F><53>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_RENDER_ADD_PIC = 0x00000008, //ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //<2F>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
PLAYM4_RENDER_TEM = 0x00000020, //<2F><EFBFBD><C2B6><EFBFBD>Ϣ
PLAYM4_RENDER_TRACK_TEM = 0x00000040, //<2F><EFBFBD><ECBCA3>Ϣ
PLAYM4_RENDER_THERMAL = 0x00000080 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
}PLAYM4_PRIDATA_RENDER;
typedef enum _PLAYM4_THERMAL_FLAG
{
PLAYM4_THERMAL_FIREMASK = 0x00000001, //<2F>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_THERMAL_RULEGAS = 0x00000002, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_THERMAL_TARGETGAS = 0x00000004 //Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}PLAYM4_THERMAL_FLAG;
typedef enum _PLAYM4_FIRE_ALARM{
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ
PLAYM4_FIRE_DISTANCE = 0x00000008, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶Ⱦ<C2B6><C8BE><EFBFBD>}PLAYM4_FIRE_ALARM
}PLAYM4_FIRE_ALARM;
typedef enum _PLAYM4_TEM_FLAG{
PLAYM4_TEM_REGION_BOX = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_TEM_REGION_LINE = 0x00000002, //<2F>߲<EFBFBD><DFB2><EFBFBD>
PLAYM4_TEM_REGION_POINT = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}PLAYM4_TEM_FLAG
}PLAYM4_TEM_FLAG;
typedef enum _PLAYM4_TRACK_FLAG
{
PLAYM4_TRACK_PEOPLE = 0x00000001, //<2F>˹켣
PLAYM4_TRACK_VEHICLE = 0x00000002, //<2F><><EFBFBD>
}PLAYM4_TRACK_FLAG;
typedef struct TI_PTZ_INFO_
{
unsigned short dwDefVer; //<2F><EFBFBD><E1B9B9><EFBFBD>
unsigned short dwLength; //PTZ_info<66><6F><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD>8<EFBFBD>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA>λ
DWORD dwP; //P<><50>0~3600<30><30>
DWORD dwT; //T<><54>0~3600<30><30>
DWORD dwZ; //Z<><5A>0~3600<30><30>
BYTE chFSMState; //<2F><><EFBFBD><EFBFBD>״̬
BYTE bClearFocusState; //<2F>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>0,1<><31>
BYTE reserved[6]; //6<><36><EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD>
}PTZ_INFO;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateData(LONG nPort, int nIntelType, BOOL bTrue);
PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateDataEx(LONG nPort, int nIntelType, int nSubType, BOOL bTrue);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>,nType=0<><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻص<CDBB><D8B5><EFBFBD>nType=1<><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
PLAYM4_API BOOL __stdcall PlayM4_SetEncryptTypeCallBack(LONG nPort, DWORD nType,
void (CALLBACK* EncryptTypeCBFun)(long nPort, ENCRYPT_INFO* pEncryptInfo, long nUser, long nReserved2), long nUser);
//lType: 1 <20><>ʾ<EFBFBD><CABE>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ʾ֡PTZ<54><5A>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><E1B9B9><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><E6B4A2>pInfo<66>ڣ<EFBFBD>plLen<65><6E><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
PLAYM4_API BOOL __stdcall PlayM4_GetStreamAdditionalInfo(LONG nPort, LONG lType, BYTE* pInfo, LONG* plLen);
#endif //_PLAYM4_H_

View File

@@ -0,0 +1,111 @@
#ifndef DATA_TYPE_H
#define DATA_TYPE_H
#define FRAME_HEAD_MAGIC 0x03211546
#define SYSTEM_SYNC_ID 2
#ifdef __LINUX__
typedef unsigned char UCHAR;
typedef unsigned char* PBYTE;
typedef char* LPTSTR;
typedef unsigned short USHORT;
typedef int HANDLE;
typedef unsigned long ULONG;
typedef unsigned long DWORD;
#endif //#ifdef __LINUX__
typedef struct tagFrameInfo{
ULONG SyncId; /* 00000000000000000000000000010b */
ULONG Magic;
USHORT FrameType; /* I frames , P frames or BBP frames Audio frames or dsp status etc */
ULONG Length; /*lenth include this header */
ULONG FrameNumber; /* serial number of this frame */
UCHAR Breakable; /* indicate if stream breakable, you could restart new file(with PktSysHeader) if true */
/*ULONG Ack;*/
ULONG PTS; /* system clock when this frames is processed */
}TMFRAME_HEADER, *PTMFRAME_HEADER;
typedef enum {
StandardNone = 0x80000000,
StandardNTSC = 0x00000001,
StandardPAL = 0x00000002,
StandardSECAM = 0x00000004,
} VideoStandard_t;
typedef enum {
PktError = 0,
PktIFrames = 0x0001,
PktPFrames = 0x0002,
PktBBPFrames = 0x0004,
PktAudioFrames = 0x0008,
PktMotionDetection = 0x00010,
PktDspStatus = 0x00020,
PktOrigImage = 0x00040,
PktSysHeader = 0x00080,
PktBPFrames = 0x00100,
PktSFrames = 0x00200,
PktSubIFrames = 0x00400,
PktSubPFrames = 0x00800,
PktSubBBPFrames = 0x01000,
PktSubSysHeader = 0x02000
}FrameType_t;
typedef struct tagVersion{
ULONG DspVersion, DspBuildNum;
ULONG DriverVersion, DriverBuildNum;
ULONG SDKVersion, SDKBuildNum;
}VERSION_INFO, *PVERSION_INFO;
typedef enum {
ENC_CIF_FORMAT = 0,
ENC_QCIF_FORMAT = 1,
ENC_2CIF_FORMAT = 2,
ENC_4CIF_FORMAT = 3,
ENC_QQCIF_FORMAT = 4,
ENC_CIFQCIF_FORMAT =5,
ENC_CIFQQCIF_FORMAT =6,
ENC_DCIF_FORMAT =7,
ENC_VGA_FORMAT=8
}PictureFormat_t;
typedef struct tagMotionData{
PictureFormat_t PicFormat;
ULONG HorizeBlocks;
ULONG VerticalBlocks;
ULONG BlockSize;
}MOTION_DATA_HEADER, *PMOTION_DATA_HEADER;
#define _OSD_BASE 0x9000 /*base address of special character*/
#define _OSD_YEAR4 (_OSD_BASE+0) /*show year time by length of 4 , for example: 2005*/
#define _OSD_YEAR2 (_OSD_BASE+1) /*show year time by length of 2, for example: 05 */
#define _OSD_MONTH3 (_OSD_BASE+2) /*show month time in English, for example: Jan*/
#define _OSD_MONTH2 (_OSD_BASE+3) /*show month time by two Arabic numerals, for example: 07*/
#define _OSD_DAY (_OSD_BASE+4) /*show day time by two Arabic numerals, for example: 31*/
#define _OSD_WEEK3 (_OSD_BASE+5) /*show week time in English: MON<4F><4E>SUN*/
#define _OSD_CWEEK1 (_OSD_BASE+6) /*show week time in Chinese GB code*/
#define _OSD_HOUR24 (_OSD_BASE+7) /*show 24 hours clock: 00<30><30>23 */
#define _OSD_HOUR12 (_OSD_BASE+8) /*show 12 hours clock: 00<30><30>12*/
#define _OSD_MINUTE (_OSD_BASE+9) /*show minute time by length of 2: 00<30><30>59*/
#define _OSD_SECOND (_OSD_BASE+10) /*show second time by length of 2: 00<30><30>59*/
#define _OSD_MILISECOND (_OSD_BASE+11) /*show millisecond time by length of 3: 000~999*/
#define _OSD_APM (_OSD_BASE+14) /*show a.m. or p.m. by length of 2 bit, AM or PM*/
//For new added APIs to set OSD: SetEncoderOsdDisplayMode, SetDecoderOsdDisplayMode and SetDisplayOsdDisplayMode in v6.0 SDK, we use new basic address of special character.
#define _OSD_BASE_EX 0x90000 /*base address of special character*/
#define _OSD_YEAR4_EX (_OSD_BASE_EX+0) /*the same as _OSD_YEAR4*/
#define _OSD_YEAR2_EX (_OSD_BASE_EX+1) /*the same as _OSD_YEAR2*/
#define _OSD_MONTH3_EX (_OSD_BASE_EX+2) /*the same as _OSD_MONTH3*/
#define _OSD_MONTH2_EX (_OSD_BASE_EX+3) /*the same as _OSD_MONTH2*/
#define _OSD_DAY_EX (_OSD_BASE_EX+4) /*the same as _OSD_DAY*/
#define _OSD_WEEK3_EX (_OSD_BASE_EX+5) /*the same as _OSD_WEEK3*/
#define _OSD_CWEEK1_EX (_OSD_BASE_EX+6) /*the same as _OSD_CWEEK1*/
#define _OSD_HOUR24_EX (_OSD_BASE_EX+7) /*the same as _OSD_HOUR24*/
#define _OSD_HOUR12_EX (_OSD_BASE_EX+8) /*the same as _OSD_HOUR12*/
#define _OSD_MINUTE_EX (_OSD_BASE_EX+9) /*the same as _OSD_MINUTE*/
#define _OSD_SECOND_EX (_OSD_BASE_EX+10) /*the same as _OSD_SECOND*/
#define _OSD_MILISECOND_EX (_OSD_BASE_EX+11) /*the same as _OSD_MILISECOND*/
#define _OSD_APM_EX (_OSD_BASE_EX+14) /*the same as _OSD_APM*/
#endif

View File

@@ -0,0 +1,451 @@
///////////////////////////////////////////////////////////////////////////
// DS-40xxHC/HF BOARD SYSTEM SDK //
///////////////////////////////////////////////////////////////////////////
#ifndef DECODECARD_SDK_H
#define DECODECARD_SDK_H
#include "datatype.h"
#define DLLEXPORT_API extern "C" __declspec(dllexport)
#define ERR_WAIT_TIMEOUT 0xc0000001
#define ERR_INVALID_HANDLE 0xc0000002
#define ERR_INVALID_ARGUMENT 0xc0000003
#define ERR_DDRAW_CREATE_FAILED 0xc0000004
#define ERR_DDRAW_CAPS_FAULT 0xc0000005
#define ERR_SET_COOPERATIVELEVEL_FAILED 0xc0000006
#define ERR_PRIMARY_SURFACE_CREATE_FAILED 0xc0000007
#define ERR_GET_OVERLAY_ADDRESS_FAILED 0xc0000008
#define ERR_OVERLAY_SURFACE_CREATE_FAILED 0xc0000009
#define ERR_OVERLAY_UPDATE_FAILED 0xc000000a
#define ERR_TMMAN_FAILURE 0xc000000b
#define ERR_CHANNELMAGIC_MISMATCH 0xc000000c
#define ERR_CALLBACK_REGISTERED 0xc000000d
#define ERR_QUEUE_OVERFLOW 0xc000000e
#define ERR_STREAM_THREAD_FAILURE 0xc000000f
#define ERR_THREAD_STOP_ERROR 0xc0000010
#define ERR_NOT_SUPPORT 0xc0000011
#define ERR_OUTOF_MEMORY 0xc0000012
#define ERR_DSP_BUSY 0xc0000013
#define ERR_DATA_ERROR 0xc0000014
#define ERR_KERNEL 0xc0000016
#define ERR_OFFSCREEN_CREATE_FAILED 0xc0000017
#define ERR_MULTICLOCK_FAILURE 0xc0000018
#define ERR_INVALID_DEVICE 0xc0000019
#define ERR_INVALID_DRIVER 0xc000001a
//error code for MD card
#define HWERR_SUCCESS 0
#define HWERR_ALLOCATE_MEMORY 0xc1000001
#define HWERR_INVALID_HANDLE 0xc1000002
#define HWERR_DDRAW_CREATE_FAILED 0xc1000003
#define HWERR_DDRAW_CAPS_FAULT 0xc1000004
#define HWERR_SET_COOPERATIVELEVEL_FAILED 0xc1000005
#define HWERR_PRIMARY_SURFACE_CREATE_FAILED 0xc1000006
#define HWERR_OVERLAY_CREATE_FAILED 0xc1000007
#define HWERR_GET_OVERLAY_ADDRESS_FAILED 0xc1000008
#define HWERR_OVERLAY_UPDATE_FAILED 0xc1000009
#define HWERR_SURFACE_NULL 0xc100000a
#define HWERR_FILEHEADER_UNKNOWN 0xc100000b
#define HWERR_CREATE_FILE_FAILED 0xc100000c
#define HWERR_FILE_SIZE_ZERO 0xc100000d
#define HWERR_FILE_SIZE_INVALID 0xc100000d
#define HWERR_CREATE_OBJ_FAILED 0xc100000e
#define HWERR_CHANNELMAGIC_MISMATCH 0xc100000f
#define HWERR_PARA_OVER 0xc1000010
#define HWERR_ORDER 0xc1000011
#define HWERR_COMMAND 0xc1000012
#define HWERR_UNSUPPORTED 0xc1000013
#define HWERR_DSPOPEN 0xc1000014
#define HWERR_DSPLOAD 0xc1000015
#define HWERR_ALLOCATE_DSPMEMORY 0xc1000016
#define HWERR_DSPCHECHER 0xc1000017
#define HWERR_IMGFILE_UNKNOWN 0xc1000018
#define HWERR_INVALID_FILE 0xc1000019
//standart
#define HW_PAL 2
#define HW_NTSC 1
//jump direction
#define HW_JUMP_FORWARD 309
#define HW_JUMP_BACKWARD 310
typedef enum tagTypeVideoFormat
{
vdfRGB8A_233 = 0x00000001,
vdfRGB8R_332 = 0x00000002,
vdfRGB15Alpha = 0x00000004,
vdfRGB16 = 0x00000008,
vdfRGB24 = 0x00000010,
vdfRGB24Alpha = 0x00000020,
vdfYUV420Planar = 0x00000040,
vdfYUV422Planar = 0x00000080,
vdfYUV411Planar = 0x00000100,
vdfYUV420Interspersed = 0x00000200,
vdfYUV422Interspersed = 0x00000400,
vdfYUV411Interspersed = 0x00000800,
vdfYUV422Sequence = 0x00001000, /* U0, Y0, V0, Y1: For VO overlay */
vdfYUV422SequenceAlpha = 0x00002000,
/* U0, Y0, V0, Y1: For VO overlay, with low bit for alpha blending */
vdfMono = 0x00004000, /* 8 bit monochrome */
vdfYUV444Planar = 0x00008000,
}TypeVideoFormat;
typedef enum _BitrateControlType_t
{
brCBR = 0,
brVBR = 1,
}BitrateControlType_t;
typedef enum _BOARD_TYPE_DS
{
DS400XM =0,
DS400XH =1,
DS4004HC =2,
DS4008HC =3,
DS4016HC =4,
DS4001HF =5,
DS4004HF =6,
DS4002MD =7,
DS4004MD =8, //4004MD
DS4016HCS =9, //4016HCS
DS4002HT =10, //4002HT
DS4004HT =11, //4004HT
DS4008HT =12, //4008HT
DS4004HC_PLUS =13, //4004HC+
DS4008HC_PLUS =14, //4008HC+
DS4016HC_PLUS =15, //4016HC+
DS4008HF =16, //4008HF
DS4008MD =17, //4008MD
DS4008HS =18, //4008HS
DS4016HS =19, //4016HS
INVALID_BOARD_TYPE =0xffffffff,
}BOARD_TYPE_DS;
#define STREAM_TYPE_VIDEO 1
#define STREAM_TYPE_AUDIO 2
#define STREAM_TYPE_AVSYNC 3
#define DRAWFUN(x) void (CALLBACK* x)(long nPort,HDC hDc,LONG nUser)
typedef void (*LOGRECORD_CALLBACK)(char *str, void *context);
typedef int (*STREAM_READ_CALLBACK)(ULONG channelNumber, void *context);
typedef int (*STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber,void *DataBuf,DWORD Length,int FrameType,void *context);
typedef struct tagChannelCapability{
UCHAR bAudioPreview;
UCHAR bAlarmIO;
UCHAR bWatchDog;
}CHANNEL_CAPABILITY, *PCHANNEL_CAPABILITY;
typedef struct tagFramsStatistics{
ULONG VideoFrames;
ULONG AudioFrames;
ULONG FramesLost;
ULONG QueueOverflow;
ULONG CurBps;
}FRAMES_STATISTICS, *PFRAMES_STATISTICS;
DLLEXPORT_API int __stdcall InitDSPs();
DLLEXPORT_API int __stdcall DeInitDSPs();
DLLEXPORT_API HANDLE __stdcall ChannelOpen(int ChannelNum);
DLLEXPORT_API int __stdcall ChannelClose(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetTotalChannels();
DLLEXPORT_API int __stdcall GetTotalDSPs();
DLLEXPORT_API int __stdcall StartVideoPreview(HANDLE hChannelHandle,HWND WndHandle, RECT *rect, BOOLEAN bOverlay, int VideoFormat, int FrameRate);
DLLEXPORT_API int __stdcall StopVideoPreview(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetVideoPara(HANDLE hChannelHandle, int Brightness, int Contrast, int Saturation, int Hue);
DLLEXPORT_API int __stdcall GetVideoPara(HANDLE hChannelHandle, VideoStandard_t *VideoStandard, int *Brightness, int *Contrast, int *Saturation, int *Hue);
DLLEXPORT_API int __stdcall GetVideoSignal(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetSDKVersion(PVERSION_INFO VersionInfo);
DLLEXPORT_API int __stdcall GetCapability(HANDLE hChannelHandle, CHANNEL_CAPABILITY *Capability);
DLLEXPORT_API int __stdcall GetLastErrorNum(HANDLE hChannelHandle, ULONG *DspError, ULONG *SdkError);
DLLEXPORT_API int __stdcall SetStreamType(HANDLE hChannelHandle, USHORT Type);
DLLEXPORT_API int __stdcall GetStreamType(HANDLE hChannelHandle, USHORT *StreamType);
DLLEXPORT_API int __stdcall GetFramesStatistics(HANDLE hChannelHandle, PFRAMES_STATISTICS framesStatistics);
DLLEXPORT_API int __stdcall StartMotionDetection(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetBoardInfo(HANDLE hChannelHandle, ULONG *BoardType, UCHAR *SerialNo);
DLLEXPORT_API int __stdcall StopMotionDetection(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetOriginalImage(HANDLE hChannelHandle, UCHAR *ImageBuf, ULONG *Size);
DLLEXPORT_API int __stdcall RegisterLogRecordCallback(LOGRECORD_CALLBACK LogRecordFunc, void *Context);
DLLEXPORT_API int __stdcall SetAudioPreview(HANDLE hChannelHandle, BOOL bEnable);
DLLEXPORT_API int __stdcall ReadStreamData(HANDLE hChannelHandle, void *DataBuf, DWORD *Length, int *FrameType);
DLLEXPORT_API int __stdcall RegisterMessageNotifyHandle(HWND hWnd, UINT MessageId);
DLLEXPORT_API int __stdcall StartVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall StopVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetIBPMode(HANDLE hChannelHandle, int KeyFrameIntervals, int BFrames, int PFrames, int FrameRate);
DLLEXPORT_API int __stdcall SetDefaultQuant(HANDLE hChannelHandle, int IQuantVal, int PQuantVal, int BQuantVal);
DLLEXPORT_API int __stdcall SetOsd(HANDLE hChannelHandle, BOOL Enable);
DLLEXPORT_API int __stdcall SetLogo(HANDLE hChannelHandle, int x, int y, int w, int h, unsigned char *yuv);
DLLEXPORT_API int __stdcall StopLogo(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetupMotionDetection(HANDLE hChannelHandle, RECT *RectList, int iAreas);
DLLEXPORT_API int __stdcall MotionAnalyzer(HANDLE hChannelHandle, char *MotionData, int iThreshold, int *iResult);
DLLEXPORT_API int __stdcall LoadYUVFromBmpFile(char *FileName, unsigned char *yuv, int BufLen, int *Width, int *Height);
DLLEXPORT_API int __stdcall SaveYUVToBmpFile(char *FileName, unsigned char *yuv, int Width, int Height);
DLLEXPORT_API int __stdcall CaptureIFrame(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall RegisterStreamReadCallback(STREAM_READ_CALLBACK StreamReadCallback, void *Context);
DLLEXPORT_API int __stdcall AdjustMotionDetectPrecision(HANDLE hChannelHandle,
int iGrade, int iFastMotionDetectFps,
int iSlowMotionDetectFps);
DLLEXPORT_API int __stdcall SetupBitrateControl(HANDLE hChannelHandle, ULONG MaxBps);
DLLEXPORT_API int __stdcall SetOverlayColorKey(COLORREF DestColorKey);
DLLEXPORT_API int __stdcall SetOsdDisplayMode(HANDLE hChannelHandle, int Brightness, BOOL Translucent, int parameter, USHORT *Format1, USHORT *Format2);
DLLEXPORT_API int __stdcall SetLogoDisplayMode(HANDLE hChannelHandle, COLORREF ColorKey, BOOL Translucent, int TwinkleInterval);
DLLEXPORT_API int __stdcall SetEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat);
DLLEXPORT_API int __stdcall SetVideoStandard(HANDLE hChannelHandle, VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall RestoreOverlay();
DLLEXPORT_API int __stdcall ResetDSP(int DspNumber);
DLLEXPORT_API int __stdcall GetSoundLevel(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetBitrateControlMode(HANDLE hChannelHandle, BitrateControlType_t brc);
DLLEXPORT_API int __stdcall SetupNotifyThreshold(HANDLE hChannelHandle, int iFramesThreshold);
DLLEXPORT_API int __stdcall SetupSubChannel(HANDLE hChannelHandle, int iSubChannel);
DLLEXPORT_API int __stdcall GetSubChannelStreamType(void *DataBuf, int FrameType);
//add for HC/HF
DLLEXPORT_API int __stdcall RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback,void *Context);
DLLEXPORT_API int __stdcall RegisterDrawFun(DWORD nport, DRAWFUN(DrawFun),LONG nUser);
DLLEXPORT_API int __stdcall SetupMask(HANDLE hChannelHandle, RECT *rectList, int iAreas);
DLLEXPORT_API int __stdcall StopMask(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetSubEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat);
DLLEXPORT_API int __stdcall StartSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall StopSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetupDateTime(HANDLE hChannelHandle, SYSTEMTIME *now);
/*
<20><><EFBFBD><EFBFBD>Ϊ1.7<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD>ܡ<EFBFBD>
<20>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĺ<DEB8><C4BA><EFBFBD><EFBFBD>ơ<EFBFBD>
*/
//ԭʼͼ<CABC><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef void (*IMAGE_STREAM_CALLBACK)(UINT channelNumber,void *context );
DLLEXPORT_API int __stdcall SetImageStream(HANDLE hChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer);
DLLEXPORT_API int __stdcall RegisterImageStreamCallback(IMAGE_STREAM_CALLBACK,void *context);
/*
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD>
(x,y)Ϊϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD><CFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼͼ<CABC><CDBC><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>
x<><78><EFBFBD><EFBFBD>Ϊ2<CEAA><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(x,y)<29><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA>йأ<D0B9><D8A3><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻ƥ<EBB2BB>
<20><><EFBFBD>ܻᵼ<DCBB><E1B5BC>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
DLLEXPORT_API int __stdcall SetInputVideoPosition(HANDLE hChannel,UINT x,UINT y);
DLLEXPORT_API int __stdcall StopRegisterDrawFun(DWORD nport);
/*
3.0
*/
#define SERIAL_NUMBER_LENGTH 12 //<2F><EFBFBD><E5BFA8><EFBFBD>кų<D0BA><C5B3><EFBFBD>
typedef struct tagDS_BOARD_DETAIL
{
BOARD_TYPE_DS type; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD>
BYTE sn[16]; //<2F><><EFBFBD>к<EFBFBD>
UINT dspCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DSP<53><50><EFBFBD><EFBFBD>
UINT firstDspIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB>DSP<53><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT encodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstEncodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT decodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDecodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT displayChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDisplayChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DS_BOARD_DETAIL;
typedef struct tagDSP_DETAIL
{
UINT encodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstEncodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT decodeChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDecodeChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT displayChannelCount; //<2F><EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT firstDisplayChannelIndex; //<2F><EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DSP_DETAIL;
DLLEXPORT_API unsigned int __stdcall GetBoardCount();
DLLEXPORT_API int __stdcall GetBoardDetail(UINT boardNum,DS_BOARD_DETAIL *pBoardDetail);
DLLEXPORT_API unsigned int __stdcall GetDspCount();
DLLEXPORT_API int __stdcall GetDspDetail(UINT dspNum,DSP_DETAIL *pDspDetail);
DLLEXPORT_API unsigned int __stdcall GetEncodeChannelCount();
DLLEXPORT_API unsigned int __stdcall GetDecodeChannelCount();
DLLEXPORT_API unsigned int __stdcall GetDisplayChannelCount();
DLLEXPORT_API int __stdcall SetDefaultVideoStandard(VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall SetVideoDetectPrecision(HANDLE hChannel,unsigned int value);
DLLEXPORT_API int __stdcall SetSubStreamType(HANDLE hChannelHandle, USHORT Type);
DLLEXPORT_API int __stdcall GetSubStreamType(HANDLE hChannelHandle, USHORT *StreamType);
#define MAX_DISPLAY_REGION 16
typedef struct tagREGION_PARAM
{
UINT left;
UINT top;
UINT width;
UINT height;
COLORREF color;
UINT param;
}REGION_PARAM;
DLLEXPORT_API int __stdcall SetDisplayStandard(UINT nDisplayChannel,VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall SetDisplayRegion(UINT nDisplayChannel,UINT nRegionCount,REGION_PARAM *pParam,UINT nReserved);
DLLEXPORT_API int __stdcall ClearDisplayRegion(UINT nDisplayChannel,UINT nRegionFlag);
DLLEXPORT_API int __stdcall SetDisplayRegionPosition(UINT nDisplayChannel,UINT nRegion,UINT nLeft,UINT nTop);
DLLEXPORT_API int __stdcall FillDisplayRegion(UINT nDisplayChannel,UINT nRegion,unsigned char *pImage);
DLLEXPORT_API int __stdcall SetEncoderVideoExtOutput(UINT nEncodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderVideoExtOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderVideoOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderAudioOutput(UINT nDecodeChannel,BOOL bOpen,UINT nOutputChannel);
//3.1
DLLEXPORT_API int __stdcall SetDeInterlace(HANDLE hChannelHandle,UINT mode,UINT level);
DLLEXPORT_API int __stdcall SetPreviewOverlayMode(BOOL bTrue);
//DECODE functions for DS4002MD
#if defined( _WINDLL)
#define PLAYER_API extern "C"__declspec(dllexport)
#else
#define PLAYER_API extern "C" __declspec(dllimport)
#endif
typedef struct tagDISPLAY_PARA
{
long bToScreen;
long bToVideoOut;
long nLeft;
long nTop;
long nWidth;
long nHeight;
long nReserved;
}DISPLAY_PARA,*PDISPLAY_PARA;
//Version info
typedef struct tagVERSION{
ULONG DspVersion, DspBuildNum;
ULONG DriverVersion, DriverBuildNum;
ULONG SDKVersion, SDKBuildNum;
}HW_VERSION, *PHW_VERSION;
//init part
PLAYER_API int __stdcall HW_InitDirectDraw(HWND hParent,COLORREF colorKey);
PLAYER_API int __stdcall HW_ReleaseDirectDraw();
PLAYER_API int __stdcall HW_InitDecDevice(long *pDeviceTotal);
PLAYER_API int __stdcall HW_ReleaseDecDevice();
PLAYER_API int __stdcall HW_ChannelOpen(long nChannelNum,HANDLE* phChannel);
PLAYER_API int __stdcall HW_ChannelClose(HANDLE hChannel);
//open part
PLAYER_API int __stdcall HW_OpenStream(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize);
DLLEXPORT_API int __stdcall HW_ResetStream(HANDLE hChannel);
PLAYER_API int __stdcall HW_CloseStream(HANDLE hChannel);
PLAYER_API int __stdcall HW_InputData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
PLAYER_API int __stdcall HW_OpenFile(HANDLE hChannel,LPTSTR sFileName);
PLAYER_API int __stdcall HW_CloseFile(HANDLE hChannel);
//play part
PLAYER_API int __stdcall HW_SetDisplayPara(HANDLE hChannel,DISPLAY_PARA *pPara);
PLAYER_API int __stdcall HW_Play(HANDLE hChannel);
PLAYER_API int __stdcall HW_Stop(HANDLE hChannel);
PLAYER_API int __stdcall HW_Pause(HANDLE hChannel,ULONG bPause);
//sound part
PLAYER_API int __stdcall HW_PlaySound(HANDLE hChannel);
PLAYER_API int __stdcall HW_StopSound(HANDLE hChannel);
PLAYER_API int __stdcall HW_SetVolume(HANDLE hChannel,ULONG nVolume);
//overlay part
PLAYER_API int __stdcall HW_RefreshSurface();
PLAYER_API int __stdcall HW_RestoreSurface();
PLAYER_API int __stdcall HW_ClearSurface();
PLAYER_API int __stdcall HW_ZoomOverlay(RECT* pSrcClientRect, RECT* pDecScreenRect);
//cut file
PLAYER_API int __stdcall HW_StartCapFile(HANDLE hChannel,LPTSTR sFileName);
PLAYER_API int __stdcall HW_StopCapFile(HANDLE hChannel);
//capture picture
PLAYER_API int __stdcall HW_GetYV12Image(HANDLE hChannel, PBYTE pBuffer, ULONG nSize);
PLAYER_API int __stdcall HW_GetPictureSize(HANDLE hChannel,ULONG* pWidth, ULONG* pHeight);
PLAYER_API int __stdcall HW_ConvertToBmpFile(BYTE * pBuf,ULONG nSize,ULONG nWidth,ULONG nHeight,char *sFileName,ULONG nReserved);
//setting and getting part
PLAYER_API int __stdcall HW_Jump(HANDLE hChannel,ULONG nDirection);
PLAYER_API int __stdcall HW_SetJumpInterval(HANDLE hChannel,ULONG nSecond);
PLAYER_API int __stdcall HW_GetSpeed(HANDLE hChannel,long *pSpeed);
PLAYER_API int __stdcall HW_SetSpeed(HANDLE hChannel,long nSpeed);
PLAYER_API int __stdcall HW_SetPlayPos(HANDLE hChannel,ULONG nPos);
PLAYER_API int __stdcall HW_GetPlayPos(HANDLE hChannel,ULONG* pPos);
PLAYER_API int __stdcall HW_GetVersion(PHW_VERSION pVersion);
PLAYER_API int __stdcall HW_GetCurrentFrameRate(HANDLE hChannel,ULONG* pFrameRate);
PLAYER_API int __stdcall HW_GetCurrentFrameNum(HANDLE hChannel,ULONG* pFrameNum);
PLAYER_API int __stdcall HW_GetFileTotalFrames(HANDLE hChannel,ULONG* pTotalFrames);
PLAYER_API int __stdcall HW_GetFileTime(HANDLE hChannel, ULONG* pFileTime);
PLAYER_API int __stdcall HW_GetCurrentFrameTime(HANDLE hChannel,ULONG* pFrameTime);
PLAYER_API int __stdcall HW_GetPlayedFrames(HANDLE hChannel,ULONG *pDecVFrames);
PLAYER_API int __stdcall HW_GetDeviceSerialNo(HANDLE hChannel,ULONG *pDeviceSerialNo);
PLAYER_API int __stdcall HW_SetFileEndMsg(HANDLE hChannel,HWND hWnd,UINT nMsg);
PLAYER_API int __stdcall HW_SetStreamOpenMode(HANDLE hChannel,ULONG nMode);
PLAYER_API int __stdcall HW_GetStreamOpenMode(HANDLE hChannel,ULONG *pMode);
PLAYER_API int __stdcall HW_SetVideoOutStandard(HANDLE hChannel,ULONG nStandard);
PLAYER_API int __stdcall HW_SetDspDeadlockMsg(HWND hWnd,UINT nMsg);
PLAYER_API int __stdcall HW_GetChannelNum(long nDspNum,long *pChannelNum,ULONG nNumsToGet,ULONG * pNumsGotten);
PLAYER_API int __stdcall HW_ResetDsp(long nDspNum);
PLAYER_API int __stdcall HW_SetAudioPreview(HANDLE hChannel, BOOL bEnable);
//////////////////////////////////////////////
PLAYER_API int __stdcall HW_OpenStreamEx(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize);
PLAYER_API int __stdcall HW_CloseStreamEx(HANDLE hChannel);
PLAYER_API int __stdcall HW_InputVideoData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
PLAYER_API int __stdcall HW_InputAudioData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
//4.0
PLAYER_API int __stdcall SetOsdDisplayModeEx(HANDLE hChannelHandle,int color,BOOL Translucent,int param,int nLineCount,USHORT **Format);
typedef void (*MOTION_DETECTION_CALLBACK)(ULONG channelNumber,BOOL bMotionDetected,void *context);
PLAYER_API int __stdcall SetupMotionDetectionEx(HANDLE hChannelHandle,int iGrade,int iFastMotionDetectFps,
int iSlowMotionDetectFps,UINT delay,RECT *RectList, int iAreas,
MOTION_DETECTION_CALLBACK MotionDetectionCallback,int reserved);
PLAYER_API int __stdcall GetJpegImage(HANDLE hChannelHandle,UCHAR *ImageBuf,ULONG *Size,UINT nQuality);
//WatchDog
PLAYER_API int __stdcall SetWatchDog(UINT boardNumber,BOOL bEnable);
//4.1
typedef void (*FILE_REF_DONE_CALLBACK)(UINT nChannel,UINT nSize);
PLAYER_API int __stdcall HW_SetFileRef(HANDLE hChannel,BOOL bEnable,FILE_REF_DONE_CALLBACK FileRefDoneCallback);
PLAYER_API int __stdcall HW_LocateByAbsoluteTime(HANDLE hChannel,SYSTEMTIME time);
PLAYER_API int __stdcall HW_LocateByFrameNumber(HANDLE hChannel,UINT frmNum);
PLAYER_API int __stdcall HW_GetCurrentAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pTime);
PLAYER_API int __stdcall HW_GetFileAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pStartTime,SYSTEMTIME *pEndTime);
//4.2
DLLEXPORT_API int __stdcall HW_ImportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize);
DLLEXPORT_API int __stdcall HW_ExportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize);
DLLEXPORT_API int __stdcall SetDisplayVideoCapture(UINT nDisplayChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer);
DLLEXPORT_API int __stdcall RegisterDisplayVideoCaptureCallback(IMAGE_STREAM_CALLBACK DisplayVideoCaptureCallback,void *context);
DLLEXPORT_API int __stdcall SetDisplayVideoBrightness(UINT chan,int Brightness);
DLLEXPORT_API int __stdcall SetChannelStreamCRC(HANDLE hChannel,BOOL bEnable);
DLLEXPORT_API int __stdcall SetSubChannelStreamCRC(HANDLE hChannel,BOOL bEnable);
DLLEXPORT_API int __stdcall HW_SetDecoderPostProcess(HANDLE hChannel,UINT param);
//
typedef void (*DECODER_VIDEO_CAPTURE_CALLBACK)(UINT nChannelNumber,void *DataBuf,UINT width,UINT height,UINT nFrameNum,UINT nFrameTime,SYSTEMTIME *pFrameAbsoluteTime,void *context);
DLLEXPORT_API int __stdcall RegisterDecoderVideoCaptureCallback(DECODER_VIDEO_CAPTURE_CALLBACK DecoderVideoCaptureCallback,void *context);
DLLEXPORT_API int __stdcall HW_SetDecoderVideoCapture(HANDLE hChannel,BOOL bStart,UINT param);
DLLEXPORT_API int __stdcall HW_InputDataByFrame(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
/*
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD>޸ġ<DEB8>
*/
typedef struct
{
short x,y,width,height;
}FACE_AREA_DEMO;
typedef struct
{
FACE_AREA_DEMO faceArea;
FACE_AREA_DEMO leftEyeArea;
FACE_AREA_DEMO rightEyeArea;
FACE_AREA_DEMO leftPupilArea;
FACE_AREA_DEMO rightPupilArea;
FACE_AREA_DEMO noseArea;
FACE_AREA_DEMO mouthArea;
}FACE_INFO_DEMO;
typedef void (*FACE_DETECTION_DEMO_CALLBACK)(UINT nChannel,UINT nFaceCount,FACE_INFO_DEMO *pFaceInfo,
char *pData,UINT nDataSize,UINT nImageWidth,UINT nImageHeight);
DLLEXPORT_API int __stdcall SetFaceDetectionDemo(HANDLE hChannelHandle,BOOL bEnable,
UINT nFrameInterval,FACE_DETECTION_DEMO_CALLBACK pFunc,
BOOL bCompress,UINT nCompressQuality,BOOL bLocateEyePos);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,955 @@
#ifndef __LINUX_PLAYM4_H__
#define __LINUX_PLAYM4_H__
#ifdef __cplusplus
extern "C"
{
#endif
typedef unsigned int PLAYM4_HWND;
typedef void * PLAYM4_HWNDEX;
typedef void * PLAYM4_HDC;
#define PLAYM4_API
#define __stdcall
#ifndef CALLBACK
#define CALLBACK
#endif
//Max channel numbers
#define PLAYM4_MAX_SUPPORTS 500
//Wave coef range;
#define MIN_WAVE_COEF -100
#define MAX_WAVE_COEF 100
//Timer type
#define TIMER_1 1 //Only 16 timers for every process.Default TIMER;
#define TIMER_2 2 //Not limit;But the precision less than TIMER_1;
//BUFFER AND DATA TYPE
#define BUF_VIDEO_SRC (1) //mixed input,total src buffer size;splited input,video src buffer size
#define BUF_AUDIO_SRC (2) //mixed input,not defined;splited input,audio src buffer size
#define BUF_VIDEO_RENDER (3) //video render node count or node cout for decoded data
#define BUF_AUDIO_RENDER (4) //audio render node count
#define BUF_VIDEO_DECODED (5) //video decoded node count to render
#define BUF_AUDIO_DECODED (6) //audio decoded node count to render
//Error code
#define PLAYM4_NOERROR 0 //no error
#define PLAYM4_PARA_OVER 1 //input parameter is invalid;
#define PLAYM4_ORDER_ERROR 2 //The order of the function to be called is error.
#define PLAYM4_TIMER_ERROR 3 //Create multimedia clock failed;
#define PLAYM4_DEC_VIDEO_ERROR 4 //Decode video data failed.
#define PLAYM4_DEC_AUDIO_ERROR 5 //Decode audio data failed.
#define PLAYM4_ALLOC_MEMORY_ERROR 6 //Allocate memory failed.
#define PLAYM4_OPEN_FILE_ERROR 7 //Open the file failed.
#define PLAYM4_CREATE_OBJ_ERROR 8 //Create thread or event failed
//#define PLAYM4_CREATE_DDRAW_ERROR 9 //Create DirectDraw object failed.
//#define PLAYM4_CREATE_OFFSCREEN_ERROR 10 //failed when creating off-screen surface.
#define PLAYM4_BUF_OVER 11 //buffer is overflow
#define PLAYM4_CREATE_SOUND_ERROR 12 //failed when creating audio device.
#define PLAYM4_SET_VOLUME_ERROR 13 //Set volume failed
#define PLAYM4_SUPPORT_FILE_ONLY 14 //The function only support play file.
#define PLAYM4_SUPPORT_STREAM_ONLY 15 //The function only support play stream.
#define PLAYM4_SYS_NOT_SUPPORT 16 //System not support.
#define PLAYM4_FILEHEADER_UNKNOWN 17 //No file header.
#define PLAYM4_VERSION_INCORRECT 18 //The version of decoder and encoder is not adapted.
#define PLAYM4_INIT_DECODER_ERROR 19 //Initialize decoder failed.
#define PLAYM4_CHECK_FILE_ERROR 20 //The file data is unknown.
#define PLAYM4_INIT_TIMER_ERROR 21 //Initialize multimedia clock failed.
#define PLAYM4_BLT_ERROR 22 //Display failed.
//#define PLAYM4_UPDATE_ERROR 23 //Update failed.
#define PLAYM4_OPEN_FILE_ERROR_MULTI 24 //openfile error, streamtype is multi
#define PLAYM4_OPEN_FILE_ERROR_VIDEO 25 //openfile error, streamtype is video
#define PLAYM4_JPEG_COMPRESS_ERROR 26 //JPEG compress error
#define PLAYM4_EXTRACT_NOT_SUPPORT 27 //Don't support the version of this file.
#define PLAYM4_EXTRACT_DATA_ERROR 28 //extract video data failed.
#define PLAYM4_SECRET_KEY_ERROR 29 //Secret key is error //add 20071218
#define PLAYM4_DECODE_KEYFRAME_ERROR 30 //add by hy 20090318
#define PLAYM4_NEED_MORE_DATA 31 //add by hy 20100617
#define PLAYM4_INVALID_PORT 32 //add by cj 20100913
#define PLAYM4_NOT_FIND 33 //add by cj 20110428
#define PLAYM4_NEED_LARGER_BUFFER 34 //add by pzj 20130528
#define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown;
//<2F><><EFBFBD>۹<EFBFBD><DBB9>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
#define PLAYM4_FEC_ERR_NOTENABLE 101 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // <20>Ӷ˿<D3B6>û<EFBFBD>з<EFBFBD><D0B7><EFBFBD>
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // û<>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ӧ<EFBFBD>˿ڵIJ<DAB5><C4B2><EFBFBD>
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // <20>Ӷ˿<D3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // <20>ð<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>
#define PLAYM4_FEC_ERR_INVALIDWND 106 // <20>Ƿ<EFBFBD><C7B7>Ĵ<EFBFBD><C4B4><EFBFBD>
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZλ<5A><CEBB>Խ<EFBFBD><D4BD>
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // Բ<>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>Ƿ<EFBFBD>
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // ָ<><D6B8><EFBFBD>İ<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD>֧<EFBFBD><D6A7>
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // <20><><EFBFBD>ſ<EFBFBD><C5BF>˿<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_FEC_ERR_PARAMVALID 111 // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // <20>Ƿ<EFBFBD><C7B7>Ӷ˿<D3B6>
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ<54><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΧԽ<CEA7><D4BD>
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵĽ<D6B5><C4BD><EFBFBD>ͨ<EFBFBD><CDA8>Ϊ<EFBFBD>ĸ<EFBFBD>
#define PLAYM4_FEC_ERR_ENABLED 115 //<2F>ö˿<C3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D<33><44><EFBFBD><EFBFBD>û<EFBFBD>п<EFBFBD><D0BF><EFBFBD>
#define PLAYM4_FEC_ERR_PLACETYPE 117 // <20><>װ<EFBFBD><D7B0>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>.һ<><D2BB><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>port<72><74><EFBFBD><EFBFBD>Ӧһ<D3A6>ְ<EFBFBD>װ<EFBFBD><D7B0>ʽ
#define PLAYM4_FEC_ERR_CorrectType 118 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>port,<2C><EFBFBD><E8B6A8><EFBFBD><EFBFBD>PTZ<54><5A><EFBFBD><EFBFBD><EFBFBD>۰<EFBFBD><DBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>,<2C><><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ֻ<EFBFBD>ܿ<EFBFBD>һ·;<3B><><EFBFBD><EFBFBD>180<38>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD>ptz<74><7A><EFBFBD><EFBFBD>һ<EFBFBD>𿪣<EFBFBD><F0BFAAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD><DEB9><EFBFBD><EFBFBD>ԡ<EFBFBD>
#define PLAYM4_FEC_ERR_NULLWND 119 // <20><><EFBFBD>۴<EFBFBD><DBB4><EFBFBD>Ϊ<EFBFBD><CEAA>
#define PLAYM4_FEC_ERR_PARA 120 // <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//Max display regions.
#define MAX_DISPLAY_WND 4
//Display type
#define DISPLAY_NORMAL 0x00000001
#define DISPLAY_QUARTER 0x00000002
#define DISPLAY_YC_SCALE 0x00000004 //add by gb 20091116
#define DISPLAY_NOTEARING 0x00000008
//Display buffers
#define MAX_DIS_FRAMES 50
#define MIN_DIS_FRAMES 1
//Locate by
#define BY_FRAMENUM 1
#define BY_FRAMETIME 2
//Source buffer
#define SOURCE_BUF_MAX 1024*100000
#define SOURCE_BUF_MIN 1024*50
//Stream type
#define STREAME_REALTIME 0
#define STREAME_FILE 1
//frame type
#define T_AUDIO16 101
#define T_AUDIO8 100
#define T_UYVY 1
#define T_YV12 3
#define T_RGB32 7
//capability
#define SUPPORT_DDRAW 1
#define SUPPORT_BLT 2
#define SUPPORT_BLTFOURCC 4
#define SUPPORT_BLTSHRINKX 8
#define SUPPORT_BLTSHRINKY 16
#define SUPPORT_BLTSTRETCHX 32
#define SUPPORT_BLTSTRETCHY 64
#define SUPPORT_SSE 128
#define SUPPORT_MMX 256
// <20><><EFBFBD>º궨<C2BA><EAB6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HIK_MEDIAINFO<46>
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO<46><EFBFBD><E1B9B9><EFBFBD><EFBFBD>
// ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>ʽ
#define SYSTEM_NULL 0x0 // û<><C3BB>ϵͳ<CFB5><EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
#define SYSTEM_HIK 0x1 // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
#define SYSTEM_MPEG2_PS 0x2 // PS<50><53>װ
#define SYSTEM_MPEG2_TS 0x3 // TS<54><53>װ
#define SYSTEM_RTP 0x4 // rtp<74><70>װ
#define SYSTEM_RTPHIK 0x401 // rtp<74><70>װ
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define VIDEO_NULL 0x0 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
#define VIDEO_H264 0x1 // <20><>׼H.264<EFBFBD>ͺ<EFBFBD><EFBFBD><EFBFBD>H.264<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define VIDEO_MPEG2 0x2 // <20><>׼MPEG2
#define VIDEO_MPEG4 0x3 // <20><>׼MPEG4
#define VIDEO_MJPEG 0x4
#define VIDEO_AVC264 0x0100
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define AUDIO_NULL 0x0000 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
#define AUDIO_ADPCM 0x1000 // ADPCM
#define AUDIO_MPEG 0x2000 // MPEG ϵ<><CFB5><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>MPEG<45><47>Ƶ
#define AUDIO_AAC 0x2001
// Gϵ<47><CFB5><EFBFBD><EFBFBD>Ƶ
#define AUDIO_RAW_DATA8 0x7000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ8k<38><6B>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>
#define AUDIO_RAW_UDATA16 0x7001 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16k<36><6B>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>L16
#define AUDIO_G711_U 0x7110
#define AUDIO_G711_A 0x7111
#define AUDIO_G722_1 0x7221
#define AUDIO_G723_1 0x7231
#define AUDIO_G726_U 0x7260
#define AUDIO_G726_A 0x7261
#define AUDIO_G726_16 0x7262
#define AUDIO_G729 0x7290
#define AUDIO_AMR_NB 0x3000
#define SYNCDATA_VEH 1 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
#define SYNCDATA_IVS 2 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
//motion flow type
#define MOTION_FLOW_NONE 0
#define MOTION_FLOW_CPU 1
#define MOTION_FLOW_GPU 2
//<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define ENCRYPT_AES_3R_VIDEO 1
#define ENCRYPT_AES_10R_VIDEO 2
#define ENCRYPT_AES_3R_AUDIO 1
#define ENCRYPT_AES_10R_AUDIO 2
typedef struct tagSystemTime
{
short wYear;
short wMonth;
short wDayOfWeek;
short wDay;
short wHour;
short wMinute;
short wSecond;
short wMilliseconds;
}SYSTEMTIME;
typedef struct tagHKRect
{
unsigned long left;
unsigned long top;
unsigned long right;
unsigned long bottom;
}HKRECT;
//Frame position
typedef struct
{
long long nFilePos;
int nFrameNum;
int nFrameTime;
int nErrorFrameNum;
SYSTEMTIME *pErrorTime;
int nErrorLostFrameNum;
int nErrorFrameSize;
}FRAME_POS,*PFRAME_POS;
//Frame Info
typedef struct
{
int nWidth;
int nHeight;
int nStamp;
int nType;
int nFrameRate;
unsigned int dwFrameNum;
}FRAME_INFO;
//Frame
typedef struct
{
char *pDataBuf;
int nSize;
int nFrameNum;
int bIsAudio;
int nReserved;
}FRAME_TYPE;
//Watermark Info //add by gb 080119
typedef struct
{
char *pDataBuf;
int nSize;
int nFrameNum;
int bRsaRight;
int nReserved;
}WATERMARK_INFO;
typedef struct SYNCDATA_INFO
{
unsigned int dwDataType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD>Ŀǰ<C4BF>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
unsigned int dwDataLen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
unsigned char* pData; //ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݽṹ<DDBD><E1B9B9>ָ<EFBFBD><D6B8>,<2C><><EFBFBD><EFBFBD>IVS_INFO<46>
} SYNCDATA_INFO;
#ifndef _HIK_MEDIAINFO_FLAG_
#define _HIK_MEDIAINFO_FLAG_
typedef struct _HIK_MEDIAINFO_ // modified by gb 080425
{
unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information
unsigned short media_version; // <20><EFBFBD>ţ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>ĿǰΪ0x0101,<2C><>1.01<EFBFBD><EFBFBD><EFBFBD>01<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>01<EFBFBD><EFBFBD><EFBFBD>Ӱ汾<EFBFBD>š<EFBFBD>
unsigned short device_id; // <20>豸ID<49><44><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>/<2F><><EFBFBD><EFBFBD>
unsigned short system_format; // ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>
unsigned short video_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned short audio_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned char audio_channels; // ͨ<><CDA8><EFBFBD><EFBFBD>
unsigned char audio_bits_per_sample; // <20><>λ<EFBFBD><CEBB>
unsigned int audio_samplesrate; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int audio_bitrate; // ѹ<><D1B9><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>,<2C><>λ<EFBFBD><CEBB>bit
unsigned char flag; //8bit,0x81<38><31>ʾ<EFBFBD><CABE> smart<72><74><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>smart,<2C><><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>intra<72>ķ<EFBFBD>ʽ<EFBFBD><CABD> media_version >= 0x0103&& video_fortmat = (H.264 or H.265) && ((flag & 0x02) ==0x2)
unsigned char stream_tag; //8bit,0x81<38><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD>SDP<44><50>Ϣ
unsigned char reserved[14]; // <20><><EFBFBD><EFBFBD>
}HIK_MEDIAINFO;
#endif
typedef struct
{
int nPort;
char* pBuf;
int nBufLen;
int nWidth;
int nHeight;
int nStamp;
int nType;
void* nUser;
}DISPLAY_INFO;
typedef struct
{
int nPort;
char *pVideoBuf;
int nVideoBufLen;
char *pPriBuf;
int nPriBufLen;
int nWidth;
int nHeight;
int nStamp;
int nType;
void* nUser;
}DISPLAY_INFOEX;
typedef struct PLAYM4_SYSTEM_TIME //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
{
unsigned int dwYear; //<2F><>
unsigned int dwMon; //<2F><>
unsigned int dwDay; //<2F><>
unsigned int dwHour; //ʱ
unsigned int dwMin; //<2F><>
unsigned int dwSec; //<2F><>
unsigned int dwMs; //<2F><><EFBFBD><EFBFBD>
} PLAYM4_SYSTEM_TIME;
#ifndef CROP_PIC_INFO_TAG
#define CROP_PIC_INFO_TAG
typedef struct
{
unsigned char* pDataBuf; //ץͼ<D7A5><CDBC><EFBFBD><EFBFBD>buffer
unsigned int dwPicSize; //ʵ<><CAB5>ͼƬ<CDBC><C6AC>С
unsigned int dwBufSize; //<2F><><EFBFBD><EFBFBD>buffer<65><72>С
unsigned int dwPicWidth; //<2F><>ͼ<EFBFBD><CDBC>
unsigned int dwPicHeight; //<2F><>ͼ<EFBFBD><CDBC>
unsigned int dwReserve; //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>reserve<76>ֶ<EFBFBD>
HKRECT* pCropRect; //ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULL, ͬ<>ϵ<EFBFBD>ץͼ<D7A5>ӿ<EFBFBD>
}CROP_PIC_INFO;
#endif
//////////////////////////////////////////////////////////////////////////////
//API
//////////////////////////////////////////////////////////////////////////////
int PlayM4_GetPort(int* nPort);
int PlayM4_FreePort(int nPort);
int PlayM4_OpenFile(int nPort,char * sFileName);
int PlayM4_CloseFile(int nPort);
int PlayM4_SetStreamOpenMode(int nPort,unsigned int nMode);
int PlayM4_GetStreamOpenMode(int nPort);
int PlayM4_OpenStream(int nPort,unsigned char * pFileHeadBuf,unsigned int nSize,unsigned int nBufPoolSize);
int PlayM4_CloseStream(int nPort);
int PlayM4_Play(int nPort, PLAYM4_HWND hWnd);
int PlayM4_PlayEx(int nPort, PLAYM4_HWNDEX hWnd);
int PlayM4_Stop(int nPort);
int PlayM4_Pause(int nPort,unsigned int nPause);
int PlayM4_Fast(int nPort);
int PlayM4_Slow(int nPort);
int PlayM4_RefreshPlay(int nPort);
int PlayM4_InputData(int nPort,unsigned char * pBuf,unsigned int nSize);
int PlayM4_PlaySound(int nPort);
int PlayM4_StopSound();
int PlayM4_PlaySoundShare(int nPort);
int PlayM4_StopSoundShare(int nPort);
int PlayM4_SetVolume(int nPort,unsigned short nVolume);
unsigned short PlayM4_GetVolume(int nPort);
int PlayM4_OneByOne(int nPort);
int PlayM4_OneByOneBack(int nPort);
int PlayM4_SetPlayPos(int nPort,float fRelativePos);
float PlayM4_GetPlayPos(int nPort);
unsigned int PlayM4_GetFileTime(int nPort);
unsigned int PlayM4_GetPlayedTime(int nPort);
unsigned int PlayM4_GetPlayedFrames(int nPort);
unsigned int PlayM4_GetFileTotalFrames(int nPort);
unsigned int PlayM4_GetCurrentFrameRate(int nPort);
unsigned int PlayM4_GetCurrentFrameNum(int nPort);
unsigned int PlayM4_GetSpecialData(int nPort);
unsigned int PlayM4_GetAbsFrameNum(int nPort);
unsigned int PlayM4_GetFileHeadLength();
unsigned int PlayM4_GetSdkVersion();
unsigned int PlayM4_GetLastError(int nPort);
unsigned int PlayM4_GetPlayedTimeEx(int nPort);
int PlayM4_GetSystemTime(int nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
int PlayM4_GetFileTimeEx(int nPort, unsigned int* pStart, unsigned int* pStop, unsigned int* pRev);
int PlayM4_GetCurrentFrameRateEx(int nPort, float* pfFrameRate);
int PlayM4_GetPictureSize(int nPort,int *pWidth,int *pHeight);
int PlayM4_GetKeyFramePos(int nPort,unsigned int nValue, unsigned int nType, PFRAME_POS pFramePos);
int PlayM4_GetNextKeyFramePos(int nPort,unsigned int nValue, unsigned int nType, PFRAME_POS pFramePos);
int PlayM4_ConvertToBmpFile(char * pBuf,int nSize,int nWidth,int nHeight,int nType,char *sFileName);
int PlayM4_ConvertToJpegFile(char * pBuf,int nSize,int nWidth,int nHeight,int nType,char *sFileName);
int PlayM4_SetJpegQuality(int nQuality);
int PlayM4_GetBMP(int nPort,unsigned char * pBitmap,unsigned int nBufSize,unsigned int* pBmpSize);
int PlayM4_GetJPEG(int nPort,unsigned char * pJpeg,unsigned int nBufSize,unsigned int* pJpegSize);
int PlayM4_SetPlayedTimeEx(int nPort,unsigned int nTime);
int PlayM4_SetCurrentFrameNum(int nPort,unsigned int nFrameNum);
int PlayM4_SetDisplayRegion(int nPort,unsigned int nRegionNum, HKRECT *pSrcRect, PLAYM4_HWND hDestWnd, int bEnable);
int PlayM4_SetDisplayRegionOnWnd(int nPort,unsigned int nRegionNum, HKRECT *pSrcRect, int bEnable);///<<3C><EFBFBD>ڷָ<DAB7><D6B8>ӿ<EFBFBD>
int PlayM4_SetDecodeFrameType(int nPort,unsigned int nFrameType);
int PlayM4_SetSecretKey(int nPort, int lKeyType, char *pSecretKey, int lKeyLen);
int PlayM4_SetDecCBStream(int nPort,unsigned int nStream);
int PlayM4_SetDecCallBackMend(int nPort,void (CALLBACK* DecCBFun)(int nPort,char * pBuf,int nSize,FRAME_INFO * pFrameInfo, void* nUser,int nReserved2), void* nUser);
int PlayM4_SetDecCallBackExMend(int nPort, void (CALLBACK* DecCBFun)(int nPort, char* pBuf, int nSize, FRAME_INFO* pFrameInfo, void* nUser, int nReserved2), char* pDest, int nDestSize, void* nUser);
int PlayM4_SetDisplayCallBack(int nPort,void (CALLBACK* DisplayCBFun)(int nPort,char * pBuf,int nSize,int nWidth,int nHeight,int nStamp,int nType,int nReserved));
int PlayM4_SetDisplayCallBackEx(int nPort,void (CALLBACK* DisplayCBFun)(DISPLAY_INFO *pstDisplayInfo), void* nUser);
int PlayM4_SetFileRefCallBack(int nPort, void (CALLBACK *pFileRefDone)(unsigned int nPort,void* nUser),void* nUser);
int PlayM4_SetEncTypeChangeCallBack(int nPort, void(CALLBACK *funEncChange)(int nPort, void* nUser), void* nUser);
int PlayM4_SetCheckWatermarkCallBack(int nPort, void(CALLBACK* funCheckWatermark)(int nPort, WATERMARK_INFO* pWatermarkInfo, void* nUser), void* nUser);
int PlayM4_SetFileEndCallback(int nPort, void(CALLBACK*FileEndCallback)(int nPort, void *pUser), void *pUser);
int PlayM4_ResetSourceBuffer(int nPort);
int PlayM4_SetDisplayBuf(int nPort, unsigned int nNum);
int PlayM4_ResetBuffer(int nPort,unsigned int nBufType);
unsigned int PlayM4_GetSourceBufferRemain(int nPort);
unsigned int PlayM4_GetDisplayBuf(int nPort);
unsigned int PlayM4_GetBufferValue(int nPort,unsigned int nBufType);
int PlayM4_GetRefValue(int nPort,unsigned char *pBuffer, unsigned int *pSize);
int PlayM4_SetRefValue(int nPort,unsigned char *pBuffer, unsigned int nSize);
int PlayM4_GetRefValueEx(int nPort,unsigned char *pBuffer, unsigned int *pSize);///< <20><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD>ͻص<CDBB>
int PlayM4_RegisterDrawFun(int nPort,void (CALLBACK* DrawFun)(int nPort,PLAYM4_HDC hDc,void* nUser),void* nUser);
int PlayM4_ThrowBFrameNum(int nPort,unsigned int nNum);
int PlayM4_SkipErrorData(int nPort, int bSkip);
int PlayM4_ReversePlay(int nPort);
#ifndef PLAYM4_SESSION_INFO_TAG
#define PLAYM4_SESSION_INFO_TAG
//nProtocolType
#define PLAYM4_PROTOCOL_RTSP 1
//nSessionInfoType
#define PLAYM4_SESSION_INFO_SDP 1
typedef struct _PLAYM4_SESSION_INFO_ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>
{
int nSessionInfoType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>SDP<44><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7BAA3>˽<EFBFBD><CBBD><EFBFBD><EFBFBD>Ϣͷ
int nSessionInfoLen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
unsigned char* pSessionInfoData; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
} PLAYM4_SESSION_INFO;
#endif
PLAYM4_API int __stdcall PlayM4_OpenStreamAdvanced(int nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, unsigned int nBufPoolSize);
#define R_ANGLE_0 -1 //<2F><><EFBFBD><EFBFBD>ת
#define R_ANGLE_L90 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30>
#define R_ANGLE_R90 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30>
#define R_ANGLE_180 2 //<2F><>ת180<38><30>
PLAYM4_API int __stdcall PlayM4_SetRotateAngle(int nPort, unsigned int nRegionNum, unsigned int dwType);
#ifndef PLAYM4_ADDITION_INFO_TAG
#define PLAYM4_ADDITION_INFO_TAG
typedef struct _PLAYM4_ADDITION_INFO_ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>
{
unsigned char* pData; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int dwDatalen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
unsigned int dwDataType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int dwTimeStamp; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
} PLAYM4_ADDITION_INFO;
#endif
//dwGroupIndex <20><>Լ<EFBFBD><D4BC>ȡֵ0~3<><33><EFBFBD><EFBFBD>һ<EFBFBD>汾ȡ<E6B1BE><C8A1>ͬ<EFBFBD><CDAC>ֻ<EFBFBD><D6BB>ͬ<EFBFBD><CDAC>closestream<61><6D><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_SetSycGroup(int nPort, unsigned int dwGroupIndex);
//<2F>ݲ<EFBFBD>ʵ<EFBFBD>ִ˺<D6B4><CBBA><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʼʱ<CABC>һ<E4B2BB>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣬ͬһ<CDAC><D2BB><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ·
PLAYM4_API int __stdcall PlayM4_SetSycStartTime(int nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
// <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صĽӿ<C4BD>
#ifndef FISH_EYE_TAG
#define FISH_EYE_TAG
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef enum tagFECPlaceType
{
FEC_PLACE_WALL = 0x1, // <20><>װ<EFBFBD><D7B0>ʽ (<28><><EFBFBD><EFBFBD>ˮƽ)
FEC_PLACE_FLOOR = 0x2, // <20><><EFBFBD>氲װ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
FEC_PLACE_CEILING = 0x3, // <20><>װ<EFBFBD><D7B0>ʽ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
}FECPLACETYPE;
typedef enum tagFECCorrectType
{
FEC_CORRECT_NULL = 0x0, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(ԭͼ)
FEC_CORRECT_PTZ = 0x100, // PTZ
FEC_CORRECT_180 = 0x200, // 180<38>Ƚ<EFBFBD><C8BD><EFBFBD> <20><><EFBFBD><EFBFBD>Ӧ2P<32><50>
FEC_CORRECT_360 = 0x300, // 360ȫ<30><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ӧ1P<31><50>
FEC_CORRECT_LAT = 0x400, // γ<><CEB3>չ<EFBFBD><D5B9>
FEC_CORRECT_SEMISPHERE = 0x500, // 3D<33><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FEC_CORRECT_CYLINDER = 0x0600, // <20><><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>ʾ - <20><>װ/<2F><>װ
FEC_CORRECT_CYLINDER_SPLIT = 0x0700, // <20><><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>ʾ - <20><>װ/<2F><>װ
FEC_CORRECT_PLANET = 0x0800, // <20><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>
FEC_CORRECT_ARCSPHERE_HORIZONTAL = 0x0900, // <20><><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD> - <20><>װ
FEC_CORRECT_ARCSPHERE_VERTICAL = 0x0A00, // <20><><EFBFBD>۴<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD> - <20><>װ
}FECCORRECTTYPE;
typedef enum tagFECCorrectEffect
{
FEC_CORRECT_EFFECT_BACK_FACE_CULLING = 0x100, // <20><><EFBFBD><EFBFBD><EFBFBD>޳<EFBFBD><DEB3><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE><EFBFBD>ã<EFBFBD>Ϊ0<CEAA><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿת<C7BF><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}FECCORRECTEFFECT;
typedef struct tagCycleParam
{
float fRadiusLeft; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
float fRadiusRight; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
float fRadiusTop; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
float fRadiusBottom; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
}CYCLEPARAM;
typedef struct tagPTZParam
{
float fPTZPositionX; // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> X<><58><EFBFBD><EFBFBD>
float fPTZPositionY; // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> Y<><59><EFBFBD><EFBFBD>
}PTZPARAM;
// PTZ<54><5A>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾģʽ
typedef enum tagFECShowMode
{
FEC_PTZ_OUTLINE_NULL, // <20><><EFBFBD><EFBFBD>ʾ
FEC_PTZ_OUTLINE_RECT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
FEC_PTZ_OUTLINE_RANGE, // <20><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
}FECSHOWMODE;
// <20><><EFBFBD>±<EFBFBD><C2B1>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define FEC_UPDATE_RADIUS 0x1
#define FEC_UPDATE_PTZZOOM 0x2
#define FEC_UPDATE_WIDESCANOFFSET 0x4
#define FEC_UPDATE_PTZPARAM 0x8
#define FEC_UPDATT_PTZCOLOR 0x10
// ɫ<>ʽ<CABD><E1B9B9>
typedef struct tagFECColor
{
unsigned char nR; // R<><52><EFBFBD><EFBFBD>
unsigned char nG; // G<><47><EFBFBD><EFBFBD>
unsigned char nB; // B<><42><EFBFBD><EFBFBD>
unsigned char nAlpha; // Alpha<68><61><EFBFBD><EFBFBD>
}FECCOLOR;
typedef struct tagFECParam
{
unsigned int nUpDateType; // <20><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>
unsigned int nPlaceAndCorrect; // <20><>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1>SetParam<61><6D>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ч,<2C><>ֵ<EFBFBD><D6B5>ʾ<EFBFBD><CABE>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>ĺ<EFBFBD>
PTZPARAM stPTZParam; // PTZ У<><D0A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
CYCLEPARAM stCycleParam; // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Բ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
float fZoom; // PTZ <20><>ʾ<EFBFBD>ķ<EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD>
float fWideScanOffset; // 180<38><30><EFBFBD><EFBFBD>360<36><30>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ƫ<EFBFBD>ƽǶ<C6BD>
FECCOLOR stPTZColor; // PTZ<54><5A>ɫ
int nResver[15]; // <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
}FISHEYEPARAM;
#define FEC_JPEG 0 // JPEGץͼ
#define FEC_BMP 1 // BMP ץͼ
///<<3C>µ<EFBFBD>3d<33><64><EFBFBD>۰<EFBFBD><DBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽDZ仯<C7B1><E4BBAF><EFBFBD><EFBFBD>(<28><><EFBFBD>ź<EFBFBD><C5BA><EFBFBD>ת)
typedef enum tagPLAYM4HRViewParamType
{
PLAYM4_HR_VPT_ROTATION_X = 0x1, ///<ˮƽ<CBAE><C6BD>ת
PLAYM4_HR_VPT_ROTATION_Y = 0x2, ///<<3C><>ֱ<EFBFBD><D6B1>ת
PLAYM4_HR_VPT_SCALE = 0x3, ///<<3C><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<D6B5><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0ֵʱΪ<CAB1><CEAA><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>)
}PLAYM4HRVIEWPARAMTYPE;
// <20><><EFBFBD><EFBFBD>3Dģ<44>Ͳ<EFBFBD><CDB2><EFBFBD>
typedef enum tagPLAYM4FEC3DModelParam
{
PLAYM4_FEC_3DMP_CYLINDER_HEIGHT = 0x1, ///< Բ<><D4B2>ģ<EFBFBD>͸<EFBFBD>
PLAYM4_FEC_3DMP_CYLINDER_RADIUS = 0x2, ///< Բ<><D4B2>ģ<EFBFBD>Ͱ뾶
}PLAYM4FEC3DMODELPARAM;
// <20>ض<EFBFBD><D8B6>ӽ<EFBFBD>״̬
typedef enum tagPLAYM4FECSpecialViewType
{
PLAYM4_FEC_SVT_EDGE = 0x1 ///<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EBB4B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>
}PLAYM4FECSPECIALVIEWTYPE;
#endif
typedef void (__stdcall * FISHEYE_CallBack )( void* pUser , unsigned int nPort , unsigned int nCBType , void * hDC , unsigned int nWidth , unsigned int nHeight);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_FEC_Enable(int nPort);
// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
PLAYM4_API int __stdcall PlayM4_FEC_Disable(int nPort);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6> [1~31]
PLAYM4_API int __stdcall PlayM4_FEC_GetPort(int nPort , unsigned int* nSubPort , FECPLACETYPE emPlaceType , FECCORRECTTYPE emCorrectType);
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6>
PLAYM4_API int __stdcall PlayM4_FEC_DelPort(int nPort , unsigned int nSubPort);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_FEC_SetParam(int nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_FEC_GetParam(int nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>л<EFBFBD>
PLAYM4_API int __stdcall PlayM4_FEC_SetWnd(int nPort , unsigned int nSubPort , void * hWnd);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۴<EFBFBD><DBB4>ڵĻ<DAB5>ͼ<EFBFBD>ص<EFBFBD>
PLAYM4_API int __stdcall PlayM4_FEC_SetCallBack(int nPort , unsigned int nSubPort , FISHEYE_CallBack cbFunc , void * pUser);
PLAYM4_API int __stdcall PlayM4_FEC_Capture(int nPort, unsigned int nSubPort , unsigned int nType, char *pFileName);
PLAYM4_API int __stdcall PlayM4_FEC_GetCurrentPTZPort(int nPort, float fPositionX,float fPositionY, unsigned int *pnPort);
PLAYM4_API int __stdcall PlayM4_FEC_SetCurrentPTZPort(int nPort, unsigned int nSubPort);
PLAYM4_API int __stdcall PlayM4_FEC_SetPTZOutLineShowMode(int nPort,FECSHOWMODE nPTZShowMode);
//<2F>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>۰<EFBFBD><DBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽDZ仯(<28><>ת)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؽӿ<D8BD>
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽDz<D3BD><C7B2><EFBFBD>(<28><><EFBFBD><EFBFBD>ǰ<EFBFBD>Ȼ<EFBFBD>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ֵ)
PLAYM4_API int __stdcall PlayM4_FEC_GetViewParam(int nPort, unsigned int nSubPort, PLAYM4HRVIEWPARAMTYPE enViewParamType, float* fValue);
//<2F><><EFBFBD>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽDZ仯<C7B1><E4BBAF><EFBFBD><EFBFBD>(<28><><EFBFBD>õ<EFBFBD>ֵΪ<D6B5><CEAA>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD>Ҫƫ<D2AA><C6AB>ֵ)
PLAYM4_API int __stdcall PlayM4_FEC_SetViewParam(int nPort, unsigned int nSubPort, PLAYM4HRVIEWPARAMTYPE enViewParamType, float fValue);
//<2F><><EFBFBD>۵<EFBFBD><DBB5>ӷŴ<D3B7> nType = 0<><30>
//<2F><><EFBFBD>۴<EFBFBD><DBB4>ڷָ<DAB7> nType = 1<><31>
//ע<><EFBFBD><E2A3AC><EFBFBD>ڷָ<DAB7>ʱhDestWnd<6E><64>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪNULL<4C><4C>20180813<31>ݲ<EFBFBD>֧<EFBFBD>֣<EFBFBD>
//Ŀǰ<C4BF><C7B0><EFBFBD>ӷŴ<D3B7><C5B4><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϷŴ<CFB7><C5B4><EFBFBD>nRegionNum<75><6D>Ϊ0<CEAA><30>hDestWnd<6E><64>ΪNULL<4C><4C>bEnable<6C><65>Ϊ0ȡ<30><C8A1><EFBFBD><EFBFBD><EFBFBD>ӷŴ󣬷<C5B4><30><CEAA><EFBFBD>ӷŴ<D3B7>
//pSrcRect<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1000<30><30><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>߸ߣ<DFB8><DFA3><EFBFBD>ֵ<EFBFBD><D6B5>0-1000֮<30>
//ֻ<>Ƽ<EFBFBD>ԭͼ<D4AD><CDBC>180<38><30>360<36><30>γ<EFBFBD><CEB3>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PTZ<54><5A>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ӷŴ<D3B7><C5B4><EFBFBD><EFBFBD>ٿ<EFBFBD>ptz<74><EFBFBD>µ<EFBFBD><C2B5>ӷŴ<D3B7>ʧЧ-3D<33><44><EFBFBD>۲<EFBFBD><DBB2><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô˽ӿ<CBBD>(<28><><EFBFBD>ӽDZ仯<C7B1>ӿڽ<D3BF><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>
PLAYM4_API bool __stdcall PlayM4_FEC_SetDisplayRegion(int nPort, unsigned int nSubPort,unsigned int nType, unsigned int nRegionNum, HKRECT *pSrcRect, PLAYM4_HWND hDestWnd, int bEnable);
//<2F><><EFBFBD><EFBFBD><EFBFBD>޳<EFBFBD><DEB3><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʾ<EFBFBD><CABE><EFBFBD>ã<EFBFBD>Ϊ0<CEAA><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿת<C7BF><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_API bool __stdcall PlayM4_FEC_SetCorrectEffect(int nPort, unsigned int nSubPort, FECCORRECTEFFECT nCorrectEffect, float fValue);
// <20><><EFBFBD><EFBFBD>3Dģ<44>Ͳ<EFBFBD><CDB2><EFBFBD>-<2D><><EFBFBD><EFBFBD>3DԲ<44><D4B2>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>Ч
PLAYM4_API bool __stdcall PlayM4_FEC_Set3DModelParam(int nPort, unsigned int nSubPort, PLAYM4FEC3DMODELPARAM enType, float fValue);
// <20><>ȡ<EFBFBD>ض<EFBFBD><D8B6>ӽDz<D3BD><C7B2><EFBFBD> - ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><E6A3AC>SetViewParam<61>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
PLAYM4_API bool __stdcall PlayM4_FEC_GetSpecialViewParam(int nPort, unsigned int nSubPort, PLAYM4FECSPECIALVIEWTYPE enSVType, PLAYM4HRVIEWPARAMTYPE enVPType, float* pValue);
//ͼ<><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD>-Linux<75><EFBFBD><E6B1BE>֧<EFBFBD><D6A7>
#ifndef PLAYM4_HIKVIE_TAG
#define PLAYM4_HIKVIE_TAG
typedef struct _PLAYM4_VIE_DYNPARAM_
{
int moduFlag; //<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><E3B7A8><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9A3AC>PLAYM4_VIE_MODULES<45>ж<EFBFBD><D0B6><EFBFBD>
//<2F><> PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>ú󣬱<C3BA><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>
//PLAYM4_VIE_MODU_ADJ
int brightVal; //<2F><><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-255, 255]
int contrastVal; //<2F>Աȶȵ<C8B6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
int colorVal; //<2F><><EFBFBD>Ͷȵ<CDB6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
//PLAYM4_VIE_MODU_EHAN
int toneScale; //<2F>˲<EFBFBD><CBB2><EFBFBD>Χ<EFBFBD><CEA7>[0, 100]
int toneGain; //<2F>Աȶȵ<C8B6><C8B5>ڣ<EFBFBD>ȫ<EFBFBD>ֶԱȶ<D4B1><C8B6><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
int toneOffset; //<2F><><EFBFBD>ȵ<EFBFBD><C8B5>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵƫ<D6B5>ƣ<EFBFBD>[-255, 255]
int toneColor; //<2F><>ɫ<EFBFBD><C9AB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
//PLAYM4_VIE_MODU_DEHAZE
int dehazeLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
int dehazeTrans; //͸<><CDB8>ֵ<EFBFBD><D6B5>[0, 255]
int dehazeBright; //<2F><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD><EFBFBD>[0, 255]
//PLAYM4_VIE_MODU_DENOISE
int denoiseLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
//PLAYM4_VIE_MODU_SHARPEN
int usmAmount; //<2F><><EFBFBD><EFBFBD>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
int usmRadius; //<2F>񻯰뾶<F1BBAFB0><EBBEB6>[1, 15]
int usmThreshold; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[0, 255]
//PLAYM4_VIE_MODU_DEBLOCK
int deblockLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 100]
//PLAYM4_VIE_MODU_LENS
int lensWarp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255]
int lensZoom; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255]
//PLAYM4_VIE_MODU_CRB
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
} PLAYM4_VIE_PARACONFIG;
typedef enum _PLAYM4_VIE_MODULES
{
PLAYM4_VIE_MODU_ADJ = 0x00000001, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_VIE_MODU_EHAN = 0x00000002, //<2F>ֲ<EFBFBD><D6B2><EFBFBD>ǿģ<C7BF><C4A3>
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //ȥ<><C8A5>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //ȥ<><C8A5>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //ȥ<><C8A5><EFBFBD>˲<EFBFBD>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_CRB = 0x00000040, //ɫ<><C9AB>ƽ<EFBFBD><C6BD>ģ<EFBFBD><C4A3>
PLAYM4_VIE_MODU_LENS = 0x00000080, //<2F><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
}PLAYM4_VIE_MODULES;
#endif
//<2F><><EFBFBD>ùر<C3B9>/<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> -- NO SUPPORT
//dwModuFlag<61><67>ӦPLAYM4_VIE_MODULES<45><53>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9BFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵIJ<CFB5><C4B2><EFBFBD>;
//<2F>ر<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>õIJ<C3B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӿڵ<D3BF><DAB5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸýӿڿ<D3BF><DABF><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>󣻷<EFBFBD><F3A3BBB7>򣬷<EFBFBD><F2A3ACB7>ش<EFBFBD><D8B4><EFBFBD>
PLAYM4_API int __stdcall PlayM4_VIE_SetModuConfig(int nPort, int nModuFlag, int bEnable);
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULLȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>16*16<31><36><EFBFBD><EFBFBD> -- NO SUPPORT
//<2F><>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD>˵4<CBB5><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><E6B1BE><EFBFBD><EFBFBD>ֻ֧<D6BB><D6A7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>ͱ<EFBFBD><CDB1><EFBFBD>
PLAYM4_API int __stdcall PlayM4_VIE_SetRegion(int nPort, int nRegNum, HKRECT* pRect);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> -- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_VIE_GetModuConfig(int nPort, int* pdwModuFlag);
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
//δ<><CEB4><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD> -- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_VIE_SetParaConfig(int nPort, PLAYM4_VIE_PARACONFIG* pParaConfig);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD> -- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_VIE_GetParaConfig(int nPort, PLAYM4_VIE_PARACONFIG* pParaConfig);
// ˽<><CBBD><EFBFBD><EFBFBD>Ϣģ<CFA2><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef enum _PLAYM4_PRIDATA_RENDER
{
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //<2F><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
PLAYM4_RENDER_MD = 0x00000002, //<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS<4F><53>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_RENDER_ADD_PIC = 0x00000008, //ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //<2F>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
PLAYM4_RENDER_TEM = 0x00000020, //<2F><EFBFBD><C2B6><EFBFBD>Ϣ
}PLAYM4_PRIDATA_RENDER;
typedef enum _PLAYM4_FIRE_ALARM
{
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ
PLAYM4_FIRE_DISTANCE = 0x00000008, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶Ⱦ<C2B6><C8BE><EFBFBD>
}PLAYM4_FIRE_ALARM;
typedef enum _PLAYM4_TEM_FLAG
{
PLAYM4_TEM_REGION_BOX = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PLAYM4_TEM_REGION_LINE = 0x00000002, //<2F>߲<EFBFBD><DFB2><EFBFBD>
PLAYM4_TEM_REGION_POINT = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}PLAYM4_TEM_FLAG;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_RenderPrivateData(int nPort, int nIntelType, int bTrue);
///<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD>
PLAYM4_API int __stdcall PlayM4_RenderPrivateDataEx(int nPort, int nIntelType, int nSubType, int bTrue);
//ENCRYPT Info
typedef struct{
long nVideoEncryptType; //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long nAudioEncryptType; //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long nSetSecretKey; //<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ã<EFBFBD>1<EFBFBD><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>0<EFBFBD><30>ʾû<CABE><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ
}ENCRYPT_INFO;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>,nType=0<><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻص<CDBB><D8B5><EFBFBD>nType=1<><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
PLAYM4_API int __stdcall PlayM4_SetEncryptTypeCallBack(int nPort, unsigned int nType, void (CALLBACK* EncryptTypeCBFun)(int nPort, ENCRYPT_INFO* pEncryptInfo, void* nUser, int nReserved2), void* nUser);
#define PLAYM4_MEDIA_HEAD 1 //ϵͳͷ<CDB3><CDB7><EFBFBD><EFBFBD>
#define PLAYM4_VIDEO_DATA 2 //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_AUDIO_DATA 3 //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_PRIVT_DATA 4 //˽<><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//Ԥ¼<D4A4><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ- NO SUPPORT
typedef struct
{
long nType; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>ļ<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>
long nStamp; // ʱ<><CAB1><EFBFBD><EFBFBD>
long nFrameNum; // ֡<><D6A1>
long nBufLen; // <20><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
char* pBuf; // ֡<><D6A1><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>֡Ϊ<D6A1><CEAA>λ<EFBFBD>ص<EFBFBD>
PLAYM4_SYSTEM_TIME stSysTime; // ȫ<><C8AB>ʱ<EFBFBD><CAB1>
}RECORD_DATA_INFO;
//<2F><><EFBFBD><EFBFBD>Ԥ¼<D4A4>񿪹أ<F1BFAAB9>bFlag=1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bFlag=0<>ر<EFBFBD>-- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_SetPreRecordFlag(int nPort, int bFlag);
//Ԥ¼<D4A4><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻص<DDBB>- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_SetPreRecordCallBack(int nPort, void (CALLBACK* PreRecordCBfun)(int nPort, RECORD_DATA_INFO* pRecordDataInfo, void* pUser), void* pUser);
typedef struct
{
long lDataType; //˽<><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long lDataStrVersion; //<2F><><EFBFBD>ݷ<EFBFBD><DDB7>صĽṹ<C4BD><E1B9B9><EFBFBD><EFBFBD><E6B1BE><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ϊ<EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>
long lDataTimeStamp;
long lDataLength;
char* pData;
}AdditionDataInfo;
PLAYM4_API int __stdcall PlayM4_SetAdditionDataCallBack(int nPort, unsigned int nSyncType, void (CALLBACK* AdditionDataCBFun)(int nPort, AdditionDataInfo* pstAddDataInfo, void* pUser), void* pUser);
//lType: 1 <20><>ʾ<EFBFBD><CABE>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ʾ֡PTZ<54><5A>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><E1B9B9><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><E6B4A2>pInfo<66>ڣ<EFBFBD>plLen<65><6E><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ;<3B><><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>pInfo = null<6C><6C><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ泤<DAB4><E6B3A4>plLen
PLAYM4_API int __stdcall PlayM4_GetStreamAdditionalInfo(int nPort, int lType, unsigned char* pInfo, int* plLen);
#define PLAYM4_SOURCE_MODULE 0 // <20><><EFBFBD><EFBFBD>Դģ<D4B4><C4A3>
#define PLAYM4_DEMUX_MODULE 1 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
#define PLAYM4_DECODE_MODULE 2 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
#define PLAYM4_RENDER_MODULE 3 // <20><>Ⱦģ<C8BE><C4A3>
#define PLAYM4_RTINFO_HARDDECODE_ERROR 0 // Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>
#define PLAYM4_RTINFO_SOFTDECODE_ERROR 1 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣨲<EFBFBD>֧<EFBFBD>֣<EFBFBD>
#define PLAYM4_RTINFO_MEDIAHEADER_ERROR 2 // ý<><C3BD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
#define PLAYM4_RTINFO_SWITCH_SOFT_DEC 3 // <20>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PLAYM4_RTINFO_ALLOC_MEMORY_ERROR 4 // <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
#define PLAYM4_RTINFO_ENCRYPT_ERROR 5 // <20><>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>
#define PLAYM4_RTINFO_RENDER_OVER 8 // <20><>Ⱦһ֡<D2BB><D6A1><EFBFBD><EFBFBD>
#define PLAYM4_RTINFO_ERR_PRESENT 16 // <20><>Ⱦ<EFBFBD><C8BE>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>[<5B><>ǰ<EFBFBD><C7B0>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦʧ<C8BE><CAA7>,<2C>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>]
#define PLAYM4_RTINFO_IDMX_DATA_ERROR 32 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
#define PLAYM4_RTINFO_DECODE_PARAM_ERROR 64 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
#define PLAYM4_RTINFO_SOFTDECODE_DATA_ERROR 128 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>
typedef struct
{
int nRunTimeModule; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>ݶ<EFBFBD><32><CEAA><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ
int nStrVersion; //<2F><><EFBFBD>ݷ<EFBFBD><DDB7>صĽṹ<C4BD><E1B9B9><EFBFBD><EFBFBD><E6B1BE><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ϊ<EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>,<2C><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x0001
int nFrameTimeStamp; //֡<><D6A1>
int nFrameNum; //ʱ<><CAB1><EFBFBD><EFBFBD>
int nErrorCode; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0ΪӲ<CEAA><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned char reserved[12]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
}RunTimeInfo;
///<ʵʱ<CAB5><CAB1>Ϣ<EFBFBD>ص<EFBFBD><D8B5>ӿ<EFBFBD>
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallBackEx(int nPort, int nModule, void (CALLBACK* RunTimeInfoCBFun)(int nPort, RunTimeInfo* pstRunTimeInfo, void* pUser), void* pUser);
// 1<><31>SetRunTimeInfoCallBackEx<45>ӿڣ<D3BF>nErrorCode<64><65><EFBFBD><EFBFBD>6<EFBFBD><36>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>չ<EFBFBD><D5B9>ʽ 16<31><36>32<33><32>64<36><34><EFBFBD>Ҵ<EFBFBD>8<EFBFBD><38>ʼ<EFBFBD><CABC>ϢĬ<CFA2>Ϲرղ<D8B1><D5B2><EFBFBD><EFBFBD>͡<EFBFBD>
// 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ƽӿڣ<D3BF><DAA3><EFBFBD><EFBFBD>ƴ<EFBFBD>8<EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>֧<EFBFBD>ִ<EFBFBD>8<EFBFBD><38>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ƴ<EFBFBD><C6B4>ģʽ 8|16|32 <20><><EFBFBD>ַ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD>
// 3<><33>nType<70><65><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4>룬nFlag<61><67>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>лص<D0BB><D8B5><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallbackType(int nPort, int nModule, unsigned int nType, int nFlag);
///<<3C><>Ⱦ<EFBFBD><C8BE>ʾ<EFBFBD><CABE><EFBFBD>ؽӿ<D8BD>
#ifndef PLAYM4_HIKD3D11_TAG
#define PLAYM4_HIKD3D11_TAG
///<<3C><>Ⱦץͼ<D7A5><EFBFBD><E1B9B9>
typedef struct _tagD3D11_PIC_INFO_
{
unsigned int nPicMode; //ץͼģʽ<C4A3><CABD>0-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʷֱ<CAB7><D6B1><EFBFBD>ץͼ(֮ǰץͼģʽ)<29><>1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B4AB><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ץͼ<D7A5><CDBC>nPicWidth*nPicHeightΪ<74><CEAA>ʾ<EFBFBD><CABE><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>ʱЧ<CAB1><D0A7><EFBFBD><EFBFBD><EFBFBD>ѣ<EFBFBD>
unsigned char* pBuf; //ץͼ<D7A5><CDBC><EFBFBD><EFBFBD>buffer
unsigned int nBufSize; //<2F><><EFBFBD><EFBFBD>buffer<65><72>С-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>nPicModeΪ0<CEAA><30>Ϊ֮ǰ<D6AE>ĸ<EFBFBD><C4B8>ݻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA3BB><EFBFBD><EFBFBD>nPicModeΪ1<CEAA><31><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õķֱ<C4B7><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int* pPicSize; //ʵ<><CAB5>ͼƬ<CDBC><C6AC>С
unsigned int nPicWidth; //<2F><><EFBFBD><EFBFBD>ץͼ<D7A5><CDBC>-nPicModeΪ1ʱ<31><CAB1>Ч<EFBFBD><D0A7><EFBFBD>ҿ<EFBFBD>>=32,nPicWidth*nPicHeight<5000w<30>ֱ<EFBFBD><D6B1>ʡ<EFBFBD>
unsigned int nPicHeight; //<2F><><EFBFBD><EFBFBD>ץͼ<D7A5><CDBC>-nPicModeΪ1ʱ<31><CAB1>Ч<EFBFBD><D0A7><EFBFBD>Ҹ<EFBFBD>>=32,nPicWidth*nPicHeight<5000w<30>ֱ<EFBFBD><D6B1>ʡ<EFBFBD>
unsigned char chReserve[8]; //reserve<76><65><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
}D3D_PIC_INFO;
/*<2A><>Ⱦͼ<C8BE><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
typedef enum tagPLAYM4PostProcType
{
PLAYM4_PPT_BRIGHTNESS = 0x1, ///< <20><><EFBFBD><EFBFBD> [-1.0, 1.0]
PLAYM4_PPT_HUE = 0x2, ///< ɫ<><C9AB> [0.0, 1.0]----0.166<EFBFBD>ۼ<EFBFBD>Ϊһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>1Ϊͬһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
PLAYM4_PPT_SATURATION = 0x3, ///< <20><><EFBFBD>Ͷ<EFBFBD> [-1.0, 1.0]
PLAYM4_PPT_CONTRAST = 0x4, ///< <20>Աȶ<D4B1> [-1.0, 1.0]
PLAYM4_PPT_SHARPNESS = 0x5, ///< <20><><EFBFBD><EFBFBD> [ 0.0, 1.0]
}PLAYM4PostProcType;
#endif
///<<3C><>Ⱦ<EFBFBD><C8BE>ץͼ:nType:0-jpeg,1-bmp.
PLAYM4_API int __stdcall PlayM4_GetD3DCapture(int nPort, unsigned int nType, D3D_PIC_INFO* pstPicInfo);
///<<3C><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
PLAYM4_API int __stdcall PlayM4_SetD3DPostProcess(int nPort, PLAYM4PostProcType nPostType, float fValue);
///<<3C><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_GetD3DPostProcess(int nPort, PLAYM4PostProcType nPostType, float* fValue);
///<<3C>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣩-playǰ<79><C7B0><EFBFBD><EFBFBD>
PLAYM4_API int __stdcall PlayM4_SetConfigFontPath(int nPort, char* pFontPath);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ȡmp4<70><34>װ<EFBFBD><D7B0><EFBFBD>߶<EFBFBD>λƫ<CEBB><C6AB>
PLAYM4_API int __stdcall PlayM4_GetMpOffset(int nPort, int nTime, int* nOffset);
///<ʱ<><CAB1><EFBFBD>ı<EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><><CDAC><EFBFBD>ط<EFBFBD>
PLAYM4_API bool __stdcall PlayM4_SetSupplementaryTimeZone(int nPort, int nTimeZone);
///<<3C><><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>򷵻<EFBFBD><F2B7B5BB><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7><><CDAC><EFBFBD>ط<EFBFBD>
PLAYM4_API bool __stdcall PlayM4_GetSupplementaryTimeZone(int nPort, int* pTimeZone);
////////////////////////////////////
///<<3C><><EFBFBD>ڴ<EFBFBD>С<EFBFBD>ı<EFBFBD>֪ͨ<CDA8>ӿ<EFBFBD>
PLAYM4_API int __stdcall PlayM4_WndResolutionChange(int nPort);//new add
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallBack(int nPort, void (CALLBACK* RunTimeInfoCBFun)(int nPort, RunTimeInfo* pstRunTimeInfo, void* pUser), void* pUser);
int PlayM4_RigisterDrawFun(int nPort,void (CALLBACK* DrawFun)(int nPort,PLAYM4_HDC hDc,void* nUser),void* nUser);
int PlayM4_SetDecCallBack(int nPort,void (CALLBACK* DecCBFun)(int nPort,char* pBuf,int nSize,FRAME_INFO * pFrameInfo, void* nReserved1,int nReserved2));
int PlayM4_SetDecCallBackEx(int nPort,void (CALLBACK* DecCBFun)(int nPort,char * pBuf,int nSize,FRAME_INFO * pFrameInfo, void* nReserved1,int nReserved2), char* pDest, int nDestSize);
int PlayM4_SetTimerType(int nPort,unsigned int nTimerType,unsigned int nReserved);
int PlayM4_GetTimerType(int nPort,unsigned int *pTimerType,unsigned int *pReserved);
int PlayM4_SetDisplayMode(int nPort, unsigned int dwType);
int PlayM4_SetVideoWindow(int nPort, unsigned int nRegionNum, PLAYM4_HWND hWnd);
/////////////////////////////////////////////////////////////////////////////
////////////////NO SUPPORT///////////////////////////////////////////////////
int PlayM4_InitDDraw(PLAYM4_HWND hWnd);
int PlayM4_RealeseDDraw();
#if (WINVER >= 0x0400)
//Note: These funtion must be builded under win2000 or above with Microsoft Platform sdk.
//You can download the sdk from "http://www.microsoft.com/msdownload/platformsdk/sdkupdate/";
int PlayM4_InitDDrawDevice();
void PlayM4_ReleaseDDrawDevice();
int PlayM4_SetDDrawDevice(int nPort, unsigned int nDeviceNum);
int PlayM4_SetDDrawDeviceEx(int nPort,unsigned int nRegionNum,unsigned int nDeviceNum);
int PlayM4_GetDDrawDeviceInfo(unsigned int nDeviceNum, char* lpDriverDescription, unsigned int nDespLen, char* lpDriverName, unsigned int nNameLen, HMONITOR* hhMonitor);
int PlayM4_GetCapsEx(unsigned int nDDrawDeviceNum);
unsigned int PlayM4_GetDDrawDeviceTotalNums();
#endif
int PlayM4_GetCaps();
int PlayM4_OpenStreamEx(int nPort, unsigned char* pFileHeadBuf, unsigned int nSize, unsigned int nBufPoolSize);
int PlayM4_CloseStreamEx(int nPort);
int PlayM4_InputVideoData(int nPort, unsigned char* pBuf, unsigned int nSize);
int PlayM4_InputAudioData(int nPort, unsigned char* pBuf, unsigned int nSize);
int PlayM4_GetFileSpecialAttr(int nPort, unsigned int* pTimeStamp, unsigned int* pFileNum, unsigned int* pReserved);
//int PlayM4_SetOverlayMode(int nPort, int bOverlay, COLORREF colorKey);
int PlayM4_GetOverlayMode(int nPort);
int PlayM4_SetOverlayFlipMode(int nPort, int bTrue);
//COLORREF PlayM4_GetColorKey(int nPort);
int PlayM4_SetPicQuality(int nPort, int bHighQuality);
int PlayM4_GetPictureQuality(int nPort, int* bHighQuality);
int PlayM4_ResetSourceBufFlag(int nPort);
int PlayM4_SetDisplayType(int nPort, int nType);
int PlayM4_GetDisplayType(int nPort);
int PlayM4_SyncToAudio(int nPort, int bSyncToAudio);
int PlayM4_RefreshPlayEx(int nPort, unsigned int nRegionNum);
int PlayM4_AdjustWaveAudio(int nPort, int nCoefficient);
int PlayM4_SetPlayMode(int nPort, int bNormal);
int PlayM4_SetColor(int nPort, unsigned int nRegionNum, int nBrightness, int nContrast, int nSaturation, int nHue);
int PlayM4_GetColor(int nPort, unsigned int nRegionNum, int* pBrightness, int* pContrast, int* pSaturation, int* pHue);
int PlayM4_SetImageSharpen(int nPort, unsigned int nLevel);
int PlayM4_SetDeflash(int nPort, int bDefalsh);
int PlayM4_CheckDiscontinuousFrameNum(int nPort, int bCheck);
int PlayM4_SetFileEndMsg(int nPort, PLAYM4_HWND hWnd, unsigned int nMsg);
int PlayM4_SetVerifyCallBack(int nPort, unsigned int nBeginTime, unsigned int nEndTime, void (__stdcall* funVerify)(int nPort, FRAME_POS* pFilePos, unsigned int bIsVideo, unsigned int nUser), unsigned int nUser);
int PlayM4_SetEncChangeMsg(int nPort, PLAYM4_HWND hWnd, unsigned int nMsg);
int PlayM4_SetGetUserDataCallBack(int nPort, void(CALLBACK* funGetUserData)(int nPort, unsigned char* pUserBuf, unsigned int nBufLen, unsigned int nUser), unsigned int nUser);
int PlayM4_SetSourceBufCallBack(int nPort, unsigned int nThreShold, void (CALLBACK* SourceBufCallBack)(int nPort, unsigned int nBufSize, unsigned int dwUser, void* pResvered), unsigned int dwUser, void* pReserved);
int PlayM4_GetOriginalFrameCallBack(int nPort, int bIsChange, int bNormalSpeed, int nStartFrameNum, int nStartStamp, int nFileHeader, void(CALLBACK *funGetOrignalFrame)(int nPort, FRAME_TYPE* frameType, int nUser), int nUser);
int PlayM4_GetThrowBFrameCallBack(int nPort, void(CALLBACK* funThrowBFrame)(int nPort, unsigned int nBFrame, unsigned int nUser), unsigned int nUser);
int PlayM4_SetAudioCallBack(int nPort, void (__stdcall* funAudio)(int nPort, char* pAudioBuf, int nSize, int nStamp, int nType, int nUser), int nUser);
//motionflow
PLAYM4_API int __stdcall PlayM4_MotionFlow(int nPort, unsigned int dwAdjustType);
////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif
#endif //_PLAYM4_H_

23761
src/json.hpp Normal file

File diff suppressed because it is too large Load Diff