refactor: 删除未使用的代码文件

- 移除 Core 目录下的 CallBack.go、core.go 和 Type.go 文件
- 这些文件包含了未使用的类型定义和函数实现
- 删除冗余代码有助于简化项目结构,提高代码可读性和维护性
This commit is contained in:
kunmeng
2025-05-30 14:15:24 +08:00
parent b4c50572d8
commit c8cb43e9b3
123 changed files with 161431 additions and 53914 deletions

10
.gitignore vendored
View File

@@ -1,13 +1,3 @@
/.idea /.idea
/.cache /.cache
/.fleet /.fleet
*.lib
*.dll
*.so
*.a
*.zip
/build
/arm64_linux_lib
/arm64_windows_lib
/amd64_linux_lib
/libs/

View File

@@ -1,19 +1,9 @@
package HikSDK package HikSDK
/*
#cgo LDFLAGS: -Wl,--allow-multiple-definition
#include <stdio.h>
#include <string.h>
*/
import "C"
import ( import (
"encoding/binary"
"errors" "errors"
"fmt" "fmt"
"gitea.com/kunmeng/HikNetSDKPkg/Core"
"sync" "sync"
"time"
"unsafe"
) )
const ( const (
@@ -161,15 +151,15 @@ var HikPTZEnum = struct {
} }
type BallCamera struct { type BallCamera struct {
userId Core.LONG userId LONG
_type uint8 _type uint8
deviceInfo Core.NET_DVR_DEVICEINFO_V30 deviceInfo NET_DVR_DEVICEINFO
mu sync.Mutex mu sync.Mutex
expectedType byte expectedType byte
} }
func NewBallCamera(Ip string, Port int, Username, Password string, Type uint8) (*BallCamera, error) { func NewBallCamera(Ip string, Port int, Username, Password string, Type uint8) (*BallCamera, error) {
UserId, DeviceInfo, err := Core.Login(Ip, Port, Username, Password) UserId, DeviceInfo, err := login(Ip, Port, Username, Password)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -181,9 +171,10 @@ func NewBallCamera(Ip string, Port int, Username, Password string, Type uint8) (
} }
type PTZ struct { type PTZ struct {
P float32 Action int
T float32 P float64
Z float32 T float64
Z float64
} }
func (this *BallCamera) GetPTZ() (PTZ, error) { func (this *BallCamera) GetPTZ() (PTZ, error) {
@@ -191,81 +182,26 @@ func (this *BallCamera) GetPTZ() (PTZ, error) {
return PTZ{}, errors.New("BallCamera is nil") return PTZ{}, errors.New("BallCamera is nil")
} }
if this._type == BuKongQiu { if this._type == BuKongQiu {
var data PTZ ptzpos, err := GetPTZPOS(this.userId)
ch := make(chan bool)
SerialStartHandle, err := Core.SerialStart(this.userId, func(lSerialHandle Core.LONG, lChannel Core.LONG, pRecvDataBuffer []byte, dwBufSize Core.DWORD, pUser unsafe.Pointer) {
if dwBufSize != 7 {
ch <- false
return
}
Type := pRecvDataBuffer[3]
this.mu.Lock()
expected := this.expectedType
this.mu.Unlock()
if Type != expected {
ch <- false
return
}
switch Type {
case 0x59:
data.P = float32(binary.BigEndian.Uint16(pRecvDataBuffer[4:6])) / 100.
case 0x5B:
data.T = float32(binary.BigEndian.Uint16(pRecvDataBuffer[4:6])) / 100.
case 0x5D:
data.Z = float32(binary.BigEndian.Uint16(pRecvDataBuffer[4:6])) / 100.
default:
ch <- false
}
ch <- true
})
if err != nil {
return data, err
}
defer func() {
err = Core.SerialStop(SerialStartHandle)
if err != nil {
println(err.Error())
}
time.Sleep(1 * time.Second)
}()
// 获取P值
this.mu.Lock()
this.expectedType = 0x59
this.mu.Unlock()
if err := this.retrySend(SerialStartHandle, []byte{0xff, 0x01, 0x00, 0x51, 0x00, 0x00, 0x52}, 5, ch); err != nil {
return data, fmt.Errorf("获取P值失败: %w", err)
}
this.mu.Lock()
this.expectedType = 0x5B
this.mu.Unlock()
if err := this.retrySend(SerialStartHandle, []byte{0xff, 0x01, 0x00, 0x53, 0x00, 0x00, 0x54}, 5, ch); err != nil {
return data, fmt.Errorf("获取T值失败: %w", err)
}
this.mu.Lock()
this.expectedType = 0x5D
this.mu.Unlock()
if err := this.retrySend(SerialStartHandle, []byte{0xff, 0x01, 0x00, 0x55, 0x00, 0x00, 0x56}, 5, ch); err != nil {
return data, fmt.Errorf("获取Z值失败: %w", err)
}
return data, nil
}
var data Core.CDVR_PTZPOS
var dataPtr = unsafe.Pointer(&data)
err := Core.GetDVRConfig(this.userId, 293, 1, dataPtr, Core.DWORD(unsafe.Sizeof(data)))
if err != nil { if err != nil {
return PTZ{}, err return PTZ{}, err
} }
res := data.Go()
return PTZ{ return PTZ{
P: float32(res.WPanPos), Action: ptzpos.Action,
T: float32(res.WTiltPos), P: float64(ptzpos.P),
Z: float32(res.WZoomPos), T: float64(ptzpos.T),
Z: float64(ptzpos.Z),
}, nil
}
ptz, err := getPTZBase(this.userId)
if err != nil {
return PTZ{}, err
}
return PTZ{
P: ptz.P,
T: ptz.T,
Z: ptz.Z,
}, nil }, nil
} }
func padding(n int) ([]byte, error) { func padding(n int) ([]byte, error) {
@@ -274,25 +210,11 @@ func padding(n int) ([]byte, error) {
} }
return []byte{byte(n >> 8), byte(n & 0xFF)}, nil return []byte{byte(n >> 8), byte(n & 0xFF)}, nil
} }
func (this *BallCamera) PtzGotoPut(Action int, P, T, Z float64) error { func (this *BallCamera) PtzGotoPut(Action int, P, T, Z float64) error {
if this == nil { if this == nil {
return errors.New("BallCamera is nil") return errors.New("BallCamera is nil")
} }
if this._type == BuKongQiu { if this._type == BuKongQiu {
SerialStartHandle, err := Core.SerialStart(this.userId, func(lSerialHandle Core.LONG, lChannel Core.LONG, pRecvDataBuffer []byte, dwBufSize Core.DWORD, pUser unsafe.Pointer) {
})
if err != nil {
return err
}
defer func() {
err = Core.SerialStop(SerialStartHandle)
if err != nil {
println(err.Error())
}
time.Sleep(1 * time.Second)
}()
PByte, err := padding(int(P * 100)) PByte, err := padding(int(P * 100))
if err != nil { if err != nil {
return err return err
@@ -324,83 +246,16 @@ func (this *BallCamera) PtzGotoPut(Action int, P, T, Z float64) error {
pBuf = append(pBuf, pBufv) pBuf = append(pBuf, pBufv)
tBuf = append(tBuf, tBufv) tBuf = append(tBuf, tBufv)
zBuf = append(zBuf, zBufv) zBuf = append(zBuf, zBufv)
switch Action { err = SetPTZPos(this.userId, pBuf, tBuf, zBuf)
case 1:
err = Core.SerialSend(SerialStartHandle, pBuf)
if err != nil {
return err
}
err = Core.SerialSend(SerialStartHandle, tBuf)
if err != nil {
return err
}
err = Core.SerialSend(SerialStartHandle, zBuf)
if err != nil {
return err
}
break
case 2:
err = Core.SerialSend(SerialStartHandle, pBuf)
if err != nil {
return err
}
break
case 3:
err = Core.SerialSend(SerialStartHandle, tBuf)
if err != nil {
return err
}
break
case 4:
err = Core.SerialSend(SerialStartHandle, zBuf)
if err != nil {
return err
}
break
case 5:
err = Core.SerialSend(SerialStartHandle, pBuf)
if err != nil {
return err
}
err = Core.SerialSend(SerialStartHandle, tBuf)
if err != nil {
return err
}
break
default:
return errors.New("action error")
}
return nil
}
var data Core.CDVR_PTZPOS
data.Set(float64(Action), P, T, Z)
var dataPtr = unsafe.Pointer(&data)
err := Core.SetDVRConfig(this.userId, 292, 1, dataPtr, Core.DWORD(unsafe.Sizeof(data)))
if err != nil { if err != nil {
return err return err
} }
return nil return nil
}
func (this *BallCamera) retrySend(handle Core.LONG, cmd []byte, maxRetries int, ch <-chan bool) error {
for retry := 0; retry < maxRetries; retry++ {
if err := Core.SerialSend(handle, cmd); err != nil {
return err
} }
select { err := setPTZBase(this.userId, PTZ{Action, P, T, Z})
case success := <-ch: if err != nil {
if success { return err
return nil
}
if retry == maxRetries-1 {
return fmt.Errorf("达到最大重试次数 %d", maxRetries)
}
case <-time.After(2 * time.Second): // 添加超时机制
if retry == maxRetries-1 {
return fmt.Errorf("响应超时,重试 %d 次后失败", maxRetries)
}
}
} }
return nil return nil
} }
@@ -409,7 +264,7 @@ func (receiver *BallCamera) StartBus(direction int, speed int) error {
if receiver == nil { if receiver == nil {
return errors.New("BallCamera is nil") return errors.New("BallCamera is nil")
} }
err := Core.PTZControlWithSpeed_Other(receiver.userId, Core.LONG(receiver.deviceInfo.ByStartChan), Core.DWORD(PTZEnum.toHikPTZEnum(direction)), Core.DWORD(0), Core.DWORD(speed)) err := pTZControlWithSpeed_Other(receiver.userId, DWORD(PTZEnum.toHikPTZEnum(direction)), DWORD(0), DWORD(speed))
if err != nil { if err != nil {
return err return err
} }
@@ -419,7 +274,7 @@ func (receiver *BallCamera) StopBus(direction int, speed int) error {
if receiver == nil { if receiver == nil {
return errors.New("BallCamera is nil") return errors.New("BallCamera is nil")
} }
err := Core.PTZControlWithSpeed_Other(receiver.userId, Core.LONG(receiver.deviceInfo.ByStartChan), Core.DWORD(PTZEnum.toHikPTZEnum(direction)), Core.DWORD(1), Core.DWORD(speed)) err := pTZControlWithSpeed_Other(receiver.userId, DWORD(PTZEnum.toHikPTZEnum(direction)), DWORD(1), DWORD(speed))
if err != nil { if err != nil {
return err return err
} }
@@ -443,12 +298,12 @@ func (this *BallCamera) Logout() error {
if this == nil { if this == nil {
return errors.New("BallCamera is nil") return errors.New("BallCamera is nil")
} }
return Core.Logout(this.userId) return logout(this.userId)
} }
func (this *BallCamera) Status() bool { func (this *BallCamera) Status() bool {
if this == nil { if this == nil {
return false return false
} }
return Core.NET_DVR_RemoteControl(this.userId) return deviceOnline(this.userId)
} }

View File

@@ -2,18 +2,17 @@ package HikSDK
import ( import (
"fmt" "fmt"
"gitea.com/kunmeng/HikNetSDKPkg/Core"
"testing" "testing"
"time" "time"
) )
func TestCamera(t *testing.T) { func TestCamera(t *testing.T) {
err := Core.Init() err := Init()
if err != nil { if err != nil {
return return
} }
//Camera, err := NewBallCamera("192.168.211.48", 8000, "admin", "okwy1234", BuKongQiu) //Camera, err := NewBallCamera("192.168.211.62", 8000, "admin", "ubis3333", BuKongQiux)
Camera, err := NewBallCamera("192.168.211.64", 8000, "admin", "ubis3333", Base) Camera, err := NewBallCamera("192.168.211.48", 8000, "admin", "okwy1234", BuKongQiu)
if err != nil { if err != nil {
t.Errorf("NewBallCamera() error = %v", err) t.Errorf("NewBallCamera() error = %v", err)
return return
@@ -29,17 +28,18 @@ func TestCamera(t *testing.T) {
return return
} }
err = Camera.PtzGotoPut(1, 11.11, 22.22, 33.33) err = Camera.PtzGotoPut(5, 11, 355, 14)
if err != nil { if err != nil {
return return
} }
for i := 0; i < 1; i++ { for i := 0; i < 10; i++ {
ptzdata, err := Camera.GetPTZ() ptzdata, err := Camera.GetPTZ()
if err != nil { if err != nil {
t.Errorf("GetPTZ() error = %v", err) t.Errorf("GetPTZ() error = %v", err)
return return
} }
time.Sleep(1000 * time.Millisecond)
fmt.Printf("%.2f %.2f %.2f \n", ptzdata.P, ptzdata.T, ptzdata.Z) fmt.Printf("%.2f %.2f %.2f \n", ptzdata.P, ptzdata.T, ptzdata.Z)
} }
err = Camera.Logout() err = Camera.Logout()

421
Core.go Normal file
View File

@@ -0,0 +1,421 @@
package HikSDK
/*
#cgo windows,amd64 LDFLAGS: -L${SRCDIR}/library/amd64_windows/lib -lHCCore -lhcnetsdk
#cgo linux,amd64 LDFLAGS: -L${SRCDIR}/library/amd64_linux/lib -lHCCore -lhcnetsdk
#cgo linux,arm64 LDFLAGS: -L${SRCDIR}/library/arm64_linux/lib -lHCCore -lhcnetsdk
#cgo windows,amd64 CFLAGS: -I${SRCDIR}/library/amd64_windows/include
#cgo linux,amd64 CFLAGS: -I${SRCDIR}/library/amd64_linux/include
#cgo linux,arm64 CFLAGS: -I${SRCDIR}/library/arm64_linux/include
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "HCNetSDK.h"
typedef struct DEVICEINFO
{
BYTE byChanNum;
BYTE byStartChan;
} DEVICEINFO;
typedef struct PTZ{
WORD P;
WORD T;
WORD Z;
} PTZ;
typedef struct TimeRange
{
DWORD StartYear;
DWORD StartMonth;
DWORD StartDay;
DWORD StartHour;
DWORD StartMinute;
DWORD StartSecond;
DWORD EndYear;
DWORD EndMonth;
DWORD EndDay;
DWORD EndHour;
DWORD EndMinute;
DWORD EndSecond;
} TimeRange;
LONG Login(char *sDVRIP,WORD wDVRPort,char *sUserName,char *sPassword,struct DEVICEINFO *info){
NET_DVR_DEVICEINFO hikInfo;
LONG lUserID = NET_DVR_Login(sDVRIP, wDVRPort, sUserName, sPassword,&hikInfo);
info->byChanNum = hikInfo.byChanNum;
info->byStartChan = hikInfo.byStartChan;
return lUserID;
}
int GetTimeZone(LONG lUserID){
NET_DVR_NETAPPCFG NTPData;
DWORD RESLEN;
NET_DVR_GetDVRConfig(lUserID,222,0,&NTPData,sizeof(NTPData),&RESLEN);
return NTPData.struNtpClientParam.cTimeDifferenceH*60 + NTPData.struNtpClientParam.cTimeDifferenceM*((NTPData.struNtpClientParam.cTimeDifferenceH>>7)?-1:1);
}
void GetPTZ(LONG lUserID,PTZ *info){
NET_DVR_PTZPOS PTZPOS;
DWORD RESLEN;
NET_DVR_GetDVRConfig(lUserID,293,1,&PTZPOS,sizeof(PTZPOS),&RESLEN);
info->P = PTZPOS.wPanPos;
info->T = PTZPOS.wTiltPos;
info->Z = PTZPOS.wZoomPos;
return;
}
void SetPTZ(LONG lUserID,WORD action,WORD p,WORD t,WORD z){
NET_DVR_PTZPOS PTZPOS;
PTZPOS.wAction = action;
PTZPOS.wPanPos = p;
PTZPOS.wTiltPos = t;
PTZPOS.wZoomPos = z;
NET_DVR_SetDVRConfig(lUserID,292,1,&PTZPOS,sizeof(PTZPOS));
}
void QueryMonth(LONG lUserID,WORD Year,BYTE Month,DWORD Channel,BYTE *byRecordDistribution){
NET_DVR_MRD_SEARCH_PARAM SEARCH_PARAM;
SEARCH_PARAM.dwSize = sizeof(SEARCH_PARAM);
SEARCH_PARAM.wYear = Year;
SEARCH_PARAM.byMonth = Month;
SEARCH_PARAM.struStreamInfo.dwChannel = 32 + Channel;
SEARCH_PARAM.byLocalOrUTC = 1;
SEARCH_PARAM.byDrawFrame = 0;
SEARCH_PARAM.byStreamType = 0;
LPVOID lpStatusList = malloc(sizeof(SEARCH_PARAM));
NET_DVR_MRD_SEARCH_RESULT SEARCH_RESULT;
NET_DVR_GetDeviceConfig(lUserID,6164,0,&SEARCH_PARAM,sizeof(SEARCH_PARAM),lpStatusList,&SEARCH_RESULT,sizeof(SEARCH_RESULT));
free(lpStatusList);
memcpy(byRecordDistribution,SEARCH_RESULT.byRecordDistribution,32);
}
LONG QueryDayHandle(LONG lUserID,DWORD Year,DWORD Month,DWORD Day,LONG Channel){
NET_DVR_FILECOND FindFile;
FindFile.dwFileType = 0xff;
FindFile.dwIsLocked = 0xff;
FindFile.dwUseCardNo = 0;
FindFile.lChannel = 32 + Channel;
FindFile.struStartTime.dwYear = Year;
FindFile.struStartTime.dwMonth = Month;
FindFile.struStartTime.dwDay = Day;
FindFile.struStartTime.dwHour = 0;
FindFile.struStartTime.dwMinute = 0;
FindFile.struStartTime.dwSecond = 0;
FindFile.struStopTime.dwYear = Year;
FindFile.struStopTime.dwMonth = Month;
FindFile.struStopTime.dwDay = Day;
FindFile.struStopTime.dwHour = 23;
FindFile.struStopTime.dwMinute = 59;
FindFile.struStopTime.dwSecond = 59;
return NET_DVR_FindFile_V30(lUserID, &FindFile);
}
LONG QueryDayNextFile(LONG QueryHandle,struct TimeRange *TimeRange){
NET_DVR_FINDDATA_V30 Data;
LONG STATE = NET_DVR_FindNextFile_V30(QueryHandle,&Data);
TimeRange->StartYear = Data.struStartTime.dwYear;
TimeRange->StartMonth = Data.struStartTime.dwMonth;
TimeRange->StartDay = Data.struStartTime.dwDay;
TimeRange->StartHour = Data.struStartTime.dwHour;
TimeRange->StartMinute = Data.struStartTime.dwMinute;
TimeRange->StartSecond = Data.struStartTime.dwSecond;
TimeRange->EndYear = Data.struStopTime.dwYear;
TimeRange->EndMonth = Data.struStopTime.dwMonth;
TimeRange->EndDay = Data.struStopTime.dwDay;
TimeRange->EndHour = Data.struStopTime.dwHour;
TimeRange->EndMinute = Data.struStopTime.dwMinute;
TimeRange->EndSecond = Data.struStopTime.dwSecond;
return STATE;
}
struct SerialData
{
float p;
float t;
float z;
};
struct SerialData serialData;
void CALLBACK g_fSerialDataCallBack(LONG lSerialHandle, char *pRecvDataBuffer, DWORD dwBufSize, DWORD dwUser)
{
char type = pRecvDataBuffer[3];
printf("type: %x\n", type);
if (type == 0x59){
serialData.p = (float)ntohs(*(uint16_t*)(pRecvDataBuffer + 4))/100.0f;
}else if (type == 0x5b){
serialData.t = (float)ntohs(*(uint16_t*)(pRecvDataBuffer + 4))/100.0f;
}else if (type == 0x5d){
serialData.z = (float)ntohs(*(uint16_t*)(pRecvDataBuffer + 4))/100.0f;
}
}
void GetPTZPOS(LONG lUserID)
{
char p[7] = {0xff, 0x01, 0x00, 0x51, 0x00, 0x00, 0x52};
char t[7] = {0xff, 0x01, 0x00, 0x53, 0x00, 0x00, 0x54};
char z[7] = {0xff, 0x01, 0x00, 0x55, 0x00, 0x00, 0x56};
LONG lTranHandle = NET_DVR_SerialStart(lUserID, 2,g_fSerialDataCallBack,6);
LONG lSerialChan = 0;
sleep(1);
NET_DVR_SerialSend(lTranHandle, lSerialChan, p, 7);
sleep(1);
NET_DVR_SerialSend(lTranHandle, lSerialChan, t, 7);
sleep(1);
NET_DVR_SerialSend(lTranHandle, lSerialChan, z, 7);
sleep(1);
NET_DVR_SerialStop(lTranHandle);
}
void SetPTZPOS(LONG lUserID,char* P,char* T,char *Z)
{
LONG lTranHandle = NET_DVR_SerialStart(lUserID, 2,g_fSerialDataCallBack,6);
LONG lSerialChan = 0;
sleep(1);
NET_DVR_SerialSend(lTranHandle, lSerialChan, P, 7);
sleep(1);
NET_DVR_SerialSend(lTranHandle, lSerialChan, T, 7);
sleep(1);
NET_DVR_SerialSend(lTranHandle, lSerialChan, Z, 7);
sleep(1);
NET_DVR_SerialStop(lTranHandle);
sleep(1);
}
*/
import "C"
import (
"math"
"sync"
"unsafe"
)
type LONG int32
type BYTE uint8
type DWORD uint32
type WORD uint16
type NET_DVR_DEVICEINFO struct {
ByChanNum BYTE
ByStartChan BYTE // 起始数字通道号0表示无数字通道比如DVR或IPC
}
// Init 初始化SDK调用其他SDK函数的前提。
func Init() error {
if C.NET_DVR_Init() != 1 {
return lastError("NET_DVR_Init")
}
return nil
}
// Cleanup 释放SDK资源在程序结束之前调用。在调用时不能同时调用其他任何SDK接口。 Init 和 Cleanup 需要配对使用,即程序里面调用多少次 Init ,退出时就需要调用多少次 Cleanup。
func Cleanup() error {
if C.NET_DVR_Cleanup() != 1 {
return lastError("NET_DVR_Cleanup")
}
return nil
}
func login(Ip string, Port int, Username string, Password string) (LONG, NET_DVR_DEVICEINFO, error) {
cIp := C.CString(Ip)
cUser := C.CString(Username)
cPass := C.CString(Password)
defer C.free(unsafe.Pointer(cIp))
defer C.free(unsafe.Pointer(cUser))
defer C.free(unsafe.Pointer(cPass))
var info C.DEVICEINFO
userId := LONG(C.Login(cIp, C.WORD(Port), cUser, cPass, &info))
err := lastError("login")
if err != nil {
return 0, NET_DVR_DEVICEINFO{}, err
}
return userId, NET_DVR_DEVICEINFO{
ByChanNum: BYTE(info.byChanNum),
ByStartChan: BYTE(info.byStartChan)},
nil
}
func lastError(funcName string) error {
ErrorCode := uint(C.NET_DVR_GetLastError())
if ErrorCode == 0 {
return nil
}
var text string
if ErrorCode == 3 {
text = "sdk not init."
return NewHcnetError(int(ErrorCode), text, funcName)
}
cErrorCode := C.LONG(ErrorCode)
cText := C.NET_DVR_GetErrorMsg(&cErrorCode)
text = C.GoString(cText)
return NewHcnetError(int(ErrorCode), text, funcName)
}
func getTimeZone(lUserId LONG) int {
return int(C.GetTimeZone(C.LONG(lUserId)))
}
func deviceOnline(lUserId LONG) bool {
return C.NET_DVR_RemoteControl(C.LONG(lUserId), C.DWORD(20005), nil, C.DWORD(0)) == C.TRUE
}
func logout(lUserId LONG) error {
if lUserId > -1 {
cResult := C.NET_DVR_Logout(C.LONG(lUserId))
if cResult != 1 {
return lastError("NET_DVR_Logout")
}
}
return nil
}
func pTZControlWithSpeed_Other(lUserID LONG, dwPTZCommand DWORD, dwStop DWORD, dwSpeed DWORD) error {
state := C.NET_DVR_PTZControlWithSpeed_Other(C.LONG(lUserID), 1, C.DWORD(dwPTZCommand), C.DWORD(dwStop), C.DWORD(dwSpeed))
if state == C.FALSE {
return lastError("NET_DVR_PTZControlWithSpeed_Other")
}
return nil
}
func getPTZBase(lUserID LONG) (PTZ, error) {
var info C.PTZ
C.GetPTZ(C.LONG(lUserID), &info)
err := lastError("GetPTZ")
if err != nil {
return PTZ{}, err
}
return PTZ{
P: HEX2DEC(WORD(info.P)),
T: HEX2DEC(WORD(info.T)),
Z: HEX2DEC(WORD(info.Z))},
nil
}
func setPTZBase(lUserID LONG, ptz PTZ) error {
C.SetPTZ(C.LONG(lUserID), C.WORD(ptz.Action), C.WORD(DEC2HEX(float64(ptz.P))), C.WORD(DEC2HEX(float64(ptz.T))), C.WORD(DEC2HEX(float64(ptz.Z))))
return lastError("SetPTZ")
}
// HEX2DEC 将十六进制整数转换为十进制浮点数
func HEX2DEC(hex WORD) float64 {
// 提取十六进制数的千位(对应十进制的百位)
bai := byte(hex >> 12)
hex = hex - WORD(bai)*WORD(math.Pow(16, 3))
// 提取十六进制数的百位(对应十进制的十位)
shi := byte(hex >> 8)
hex = hex - WORD(shi)*WORD(math.Pow(16, 2))
// 提取十六进制数的十位(对应十进制的个位)
ge := byte(hex >> 4)
hex = hex - WORD(ge)*WORD(math.Pow(16, 1))
// 提取十六进制数的个位(对应十进制的十分位)
xiao := byte(hex)
// 计算对应的十进制浮点数
return float64(bai)*math.Pow(10, 2) + float64(shi)*math.Pow(10, 1) + float64(ge)*math.Pow(10, 0) + float64(xiao)*math.Pow(10, -1)
}
// DEC2HEX 将十进制浮点数转换为十六进制整数
func DEC2HEX(dec float64) WORD {
// 提取千位(对应十进制的百位)
bai := uint16(dec / math.Pow(10, 2))
dec -= float64(bai) * math.Pow(10, 2)
// 提取百位(对应十进制的十位)
shi := uint16(dec / math.Pow(10, 1))
dec -= float64(shi) * math.Pow(10, 1)
// 提取十位(对应十进制的个位)
ge := uint16(dec / math.Pow(10, 0))
dec -= float64(ge) * math.Pow(10, 0)
// 提取个位(对应十进制的十分位)
xiao := uint16(dec * 10)
// 合成十六进制数
hex := WORD(bai)<<12 | WORD(shi)<<8 | WORD(ge)<<4 | WORD(xiao)
return hex
}
func QueryMonth(lUserID LONG, Year WORD, Month BYTE, Channel DWORD) (res []uint8, err error) {
buf := (*C.BYTE)(C.malloc(32))
defer C.free(unsafe.Pointer(buf))
C.QueryMonth(C.LONG(lUserID), C.WORD(Year), C.BYTE(Month), C.DWORD(Channel), buf)
goBuf := C.GoBytes(unsafe.Pointer(buf), 32)
for i := 0; i < 32; i++ {
if goBuf[i] != 0 {
res = append(res, uint8(i+1))
}
}
err = lastError("QueryMonth")
return
}
func QueryDayHandle(lUserID LONG, Year, Month, Day DWORD, Channel LONG) LONG {
return LONG(C.QueryDayHandle(C.LONG(lUserID), C.DWORD(Year), C.DWORD(Month), C.DWORD(Day), C.LONG(Channel)))
}
func QueryDayNextFile(Handle LONG) (TimeRange, LONG, error) {
var FindData C.TimeRange
state := LONG(C.QueryDayNextFile(C.LONG(Handle), &FindData))
if state < 0 {
return TimeRange{}, state, lastError("QueryDayNextFile")
}
return TimeRange{
StartYear: DWORD(FindData.StartYear),
StartMonth: DWORD(FindData.StartMonth),
StartDay: DWORD(FindData.StartDay),
StartHour: DWORD(FindData.StartHour),
StartMinute: DWORD(FindData.StartMinute),
StartSecond: DWORD(FindData.StartSecond),
EndYear: DWORD(FindData.EndYear),
EndMonth: DWORD(FindData.EndMonth),
EndDay: DWORD(FindData.EndDay),
EndHour: DWORD(FindData.EndHour),
EndMinute: DWORD(FindData.EndMinute),
EndSecond: DWORD(FindData.EndSecond),
}, state, nil
}
func FindClose(Handle LONG) error {
C.NET_DVR_FindClose_V30(C.LONG(Handle))
return lastError("NET_DVR_FindClose_V30")
}
var SerialMux sync.Mutex
func SetPTZPos(lUserID LONG, P []byte, T []byte, Z []byte) error {
cP := C.CBytes(P)
cT := C.CBytes(T)
cZ := C.CBytes(Z)
defer C.free(cP)
defer C.free(cT)
defer C.free(cZ)
SerialMux.Lock()
C.SetPTZPOS(C.LONG(lUserID), (*C.char)(cP), (*C.char)(cT), (*C.char)(cZ))
SerialMux.Unlock()
return lastError("SetPTZPOS")
}
func GetPTZPOS(lUserID LONG) (PTZ, error) {
SerialMux.Lock()
C.GetPTZPOS(C.LONG(lUserID))
p := float32(C.serialData.p)
t := float32(C.serialData.t)
z := float32(C.serialData.z)
SerialMux.Unlock()
return PTZ{
P: float64(p),
T: float64(t),
Z: float64(z),
}, lastError("GetPTZPOS")
}

View File

@@ -1,42 +0,0 @@
package Core
/*
#cgo CFLAGS: -I../include
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "HCNetSDK.h"
*/
import "C"
import "unsafe"
func charPtrToByteSlice(cstr *C.char, dwBufSize DWORD) []byte {
goSlice := C.GoBytes(unsafe.Pointer(cstr), C.int(dwBufSize))
return goSlice
}
var serialCallBackHooks = make(map[LONG]serialDataCallBack)
type serialDataCallBack func(lSerialHandle LONG, lChannel LONG, pRecvDataBuffer []byte, dwBufSize DWORD, pUser unsafe.Pointer)
//export fSerialDataCallBackGo
func fSerialDataCallBackGo(lSerialHandle C.LONG, lChannel C.LONG, pRecvDataBuffer *C.char, dwBufSize C.DWORD, pUser *C.void) {
callback := serialCallBackHooks[LONG(lSerialHandle)]
println(DWORD(dwBufSize))
if callback != nil {
callback(LONG(lSerialHandle), LONG(lChannel), charPtrToByteSlice(pRecvDataBuffer, DWORD(dwBufSize)), DWORD(dwBufSize), unsafe.Pointer(pUser))
}
}
var exceptionCallBackHooks = make(map[int]ExceptionCallBack)
type ExceptionCallBack func(dwType uint32, lUserID int32, lHandle int32, pUser interface{})
//export fExceptionCallBackGo
func fExceptionCallBackGo(dwType C.DWORD, lUserID C.LONG, lHandle C.LONG, pUser *C.void) {
callback := exceptionCallBackHooks[int(lUserID)]
if callback != nil {
callback(uint32(dwType), int32(lUserID), int32(lHandle), pUser)
}
}

View File

@@ -1,492 +0,0 @@
package Core
/*
#include "HCNetSDK.h"
*/
import "C"
import "unsafe"
const NAME_LEN = 32
const PASSWD_LEN = 16
const SERIALNO_LEN = 48
const STREAM_ID_LEN = 32
type DWORD uint32
type WORD uint16
type USHORT WORD
type SHORT int16
type LONG int32
type BYTE uint8
type UINT uint32
// type LPVOID void*
// type HANDLE void*
// type LPDWORD unsigned int*
type UINT64 uint64
type INT64 int64
type NET_DVR_DEVICEINFO_V30 struct {
cData C.NET_DVR_DEVICEINFO_V30
SSerialNumber []byte // 序列号
ByAlarmInPortNum BYTE // 模拟报警输入个数
ByAlarmOutPortNum BYTE // 模拟报警输出个数
ByDiskNum BYTE // 硬盘个数
ByDVRType BYTE // 设备类型
ByChanNum BYTE // 设备模拟通道个数数字IP通道最大个数为byIPChanNum + byHighDChanNum*256
ByStartChan BYTE // 模拟通道的起始通道号从1开始。数字通道的起始通道号见下面参数byStartDChan
ByAudioChanNum BYTE // 设备语音对讲通道数
ByIPChanNum BYTE // 设备最大数字通道个数低8位高8位见byHighDChanNum。可以根据IP通道个数来判断是否调用NET_DVR_GetDVRConfig配置命令NET_DVR_GET_IPPARACFG_V40获取模拟和数字通道相关参数NET_DVR_IPPARACFG_V40
ByZeroChanNum BYTE // 零通道编码个数
ByMainProto BYTE // 主码流传输协议类型0- private1- rtsp2- 同时支持私有协议和rtsp协议取流默认采用私有协议取流
BySubProto BYTE // 子码流传输协议类型0- private1- rtsp2- 同时支持私有协议和rtsp协议取流默认采用私有协议取流
BySupport BYTE // 能力位与结果为0表示不支持1表示支持
//bySupport & 0x1表示是否支持智能搜索
//bySupport & 0x2表示是否支持备份
//bySupport & 0x4表示是否支持压缩参数能力获取
//bySupport & 0x8, 表示是否支持双网卡
//bySupport & 0x10, 表示支持远程SADP
//bySupport & 0x20, 表示支持Raid卡功能
//bySupport & 0x40, 表示支持IPSAN目录查找
//bySupport & 0x80, 表示支持rtp over rtsp
BySupport1 BYTE // 能力集扩充位与结果为0表示不支持1表示支持
//bySupport1 & 0x1, 表示是否支持snmp v30
//bySupport1 & 0x2, 表示是否支持区分回放和下载
//bySupport1 & 0x4, 表示是否支持布防优先级
//bySupport1 & 0x8, 表示智能设备是否支持布防时间段扩展
//bySupport1 & 0x10,表示是否支持多磁盘数超过33个
//bySupport1 & 0x20,表示是否支持rtsp over http
//bySupport1 & 0x80,表示是否支持车牌新报警信息且还表示是否支持NET_DVR_IPPARACFG_V40配置
BySupport2 BYTE // 能力集扩充位与结果为0表示不支持1表示支持
//bySupport2 & 0x1, 表示解码器是否支持通过URL取流解码
//bySupport2 & 0x2, 表示是否支持FTPV40
//bySupport2 & 0x4, 表示是否支持ANR(断网录像)
//bySupport2 & 0x20, 表示是否支持单独获取设备状态子项
//bySupport2 & 0x40, 表示是否是码流加密设备
WDevType WORD // 设备型号,详见下文列表
BySupport3 BYTE // 能力集扩充位与结果为0表示不支持1表示支持
//bySupport3 & 0x1, 表示是否支持多码流
//bySupport3 & 0x4, 表示是否支持按组配置具体包含通道图像参数、报警输入参数、IP报警输入/输出接入参数、用户参数、设备工作状态、JPEG抓图、定时和时间抓图、硬盘盘组管理等
//bySupport3 & 0x20, 表示是否支持通过DDNS域名解析取流
ByMultiStreamProto BYTE // 是否支持多码流按位表示位与结果0-不支持1-支持
//byMultiStreamProto & 0x1, 表示是否支持码流3
//byMultiStreamProto & 0x2, 表示是否支持码流4
//byMultiStreamProto & 0x40,表示是否支持主码流
//byMultiStreamProto & 0x80,表示是否支持子码流
ByStartDChan BYTE // 起始数字通道号0表示无数字通道比如DVR或IPC
ByStartDTalkChan BYTE // 起始数字对讲通道号区别于模拟对讲通道号0表示无数字对讲通道
ByHighDChanNum BYTE // 数字通道个数高8位
BySupport4 BYTE // 能力集扩展按位表示位与结果0- 不支持1- 支持
//bySupport4 & 0x01, 表示是否所有码流类型同时支持RTSP和私有协议
//bySupport4 & 0x10, 表示是否支持域名方式挂载网络硬盘
ByLanguageType BYTE // 支持语种能力按位表示位与结果0- 不支持1- 支持
//byLanguageType ==0表示老设备不支持该字段
//byLanguageType & 0x1表示是否支持中文
//byLanguageType & 0x2表示是否支持英文
ByVoiceInChanNum BYTE // 音频输入通道数
ByStartVoiceInChanNo BYTE // 音频输入起始通道号0表示无效
BySupport5 BYTE
BySupport6 BYTE
ByMirrorChanNum BYTE // 镜像通道个数,录播主机中用于表示导播通道
WStartMirrorChanNo WORD // 起始镜像通道号
BySupport7 BYTE
ByRes2 BYTE // 保留置为0
}
func (this *NET_DVR_DEVICEINFO_V30) GetCPtr() *C.NET_DVR_DEVICEINFO_V30 {
return &this.cData
}
func (this *NET_DVR_DEVICEINFO_V30) Go() {
this.SSerialNumber = C.GoBytes(unsafe.Pointer(&this.cData.sSerialNumber), C.int(SERIALNO_LEN))
this.ByAlarmInPortNum = BYTE(this.cData.byAlarmInPortNum)
this.ByAlarmOutPortNum = BYTE(this.cData.byAlarmOutPortNum)
this.ByDiskNum = BYTE(this.cData.byDiskNum)
this.ByDVRType = BYTE(this.cData.byDVRType)
this.ByChanNum = BYTE(this.cData.byChanNum)
this.ByStartChan = BYTE(this.cData.byStartChan)
this.ByAudioChanNum = BYTE(this.cData.byAudioChanNum)
this.ByIPChanNum = BYTE(this.cData.byIPChanNum)
this.ByZeroChanNum = BYTE(this.cData.byZeroChanNum)
this.ByMainProto = BYTE(this.cData.byMainProto)
this.BySubProto = BYTE(this.cData.bySubProto)
this.BySupport = BYTE(this.cData.bySupport)
this.BySupport1 = BYTE(this.cData.bySupport1)
this.BySupport2 = BYTE(this.cData.bySupport2)
this.WDevType = WORD(this.cData.wDevType)
this.BySupport3 = BYTE(this.cData.bySupport3)
this.ByMultiStreamProto = BYTE(this.cData.byMultiStreamProto)
this.ByStartDChan = BYTE(this.cData.byStartDChan)
this.ByStartDTalkChan = BYTE(this.cData.byStartDTalkChan)
this.ByHighDChanNum = BYTE(this.cData.byHighDChanNum)
this.BySupport4 = BYTE(this.cData.bySupport4)
this.ByLanguageType = BYTE(this.cData.byLanguageType)
this.ByVoiceInChanNum = BYTE(this.cData.byVoiceInChanNum)
this.ByStartVoiceInChanNo = BYTE(this.cData.byStartVoiceInChanNo)
this.BySupport5 = BYTE(this.cData.bySupport5)
this.BySupport6 = BYTE(this.cData.bySupport6)
this.ByMirrorChanNum = BYTE(this.cData.byMirrorChanNum)
this.WStartMirrorChanNo = WORD(this.cData.wStartMirrorChanNo)
this.BySupport7 = BYTE(this.cData.bySupport7)
this.ByRes2 = BYTE(this.cData.byRes2)
}
type NET_DVR_NETAPPCFG struct {
cData C.NET_DVR_NETAPPCFG
DwSize DWORD
SDNSIp []byte
StruNtpClientParam NET_DVR_NTPPARA
StruDDNSClientParam NET_DVR_DDNSPARA
Res []byte
}
func (this *NET_DVR_NETAPPCFG) GetCPtr() *C.NET_DVR_NETAPPCFG {
return &this.cData
}
func (this *NET_DVR_NETAPPCFG) GetC() C.NET_DVR_NETAPPCFG {
return this.cData
}
func (this *NET_DVR_NETAPPCFG) Go() {
this.DwSize = DWORD(this.cData.dwSize)
this.SDNSIp = C.GoBytes(unsafe.Pointer(&this.cData.sDNSIp), C.int(16))
this.StruNtpClientParam.SetC(this.cData.struNtpClientParam)
this.StruDDNSClientParam.SetC(this.cData.struDDNSClientParam)
this.Res = C.GoBytes(unsafe.Pointer(&this.cData.res), C.int(464))
}
type NET_DVR_NTPPARA struct {
cData C.NET_DVR_NTPPARA
SNTPServer []byte
WInterval WORD
ByEnableNTP BYTE
CTimeDifferenceH int8
CTimeDifferenceM int8
Res1 BYTE
WNtpPort WORD
Res2 []byte
}
// Set NET_DVR_NTPPARA 的 cData
func (this *NET_DVR_NTPPARA) SetC(cData C.NET_DVR_NTPPARA) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_NTPPARA) GetCPtr() *C.NET_DVR_NTPPARA {
return &this.cData
}
func (this *NET_DVR_NTPPARA) Go() {
this.SNTPServer = C.GoBytes(unsafe.Pointer(&this.cData.sNTPServer), C.int(64))
this.WInterval = WORD(this.cData.wInterval)
this.ByEnableNTP = BYTE(this.cData.byEnableNTP)
this.CTimeDifferenceH = int8(this.cData.cTimeDifferenceH)
this.CTimeDifferenceM = int8(this.cData.cTimeDifferenceM)
this.Res1 = BYTE(this.cData.res1)
this.WNtpPort = WORD(this.cData.wNtpPort)
this.Res2 = C.GoBytes(unsafe.Pointer(&this.cData.res2), C.int(8))
}
type NET_DVR_DDNSPARA struct {
cData C.NET_DVR_DDNSPARA
SUserName []byte
SPassword []byte
SDomainName []byte
ByEnableDDNS BYTE
Res []byte
}
func (this *NET_DVR_DDNSPARA) SetC(cData C.NET_DVR_DDNSPARA) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_DDNSPARA) GetCPtr() *C.NET_DVR_DDNSPARA {
return &this.cData
}
func (this *NET_DVR_DDNSPARA) Go() {
this.SUserName = C.GoBytes(unsafe.Pointer(&this.cData.sUsername), C.int(NAME_LEN))
this.SPassword = C.GoBytes(unsafe.Pointer(&this.cData.sPassword), C.int(PASSWD_LEN))
this.SDomainName = C.GoBytes(unsafe.Pointer(&this.cData.sDomainName), C.int(64))
this.ByEnableDDNS = BYTE(this.cData.byEnableDDNS)
this.Res = C.GoBytes(unsafe.Pointer(&this.cData.res), C.int(15))
}
type NET_DVR_MRD_SEARCH_PARAM struct {
cData C.NET_DVR_MRD_SEARCH_PARAM
DwSize DWORD
StruStreamInfo NET_DVR_STREAM_INFO
WYear WORD
ByMonth BYTE
ByDrawFrame BYTE
ByStreamType BYTE
ByLocalOrUTC BYTE
ByRes []byte
}
func (this *NET_DVR_MRD_SEARCH_PARAM) g2c() {
this.cData.dwSize = C.DWORD(this.DwSize)
this.cData.struStreamInfo = this.StruStreamInfo.GetC()
this.cData.wYear = C.WORD(this.WYear)
this.cData.byMonth = C.BYTE(this.ByMonth)
this.cData.byDrawFrame = C.BYTE(this.ByDrawFrame)
this.cData.byStreamType = C.BYTE(this.ByStreamType)
this.cData.byLocalOrUTC = C.BYTE(this.ByLocalOrUTC)
var cArray [30]C.BYTE
for i := 0; i < len(this.ByRes); i++ {
cArray[i] = C.BYTE(this.ByRes[i])
}
this.cData.byRes = cArray
}
func (this *NET_DVR_MRD_SEARCH_PARAM) SetC(cData C.NET_DVR_MRD_SEARCH_PARAM) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_MRD_SEARCH_PARAM) GetCPtr() *C.NET_DVR_MRD_SEARCH_PARAM {
this.g2c()
return &this.cData
}
func (this *NET_DVR_MRD_SEARCH_PARAM) GetC() C.NET_DVR_MRD_SEARCH_PARAM {
this.g2c()
return this.cData
}
func (this *NET_DVR_MRD_SEARCH_PARAM) Go() {
this.DwSize = DWORD(this.cData.dwSize)
this.StruStreamInfo.SetC(this.cData.struStreamInfo)
this.WYear = WORD(this.cData.wYear)
this.ByMonth = BYTE(this.cData.byMonth)
this.ByDrawFrame = BYTE(this.cData.byDrawFrame)
this.ByStreamType = BYTE(this.cData.byStreamType)
this.ByLocalOrUTC = BYTE(this.cData.byLocalOrUTC)
this.ByRes = C.GoBytes(unsafe.Pointer(&this.cData.byRes), C.int(30))
}
type NET_DVR_STREAM_INFO struct {
cData C.NET_DVR_STREAM_INFO
DwSize DWORD
ByID []byte
DwChannel DWORD
ByRes []byte
}
func (this *NET_DVR_STREAM_INFO) g2c() {
var byIDArray [STREAM_ID_LEN]C.BYTE
for i := 0; i < len(this.ByID); i++ {
byIDArray[i] = C.BYTE(this.ByID[i])
}
var byResArray [32]C.BYTE
for i := 0; i < len(this.ByRes); i++ {
byResArray[i] = C.BYTE(this.ByRes[i])
}
this.cData.dwSize = C.DWORD(this.DwSize)
this.cData.byID = byIDArray
this.cData.dwChannel = C.DWORD(this.DwChannel)
this.cData.byRes = byResArray
}
func (this *NET_DVR_STREAM_INFO) SetC(cData C.NET_DVR_STREAM_INFO) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_STREAM_INFO) GetC() C.NET_DVR_STREAM_INFO {
this.g2c()
return this.cData
}
func (this *NET_DVR_STREAM_INFO) GetCPtr() *C.NET_DVR_STREAM_INFO {
this.g2c()
return &this.cData
}
func (this *NET_DVR_STREAM_INFO) Go() {
this.DwSize = DWORD(this.cData.dwSize)
this.ByID = C.GoBytes(unsafe.Pointer(&this.cData.byID), C.int(STREAM_ID_LEN))
this.DwChannel = DWORD(this.cData.dwChannel)
this.ByRes = C.GoBytes(unsafe.Pointer(&this.cData.byRes), C.int(32))
}
type NET_DVR_MRD_SEARCH_RESULT struct {
cData C.NET_DVR_MRD_SEARCH_RESULT
DwSize DWORD
ByRecordDistribution []byte
ByHasEventRecode []byte
ByRes BYTE
}
func (this *NET_DVR_MRD_SEARCH_RESULT) g2c() {
var byRecordDistributionArray [32]C.BYTE
for i := 0; i < len(this.ByRecordDistribution); i++ {
byRecordDistributionArray[i] = C.BYTE(this.ByRecordDistribution[i])
}
var byHasEventRecodeArray [31]C.BYTE
for i := 0; i < len(this.ByHasEventRecode); i++ {
byHasEventRecodeArray[i] = C.BYTE(this.ByHasEventRecode[i])
}
this.cData.dwSize = C.DWORD(this.DwSize)
this.cData.byRecordDistribution = byRecordDistributionArray
this.cData.byHasEventRecode = byHasEventRecodeArray
this.cData.byRes = C.BYTE(this.ByRes)
}
func (this *NET_DVR_MRD_SEARCH_RESULT) SetC(cData C.NET_DVR_MRD_SEARCH_RESULT) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_MRD_SEARCH_RESULT) GetC() C.NET_DVR_MRD_SEARCH_RESULT {
this.g2c()
return this.cData
}
func (this *NET_DVR_MRD_SEARCH_RESULT) GetCPtr() *C.NET_DVR_MRD_SEARCH_RESULT {
this.g2c()
return &this.cData
}
func (this *NET_DVR_MRD_SEARCH_RESULT) Go() {
this.DwSize = DWORD(this.cData.dwSize)
this.ByRecordDistribution = C.GoBytes(unsafe.Pointer(&this.cData.byRecordDistribution), C.int(32))
this.ByHasEventRecode = C.GoBytes(unsafe.Pointer(&this.cData.byHasEventRecode), C.int(31))
this.ByRes = BYTE(this.cData.byRes)
}
type NET_DVR_FILECOND struct {
cData C.NET_DVR_FILECOND
LChannel LONG
DwFileType DWORD
DwIsLocked DWORD
DwUseCardNo DWORD
SCardNumber []byte
StruStartTime NET_DVR_TIME
StruStopTime NET_DVR_TIME
}
func (this *NET_DVR_FILECOND) g2c() {
this.cData.lChannel = C.LONG(this.LChannel)
this.cData.dwFileType = C.DWORD(this.DwFileType)
this.cData.dwIsLocked = C.DWORD(this.DwIsLocked)
this.cData.dwUseCardNo = C.DWORD(this.DwUseCardNo)
var sCardNumberArray [32]C.BYTE
for i := 0; i < len(this.SCardNumber); i++ {
sCardNumberArray[i] = C.BYTE(this.SCardNumber[i])
}
this.cData.sCardNumber = sCardNumberArray
this.cData.struStartTime = this.StruStartTime.GetC()
this.cData.struStopTime = this.StruStopTime.GetC()
}
func (this *NET_DVR_FILECOND) SetC(cData C.NET_DVR_FILECOND) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_FILECOND) GetC() C.NET_DVR_FILECOND {
this.g2c()
return this.cData
}
func (this *NET_DVR_FILECOND) GetCPtr() *C.NET_DVR_FILECOND {
this.g2c()
return &this.cData
}
func (this *NET_DVR_FILECOND) Go() {
this.LChannel = LONG(this.cData.lChannel)
this.DwFileType = DWORD(this.cData.dwFileType)
this.DwIsLocked = DWORD(this.cData.dwIsLocked)
this.DwUseCardNo = DWORD(this.cData.dwUseCardNo)
this.SCardNumber = C.GoBytes(unsafe.Pointer(&this.cData.sCardNumber), C.int(64))
this.StruStartTime.SetC(this.cData.struStartTime)
this.StruStopTime.SetC(this.cData.struStopTime)
}
type NET_DVR_TIME struct {
cData C.NET_DVR_TIME
DwYear DWORD
DwMonth DWORD
DwDay DWORD
DwHour DWORD
DwMinute DWORD
DwSecond DWORD
}
func (this *NET_DVR_TIME) g2c() {
this.cData.dwYear = C.DWORD(this.DwYear)
this.cData.dwMonth = C.DWORD(this.DwMonth)
this.cData.dwDay = C.DWORD(this.DwDay)
this.cData.dwHour = C.DWORD(this.DwHour)
this.cData.dwMinute = C.DWORD(this.DwMinute)
this.cData.dwSecond = C.DWORD(this.DwSecond)
}
func (this *NET_DVR_TIME) SetC(cData C.NET_DVR_TIME) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_TIME) GetC() C.NET_DVR_TIME {
this.g2c()
return this.cData
}
func (this *NET_DVR_TIME) GetCPtr() *C.NET_DVR_TIME {
this.g2c()
return &this.cData
}
func (this *NET_DVR_TIME) Go() {
this.DwYear = DWORD(this.cData.dwYear)
this.DwMonth = DWORD(this.cData.dwMonth)
this.DwDay = DWORD(this.cData.dwDay)
this.DwHour = DWORD(this.cData.dwHour)
this.DwMinute = DWORD(this.cData.dwMinute)
this.DwSecond = DWORD(this.cData.dwSecond)
}
type NET_DVR_FINDDATA_V30 struct {
cData C.NET_DVR_FINDDATA_V30
SFileName []byte
StruStartTime NET_DVR_TIME
StruStopTime NET_DVR_TIME
DwFileSize DWORD
SCardNum []byte
ByLocked BYTE
ByFileType BYTE
ByRes []byte
}
func (this *NET_DVR_FINDDATA_V30) g2c() {
var sFileNameArray [100]C.BYTE
for i := 0; i < len(this.SFileName); i++ {
sFileNameArray[i] = C.BYTE(this.SFileName[i])
}
this.cData.struStartTime = this.StruStartTime.GetC()
this.cData.struStopTime = this.StruStopTime.GetC()
this.cData.dwFileSize = C.DWORD(this.DwFileSize)
var sCardNumArray [32]C.BYTE
for i := 0; i < len(this.SCardNum); i++ {
sCardNumArray[i] = C.BYTE(this.SCardNum[i])
}
this.cData.byLocked = C.BYTE(this.ByLocked)
this.cData.byFileType = C.BYTE(this.ByFileType)
var byResArray [2]C.BYTE
for i := 0; i < len(this.ByRes); i++ {
byResArray[i] = C.BYTE(this.ByRes[i])
}
this.cData.byRes = byResArray
}
func (this *NET_DVR_FINDDATA_V30) SetC(cData C.NET_DVR_FINDDATA_V30) {
this.cData = cData
this.Go()
}
func (this *NET_DVR_FINDDATA_V30) GetC() C.NET_DVR_FINDDATA_V30 {
this.g2c()
return this.cData
}
func (this *NET_DVR_FINDDATA_V30) GetCPtr() *C.NET_DVR_FINDDATA_V30 {
this.g2c()
return &this.cData
}
func (this *NET_DVR_FINDDATA_V30) Go() {
this.SFileName = C.GoBytes(unsafe.Pointer(&this.cData.sFileName), C.int(100))
this.StruStartTime.SetC(this.cData.struStartTime)
this.StruStopTime.SetC(this.cData.struStopTime)
this.DwFileSize = DWORD(this.cData.dwFileSize)
this.SCardNum = C.GoBytes(unsafe.Pointer(&this.cData.sCardNum), C.int(32))
this.ByLocked = BYTE(this.cData.byLocked)
this.ByFileType = BYTE(this.cData.byFileType)
this.ByRes = C.GoBytes(unsafe.Pointer(&this.cData.byRes), C.int(12))
}

View File

@@ -1,241 +0,0 @@
package Core
/*
#cgo CFLAGS: -I../include
#cgo LDFLAGS: -lHCCore -lhcnetsdk
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include "HCNetSDK.h"
extern void fSerialDataCallBackGo(LONG lSerialHandle,LONG lChannel,char *pRecvDataBuffer,DWORD dwBufSize,void *pUser);
void FSerialDataCallBackCGo(LONG lSerialHandle,LONG lChannel,char *pRecvDataBuffer,DWORD dwBufSize,void *pUser){
fSerialDataCallBackGo(lSerialHandle, lChannel, pRecvDataBuffer, dwBufSize,pUser);
};
// 异常回调函数
extern void fExceptionCallBackGo(DWORD dwType, LONG lUserID, LONG lHandle, void *pUser);
void FExceptionCallBackCgo(DWORD dwType, LONG lUserID, LONG lHandle, void *pUser)
{
fExceptionCallBackGo(dwType, lUserID, lHandle, pUser);
}
*/
import "C"
import (
"math"
"unsafe"
)
// Init 初始化SDK调用其他SDK函数的前提。
func Init() error {
if C.NET_DVR_Init() != 1 {
return LastError("NET_DVR_Init")
}
return nil
}
// Cleanup 释放SDK资源在程序结束之前调用。在调用时不能同时调用其他任何SDK接口。 Init 和 Cleanup 需要配对使用,即程序里面调用多少次 Init ,退出时就需要调用多少次 Cleanup。
func Cleanup() error {
if C.NET_DVR_Cleanup() != 1 {
return LastError("NET_DVR_Cleanup")
}
return nil
}
func Login(Ip string, Port int, Username string, Password string) (LONG, NET_DVR_DEVICEINFO_V30, error) {
cIp := C.CString(Ip)
defer C.free(unsafe.Pointer(cIp))
cUsername := C.CString(Username)
defer C.free(unsafe.Pointer(cUsername))
cPassword := C.CString(Password)
defer C.free(unsafe.Pointer(cPassword))
var DeviceInfo NET_DVR_DEVICEINFO_V30
cUserId := C.NET_DVR_Login_V30(cIp, C.WORD(Port), cUsername, cPassword, DeviceInfo.GetCPtr())
if LONG(cUserId) == -1 {
return -1, NET_DVR_DEVICEINFO_V30{}, LastError("NET_DVR_Login_V30")
}
DeviceInfo.Go()
return LONG(cUserId), DeviceInfo, nil
}
func NET_DVR_RemoteControl(userId LONG) bool {
return C.NET_DVR_RemoteControl(C.LONG(userId), C.DWORD(20005), nil, C.DWORD(0)) == C.TRUE
}
func Logout(userId LONG) error {
if userId > -1 {
cResult := C.NET_DVR_Logout(C.LONG(userId))
if cResult != 1 {
return LastError("NET_DVR_Logout")
}
}
return nil
}
func NET_DVR_FindClose_V30(QueryHandle LONG) error {
if C.NET_DVR_FindClose_V30(C.LONG(QueryHandle)) == C.FALSE {
return LastError("NET_DVR_FindClose_V30")
}
return nil
}
func SerialStart(UserId LONG, CallBack serialDataCallBack) (LONG, error) {
SerialStartParam := C.NET_DVR_SERIALSTART_V40{}
SerialStartParam.dwSize = C.DWORD(unsafe.Sizeof(SerialStartParam))
SerialStartParam.dwSerialType = C.DWORD(2) //1:232串口2:485串口
SerialStartParam.bySerialNum = C.BYTE(1) //串口编号设备支持多个RS232串口时有效
// 填充 byRes 字段
for i := 0; i < 255; i++ {
SerialStartParam.byRes[i] = C.BYTE(0) // 示例值,逐个赋值
}
SerialStartHandle := C.NET_DVR_SerialStart_V40(C.LONG(UserId), unsafe.Pointer(&SerialStartParam), C.LONG(unsafe.Sizeof(SerialStartParam)), C.fSerialDataCallBack(C.FSerialDataCallBackCGo), nil)
if LONG(SerialStartHandle) == -1 {
return -1, LastError("NET_DVR_SerialStart_V40")
}
serialCallBackHooks[LONG(SerialStartHandle)] = CallBack
return LONG(SerialStartHandle), nil
}
func SerialSend(lSerialHandle LONG, hexbyte []byte) error {
if C.NET_DVR_SerialSend(C.LONG(lSerialHandle), 1, (*C.char)(unsafe.Pointer(&hexbyte[0])), C.DWORD(len(hexbyte))) == C.FALSE {
return LastError("NET_DVR_SerialSend")
}
return nil
}
func SerialStop(lSerialHandle LONG) error {
if int(C.NET_DVR_SerialStop(C.LONG(lSerialHandle))) != 1 {
return LastError("SerialStop")
}
delete(serialCallBackHooks, lSerialHandle)
return nil
}
type CDVR_PTZPOS C.NET_DVR_PTZPOS
func (d *CDVR_PTZPOS) Go() DVR_PTZPOS {
return DVR_PTZPOS{
WAction: 1,
WPanPos: HEX2DEC(WORD(d.wPanPos)),
WTiltPos: HEX2DEC(WORD(d.wTiltPos)),
WZoomPos: HEX2DEC(WORD(d.wZoomPos)),
}
}
func (d *CDVR_PTZPOS) Set(Action, PanPos, TiltPos, ZoomPos float64) {
d.wAction = C.WORD(Action)
d.wPanPos = C.WORD(DEC2HEX(PanPos))
d.wTiltPos = C.WORD(DEC2HEX(TiltPos))
d.wZoomPos = C.WORD(DEC2HEX(ZoomPos))
}
type DVR_PTZPOS struct {
WAction int
WPanPos float64
WTiltPos float64
WZoomPos float64
}
// DEC2HEX 将十进制浮点数转换为十六进制整数
func DEC2HEX(dec float64) WORD {
// 提取千位(对应十进制的百位)
bai := uint16(dec / math.Pow(10, 2))
dec -= float64(bai) * math.Pow(10, 2)
// 提取百位(对应十进制的十位)
shi := uint16(dec / math.Pow(10, 1))
dec -= float64(shi) * math.Pow(10, 1)
// 提取十位(对应十进制的个位)
ge := uint16(dec / math.Pow(10, 0))
dec -= float64(ge) * math.Pow(10, 0)
// 提取个位(对应十进制的十分位)
xiao := uint16(dec * 10)
// 合成十六进制数
hex := WORD(bai)<<12 | WORD(shi)<<8 | WORD(ge)<<4 | WORD(xiao)
return hex
}
// HEX2DEC 将十六进制整数转换为十进制浮点数
func HEX2DEC(hex WORD) float64 {
// 提取十六进制数的千位(对应十进制的百位)
bai := byte(hex >> 12)
hex = hex - WORD(bai)*WORD(math.Pow(16, 3))
// 提取十六进制数的百位(对应十进制的十位)
shi := byte(hex >> 8)
hex = hex - WORD(shi)*WORD(math.Pow(16, 2))
// 提取十六进制数的十位(对应十进制的个位)
ge := byte(hex >> 4)
hex = hex - WORD(ge)*WORD(math.Pow(16, 1))
// 提取十六进制数的个位(对应十进制的十分位)
xiao := byte(hex)
// 计算对应的十进制浮点数
return float64(bai)*math.Pow(10, 2) + float64(shi)*math.Pow(10, 1) + float64(ge)*math.Pow(10, 0) + float64(xiao)*math.Pow(10, -1)
}
func GetDVRConfig(lUserID LONG, dwCommand DWORD, lChannel LONG, lpOutBuffer unsafe.Pointer, dwOutBufferSize DWORD) error {
bytesReturned := C.DWORD(0)
cResult := C.NET_DVR_GetDVRConfig(C.LONG(lUserID), C.DWORD(dwCommand), C.LONG(lChannel), C.LPVOID(lpOutBuffer), C.DWORD(dwOutBufferSize), &bytesReturned)
if cResult != 1 {
return LastError("NET_DVR_GetDVRConfig")
}
return nil
}
func SetDVRConfig(lUserID LONG, dwCommand DWORD, lChannel LONG, lpInBuffer unsafe.Pointer, dwOutBufferSize DWORD) error {
cResult := C.NET_DVR_SetDVRConfig(C.LONG(lUserID), C.DWORD(dwCommand), C.LONG(lChannel), C.LPVOID(lpInBuffer), C.DWORD(dwOutBufferSize))
if cResult != 1 {
return LastError("NET_DVR_SetDVRConfig")
}
return nil
}
func GetDVRDeviceConfig(lUserID LONG, dwCommand DWORD, dwCount DWORD, lpInBuffer unsafe.Pointer, dwInBufferSize DWORD, lpStatusList unsafe.Pointer, lpOutBuffer unsafe.Pointer, dwOutBufferSize DWORD) error {
cResult := C.NET_DVR_GetDeviceConfig(C.LONG(lUserID), C.DWORD(dwCommand), C.DWORD(dwCount), C.LPVOID(lpInBuffer), C.DWORD(dwInBufferSize), C.LPVOID(lpStatusList), C.LPVOID(lpOutBuffer), C.DWORD(dwOutBufferSize))
if cResult != 1 {
return LastError("NET_DVR_GetDeviceConfig")
}
return nil
}
func LastError(funcName string) error {
cCode := C.NET_DVR_GetLastError()
if cCode == 0 {
return nil
}
var text string
if cCode == 3 {
text = "sdk not init."
} else {
cCode2 := C.LONG(cCode)
cText := C.NET_DVR_GetErrorMsg(&cCode2)
text = C.GoString(cText)
}
return NewHcnetError(int(cCode), text, funcName)
}
func PTZControlWithSpeed_Other(lUserID LONG, lChannel LONG, dwPTZCommand DWORD, dwStop DWORD, dwSpeed DWORD) error {
state := C.NET_DVR_PTZControlWithSpeed_Other(C.LONG(lUserID), C.LONG(lChannel), C.DWORD(dwPTZCommand), C.DWORD(dwStop), C.DWORD(dwSpeed))
if state == C.FALSE {
return LastError("NET_DVR_PTZControlWithSpeed_Other")
}
return nil
}
func NET_DVR_FindFile_V30(lUserID LONG, lpFindFileInfo NET_DVR_FILECOND) (LONG, error) {
Handle := C.NET_DVR_FindFile_V30(C.LONG(lUserID), lpFindFileInfo.GetCPtr())
if Handle == -1 {
return 0, LastError("NET_DVR_FindFile_V30")
}
return LONG(Handle), nil
}
func NET_DVR_FindNextFile_V30(lFindHandle LONG, lpFindData *NET_DVR_FINDDATA_V30) (LONG, error) {
state := C.NET_DVR_FindNextFile_V30(C.LONG(lFindHandle), (*lpFindData).GetCPtr())
if state == -1 {
return 0, LastError("NET_DVR_FindNextFile_V30")
}
lpFindData.Go()
return LONG(state), nil
}

150
Nvr.go
View File

@@ -1,25 +1,36 @@
package HikSDK package HikSDK
/*
#cgo LDFLAGS: -Wl,--allow-multiple-definition
#include <stdio.h>
#include <string.h>
*/
import "C"
import ( import (
"errors" "errors"
"gitea.com/kunmeng/HikNetSDKPkg/Core"
"time" "time"
"unsafe"
) )
type Nvr struct { type Nvr struct {
userId Core.LONG userId LONG
deviceInfo Core.NET_DVR_DEVICEINFO_V30 deviceInfo NET_DVR_DEVICEINFO
}
type TimeRange struct {
StartYear DWORD
StartMonth DWORD
StartDay DWORD
StartHour DWORD
StartMinute DWORD
StartSecond DWORD
EndYear DWORD
EndMonth DWORD
EndDay DWORD
EndHour DWORD
EndMinute DWORD
EndSecond DWORD
}
type WebTimeRang struct {
StartTime time.Time
EndTime time.Time
} }
func NewNvr(Ip string, Port int, Username, Password string) (*Nvr, error) { func NewNvr(Ip string, Port int, Username, Password string) (*Nvr, error) {
userId, deviceInfo, err := Core.Login(Ip, Port, Username, Password) userId, deviceInfo, err := login(Ip, Port, Username, Password)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -33,92 +44,30 @@ func (this *Nvr) GetTimeZone() (int, error) {
if this == nil { if this == nil {
return 0, errors.New("Nvr is nil") return 0, errors.New("Nvr is nil")
} }
var data Core.NET_DVR_NETAPPCFG return getTimeZone(this.userId), nil
var dataPtr = unsafe.Pointer(data.GetCPtr())
err := Core.GetDVRConfig(this.userId, 222, 0, dataPtr, Core.DWORD(unsafe.Sizeof(data.GetC())))
if err != nil {
return 0, err
}
data.Go()
return int(data.StruNtpClientParam.CTimeDifferenceH)*60 + int(data.StruNtpClientParam.CTimeDifferenceM)*map[int8]int{-1: -1, 0: 1}[data.StruNtpClientParam.CTimeDifferenceH>>7], nil
} }
func (this *Nvr) CheckTimeRegionWithMonth(Year, Month, Channel uint16) ([]uint8, error) { func (this *Nvr) CheckTimeRegionWithMonth(Year, Month, Channel uint16) ([]uint8, error) {
if this == nil { if this == nil {
return nil, errors.New("Nvr is nil") return nil, errors.New("Nvr is nil")
} }
// //// 查当月 return QueryMonth(this.userId, WORD(Year), BYTE(Month), DWORD(Channel))
var struSearchParam Core.NET_DVR_MRD_SEARCH_PARAM
struSearchParam.DwSize = Core.DWORD(unsafe.Sizeof(struSearchParam.GetC()))
struSearchParam.WYear = Core.WORD(Year)
struSearchParam.ByMonth = Core.BYTE(Month)
struSearchParam.StruStreamInfo.DwChannel = Core.DWORD(32 + Channel)
struSearchParam.ByLocalOrUTC = 1
struSearchParam.ByDrawFrame = 0
struSearchParam.ByStreamType = 0
var dataPtr = unsafe.Pointer(struSearchParam.GetCPtr())
var ResData Core.NET_DVR_MRD_SEARCH_RESULT
var ResDataPtr = unsafe.Pointer(ResData.GetCPtr())
err := Core.GetDVRDeviceConfig(this.userId, 6164, 0, dataPtr, Core.DWORD(unsafe.Sizeof(struSearchParam.GetC())), nil, ResDataPtr, Core.DWORD(unsafe.Sizeof(ResData.GetC())))
if err != nil {
return nil, err
}
ResData.Go()
var res []uint8
for i := 0; i < 32; i++ {
if ResData.ByRecordDistribution[i] != 0 {
res = append(res, uint8(i+1))
}
}
return res, nil
} }
func (this *Nvr) CheckTimeRegionWithDay(Year, Month, Day, Channel uint16) ([]TimeRange, error) { func (this *Nvr) CheckTimeRegionWithDay(Year, Month, Day, Channel uint16) ([]WebTimeRang, error) {
if this == nil { if this == nil {
return nil, errors.New("Nvr is nil") return nil, errors.New("Nvr is nil")
} }
var Data Core.NET_DVR_FILECOND Handle := QueryDayHandle(this.userId, DWORD(Year), DWORD(Month), DWORD(Day), LONG(Channel))
Data.DwFileType = 0xff res, state, err := QueryDayNextFile(Handle)
Data.DwIsLocked = 0xff
Data.DwUseCardNo = 0
Data.LChannel = Core.LONG(32 + Channel)
StartTime := Core.NET_DVR_TIME{
DwYear: Core.DWORD(Year),
DwMonth: Core.DWORD(Month),
DwDay: Core.DWORD(Day),
DwHour: 0,
DwMinute: 0,
DwSecond: 0,
}
StopTime := Core.NET_DVR_TIME{
DwYear: Core.DWORD(Year),
DwMonth: Core.DWORD(Month),
DwDay: Core.DWORD(Day),
DwHour: 23,
DwMinute: 59,
DwSecond: 59,
}
Data.StruStartTime = StartTime
Data.StruStopTime = StopTime
QueryHandle, err := Core.NET_DVR_FindFile_V30(this.userId, Data)
if err != nil { if err != nil {
return nil, err return []WebTimeRang{}, err
}
var FindData Core.NET_DVR_FINDDATA_V30
var state Core.LONG
state, err = Core.NET_DVR_FindNextFile_V30(QueryHandle, &FindData)
if err != nil {
return nil, err
} }
ByUTCDiff, err := this.GetTimeZone() ByUTCDiff, err := this.GetTimeZone()
if err != nil { if err != nil {
return nil, err return nil, err
} }
var res []TimeRange var webres []WebTimeRang
for state > 0 { for state > 0 {
var StartTimeObj time.Time var StartTimeObj time.Time
var EndTimeObj time.Time var EndTimeObj time.Time
@@ -133,59 +82,52 @@ func (this *Nvr) CheckTimeRegionWithDay(Year, Month, Day, Channel uint16) ([]Tim
break break
} }
if state == 1000 { if state == 1000 {
if uint16(FindData.StruStartTime.DwDay) != Day { if uint16(res.StartDay) != Day {
StartTimeObj = time.Date(int(FindData.StruStartTime.DwYear), time.Month(FindData.StruStartTime.DwMonth), int(FindData.StruStartTime.DwDay+1), 0, 0, 0, 0, time.UTC) StartTimeObj = time.Date(int(res.StartYear), time.Month(res.StartMonth), int(res.StartDay+1), 0, 0, 0, 0, time.UTC)
} else { } else {
StartTimeObj = time.Date(int(FindData.StruStartTime.DwYear), time.Month(FindData.StruStartTime.DwMonth), int(FindData.StruStartTime.DwDay), int(FindData.StruStartTime.DwHour), int(FindData.StruStartTime.DwMinute), int(FindData.StruStartTime.DwSecond), 0, time.UTC) StartTimeObj = time.Date(int(res.StartYear), time.Month(res.StartMonth), int(res.StartDay), int(res.StartHour), int(res.StartMinute), int(res.StartSecond), 0, time.UTC)
} }
if uint16(FindData.StruStopTime.DwDay) != Day { if uint16(res.EndDay) != Day {
EndTimeObj = time.Date(int(FindData.StruStopTime.DwYear), time.Month(FindData.StruStopTime.DwMonth), int(FindData.StruStopTime.DwDay-1), 23, 59, 59, 59, time.UTC) EndTimeObj = time.Date(int(res.EndYear), time.Month(res.EndMonth), int(res.EndDay-1), 23, 59, 59, 59, time.UTC)
} else { } else {
EndTimeObj = time.Date(int(FindData.StruStopTime.DwYear), time.Month(FindData.StruStopTime.DwMonth), int(FindData.StruStopTime.DwDay), int(FindData.StruStopTime.DwHour), int(FindData.StruStopTime.DwMinute), int(FindData.StruStopTime.DwSecond), 0, time.UTC) EndTimeObj = time.Date(int(res.EndYear), time.Month(res.EndMonth), int(res.EndDay), int(res.EndHour), int(res.EndMinute), int(res.EndSecond), 0, time.UTC)
} }
StartTimeObj = StartTimeObj.Add(time.Minute * time.Duration(-ByUTCDiff)) StartTimeObj = StartTimeObj.Add(time.Minute * time.Duration(-ByUTCDiff))
EndTimeObj = EndTimeObj.Add(time.Minute * time.Duration(-ByUTCDiff)) EndTimeObj = EndTimeObj.Add(time.Minute * time.Duration(-ByUTCDiff))
res = append(res, TimeRange{ webres = append(webres, WebTimeRang{
StartTime: StartTimeObj, StartTime: StartTimeObj,
EndTime: EndTimeObj, EndTime: EndTimeObj,
}) })
} }
if state == 1002 { if state == 1002 {
FindData = Core.NET_DVR_FINDDATA_V30{} res, state, err = QueryDayNextFile(Handle)
state, err = Core.NET_DVR_FindNextFile_V30(QueryHandle, &FindData) if err != nil {
return []WebTimeRang{}, err
}
time.Sleep(time.Millisecond * 5) time.Sleep(time.Millisecond * 5)
continue continue
} }
res, state, err = QueryDayNextFile(Handle)
FindData = Core.NET_DVR_FINDDATA_V30{}
state, err = Core.NET_DVR_FindNextFile_V30(QueryHandle, &FindData)
if err != nil { if err != nil {
return res, err return []WebTimeRang{}, err
} }
time.Sleep(time.Millisecond * 5) time.Sleep(time.Millisecond * 5)
} }
err = FindClose(Handle)
err = Core.NET_DVR_FindClose_V30(QueryHandle)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return res, nil return webres, nil
} }
func (this *Nvr) Logout() error { func (this *Nvr) Logout() error {
if this == nil { if this == nil {
return errors.New("Nvr is nil") return errors.New("Nvr is nil")
} }
return Core.Logout(this.userId) return logout(this.userId)
} }
func (this *Nvr) Status() bool { func (this *Nvr) Status() bool {
if this == nil { if this == nil {
return false return false
} }
return Core.NET_DVR_RemoteControl(this.userId) return deviceOnline(this.userId)
}
type TimeRange struct {
StartTime time.Time
EndTime time.Time
} }

View File

@@ -1,12 +1,11 @@
package HikSDK package HikSDK
import ( import (
"gitea.com/kunmeng/HikNetSDKPkg/Core"
"testing" "testing"
) )
func TestNewNvr(t *testing.T) { func TestNewNvr(t *testing.T) {
err := Core.Init() err := Init()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
return return
@@ -20,12 +19,18 @@ func TestNewNvr(t *testing.T) {
return return
} }
t.Log(diff) t.Log(diff)
month, err := nvr.CheckTimeRegionWithMonth(2025, 3, 1) month, err := nvr.CheckTimeRegionWithMonth(2025, 5, 1)
if err != nil { if err != nil {
return return
} }
t.Log(month) t.Log(month)
timeList, err := nvr.CheckTimeRegionWithDay(2025, 3, 20, 1) timeList, err := nvr.CheckTimeRegionWithDay(2025, 5, 29, 1)
if err != nil {
return
}
Status := nvr.Status()
t.Log(Status)
err = nvr.Logout()
if err != nil { if err != nil {
return return
} }

View File

@@ -1,4 +1,4 @@
package Core package HikSDK
import "C" import "C"
import ( import (

File diff suppressed because it is too large Load Diff

View File

@@ -82,12 +82,12 @@ typedef struct tagMotionData{
#define _OSD_MONTH3 (_OSD_BASE+2) /*show month time in English, for example: Jan*/ #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_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_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¡«SUN*/ #define _OSD_WEEK3 (_OSD_BASE+5) /*show week time in English: MONSUN*/
#define _OSD_CWEEK1 (_OSD_BASE+6) /*show week time in Chinese GB code*/ #define _OSD_CWEEK1 (_OSD_BASE+6) /*show week time in Chinese GB code*/
#define _OSD_HOUR24 (_OSD_BASE+7) /*show 24 hours clock: 00¡«23 */ #define _OSD_HOUR24 (_OSD_BASE+7) /*show 24 hours clock: 0023 */
#define _OSD_HOUR12 (_OSD_BASE+8) /*show 12 hours clock: 00¡«12*/ #define _OSD_HOUR12 (_OSD_BASE+8) /*show 12 hours clock: 0012*/
#define _OSD_MINUTE (_OSD_BASE+9) /*show minute time by length of 2: 00¡«59*/ #define _OSD_MINUTE (_OSD_BASE+9) /*show minute time by length of 2: 0059*/
#define _OSD_SECOND (_OSD_BASE+10) /*show second time by length of 2: 00¡«59*/ #define _OSD_SECOND (_OSD_BASE+10) /*show second time by length of 2: 0059*/
#define _OSD_MILISECOND (_OSD_BASE+11) /*show millisecond time by length of 3: 000~999*/ #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*/ #define _OSD_APM (_OSD_BASE+14) /*show a.m. or p.m. by length of 2 bit, AM or PM*/

View File

@@ -216,19 +216,19 @@ DLLEXPORT_API int __stdcall StartSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall StopSubVideoCapture(HANDLE hChannelHandle); DLLEXPORT_API int __stdcall StopSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetupDateTime(HANDLE hChannelHandle, SYSTEMTIME *now); DLLEXPORT_API int __stdcall SetupDateTime(HANDLE hChannelHandle, SYSTEMTIME *now);
/* /*
1.7 1.7
*/ */
//原始图像流设置 //原始图像流设置
typedef void (*IMAGE_STREAM_CALLBACK)(UINT channelNumber,void *context ); 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 SetImageStream(HANDLE hChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer);
DLLEXPORT_API int __stdcall RegisterImageStreamCallback(IMAGE_STREAM_CALLBACK,void *context); DLLEXPORT_API int __stdcall RegisterImageStreamCallback(IMAGE_STREAM_CALLBACK,void *context);
/* /*
(x,y) (x,y)
x必须为2的整数倍 x必须为2的整数倍
(x,y) (x,y)
*/ */
DLLEXPORT_API int __stdcall SetInputVideoPosition(HANDLE hChannel,UINT x,UINT y); DLLEXPORT_API int __stdcall SetInputVideoPosition(HANDLE hChannel,UINT x,UINT y);
DLLEXPORT_API int __stdcall StopRegisterDrawFun(DWORD nport); DLLEXPORT_API int __stdcall StopRegisterDrawFun(DWORD nport);
@@ -236,19 +236,19 @@ DLLEXPORT_API int __stdcall StopRegisterDrawFun(DWORD nport);
/* /*
3.0 3.0
*/ */
#define SERIAL_NUMBER_LENGTH 12 //板卡序列号长度 #define SERIAL_NUMBER_LENGTH 12 //板卡序列号长度
typedef struct tagDS_BOARD_DETAIL typedef struct tagDS_BOARD_DETAIL
{ {
BOARD_TYPE_DS type; //板卡类型 BOARD_TYPE_DS type; //板卡类型
BYTE sn[16]; //序列号 BYTE sn[16]; //序列号
UINT dspCount; //板卡包含的DSP个数 UINT dspCount; //板卡包含的DSP个数
UINT firstDspIndex; //板卡上第一个DSP的索引 UINT firstDspIndex; //板卡上第一个DSP的索引
UINT encodeChannelCount; //板卡包含的编码通道个数 UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引 UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数 UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引 UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数 UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引 UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
UINT reserved1; UINT reserved1;
UINT reserved2; UINT reserved2;
UINT reserved3; UINT reserved3;
@@ -256,12 +256,12 @@ typedef struct tagDS_BOARD_DETAIL
}DS_BOARD_DETAIL; }DS_BOARD_DETAIL;
typedef struct tagDSP_DETAIL typedef struct tagDSP_DETAIL
{ {
UINT encodeChannelCount; //板卡包含的编码通道个数 UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引 UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数 UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引 UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数 UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引 UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
UINT reserved1; UINT reserved1;
UINT reserved2; UINT reserved2;
UINT reserved3; UINT reserved3;
@@ -424,7 +424,7 @@ DLLEXPORT_API int __stdcall RegisterDecoderVideoCaptureCallback(DECODER_VIDEO_CA
DLLEXPORT_API int __stdcall HW_SetDecoderVideoCapture(HANDLE hChannel,BOOL bStart,UINT param); DLLEXPORT_API int __stdcall HW_SetDecoderVideoCapture(HANDLE hChannel,BOOL bStart,UINT param);
DLLEXPORT_API int __stdcall HW_InputDataByFrame(HANDLE hChannel,PBYTE pBuf,DWORD nSize); DLLEXPORT_API int __stdcall HW_InputDataByFrame(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
/* /*
: :
*/ */
typedef struct typedef struct
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -64,24 +64,24 @@
#define PLAYM4_NEED_LARGER_BUFFER 34 //add by pzj 20130528 #define PLAYM4_NEED_LARGER_BUFFER 34 //add by pzj 20130528
#define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown; #define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown;
//鱼眼功能错误码 //鱼眼功能错误码
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // 鱼眼模块加载失败 #define PLAYM4_FEC_ERR_ENABLEFAIL 100 // 鱼眼模块加载失败
#define PLAYM4_FEC_ERR_NOTENABLE 101 // 鱼眼模块没有加载 #define PLAYM4_FEC_ERR_NOTENABLE 101 // 鱼眼模块没有加载
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // 子端口没有分配 #define PLAYM4_FEC_ERR_NOSUBPORT 102 // 子端口没有分配
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // 没有初始化对应端口的参数 #define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // 没有初始化对应端口的参数
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // 子端口已经用完 #define PLAYM4_FEC_ERR_SUBPORTOVER 104 // 子端口已经用完
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // 该安装方式下这种效果不支持 #define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // 该安装方式下这种效果不支持
#define PLAYM4_FEC_ERR_INVALIDWND 106 // 非法的窗口 #define PLAYM4_FEC_ERR_INVALIDWND 106 // 非法的窗口
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZ位置越界 #define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZ位置越界
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // 圆心参数非法 #define PLAYM4_FEC_ERR_RADIUSINVALID 108 // 圆心参数非法
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // 指定的安装方式和矫正效果,该参数更新不支持 #define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // 指定的安装方式和矫正效果,该参数更新不支持
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // 播放库端口没有启用 #define PLAYM4_FEC_ERR_NOPLAYPORT 110 // 播放库端口没有启用
#define PLAYM4_FEC_ERR_PARAMVALID 111 // 参数为空 #define PLAYM4_FEC_ERR_PARAMVALID 111 // 参数为空
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // 非法子端口 #define PLAYM4_FEC_ERR_INVALIDPORT 112 // 非法子端口
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ矫正范围越界 #define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ矫正范围越界
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // 矫正通道饱和,最大支持的矫正通道为四个 #define PLAYM4_FEC_ERR_OVERMAXPORT 114 // 矫正通道饱和,最大支持的矫正通道为四个
#define PLAYM4_FEC_ERR_ENABLED 115 //该端口已经启用了鱼眼模块 #define PLAYM4_FEC_ERR_ENABLED 115 //该端口已经启用了鱼眼模块
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D加速没有开启 #define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D加速没有开启
//Max display regions. //Max display regions.
@@ -126,31 +126,31 @@
#define SUPPORT_SSE 128 #define SUPPORT_SSE 128
#define SUPPORT_MMX 256 #define SUPPORT_MMX 256
// 以下宏定义用于HIK_MEDIAINFO结构 // 以下宏定义用于HIK_MEDIAINFO结构
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO结构标记 #define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO结构标记
// 系统封装格式 // 系统封装格式
#define SYSTEM_NULL 0x0 // 没有系统层,纯音频流或视频流 #define SYSTEM_NULL 0x0 // 没有系统层,纯音频流或视频流
#define SYSTEM_HIK 0x1 // 海康文件层 #define SYSTEM_HIK 0x1 // 海康文件层
#define SYSTEM_MPEG2_PS 0x2 // PS封装 #define SYSTEM_MPEG2_PS 0x2 // PS封装
#define SYSTEM_MPEG2_TS 0x3 // TS封装 #define SYSTEM_MPEG2_TS 0x3 // TS封装
#define SYSTEM_RTP 0x4 // rtp封装 #define SYSTEM_RTP 0x4 // rtp封装
#define SYSTEM_RTPHIK 0x401 // rtp封装 #define SYSTEM_RTPHIK 0x401 // rtp封装
// 视频编码类型 // 视频编码类型
#define VIDEO_NULL 0x0 // 没有视频 #define VIDEO_NULL 0x0 // 没有视频
#define VIDEO_H264 0x1 // 海康H.264 #define VIDEO_H264 0x1 // 海康H.264
#define VIDEO_MPEG4 0x3 // 标准MPEG4 #define VIDEO_MPEG4 0x3 // 标准MPEG4
#define VIDEO_MJPEG 0x4 #define VIDEO_MJPEG 0x4
#define VIDEO_AVC264 0x0100 #define VIDEO_AVC264 0x0100
// 音频编码类型 // 音频编码类型
#define AUDIO_NULL 0x0000 // 没有音频 #define AUDIO_NULL 0x0000 // 没有音频
#define AUDIO_ADPCM 0x1000 // ADPCM #define AUDIO_ADPCM 0x1000 // ADPCM
#define AUDIO_MPEG 0x2000 // MPEG 系列音频解码器能自适应各种MPEG音频 #define AUDIO_MPEG 0x2000 // MPEG 系列音频解码器能自适应各种MPEG音频
#define AUDIO_AAC 0X2001 // AAC 编码 #define AUDIO_AAC 0X2001 // AAC 编码
// G系列音频 // G系列音频
#define AUDIO_RAW_DATA8 0x7000 //采样率为8k的原始数据 #define AUDIO_RAW_DATA8 0x7000 //采样率为8k的原始数据
#define AUDIO_RAW_UDATA16 0x7001 //采样率为16k的原始数据即L16 #define AUDIO_RAW_UDATA16 0x7001 //采样率为16k的原始数据即L16
#define AUDIO_G711_U 0x7110 #define AUDIO_G711_U 0x7110
#define AUDIO_G711_A 0x7111 #define AUDIO_G711_A 0x7111
#define AUDIO_G722_1 0x7221 #define AUDIO_G722_1 0x7221
@@ -161,15 +161,15 @@
#define AUDIO_G729 0x7290 #define AUDIO_G729 0x7290
#define AUDIO_AMR_NB 0x3000 #define AUDIO_AMR_NB 0x3000
#define SYNCDATA_VEH 1 //同步数据:车载信息 #define SYNCDATA_VEH 1 //同步数据:车载信息
#define SYNCDATA_IVS 2 //同步数据:智能信息 #define SYNCDATA_IVS 2 //同步数据:智能信息
//motion flow type //motion flow type
#define MOTION_FLOW_NONE 0 #define MOTION_FLOW_NONE 0
#define MOTION_FLOW_CPU 1 #define MOTION_FLOW_CPU 1
#define MOTION_FLOW_GPU 2 #define MOTION_FLOW_GPU 2
//音视频加密类型 //音视频加密类型
#define ENCRYPT_AES_3R_VIDEO 1 #define ENCRYPT_AES_3R_VIDEO 1
#define ENCRYPT_AES_10R_VIDEO 2 #define ENCRYPT_AES_10R_VIDEO 2
#define ENCRYPT_AES_3R_AUDIO 1 #define ENCRYPT_AES_3R_AUDIO 1
@@ -198,19 +198,19 @@ typedef struct{
typedef struct typedef struct
{ {
long nPort; //通道号 long nPort; //通道号
char *pBuf; //返回的第一路图像数据指针 char *pBuf; //返回的第一路图像数据指针
unsigned int nBufLen; //返回的第一路图像数据大小 unsigned int nBufLen; //返回的第一路图像数据大小
char *pBuf1; //返回的第二路图像数据指针 char *pBuf1; //返回的第二路图像数据指针
unsigned int nBufLen1; //返回的第二路图像数据大小 unsigned int nBufLen1; //返回的第二路图像数据大小
char *pBuf2; //返回的第三路图像数据指针 char *pBuf2; //返回的第三路图像数据指针
unsigned int nBufLen2; //返回的第三路图像数据大小 unsigned int nBufLen2; //返回的第三路图像数据大小
unsigned int nWidth; //画面宽 unsigned int nWidth; //画面宽
unsigned int nHeight; //画面高 unsigned int nHeight; //画面高
unsigned int nStamp; //时标信息,单位毫秒 unsigned int nStamp; //时标信息,单位毫秒
unsigned int nType; //数据类型 unsigned int nType; //数据类型
void *pUser; //用户数据 void *pUser; //用户数据
unsigned int reserved[4]; //保留 unsigned int reserved[4]; //保留
}DISPLAY_INFO_YUV; }DISPLAY_INFO_YUV;
//Frame //Frame
@@ -233,9 +233,9 @@ typedef struct{
typedef struct SYNCDATA_INFO typedef struct SYNCDATA_INFO
{ {
DWORD dwDataType; //和码流数据同步的附属信息类型,目前有:智能信息,车载信息 DWORD dwDataType; //和码流数据同步的附属信息类型,目前有:智能信息,车载信息
DWORD dwDataLen; //附属信息数据长度 DWORD dwDataLen; //附属信息数据长度
BYTE* pData; //指向附属信息数据结构的指针,比如IVS_INFO结构 BYTE* pData; //指向附属信息数据结构的指针,比如IVS_INFO结构
} SYNCDATA_INFO; } SYNCDATA_INFO;
#ifndef _HIK_MEDIAINFO_FLAG_ #ifndef _HIK_MEDIAINFO_FLAG_
@@ -243,19 +243,19 @@ typedef struct SYNCDATA_INFO
typedef struct _HIK_MEDIAINFO_ // modified by gb 080425 typedef struct _HIK_MEDIAINFO_ // modified by gb 080425
{ {
unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information
unsigned short media_version; // 版本号指本信息结构版本号目前为0x0101,即1.01版本01主版本号01子版本号。 unsigned short media_version; // 版本号指本信息结构版本号目前为0x0101,即1.01版本01主版本号01子版本号。
unsigned short device_id; // 设备ID便于跟随/分析 unsigned short device_id; // 设备ID便于跟随/分析
unsigned short system_format; // 系统封装层 unsigned short system_format; // 系统封装层
unsigned short video_format; // 视频编码类型 unsigned short video_format; // 视频编码类型
unsigned short audio_format; // 音频编码类型 unsigned short audio_format; // 音频编码类型
unsigned char audio_channels; // 通道数 unsigned char audio_channels; // 通道数
unsigned char audio_bits_per_sample; // 样位率 unsigned char audio_bits_per_sample; // 样位率
unsigned int audio_samplesrate; // 采样率 unsigned int audio_samplesrate; // 采样率
unsigned int audio_bitrate; // 压缩音频码率,单位bit unsigned int audio_bitrate; // 压缩音频码率,单位bit
unsigned int reserved[4]; // 保留 unsigned int reserved[4]; // 保留
}HIK_MEDIAINFO; }HIK_MEDIAINFO;
#endif #endif
@@ -285,22 +285,22 @@ typedef struct
long nUser; long nUser;
}DISPLAY_INFOEX; }DISPLAY_INFOEX;
typedef struct PLAYM4_SYSTEM_TIME //绝对时间 typedef struct PLAYM4_SYSTEM_TIME //绝对时间
{ {
DWORD dwYear; //年 DWORD dwYear; //年
DWORD dwMon; //月 DWORD dwMon; //月
DWORD dwDay; //日 DWORD dwDay; //日
DWORD dwHour; //时 DWORD dwHour; //时
DWORD dwMin; //分 DWORD dwMin; //分
DWORD dwSec; //秒 DWORD dwSec; //秒
DWORD dwMs; //毫秒 DWORD dwMs; //毫秒
} PLAYM4_SYSTEM_TIME; } PLAYM4_SYSTEM_TIME;
//ENCRYPT Info //ENCRYPT Info
typedef struct{ typedef struct{
long nVideoEncryptType; //视频加密类型 long nVideoEncryptType; //视频加密类型
long nAudioEncryptType; //音频加密类型 long nAudioEncryptType; //音频加密类型
long nSetSecretKey; //是否设置1表示设置密钥0表示没有设置密钥 long nSetSecretKey; //是否设置1表示设置密钥0表示没有设置密钥
}ENCRYPT_INFO; }ENCRYPT_INFO;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@@ -478,88 +478,88 @@ PLAYM4_API BOOL __stdcall PlayM4_GetSystemTime(LONG nPort, PLAYM4_SYSTEM_TIME *p
//nSessionInfoType //nSessionInfoType
#define PLAYM4_SESSION_INFO_SDP 1 #define PLAYM4_SESSION_INFO_SDP 1
typedef struct _PLAYM4_SESSION_INFO_ //交互信息结构 typedef struct _PLAYM4_SESSION_INFO_ //交互信息结构
{ {
int nSessionInfoType; //交互信息类型比如SDP比如海康私有信息头 int nSessionInfoType; //交互信息类型比如SDP比如海康私有信息头
int nSessionInfoLen; //交互信息长度 int nSessionInfoLen; //交互信息长度
unsigned char* pSessionInfoData; //交互信息数据 unsigned char* pSessionInfoData; //交互信息数据
} PLAYM4_SESSION_INFO; } PLAYM4_SESSION_INFO;
#endif #endif
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamAdvanced(LONG nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, DWORD nBufPoolSize); PLAYM4_API BOOL __stdcall PlayM4_OpenStreamAdvanced(LONG nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, DWORD nBufPoolSize);
#define R_ANGLE_0 -1 //不旋转 #define R_ANGLE_0 -1 //不旋转
#define R_ANGLE_L90 0 //向左旋转90度 #define R_ANGLE_L90 0 //向左旋转90度
#define R_ANGLE_R90 1 //向右旋转90度 #define R_ANGLE_R90 1 //向右旋转90度
#define R_ANGLE_180 2 //旋转180度 #define R_ANGLE_180 2 //旋转180度
PLAYM4_API BOOL __stdcall PlayM4_SetRotateAngle(LONG nPort, DWORD nRegionNum, DWORD dwType); PLAYM4_API BOOL __stdcall PlayM4_SetRotateAngle(LONG nPort, DWORD nRegionNum, DWORD dwType);
#ifndef PLAYM4_ADDITION_INFO_TAG #ifndef PLAYM4_ADDITION_INFO_TAG
#define PLAYM4_ADDITION_INFO_TAG #define PLAYM4_ADDITION_INFO_TAG
typedef struct _PLAYM4_ADDITION_INFO_ //交互信息结构 typedef struct _PLAYM4_ADDITION_INFO_ //交互信息结构
{ {
BYTE* pData; //附件数据 BYTE* pData; //附件数据
DWORD dwDatalen; //附件数据长度 DWORD dwDatalen; //附件数据长度
DWORD dwDataType; //数据类型 DWORD dwDataType; //数据类型
DWORD dwTimeStamp; //相对时间戳 DWORD dwTimeStamp; //相对时间戳
} PLAYM4_ADDITION_INFO; } PLAYM4_ADDITION_INFO;
#endif #endif
//dwGroupIndex 暂约定取值0~3第一版本取消同步只能同个closestream处理 //dwGroupIndex 暂约定取值0~3第一版本取消同步只能同个closestream处理
PLAYM4_API BOOL __stdcall PlayM4_SetSycGroup(LONG nPort, DWORD dwGroupIndex); PLAYM4_API BOOL __stdcall PlayM4_SetSycGroup(LONG nPort, DWORD dwGroupIndex);
//暂不实现此函数,同个组设置的起始时间不一致,以最小的时间作为播放起点,同一组可只设一路 //暂不实现此函数,同个组设置的起始时间不一致,以最小的时间作为播放起点,同一组可只设一路
PLAYM4_API BOOL __stdcall PlayM4_SetSycStartTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime); PLAYM4_API BOOL __stdcall PlayM4_SetSycStartTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
// 以下实现鱼眼相关的接口 // 以下实现鱼眼相关的接口
#ifndef FISH_EYE_TAG #ifndef FISH_EYE_TAG
#define FISH_EYE_TAG #define FISH_EYE_TAG
// 安装类型 // 安装类型
typedef enum tagFECPlaceType typedef enum tagFECPlaceType
{ {
FEC_PLACE_WALL = 0x1, // 壁装方式 (法线水平) FEC_PLACE_WALL = 0x1, // 壁装方式 (法线水平)
FEC_PLACE_FLOOR = 0x2, // 地面安装 (法线向上) FEC_PLACE_FLOOR = 0x2, // 地面安装 (法线向上)
FEC_PLACE_CEILING = 0x3, // 顶装方式 (法线向下) FEC_PLACE_CEILING = 0x3, // 顶装方式 (法线向下)
}FECPLACETYPE; }FECPLACETYPE;
typedef enum tagFECCorrectType typedef enum tagFECCorrectType
{ {
FEC_CORRECT_PTZ = 0x100, // PTZ FEC_CORRECT_PTZ = 0x100, // PTZ
FEC_CORRECT_180 = 0x200, // 180度矫正 对应2P FEC_CORRECT_180 = 0x200, // 180度矫正 对应2P
FEC_CORRECT_360 = 0x300, // 360全景矫正 对应1P FEC_CORRECT_360 = 0x300, // 360全景矫正 对应1P
FEC_CORRECT_LAT = 0x400 //纬度展开 FEC_CORRECT_LAT = 0x400 //纬度展开
}FECCORRECTTYPE; }FECCORRECTTYPE;
typedef struct tagCycleParam typedef struct tagCycleParam
{ {
float fRadiusLeft; // 圆的最左边X坐标 float fRadiusLeft; // 圆的最左边X坐标
float fRadiusRight; // 圆的最右边X坐标 float fRadiusRight; // 圆的最右边X坐标
float fRadiusTop; // 圆的最上边Y坐标 float fRadiusTop; // 圆的最上边Y坐标
float fRadiusBottom; // 圆的最下边Y坐标 float fRadiusBottom; // 圆的最下边Y坐标
}CYCLEPARAM; }CYCLEPARAM;
typedef struct tagPTZParam typedef struct tagPTZParam
{ {
float fPTZPositionX; // PTZ 显示的中心位置 X坐标 float fPTZPositionX; // PTZ 显示的中心位置 X坐标
float fPTZPositionY; // PTZ 显示的中心位置 Y坐标 float fPTZPositionY; // PTZ 显示的中心位置 Y坐标
}PTZPARAM; }PTZPARAM;
// 错误码 // 错误码
/********************************************* /*********************************************
********************************************/ ********************************************/
// 更新标记变量定义 // 更新标记变量定义
#define FEC_UPDATE_RADIUS 0x1 #define FEC_UPDATE_RADIUS 0x1
@@ -572,188 +572,188 @@ typedef struct tagFECParam
{ {
unsigned int nUpDateType; // 更新的类型 unsigned int nUpDateType; // 更新的类型
unsigned int nPlaceAndCorrect; // 安装方式和矫正方式只能用于获取SetParam的时候无效,该值表示安装方式和矫正方式的和 unsigned int nPlaceAndCorrect; // 安装方式和矫正方式只能用于获取SetParam的时候无效,该值表示安装方式和矫正方式的和
PTZPARAM stPTZParam; // PTZ 校正的参数 PTZPARAM stPTZParam; // PTZ 校正的参数
CYCLEPARAM stCycleParam; // 鱼眼图像圆心参数 CYCLEPARAM stCycleParam; // 鱼眼图像圆心参数
float fZoom; // PTZ 显示的范围参数 float fZoom; // PTZ 显示的范围参数
float fWideScanOffset; // 180或者360度校正的偏移角度 float fWideScanOffset; // 180或者360度校正的偏移角度
int nResver[16]; // 保留字段 int nResver[16]; // 保留字段
}FISHEYEPARAM; }FISHEYEPARAM;
typedef void (__stdcall * FISHEYE_CallBack )( void* pUser , unsigned int nSubPort , unsigned int nCBType , void * hDC , unsigned int nWidth , unsigned int nHeight); typedef void (__stdcall * FISHEYE_CallBack )( void* pUser , unsigned int nSubPort , unsigned int nCBType , void * hDC , unsigned int nWidth , unsigned int nHeight);
#endif #endif
// 启用鱼眼 // 启用鱼眼
PLAYM4_API BOOL __stdcall PlayM4_FEC_Enable(LONG nPort); PLAYM4_API BOOL __stdcall PlayM4_FEC_Enable(LONG nPort);
// 关闭鱼眼模块 // 关闭鱼眼模块
PLAYM4_API BOOL __stdcall PlayM4_FEC_Disable(LONG nPort); PLAYM4_API BOOL __stdcall PlayM4_FEC_Disable(LONG nPort);
// 获取鱼眼矫正处理子端口 [1~31] // 获取鱼眼矫正处理子端口 [1~31]
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetPort(LONG nPort, unsigned int* nSubPort,FECPLACETYPE emPlaceType,FECCORRECTTYPE emCorrectType); PLAYM4_API BOOL __stdcall PlayM4_FEC_GetPort(LONG nPort, unsigned int* nSubPort,FECPLACETYPE emPlaceType,FECCORRECTTYPE emCorrectType);
// 删除鱼眼矫正处理子端口 // 删除鱼眼矫正处理子端口
PLAYM4_API BOOL __stdcall PlayM4_FEC_DelPort(LONG nPort , unsigned int nSubPort); PLAYM4_API BOOL __stdcall PlayM4_FEC_DelPort(LONG nPort , unsigned int nSubPort);
// 设置鱼眼矫正参数 // 设置鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara); PLAYM4_API BOOL __stdcall PlayM4_FEC_SetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 获取鱼眼矫正参数 // 获取鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara); PLAYM4_API BOOL __stdcall PlayM4_FEC_GetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 设置显示窗口,可以随时切换 // 设置显示窗口,可以随时切换
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetWnd(LONG nPort , unsigned int nSubPort , void * hWnd); PLAYM4_API BOOL __stdcall PlayM4_FEC_SetWnd(LONG nPort , unsigned int nSubPort , void * hWnd);
// 设置鱼眼窗口的绘图回调 // 设置鱼眼窗口的绘图回调
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetCallBack(LONG nPort , unsigned int nSubPort , FISHEYE_CallBack cbFunc , void * pUser); PLAYM4_API BOOL __stdcall PlayM4_FEC_SetCallBack(LONG nPort , unsigned int nSubPort , FISHEYE_CallBack cbFunc , void * pUser);
//motionflow //motionflow
PLAYM4_API BOOL __stdcall PlayM4_MotionFlow(LONG nPort, DWORD dwAdjustType); PLAYM4_API BOOL __stdcall PlayM4_MotionFlow(LONG nPort, DWORD dwAdjustType);
//图像增强相关 //图像增强相关
#ifndef PLAYM4_HIKVIE_TAG #ifndef PLAYM4_HIKVIE_TAG
#define PLAYM4_HIKVIE_TAG #define PLAYM4_HIKVIE_TAG
typedef struct _PLAYM4_VIE_DYNPARAM_ typedef struct _PLAYM4_VIE_DYNPARAM_
{ {
int moduFlag; //启用的算法处理模块在PLAYM4_VIE_MODULES中定义 int moduFlag; //启用的算法处理模块在PLAYM4_VIE_MODULES中定义
//如 PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN //如 PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN
//模块启用后,必须设置相应的参数; //模块启用后,必须设置相应的参数;
//PLAYM4_VIE_MODU_ADJ //PLAYM4_VIE_MODU_ADJ
int brightVal; //亮度调节值,[-255, 255] int brightVal; //亮度调节值,[-255, 255]
int contrastVal; //对比度调节值,[-256, 255] int contrastVal; //对比度调节值,[-256, 255]
int colorVal; //饱和度调节值,[-256, 255] int colorVal; //饱和度调节值,[-256, 255]
//PLAYM4_VIE_MODU_EHAN //PLAYM4_VIE_MODU_EHAN
int toneScale; //滤波范围,[0, 100] int toneScale; //滤波范围,[0, 100]
int toneGain; //对比度调节,全局对比度增益值,[-256, 255] int toneGain; //对比度调节,全局对比度增益值,[-256, 255]
int toneOffset; //亮度调节,亮度平均值偏移,[-255, 255] int toneOffset; //亮度调节,亮度平均值偏移,[-255, 255]
int toneColor; //颜色调节,颜色保真值,[-256, 255] int toneColor; //颜色调节,颜色保真值,[-256, 255]
//PLAYM4_VIE_MODU_DEHAZE //PLAYM4_VIE_MODU_DEHAZE
int dehazeLevel; //去雾强度,[0, 255] int dehazeLevel; //去雾强度,[0, 255]
int dehazeTrans; //透射值,[0, 255] int dehazeTrans; //透射值,[0, 255]
int dehazeBright; //亮度补偿,[0, 255] int dehazeBright; //亮度补偿,[0, 255]
//PLAYM4_VIE_MODU_DENOISE //PLAYM4_VIE_MODU_DENOISE
int denoiseLevel; //去噪强度,[0, 255] int denoiseLevel; //去噪强度,[0, 255]
//PLAYM4_VIE_MODU_SHARPEN //PLAYM4_VIE_MODU_SHARPEN
int usmAmount; //锐化强度,[0, 255] int usmAmount; //锐化强度,[0, 255]
int usmRadius; //锐化半径,[1, 15] int usmRadius; //锐化半径,[1, 15]
int usmThreshold; //锐化阈值,[0, 255] int usmThreshold; //锐化阈值,[0, 255]
//PLAYM4_VIE_MODU_DEBLOCK //PLAYM4_VIE_MODU_DEBLOCK
int deblockLevel; //去块强度,[0, 100] int deblockLevel; //去块强度,[0, 100]
//PLAYM4_VIE_MODU_LENS //PLAYM4_VIE_MODU_LENS
int lensWarp; //畸变量,[-256, 255] int lensWarp; //畸变量,[-256, 255]
int lensZoom; //缩放量,[-256, 255] int lensZoom; //缩放量,[-256, 255]
//PLAYM4_VIE_MODU_CRB //PLAYM4_VIE_MODU_CRB
//无响应参数 //无响应参数
} PLAYM4_VIE_PARACONFIG; } PLAYM4_VIE_PARACONFIG;
typedef enum _PLAYM4_VIE_MODULES typedef enum _PLAYM4_VIE_MODULES
{ {
PLAYM4_VIE_MODU_ADJ = 0x00000001, //图像基本调节 PLAYM4_VIE_MODU_ADJ = 0x00000001, //图像基本调节
PLAYM4_VIE_MODU_EHAN = 0x00000002, //局部增强模块 PLAYM4_VIE_MODU_EHAN = 0x00000002, //局部增强模块
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //去雾模块 PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //去雾模块
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //去噪模块 PLAYM4_VIE_MODU_DENOISE = 0x00000008, //去噪模块
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //锐化模块 PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //锐化模块
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //去块滤波模块 PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //去块滤波模块
PLAYM4_VIE_MODU_CRB = 0x00000040, //色彩平衡模块 PLAYM4_VIE_MODU_CRB = 0x00000040, //色彩平衡模块
PLAYM4_VIE_MODU_LENS = 0x00000080, //镜头畸变矫正模块 PLAYM4_VIE_MODU_LENS = 0x00000080, //镜头畸变矫正模块
}PLAYM4_VIE_MODULES; }PLAYM4_VIE_MODULES;
#endif #endif
//设置关闭/开启模块 //设置关闭/开启模块
//dwModuFlag对应PLAYM4_VIE_MODULES宏,可组合 //dwModuFlag对应PLAYM4_VIE_MODULES宏,可组合
//先设置模块开启,再设置模块参数;期间采用默认的参数; //先设置模块开启,再设置模块参数;期间采用默认的参数;
//关闭模块后,上次设置的参数清空 //关闭模块后,上次设置的参数清空
//其他接口调用,必须在该接口开启模块后;否则,返回错误 //其他接口调用,必须在该接口开启模块后;否则,返回错误
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetModuConfig(LONG lPort,int nModuFlag,BOOL bEnable); PLAYM4_API BOOL __stdcall PlayM4_VIE_SetModuConfig(LONG lPort,int nModuFlag,BOOL bEnable);
//设置图像增强区域NULL全图超过全图采用全图最小区域16*16像素 //设置图像增强区域NULL全图超过全图采用全图最小区域16*16像素
//可支持设置区域最多比较说4个第一个版本可以只支持一个。多个区域要求不能重叠有重叠就报错 //可支持设置区域最多比较说4个第一个版本可以只支持一个。多个区域要求不能重叠有重叠就报错
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetRegion(LONG lPort,LONG lRegNum,RECT* pRect); PLAYM4_API BOOL __stdcall PlayM4_VIE_SetRegion(LONG lPort,LONG lRegNum,RECT* pRect);
//获取开启模块 //获取开启模块
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetModuConfig(LONG lPort,int* pdwModuFlag); PLAYM4_API BOOL __stdcall PlayM4_VIE_GetModuConfig(LONG lPort,int* pdwModuFlag);
//设置参数 //设置参数
//未开启模块的参数设置被忽略 //未开启模块的参数设置被忽略
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig); PLAYM4_API BOOL __stdcall PlayM4_VIE_SetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//获取开启模块的参数 //获取开启模块的参数
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig); PLAYM4_API BOOL __stdcall PlayM4_VIE_GetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//音视频同步接口 //音视频同步接口
PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio); PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio);
// 私有信息模块类型 // 私有信息模块类型
typedef enum _PLAYM4_PRIDATA_RENDER typedef enum _PLAYM4_PRIDATA_RENDER
{ {
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //智能分析 PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //智能分析
PLAYM4_RENDER_MD = 0x00000002, //移动侦测 PLAYM4_RENDER_MD = 0x00000002, //移动侦测
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS信息后叠加 PLAYM4_RENDER_ADD_POS = 0x00000004, //POS信息后叠加
PLAYM4_RENDER_ADD_PIC = 0x00000008, //图片叠加 PLAYM4_RENDER_ADD_PIC = 0x00000008, //图片叠加
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //热成像信息 PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //热成像信息
PLAYM4_RENDER_TEM = 0x00000020, //温度信息 PLAYM4_RENDER_TEM = 0x00000020, //温度信息
PLAYM4_RENDER_TRACK_TEM = 0x00000040, //轨迹信息 PLAYM4_RENDER_TRACK_TEM = 0x00000040, //轨迹信息
PLAYM4_RENDER_THERMAL = 0x00000080 //废气检测和烟火屏蔽信息 PLAYM4_RENDER_THERMAL = 0x00000080 //废气检测和烟火屏蔽信息
}PLAYM4_PRIDATA_RENDER; }PLAYM4_PRIDATA_RENDER;
typedef enum _PLAYM4_THERMAL_FLAG typedef enum _PLAYM4_THERMAL_FLAG
{ {
PLAYM4_THERMAL_FIREMASK = 0x00000001, //烟火屏蔽 PLAYM4_THERMAL_FIREMASK = 0x00000001, //烟火屏蔽
PLAYM4_THERMAL_RULEGAS = 0x00000002, //规则废气检测 PLAYM4_THERMAL_RULEGAS = 0x00000002, //规则废气检测
PLAYM4_THERMAL_TARGETGAS = 0x00000004 //目标废气检测 PLAYM4_THERMAL_TARGETGAS = 0x00000004 //目标废气检测
}PLAYM4_THERMAL_FLAG; }PLAYM4_THERMAL_FLAG;
typedef enum _PLAYM4_FIRE_ALARM{ typedef enum _PLAYM4_FIRE_ALARM{
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //火点框显示 PLAYM4_FIRE_FRAME_DIS = 0x00000001, //火点框显示
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //最高温度 PLAYM4_FIRE_MAX_TEMP = 0x00000002, //最高温度
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //最高温度位置显示 PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //最高温度位置显示
PLAYM4_FIRE_DISTANCE = 0x00000008, //最高温度距离}PLAYM4_FIRE_ALARM PLAYM4_FIRE_DISTANCE = 0x00000008, //最高温度距离}PLAYM4_FIRE_ALARM
}PLAYM4_FIRE_ALARM; }PLAYM4_FIRE_ALARM;
typedef enum _PLAYM4_TEM_FLAG{ typedef enum _PLAYM4_TEM_FLAG{
PLAYM4_TEM_REGION_BOX = 0x00000001, //框测温 PLAYM4_TEM_REGION_BOX = 0x00000001, //框测温
PLAYM4_TEM_REGION_LINE = 0x00000002, //线测温 PLAYM4_TEM_REGION_LINE = 0x00000002, //线测温
PLAYM4_TEM_REGION_POINT = 0x00000004, //点测温}PLAYM4_TEM_FLAG PLAYM4_TEM_REGION_POINT = 0x00000004, //点测温}PLAYM4_TEM_FLAG
}PLAYM4_TEM_FLAG; }PLAYM4_TEM_FLAG;
typedef enum _PLAYM4_TRACK_FLAG typedef enum _PLAYM4_TRACK_FLAG
{ {
PLAYM4_TRACK_PEOPLE = 0x00000001, //人轨迹 PLAYM4_TRACK_PEOPLE = 0x00000001, //人轨迹
PLAYM4_TRACK_VEHICLE = 0x00000002, //车轨迹 PLAYM4_TRACK_VEHICLE = 0x00000002, //车轨迹
}PLAYM4_TRACK_FLAG; }PLAYM4_TRACK_FLAG;
typedef struct TI_PTZ_INFO_ typedef struct TI_PTZ_INFO_
{ {
unsigned short dwDefVer; //结构体版本 unsigned short dwDefVer; //结构体版本
unsigned short dwLength; //PTZ_info长度以8字节为单位 unsigned short dwLength; //PTZ_info长度以8字节为单位
DWORD dwP; //P0~3600 DWORD dwP; //P0~3600
DWORD dwT; //T0~3600 DWORD dwT; //T0~3600
DWORD dwZ; //Z0~3600 DWORD dwZ; //Z0~3600
BYTE chFSMState; //跟随状态 BYTE chFSMState; //跟随状态
BYTE bClearFocusState; //聚焦清晰状态0,1 BYTE bClearFocusState; //聚焦清晰状态0,1
BYTE reserved[6]; //6个字节保留 BYTE reserved[6]; //6个字节保留
}PTZ_INFO; }PTZ_INFO;
// 智能信息开关 // 智能信息开关
PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateData(LONG nPort, int nIntelType, BOOL bTrue); 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); PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateDataEx(LONG nPort, int nIntelType, int nSubType, BOOL bTrue);
// 加密码流回调,nType=0表示码流加密标记位发生变化就回调nType=1表示码流有加密位发生回调 // 加密码流回调,nType=0表示码流加密标记位发生变化就回调nType=1表示码流有加密位发生回调
PLAYM4_API BOOL __stdcall PlayM4_SetEncryptTypeCallBack(LONG nPort, DWORD nType, PLAYM4_API BOOL __stdcall PlayM4_SetEncryptTypeCallBack(LONG nPort, DWORD nType,
void (CALLBACK* EncryptTypeCBFun)(long nPort, ENCRYPT_INFO* pEncryptInfo, long nUser, long nReserved2), long nUser); void (CALLBACK* EncryptTypeCBFun)(long nPort, ENCRYPT_INFO* pEncryptInfo, long nUser, long nReserved2), long nUser);
//lType: 1 表示获取当前显示帧PTZ信息。以特定结构体形式存储在pInfo内plLen返回长度信息 //lType: 1 表示获取当前显示帧PTZ信息。以特定结构体形式存储在pInfo内plLen返回长度信息
PLAYM4_API BOOL __stdcall PlayM4_GetStreamAdditionalInfo(LONG nPort, LONG lType, BYTE* pInfo, LONG* plLen); PLAYM4_API BOOL __stdcall PlayM4_GetStreamAdditionalInfo(LONG nPort, LONG lType, BYTE* pInfo, LONG* plLen);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="GB2312"?>
<SdkLocal>
<SdkLog>
<logLevel>3</logLevel><!--req, 1-ERROR, 2-DEBUG, 3-INFO-->
<logDirectory>./SDKLOG/</logDirectory><!--the end of the string must be '/'-->
<autoDelete>true</autoDelete><!--true: There are less than 10 files in the directory, it will be auto deleted by sdk when the files are more than 10; false: No upper limit to the number of log files-->
</SdkLog>
<HeartbeatCfg>
<Interval>120</Interval> <!-- <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EBA3AC><EFBFBD><EFBFBD>0<EFBFBD><30>ʹ<EFBFBD><CAB9>Ĭ<EFBFBD><C4AC>ֵ120s<30><73>ȡֵ<C8A1><D6B5>ΧΪ[30, 120] С<><D0A1>30s<30><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ30s<30><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>120s<30><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ120s-->
<Count>1</Count> <!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʹ<EFBFBD><CAB9>Ĭ<EFBFBD><C4AC>ֵ1<D6B5><31>-->
</HeartbeatCfg>
</SdkLocal>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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: MONSUN*/
#define _OSD_CWEEK1 (_OSD_BASE+6) /*show week time in Chinese GB code*/
#define _OSD_HOUR24 (_OSD_BASE+7) /*show 24 hours clock: 0023 */
#define _OSD_HOUR12 (_OSD_BASE+8) /*show 12 hours clock: 0012*/
#define _OSD_MINUTE (_OSD_BASE+9) /*show minute time by length of 2: 0059*/
#define _OSD_SECOND (_OSD_BASE+10) /*show second time by length of 2: 0059*/
#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);
/*
以下为1.7版本新增的功能。
以后可能会根据用户的反馈进行修改和完善。
*/
//原始图像流设置
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);
/*
设置视频输入位置:
(x,y)为系统所处理图像的左上角在摄像机输入的原始图像中的坐标。
x必须为2的整数倍。
(x,y)坐标的参数范围和摄像机的型号有关,如果指定的值和摄像机的输入不匹配,
可能会导致图像静止或水平、垂直方向滚动。
*/
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 //板卡序列号长度
typedef struct tagDS_BOARD_DETAIL
{
BOARD_TYPE_DS type; //板卡类型
BYTE sn[16]; //序列号
UINT dspCount; //板卡包含的DSP个数
UINT firstDspIndex; //板卡上第一个DSP的索引
UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DS_BOARD_DETAIL;
typedef struct tagDSP_DETAIL
{
UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
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);
/*
人脸抓拍接口:仅供测试、评估,以后可能会做修改。
*/
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;
//鱼眼功能错误码
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // 鱼眼模块加载失败
#define PLAYM4_FEC_ERR_NOTENABLE 101 // 鱼眼模块没有加载
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // 子端口没有分配
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // 没有初始化对应端口的参数
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // 子端口已经用完
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // 该安装方式下这种效果不支持
#define PLAYM4_FEC_ERR_INVALIDWND 106 // 非法的窗口
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZ位置越界
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // 圆心参数非法
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // 指定的安装方式和矫正效果,该参数更新不支持
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // 播放库端口没有启用
#define PLAYM4_FEC_ERR_PARAMVALID 111 // 参数为空
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // 非法子端口
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ矫正范围越界
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // 矫正通道饱和,最大支持的矫正通道为四个
#define PLAYM4_FEC_ERR_ENABLED 115 //该端口已经启用了鱼眼模块
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D加速没有开启
//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
// 以下宏定义用于HIK_MEDIAINFO结构
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO结构标记
// 系统封装格式
#define SYSTEM_NULL 0x0 // 没有系统层,纯音频流或视频流
#define SYSTEM_HIK 0x1 // 海康文件层
#define SYSTEM_MPEG2_PS 0x2 // PS封装
#define SYSTEM_MPEG2_TS 0x3 // TS封装
#define SYSTEM_RTP 0x4 // rtp封装
#define SYSTEM_RTPHIK 0x401 // rtp封装
// 视频编码类型
#define VIDEO_NULL 0x0 // 没有视频
#define VIDEO_H264 0x1 // 海康H.264
#define VIDEO_MPEG4 0x3 // 标准MPEG4
#define VIDEO_MJPEG 0x4
#define VIDEO_AVC264 0x0100
// 音频编码类型
#define AUDIO_NULL 0x0000 // 没有音频
#define AUDIO_ADPCM 0x1000 // ADPCM
#define AUDIO_MPEG 0x2000 // MPEG 系列音频解码器能自适应各种MPEG音频
#define AUDIO_AAC 0X2001 // AAC 编码
// G系列音频
#define AUDIO_RAW_DATA8 0x7000 //采样率为8k的原始数据
#define AUDIO_RAW_UDATA16 0x7001 //采样率为16k的原始数据即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 //同步数据:车载信息
#define SYNCDATA_IVS 2 //同步数据:智能信息
//motion flow type
#define MOTION_FLOW_NONE 0
#define MOTION_FLOW_CPU 1
#define MOTION_FLOW_GPU 2
//音视频加密类型
#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; //通道号
char *pBuf; //返回的第一路图像数据指针
unsigned int nBufLen; //返回的第一路图像数据大小
char *pBuf1; //返回的第二路图像数据指针
unsigned int nBufLen1; //返回的第二路图像数据大小
char *pBuf2; //返回的第三路图像数据指针
unsigned int nBufLen2; //返回的第三路图像数据大小
unsigned int nWidth; //画面宽
unsigned int nHeight; //画面高
unsigned int nStamp; //时标信息,单位毫秒
unsigned int nType; //数据类型
void *pUser; //用户数据
unsigned int reserved[4]; //保留
}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; //和码流数据同步的附属信息类型,目前有:智能信息,车载信息
DWORD dwDataLen; //附属信息数据长度
BYTE* pData; //指向附属信息数据结构的指针,比如IVS_INFO结构
} 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; // 版本号指本信息结构版本号目前为0x0101,即1.01版本01主版本号01子版本号。
unsigned short device_id; // 设备ID便于跟随/分析
unsigned short system_format; // 系统封装层
unsigned short video_format; // 视频编码类型
unsigned short audio_format; // 音频编码类型
unsigned char audio_channels; // 通道数
unsigned char audio_bits_per_sample; // 样位率
unsigned int audio_samplesrate; // 采样率
unsigned int audio_bitrate; // 压缩音频码率,单位bit
unsigned int reserved[4]; // 保留
}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 //绝对时间
{
DWORD dwYear; //年
DWORD dwMon; //月
DWORD dwDay; //日
DWORD dwHour; //时
DWORD dwMin; //分
DWORD dwSec; //秒
DWORD dwMs; //毫秒
} PLAYM4_SYSTEM_TIME;
//ENCRYPT Info
typedef struct{
long nVideoEncryptType; //视频加密类型
long nAudioEncryptType; //音频加密类型
long nSetSecretKey; //是否设置1表示设置密钥0表示没有设置密钥
}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_ //交互信息结构
{
int nSessionInfoType; //交互信息类型比如SDP比如海康私有信息头
int nSessionInfoLen; //交互信息长度
unsigned char* pSessionInfoData; //交互信息数据
} 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 //不旋转
#define R_ANGLE_L90 0 //向左旋转90度
#define R_ANGLE_R90 1 //向右旋转90度
#define R_ANGLE_180 2 //旋转180度
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_ //交互信息结构
{
BYTE* pData; //附件数据
DWORD dwDatalen; //附件数据长度
DWORD dwDataType; //数据类型
DWORD dwTimeStamp; //相对时间戳
} PLAYM4_ADDITION_INFO;
#endif
//dwGroupIndex 暂约定取值0~3第一版本取消同步只能同个closestream处理
PLAYM4_API BOOL __stdcall PlayM4_SetSycGroup(LONG nPort, DWORD dwGroupIndex);
//暂不实现此函数,同个组设置的起始时间不一致,以最小的时间作为播放起点,同一组可只设一路
PLAYM4_API BOOL __stdcall PlayM4_SetSycStartTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
// 以下实现鱼眼相关的接口
#ifndef FISH_EYE_TAG
#define FISH_EYE_TAG
// 安装类型
typedef enum tagFECPlaceType
{
FEC_PLACE_WALL = 0x1, // 壁装方式 (法线水平)
FEC_PLACE_FLOOR = 0x2, // 地面安装 (法线向上)
FEC_PLACE_CEILING = 0x3, // 顶装方式 (法线向下)
}FECPLACETYPE;
typedef enum tagFECCorrectType
{
FEC_CORRECT_PTZ = 0x100, // PTZ
FEC_CORRECT_180 = 0x200, // 180度矫正 对应2P
FEC_CORRECT_360 = 0x300, // 360全景矫正 对应1P
FEC_CORRECT_LAT = 0x400 //纬度展开
}FECCORRECTTYPE;
typedef struct tagCycleParam
{
float fRadiusLeft; // 圆的最左边X坐标
float fRadiusRight; // 圆的最右边X坐标
float fRadiusTop; // 圆的最上边Y坐标
float fRadiusBottom; // 圆的最下边Y坐标
}CYCLEPARAM;
typedef struct tagPTZParam
{
float fPTZPositionX; // PTZ 显示的中心位置 X坐标
float fPTZPositionY; // PTZ 显示的中心位置 Y坐标
}PTZPARAM;
// 错误码
/*********************************************
********************************************/
// 更新标记变量定义
#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; // 更新的类型
unsigned int nPlaceAndCorrect; // 安装方式和矫正方式只能用于获取SetParam的时候无效,该值表示安装方式和矫正方式的和
PTZPARAM stPTZParam; // PTZ 校正的参数
CYCLEPARAM stCycleParam; // 鱼眼图像圆心参数
float fZoom; // PTZ 显示的范围参数
float fWideScanOffset; // 180或者360度校正的偏移角度
int nResver[16]; // 保留字段
}FISHEYEPARAM;
typedef void (__stdcall * FISHEYE_CallBack )( void* pUser , unsigned int nSubPort , unsigned int nCBType , void * hDC , unsigned int nWidth , unsigned int nHeight);
#endif
// 启用鱼眼
PLAYM4_API BOOL __stdcall PlayM4_FEC_Enable(LONG nPort);
// 关闭鱼眼模块
PLAYM4_API BOOL __stdcall PlayM4_FEC_Disable(LONG nPort);
// 获取鱼眼矫正处理子端口 [1~31]
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetPort(LONG nPort, unsigned int* nSubPort,FECPLACETYPE emPlaceType,FECCORRECTTYPE emCorrectType);
// 删除鱼眼矫正处理子端口
PLAYM4_API BOOL __stdcall PlayM4_FEC_DelPort(LONG nPort , unsigned int nSubPort);
// 设置鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 获取鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 设置显示窗口,可以随时切换
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetWnd(LONG nPort , unsigned int nSubPort , void * hWnd);
// 设置鱼眼窗口的绘图回调
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);
//图像增强相关
#ifndef PLAYM4_HIKVIE_TAG
#define PLAYM4_HIKVIE_TAG
typedef struct _PLAYM4_VIE_DYNPARAM_
{
int moduFlag; //启用的算法处理模块在PLAYM4_VIE_MODULES中定义
//如 PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN
//模块启用后,必须设置相应的参数;
//PLAYM4_VIE_MODU_ADJ
int brightVal; //亮度调节值,[-255, 255]
int contrastVal; //对比度调节值,[-256, 255]
int colorVal; //饱和度调节值,[-256, 255]
//PLAYM4_VIE_MODU_EHAN
int toneScale; //滤波范围,[0, 100]
int toneGain; //对比度调节,全局对比度增益值,[-256, 255]
int toneOffset; //亮度调节,亮度平均值偏移,[-255, 255]
int toneColor; //颜色调节,颜色保真值,[-256, 255]
//PLAYM4_VIE_MODU_DEHAZE
int dehazeLevel; //去雾强度,[0, 255]
int dehazeTrans; //透射值,[0, 255]
int dehazeBright; //亮度补偿,[0, 255]
//PLAYM4_VIE_MODU_DENOISE
int denoiseLevel; //去噪强度,[0, 255]
//PLAYM4_VIE_MODU_SHARPEN
int usmAmount; //锐化强度,[0, 255]
int usmRadius; //锐化半径,[1, 15]
int usmThreshold; //锐化阈值,[0, 255]
//PLAYM4_VIE_MODU_DEBLOCK
int deblockLevel; //去块强度,[0, 100]
//PLAYM4_VIE_MODU_LENS
int lensWarp; //畸变量,[-256, 255]
int lensZoom; //缩放量,[-256, 255]
//PLAYM4_VIE_MODU_CRB
//无响应参数
} PLAYM4_VIE_PARACONFIG;
typedef enum _PLAYM4_VIE_MODULES
{
PLAYM4_VIE_MODU_ADJ = 0x00000001, //图像基本调节
PLAYM4_VIE_MODU_EHAN = 0x00000002, //局部增强模块
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //去雾模块
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //去噪模块
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //锐化模块
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //去块滤波模块
PLAYM4_VIE_MODU_CRB = 0x00000040, //色彩平衡模块
PLAYM4_VIE_MODU_LENS = 0x00000080, //镜头畸变矫正模块
}PLAYM4_VIE_MODULES;
#endif
//设置关闭/开启模块
//dwModuFlag对应PLAYM4_VIE_MODULES宏,可组合
//先设置模块开启,再设置模块参数;期间采用默认的参数;
//关闭模块后,上次设置的参数清空
//其他接口调用,必须在该接口开启模块后;否则,返回错误
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetModuConfig(LONG lPort,int nModuFlag,BOOL bEnable);
//设置图像增强区域NULL全图超过全图采用全图最小区域16*16像素
//可支持设置区域最多比较说4个第一个版本可以只支持一个。多个区域要求不能重叠有重叠就报错
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetRegion(LONG lPort,LONG lRegNum,RECT* pRect);
//获取开启模块
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetModuConfig(LONG lPort,int* pdwModuFlag);
//设置参数
//未开启模块的参数设置被忽略
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//获取开启模块的参数
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//音视频同步接口
PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio);
// 私有信息模块类型
typedef enum _PLAYM4_PRIDATA_RENDER
{
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //智能分析
PLAYM4_RENDER_MD = 0x00000002, //移动侦测
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS信息后叠加
PLAYM4_RENDER_ADD_PIC = 0x00000008, //图片叠加
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //热成像信息
PLAYM4_RENDER_TEM = 0x00000020, //温度信息
PLAYM4_RENDER_TRACK_TEM = 0x00000040, //轨迹信息
PLAYM4_RENDER_THERMAL = 0x00000080 //废气检测和烟火屏蔽信息
}PLAYM4_PRIDATA_RENDER;
typedef enum _PLAYM4_THERMAL_FLAG
{
PLAYM4_THERMAL_FIREMASK = 0x00000001, //烟火屏蔽
PLAYM4_THERMAL_RULEGAS = 0x00000002, //规则废气检测
PLAYM4_THERMAL_TARGETGAS = 0x00000004 //目标废气检测
}PLAYM4_THERMAL_FLAG;
typedef enum _PLAYM4_FIRE_ALARM{
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //火点框显示
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //最高温度
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //最高温度位置显示
PLAYM4_FIRE_DISTANCE = 0x00000008, //最高温度距离}PLAYM4_FIRE_ALARM
}PLAYM4_FIRE_ALARM;
typedef enum _PLAYM4_TEM_FLAG{
PLAYM4_TEM_REGION_BOX = 0x00000001, //框测温
PLAYM4_TEM_REGION_LINE = 0x00000002, //线测温
PLAYM4_TEM_REGION_POINT = 0x00000004, //点测温}PLAYM4_TEM_FLAG
}PLAYM4_TEM_FLAG;
typedef enum _PLAYM4_TRACK_FLAG
{
PLAYM4_TRACK_PEOPLE = 0x00000001, //人轨迹
PLAYM4_TRACK_VEHICLE = 0x00000002, //车轨迹
}PLAYM4_TRACK_FLAG;
typedef struct TI_PTZ_INFO_
{
unsigned short dwDefVer; //结构体版本
unsigned short dwLength; //PTZ_info长度以8字节为单位
DWORD dwP; //P0~3600
DWORD dwT; //T0~3600
DWORD dwZ; //Z0~3600
BYTE chFSMState; //跟随状态
BYTE bClearFocusState; //聚焦清晰状态0,1
BYTE reserved[6]; //6个字节保留
}PTZ_INFO;
// 智能信息开关
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);
// 加密码流回调,nType=0表示码流加密标记位发生变化就回调nType=1表示码流有加密位发生回调
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 表示获取当前显示帧PTZ信息。以特定结构体形式存储在pInfo内plLen返回长度信息
PLAYM4_API BOOL __stdcall PlayM4_GetStreamAdditionalInfo(LONG nPort, LONG lType, BYTE* pInfo, LONG* plLen);
#endif //_PLAYM4_H_

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
The dll in this directory<72><79>iconv.dll,libxml2.dll,zlib1.dll,calib.dll<6C><6C>only used in ClientDemo.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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: MONSUN*/
#define _OSD_CWEEK1 (_OSD_BASE+6) /*show week time in Chinese GB code*/
#define _OSD_HOUR24 (_OSD_BASE+7) /*show 24 hours clock: 0023 */
#define _OSD_HOUR12 (_OSD_BASE+8) /*show 12 hours clock: 0012*/
#define _OSD_MINUTE (_OSD_BASE+9) /*show minute time by length of 2: 0059*/
#define _OSD_SECOND (_OSD_BASE+10) /*show second time by length of 2: 0059*/
#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);
/*
以下为1.7版本新增的功能。
以后可能会根据用户的反馈进行修改和完善。
*/
//原始图像流设置
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);
/*
设置视频输入位置:
(x,y)为系统所处理图像的左上角在摄像机输入的原始图像中的坐标。
x必须为2的整数倍。
(x,y)坐标的参数范围和摄像机的型号有关,如果指定的值和摄像机的输入不匹配,
可能会导致图像静止或水平、垂直方向滚动。
*/
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 //板卡序列号长度
typedef struct tagDS_BOARD_DETAIL
{
BOARD_TYPE_DS type; //板卡类型
BYTE sn[16]; //序列号
UINT dspCount; //板卡包含的DSP个数
UINT firstDspIndex; //板卡上第一个DSP的索引
UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DS_BOARD_DETAIL;
typedef struct tagDSP_DETAIL
{
UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
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);
/*
人脸检测接口:仅供测试、评估,以后可能会做修改。
*/
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;
//鱼眼功能错误码
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // 鱼眼模块加载失败
#define PLAYM4_FEC_ERR_NOTENABLE 101 // 鱼眼模块没有加载
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // 子端口没有分配
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // 没有初始化对应端口的参数
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // 子端口已经用完
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // 该安装方式下这种效果不支持
#define PLAYM4_FEC_ERR_INVALIDWND 106 // 非法的窗口
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZ位置越界
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // 圆心参数非法
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // 指定的安装方式和矫正效果,该参数更新不支持
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // 播放库端口没有启用
#define PLAYM4_FEC_ERR_PARAMVALID 111 // 参数为空
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // 非法子端口
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ矫正范围越界
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // 矫正通道饱和,最大支持的矫正通道为四个
#define PLAYM4_FEC_ERR_ENABLED 115 //该端口已经启用了鱼眼模块
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D加速没有开启
#define PLAYM4_FEC_ERR_PLACETYPE 117 // 安装方式不对.一个播放库port对应一种安装方式
#define PLAYM4_FEC_ERR_CorrectType 118 // 矫正方式错误:如矫正方式已有,则不能开多个比如一个播放库port,设定除了PTZ和鱼眼半球矫正方式外,其他的矫正方式则只能开一路;设置180度矫正不能和ptz矫正一起开半球矫正与其他矫正则无关联性。
#define PLAYM4_FEC_ERR_NULLWND 119 // 鱼眼窗口为空
#define PLAYM4_FEC_ERR_PARA 120 // 鱼眼参数错误
//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
// 以下宏定义用于HIK_MEDIAINFO结构
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO结构标记
// 系统封装格式
#define SYSTEM_NULL 0x0 // 没有系统层,纯音频流或视频流
#define SYSTEM_HIK 0x1 // 海康文件层
#define SYSTEM_MPEG2_PS 0x2 // PS封装
#define SYSTEM_MPEG2_TS 0x3 // TS封装
#define SYSTEM_RTP 0x4 // rtp封装
#define SYSTEM_RTPHIK 0x401 // rtp封装
// 视频编码类型
#define VIDEO_NULL 0x0 // 没有视频
#define VIDEO_H264 0x1 // 标准H.264和海康H.264都可以用这个定义
#define VIDEO_MPEG2 0x2 // 标准MPEG2
#define VIDEO_MPEG4 0x3 // 标准MPEG4
#define VIDEO_MJPEG 0x4
#define VIDEO_AVC264 0x0100
// 音频编码类型
#define AUDIO_NULL 0x0000 // 没有音频
#define AUDIO_ADPCM 0x1000 // ADPCM
#define AUDIO_MPEG 0x2000 // MPEG 系列音频解码器能自适应各种MPEG音频
#define AUDIO_AAC 0x2001
// G系列音频
#define AUDIO_RAW_DATA8 0x7000 //采样率为8k的原始数据
#define AUDIO_RAW_UDATA16 0x7001 //采样率为16k的原始数据即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 //同步数据:车载信息
#define SYNCDATA_IVS 2 //同步数据:智能信息
//motion flow type
#define MOTION_FLOW_NONE 0
#define MOTION_FLOW_CPU 1
#define MOTION_FLOW_GPU 2
//音视频加密类型
#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; //和码流数据同步的附属信息类型,目前有:智能信息,车载信息
unsigned int dwDataLen; //附属信息数据长度
unsigned char* pData; //指向附属信息数据结构的指针,比如IVS_INFO结构
} 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; // 版本号指本信息结构版本号目前为0x0101,即1.01版本01主版本号01子版本号。
unsigned short device_id; // 设备ID便于跟踪/分析
unsigned short system_format; // 系统封装层
unsigned short video_format; // 视频编码类型
unsigned short audio_format; // 音频编码类型
unsigned char audio_channels; // 通道数
unsigned char audio_bits_per_sample; // 样位率
unsigned int audio_samplesrate; // 采样率
unsigned int audio_bitrate; // 压缩音频码率,单位bit
unsigned char flag; //8bit,0x81表示是 smart标记否则为非smart,快速识别intra的方式是 media_version >= 0x0103&& video_fortmat = (H.264 or H.265) && ((flag & 0x02) ==0x2)
unsigned char stream_tag; //8bit,0x81表示码流中含有SDP信息
unsigned char reserved[14]; // 保留
}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 //绝对时间
{
unsigned int dwYear; //年
unsigned int dwMon; //月
unsigned int dwDay; //日
unsigned int dwHour; //时
unsigned int dwMin; //分
unsigned int dwSec; //秒
unsigned int dwMs; //毫秒
} PLAYM4_SYSTEM_TIME;
#ifndef CROP_PIC_INFO_TAG
#define CROP_PIC_INFO_TAG
typedef struct
{
unsigned char* pDataBuf; //抓图数据buffer
unsigned int dwPicSize; //实际图片大小
unsigned int dwBufSize; //数据buffer大小
unsigned int dwPicWidth; //截图宽
unsigned int dwPicHeight; //截图高
unsigned int dwReserve; //多加一个reserve字段
HKRECT* pCropRect; //选择区域NULL, 同老的抓图接口
}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);///<多窗口分割接口
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);///< 增加帧类型回调
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_ //交互信息结构
{
int nSessionInfoType; //交互信息类型比如SDP比如海康私有信息头
int nSessionInfoLen; //交互信息长度
unsigned char* pSessionInfoData; //交互信息数据
} 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 //不旋转
#define R_ANGLE_L90 0 //向左旋转90度
#define R_ANGLE_R90 1 //向右旋转90度
#define R_ANGLE_180 2 //旋转180度
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_ //交互信息结构
{
unsigned char* pData; //附件数据
unsigned int dwDatalen; //附件数据长度
unsigned int dwDataType; //数据类型
unsigned int dwTimeStamp; //相对时间戳
} PLAYM4_ADDITION_INFO;
#endif
//dwGroupIndex 暂约定取值0~3第一版本取消同步只能同个closestream处理
PLAYM4_API int __stdcall PlayM4_SetSycGroup(int nPort, unsigned int dwGroupIndex);
//暂不实现此函数,同个组设置的起始时间不一致,以最小的时间作为播放起点,同一组可只设一路
PLAYM4_API int __stdcall PlayM4_SetSycStartTime(int nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
// 以下实现鱼眼相关的接口
#ifndef FISH_EYE_TAG
#define FISH_EYE_TAG
// 矫正类型
typedef enum tagFECPlaceType
{
FEC_PLACE_WALL = 0x1, // 壁装方式 (法线水平)
FEC_PLACE_FLOOR = 0x2, // 地面安装 (法线向上)
FEC_PLACE_CEILING = 0x3, // 顶装方式 (法线向下)
}FECPLACETYPE;
typedef enum tagFECCorrectType
{
FEC_CORRECT_NULL = 0x0, // 不矫正(原图)
FEC_CORRECT_PTZ = 0x100, // PTZ
FEC_CORRECT_180 = 0x200, // 180度矫正 对应2P
FEC_CORRECT_360 = 0x300, // 360全景矫正 对应1P
FEC_CORRECT_LAT = 0x400, // 纬度展开
FEC_CORRECT_SEMISPHERE = 0x500, // 3D半球矫正
FEC_CORRECT_CYLINDER = 0x0600, // 鱼眼圆柱显示 - 顶装/底装
FEC_CORRECT_CYLINDER_SPLIT = 0x0700, // 鱼眼切开的圆柱显示 - 顶装/底装
FEC_CORRECT_PLANET = 0x0800, // 鱼眼小行星
FEC_CORRECT_ARCSPHERE_HORIZONTAL = 0x0900, // 鱼眼水平弧面 - 壁装
FEC_CORRECT_ARCSPHERE_VERTICAL = 0x0A00, // 鱼眼垂直弧面 - 壁装
}FECCORRECTTYPE;
typedef enum tagFECCorrectEffect
{
FEC_CORRECT_EFFECT_BACK_FACE_CULLING = 0x100, // 背面剔除非0表示启用为0表示不启用建议设置整数强转浮点数
}FECCORRECTEFFECT;
typedef struct tagCycleParam
{
float fRadiusLeft; // 圆的最左边X坐标
float fRadiusRight; // 圆的最右边X坐标
float fRadiusTop; // 圆的最上边Y坐标
float fRadiusBottom; // 圆的最下边Y坐标
}CYCLEPARAM;
typedef struct tagPTZParam
{
float fPTZPositionX; // PTZ 显示的中心位置 X坐标
float fPTZPositionY; // PTZ 显示的中心位置 Y坐标
}PTZPARAM;
// PTZ在原始鱼眼图上轮廓的显示模式
typedef enum tagFECShowMode
{
FEC_PTZ_OUTLINE_NULL, // 不显示
FEC_PTZ_OUTLINE_RECT, // 矩形显示
FEC_PTZ_OUTLINE_RANGE, // 真实区域显示
}FECSHOWMODE;
// 更新标记变量定义
#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
// 色彩结构体
typedef struct tagFECColor
{
unsigned char nR; // R分量
unsigned char nG; // G分量
unsigned char nB; // B分量
unsigned char nAlpha; // Alpha分量
}FECCOLOR;
typedef struct tagFECParam
{
unsigned int nUpDateType; // 更新的类型
unsigned int nPlaceAndCorrect; // 安装方式和矫正方式只能用于获取SetParam的时候无效,该值表示安装方式和矫正方式的和
PTZPARAM stPTZParam; // PTZ 校正的参数
CYCLEPARAM stCycleParam; // 鱼眼图像圆心参数
float fZoom; // PTZ 显示的范围参数
float fWideScanOffset; // 180或者360度校正的偏移角度
FECCOLOR stPTZColor; // PTZ颜色
int nResver[15]; // 保留字段
}FISHEYEPARAM;
#define FEC_JPEG 0 // JPEG抓图
#define FEC_BMP 1 // BMP 抓图
///<新的3d鱼眼半球矫正画面的视角变化调节(缩放和旋转)
typedef enum tagPLAYM4HRViewParamType
{
PLAYM4_HR_VPT_ROTATION_X = 0x1, ///<水平旋转
PLAYM4_HR_VPT_ROTATION_Y = 0x2, ///<垂直旋转
PLAYM4_HR_VPT_SCALE = 0x3, ///<缩放(其绝对值为浮点型0值时为黑屏-正常效果)
}PLAYM4HRVIEWPARAMTYPE;
// 鱼眼3D模型参数
typedef enum tagPLAYM4FEC3DModelParam
{
PLAYM4_FEC_3DMP_CYLINDER_HEIGHT = 0x1, ///< 圆柱模型高
PLAYM4_FEC_3DMP_CYLINDER_RADIUS = 0x2, ///< 圆柱模型半径
}PLAYM4FEC3DMODELPARAM;
// 特定视角状态
typedef enum tagPLAYM4FECSpecialViewType
{
PLAYM4_FEC_SVT_EDGE = 0x1 ///<弧面鱼眼模型与窗口贴边视角
}PLAYM4FECSPECIALVIEWTYPE;
#endif
typedef void (__stdcall * FISHEYE_CallBack )( void* pUser , unsigned int nPort , unsigned int nCBType , void * hDC , unsigned int nWidth , unsigned int nHeight);
// 启用鱼眼
PLAYM4_API int __stdcall PlayM4_FEC_Enable(int nPort);
// 关闭鱼眼模块
PLAYM4_API int __stdcall PlayM4_FEC_Disable(int nPort);
// 获取鱼眼矫正处理子端口 [1~31]
PLAYM4_API int __stdcall PlayM4_FEC_GetPort(int nPort , unsigned int* nSubPort , FECPLACETYPE emPlaceType , FECCORRECTTYPE emCorrectType);
// 删除鱼眼矫正处理子端口
PLAYM4_API int __stdcall PlayM4_FEC_DelPort(int nPort , unsigned int nSubPort);
// 设置鱼眼矫正参数
PLAYM4_API int __stdcall PlayM4_FEC_SetParam(int nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 获取鱼眼矫正参数
PLAYM4_API int __stdcall PlayM4_FEC_GetParam(int nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 设置显示窗口,可以随时切换
PLAYM4_API int __stdcall PlayM4_FEC_SetWnd(int nPort , unsigned int nSubPort , void * hWnd);
// 设置鱼眼窗口的绘图回调
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);
//新的鱼眼半球矫正视角变化(旋转)两个相关接口
//获取半球矫正视角参数(设置前先获取当前的值)
PLAYM4_API int __stdcall PlayM4_FEC_GetViewParam(int nPort, unsigned int nSubPort, PLAYM4HRVIEWPARAMTYPE enViewParamType, float* fValue);
//设置半球矫正视角变化参数(设置的值为获取值加上要偏移值)
PLAYM4_API int __stdcall PlayM4_FEC_SetViewParam(int nPort, unsigned int nSubPort, PLAYM4HRVIEWPARAMTYPE enViewParamType, float fValue);
//鱼眼电子放大 nType = 0
//鱼眼窗口分割 nType = 1
//注意窗口分割时hDestWnd无效请设置为NULL20180813暂不支持
//目前电子放大不支持其他窗口上放大nRegionNum置为0hDestWnd置为NULLbEnable置为0取消电子放大非0为电子放大
//pSrcRect区域归一化乘以1000除以宽或者高其值在0-1000之间
//只推荐原图、180、360、纬度展开不带PTZ显示电子放大再开ptz会导致电子放大失效-3D鱼眼不建议使用此接口(用视角变化接口进行缩放)
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);
//背面剔除非0表示启用为0表示不启用建议设置整数强转浮点数
PLAYM4_API bool __stdcall PlayM4_FEC_SetCorrectEffect(int nPort, unsigned int nSubPort, FECCORRECTEFFECT nCorrectEffect, float fValue);
// 设置3D模型参数-针对3D圆柱展开有效
PLAYM4_API bool __stdcall PlayM4_FEC_Set3DModelParam(int nPort, unsigned int nSubPort, PLAYM4FEC3DMODELPARAM enType, float fValue);
// 获取特定视角参数 - 只适用于弧面跟SetViewParam接口配合使用
PLAYM4_API bool __stdcall PlayM4_FEC_GetSpecialViewParam(int nPort, unsigned int nSubPort, PLAYM4FECSPECIALVIEWTYPE enSVType, PLAYM4HRVIEWPARAMTYPE enVPType, float* pValue);
//图像增强相关-Linux版本不支持
#ifndef PLAYM4_HIKVIE_TAG
#define PLAYM4_HIKVIE_TAG
typedef struct _PLAYM4_VIE_DYNPARAM_
{
int moduFlag; //启用的算法处理模块在PLAYM4_VIE_MODULES中定义
//如 PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN
//模块启用后,必须设置相应的参数;
//PLAYM4_VIE_MODU_ADJ
int brightVal; //亮度调节值,[-255, 255]
int contrastVal; //对比度调节值,[-256, 255]
int colorVal; //饱和度调节值,[-256, 255]
//PLAYM4_VIE_MODU_EHAN
int toneScale; //滤波范围,[0, 100]
int toneGain; //对比度调节,全局对比度增益值,[-256, 255]
int toneOffset; //亮度调节,亮度平均值偏移,[-255, 255]
int toneColor; //颜色调节,颜色保真值,[-256, 255]
//PLAYM4_VIE_MODU_DEHAZE
int dehazeLevel; //去雾强度,[0, 255]
int dehazeTrans; //透射值,[0, 255]
int dehazeBright; //亮度补偿,[0, 255]
//PLAYM4_VIE_MODU_DENOISE
int denoiseLevel; //去噪强度,[0, 255]
//PLAYM4_VIE_MODU_SHARPEN
int usmAmount; //锐化强度,[0, 255]
int usmRadius; //锐化半径,[1, 15]
int usmThreshold; //锐化阈值,[0, 255]
//PLAYM4_VIE_MODU_DEBLOCK
int deblockLevel; //去块强度,[0, 100]
//PLAYM4_VIE_MODU_LENS
int lensWarp; //畸变量,[-256, 255]
int lensZoom; //缩放量,[-256, 255]
//PLAYM4_VIE_MODU_CRB
//无响应参数
} PLAYM4_VIE_PARACONFIG;
typedef enum _PLAYM4_VIE_MODULES
{
PLAYM4_VIE_MODU_ADJ = 0x00000001, //图像基本调节
PLAYM4_VIE_MODU_EHAN = 0x00000002, //局部增强模块
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //去雾模块
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //去噪模块
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //锐化模块
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //去块滤波模块
PLAYM4_VIE_MODU_CRB = 0x00000040, //色彩平衡模块
PLAYM4_VIE_MODU_LENS = 0x00000080, //镜头畸变矫正模块
}PLAYM4_VIE_MODULES;
#endif
//设置关闭/开启模块 -- NO SUPPORT
//dwModuFlag对应PLAYM4_VIE_MODULES宏,可组合
//先设置模块开启,再设置模块参数;期间采用默认的参数;
//关闭模块后,上次设置的参数清空
//其他接口调用,必须在该接口开启模块后;否则,返回错误
PLAYM4_API int __stdcall PlayM4_VIE_SetModuConfig(int nPort, int nModuFlag, int bEnable);
//设置图像增强区域NULL全图超过全图采用全图最小区域16*16像素 -- NO SUPPORT
//可支持设置区域最多比较说4个第一个版本可以只支持一个。多个区域要求不能重叠有重叠就报错
PLAYM4_API int __stdcall PlayM4_VIE_SetRegion(int nPort, int nRegNum, HKRECT* pRect);
//获取开启模块 -- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_VIE_GetModuConfig(int nPort, int* pdwModuFlag);
//设置参数
//未开启模块的参数设置被忽略 -- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_VIE_SetParaConfig(int nPort, PLAYM4_VIE_PARACONFIG* pParaConfig);
//获取开启模块的参数 -- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_VIE_GetParaConfig(int nPort, PLAYM4_VIE_PARACONFIG* pParaConfig);
// 私有信息模块类型
typedef enum _PLAYM4_PRIDATA_RENDER
{
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //智能分析
PLAYM4_RENDER_MD = 0x00000002, //移动侦测
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS信息后叠加
PLAYM4_RENDER_ADD_PIC = 0x00000008, //图片叠加信息
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //热成像信息
PLAYM4_RENDER_TEM = 0x00000020, //温度信息
}PLAYM4_PRIDATA_RENDER;
typedef enum _PLAYM4_FIRE_ALARM
{
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //火点框显示
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //最高温度
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //最高温度位置显示
PLAYM4_FIRE_DISTANCE = 0x00000008, //最高温度距离
}PLAYM4_FIRE_ALARM;
typedef enum _PLAYM4_TEM_FLAG
{
PLAYM4_TEM_REGION_BOX = 0x00000001, //框测温
PLAYM4_TEM_REGION_LINE = 0x00000002, //线测温
PLAYM4_TEM_REGION_POINT = 0x00000004, //点测温
}PLAYM4_TEM_FLAG;
// 智能信息开关
PLAYM4_API int __stdcall PlayM4_RenderPrivateData(int nPort, int nIntelType, int bTrue);
///<智能信息子开关
PLAYM4_API int __stdcall PlayM4_RenderPrivateDataEx(int nPort, int nIntelType, int nSubType, int bTrue);
//ENCRYPT Info
typedef struct{
long nVideoEncryptType; //视频加密类型
long nAudioEncryptType; //音频加密类型
long nSetSecretKey; //是否设置1表示设置密钥0表示没有设置密钥
}ENCRYPT_INFO;
// 加密码流回调,nType=0表示码流加密标记位发生变化就回调nType=1表示码流有加密位发生回调
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 //系统头数据
#define PLAYM4_VIDEO_DATA 2 //视频流数据
#define PLAYM4_AUDIO_DATA 3 //音频流数据
#define PLAYM4_PRIVT_DATA 4 //私有流数据
//预录像数据信息- NO SUPPORT
typedef struct
{
long nType; // 数据类型,如文件头,视频,音频,私有数据等
long nStamp; // 时间戳
long nFrameNum; // 帧号
long nBufLen; // 数据长度
char* pBuf; // 帧数据,以帧为单位回调
PLAYM4_SYSTEM_TIME stSysTime; // 全局时间
}RECORD_DATA_INFO;
//设置预录像开关bFlag=1开启bFlag=0关闭-- NO SUPPORT
PLAYM4_API int __stdcall PlayM4_SetPreRecordFlag(int nPort, int bFlag);
//预录像数据数据回调- 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; //私有数据类型
long lDataStrVersion; //数据返回的结构体版本,主要是为了兼容性
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 表示获取当前显示帧PTZ信息。以特定结构体形式存储在pInfo内plLen返回长度信息;起先传入pInfo = null可以获取出需要分配的内存长度plLen
PLAYM4_API int __stdcall PlayM4_GetStreamAdditionalInfo(int nPort, int lType, unsigned char* pInfo, int* plLen);
#define PLAYM4_SOURCE_MODULE 0 // 数据源模块
#define PLAYM4_DEMUX_MODULE 1 // 解析模块
#define PLAYM4_DECODE_MODULE 2 // 解码模块
#define PLAYM4_RENDER_MODULE 3 // 渲染模块
#define PLAYM4_RTINFO_HARDDECODE_ERROR 0 // 硬解码致命(需要切软解)错误
#define PLAYM4_RTINFO_SOFTDECODE_ERROR 1 // 软解码错误(不支持)
#define PLAYM4_RTINFO_MEDIAHEADER_ERROR 2 // 媒体头错误
#define PLAYM4_RTINFO_SWITCH_SOFT_DEC 3 // 切换至软解
#define PLAYM4_RTINFO_ALLOC_MEMORY_ERROR 4 // 内存分配失败
#define PLAYM4_RTINFO_ENCRYPT_ERROR 5 // 秘钥错误
#define PLAYM4_RTINFO_RENDER_OVER 8 // 渲染一帧结束
#define PLAYM4_RTINFO_ERR_PRESENT 16 // 渲染显示错误[当前渲染引擎渲染失败,上层重新切换引擎]
#define PLAYM4_RTINFO_IDMX_DATA_ERROR 32 // 数据有误,解析失败
#define PLAYM4_RTINFO_DECODE_PARAM_ERROR 64 // 参数有误,解码失败
#define PLAYM4_RTINFO_SOFTDECODE_DATA_ERROR 128 // 软解码数据错误
typedef struct
{
int nRunTimeModule; //当前运行模块暂定2为解码模块后续扩展
int nStrVersion; //数据返回的结构体版本,主要是为了兼容性,第一个版本定义成0x0001
int nFrameTimeStamp; //帧号
int nFrameNum; //时间戳
int nErrorCode; //错误码,0为硬解错误
unsigned char reserved[12]; //保留字节
}RunTimeInfo;
///<实时信息回调接口
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallBackEx(int nPort, int nModule, void (CALLBACK* RunTimeInfoCBFun)(int nPort, RunTimeInfo* pstRunTimeInfo, void* pUser), void* pUser);
// 1、SetRunTimeInfoCallBackEx接口nErrorCode类型6改为类型8以后扩展方式 16、32、64且从8开始消息默认关闭不发送。
// 2、新增消息控制接口控制从8以后的消息支持从8开始后消息拼接模式 8|16|32 这种方式,上层主动选择接受类型。
// 3、nType可以通过或的方式将类型传入nFlag表示清除为0或者进行回调非0
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallbackType(int nPort, int nModule, unsigned int nType, int nFlag);
///<渲染显示相关接口
#ifndef PLAYM4_HIKD3D11_TAG
#define PLAYM4_HIKD3D11_TAG
///<渲染抓图结构体
typedef struct _tagD3D11_PIC_INFO_
{
unsigned int nPicMode; //抓图模式0-按照码流实际分辨率抓图(之前抓图模式)1-按照下面传入的宽高抓图nPicWidth*nPicHeight为显示窗口宽高时效果最佳
unsigned char* pBuf; //抓图数据buffer
unsigned int nBufSize; //缓存buffer大小-如果nPicMode为0则为之前的根据获取到的码流分辨率来进行缓存申请如果nPicMode为1则上层根据设置的分辨率来申请缓存
unsigned int* pPicSize; //实际图片大小
unsigned int nPicWidth; //设置抓图宽-nPicMode为1时有效且宽>=32,nPicWidth*nPicHeight<5000w分辨率。
unsigned int nPicHeight; //设置抓图高-nPicMode为1时有效且高>=32,nPicWidth*nPicHeight<5000w分辨率。
unsigned char chReserve[8]; //reserve保留字段
}D3D_PIC_INFO;
/*渲染图像后处理类型*/
typedef enum tagPLAYM4PostProcType
{
PLAYM4_PPT_BRIGHTNESS = 0x1, ///< 亮度 [-1.0, 1.0]
PLAYM4_PPT_HUE = 0x2, ///< 色度 [0.0, 1.0]----0.166累加为一种颜色变化及0和1为同一种颜色
PLAYM4_PPT_SATURATION = 0x3, ///< 饱和度 [-1.0, 1.0]
PLAYM4_PPT_CONTRAST = 0x4, ///< 对比度 [-1.0, 1.0]
PLAYM4_PPT_SHARPNESS = 0x5, ///< 锐度 [ 0.0, 1.0]
}PLAYM4PostProcType;
#endif
///<渲染库抓图:nType:0-jpeg,1-bmp.
PLAYM4_API int __stdcall PlayM4_GetD3DCapture(int nPort, unsigned int nType, D3D_PIC_INFO* pstPicInfo);
///<渲染后处理-设置参数
PLAYM4_API int __stdcall PlayM4_SetD3DPostProcess(int nPort, PLAYM4PostProcType nPostType, float fValue);
///<渲染后处理-获取参数
PLAYM4_API int __stdcall PlayM4_GetD3DPostProcess(int nPort, PLAYM4PostProcType nPostType, float* fValue);
///<字符叠加的字体库路径(不设置时采用默认字体库)-play前设置
PLAYM4_API int __stdcall PlayM4_SetConfigFontPath(int nPort, char* pFontPath);
// 根据相对时间获取mp4封装在线定位偏移
PLAYM4_API int __stdcall PlayM4_GetMpOffset(int nPort, int nTime, int* nOffset);
///<时区的表示以秒为单位,东区为正,西区为负-同步回放
PLAYM4_API bool __stdcall PlayM4_SetSupplementaryTimeZone(int nPort, int nTimeZone);
///<若已经设置时区则返回设置时区,否则失败-同步回放
PLAYM4_API bool __stdcall PlayM4_GetSupplementaryTimeZone(int nPort, int* pTimeZone);
////////////////////////////////////
///<窗口大小改变通知接口
PLAYM4_API int __stdcall PlayM4_WndResolutionChange(int nPort);//new add
//不建议使用
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_

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More