1. 使用CGO对代码进行重构
This commit is contained in:
		
							
								
								
									
										444
									
								
								BallCamera.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										444
									
								
								BallCamera.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,444 @@ | |||||||
|  | package HikSDK | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | #cgo LDFLAGS: -Wl,--allow-multiple-definition | ||||||
|  | #include <stdio.h> | ||||||
|  | #include <string.h> | ||||||
|  | */ | ||||||
|  | import "C" | ||||||
|  | import ( | ||||||
|  | 	"encoding/binary" | ||||||
|  | 	"errors" | ||||||
|  | 	"fmt" | ||||||
|  | 	"gitea.com/kunmeng/HikNetSDKPkg/core" | ||||||
|  | 	"sync" | ||||||
|  | 	"time" | ||||||
|  | 	"unsafe" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	Base      = 0 | ||||||
|  | 	BuKongQiu = 1 | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type PTZEnumObj struct { | ||||||
|  | 	PTZ_LEFT       int | ||||||
|  | 	PTZ_RIGHT      int | ||||||
|  | 	PTZ_UP         int | ||||||
|  | 	PTZ_DOWN       int | ||||||
|  | 	PTZ_UP_LEFT    int | ||||||
|  | 	PTZ_UP_RIGHT   int | ||||||
|  | 	PTZ_DOWN_LEFT  int | ||||||
|  | 	PTZ_DOWN_RIGHT int | ||||||
|  | 	PTZ_ZOOM_IN    int | ||||||
|  | 	PTZ_ZOOM_OUT   int | ||||||
|  | 	PTZ_Focus_Far  int | ||||||
|  | 	PTZ_Focus_Near int | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (receiver *PTZEnumObj) toHikPTZEnum(v int) int { | ||||||
|  | 	switch v { | ||||||
|  | 	case PTZEnum.PTZ_LEFT: | ||||||
|  | 		return HikPTZEnum.PAN_LEFT | ||||||
|  | 	case PTZEnum.PTZ_RIGHT: | ||||||
|  | 		return HikPTZEnum.PAN_RIGHT | ||||||
|  | 	case PTZEnum.PTZ_UP: | ||||||
|  | 		return HikPTZEnum.TILT_UP | ||||||
|  | 	case PTZEnum.PTZ_DOWN: | ||||||
|  | 		return HikPTZEnum.TILT_DOWN | ||||||
|  | 	case PTZEnum.PTZ_ZOOM_IN: | ||||||
|  | 		return HikPTZEnum.ZOOM_IN | ||||||
|  | 	case PTZEnum.PTZ_ZOOM_OUT: | ||||||
|  | 		return HikPTZEnum.ZOOM_OUT | ||||||
|  | 	case PTZEnum.PTZ_Focus_Far: | ||||||
|  | 		return HikPTZEnum.FOCUS_FAR | ||||||
|  | 	case PTZEnum.PTZ_Focus_Near: | ||||||
|  | 		return HikPTZEnum.FOCUS_NEAR | ||||||
|  | 	case PTZEnum.PTZ_UP_LEFT: | ||||||
|  | 		return HikPTZEnum.UP_LEFT | ||||||
|  | 	case PTZEnum.PTZ_UP_RIGHT: | ||||||
|  | 		return HikPTZEnum.UP_RIGHT | ||||||
|  | 	case PTZEnum.PTZ_DOWN_LEFT: | ||||||
|  | 		return HikPTZEnum.DOWN_LEFT | ||||||
|  | 	case PTZEnum.PTZ_DOWN_RIGHT: | ||||||
|  | 		return HikPTZEnum.DOWN_RIGHT | ||||||
|  |  | ||||||
|  | 	default: | ||||||
|  | 		return -1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | var PTZEnum = PTZEnumObj{ | ||||||
|  | 	PTZ_LEFT:       1, | ||||||
|  | 	PTZ_RIGHT:      2, | ||||||
|  | 	PTZ_UP:         3, | ||||||
|  | 	PTZ_DOWN:       4, | ||||||
|  | 	PTZ_UP_LEFT:    5, | ||||||
|  | 	PTZ_UP_RIGHT:   6, | ||||||
|  | 	PTZ_DOWN_LEFT:  7, | ||||||
|  | 	PTZ_DOWN_RIGHT: 8, | ||||||
|  | 	PTZ_ZOOM_IN:    9, | ||||||
|  | 	PTZ_ZOOM_OUT:   10, | ||||||
|  | 	PTZ_Focus_Far:  11, | ||||||
|  | 	PTZ_Focus_Near: 12, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | var HikPTZEnum = struct { | ||||||
|  | 	LIGHT_PWRON         int //接通灯光电源 | ||||||
|  | 	WIPER_PWRON         int //接通雨刷开关 | ||||||
|  | 	FAN_PWRON           int //接通风扇开关 | ||||||
|  | 	HEATER_PWRON        int //接通加热器开关 | ||||||
|  | 	AUX_PWRON1          int //接通辅助设备开关 | ||||||
|  | 	AUX_PWRON2          int //接通辅助设备开关 | ||||||
|  | 	ZOOM_IN             int //焦距变大(倍率变大) | ||||||
|  | 	ZOOM_OUT            int //焦距变小(倍率变小) | ||||||
|  | 	FOCUS_NEAR          int //焦点前调 | ||||||
|  | 	FOCUS_FAR           int //焦点后调 | ||||||
|  | 	IRIS_OPEN           int //光圈扩大 | ||||||
|  | 	IRIS_CLOSE          int //光圈缩小 | ||||||
|  | 	TILT_UP             int //云台上仰 | ||||||
|  | 	TILT_DOWN           int //云台下俯 | ||||||
|  | 	PAN_LEFT            int //云台左转 | ||||||
|  | 	PAN_RIGHT           int //云台右转 | ||||||
|  | 	UP_LEFT             int //云台上仰和左转 | ||||||
|  | 	UP_RIGHT            int //云台上仰和右转 | ||||||
|  | 	DOWN_LEFT           int //云台下俯和左转 | ||||||
|  | 	DOWN_RIGHT          int //云台下俯和右转 | ||||||
|  | 	PAN_AUTO            int //云台左右自动扫描 | ||||||
|  | 	TILT_DOWN_ZOOM_IN   int //云台下俯和焦距变大(倍率变大) | ||||||
|  | 	TILT_DOWN_ZOOM_OUT  int //云台下俯和焦距变小(倍率变小) | ||||||
|  | 	PAN_LEFT_ZOOM_IN    int //云台左转和焦距变大(倍率变大) | ||||||
|  | 	PAN_LEFT_ZOOM_OUT   int //云台左转和焦距变小(倍率变小) | ||||||
|  | 	PAN_RIGHT_ZOOM_IN   int //云台右转和焦距变大(倍率变大) | ||||||
|  | 	PAN_RIGHT_ZOOM_OUT  int //云台右转和焦距变小(倍率变小) | ||||||
|  | 	UP_LEFT_ZOOM_IN     int //云台上仰和左转和焦距变大(倍率变大) | ||||||
|  | 	UP_LEFT_ZOOM_OUT    int //云台上仰和左转和焦距变小(倍率变小) | ||||||
|  | 	UP_RIGHT_ZOOM_IN    int //云台上仰和右转和焦距变大(倍率变大) | ||||||
|  | 	UP_RIGHT_ZOOM_OUT   int //云台上仰和右转和焦距变小(倍率变小) | ||||||
|  | 	DOWN_LEFT_ZOOM_IN   int //云台下俯和左转和焦距变大(倍率变大) | ||||||
|  | 	DOWN_LEFT_ZOOM_OUT  int //云台下俯和左转和焦距变小(倍率变小) | ||||||
|  | 	DOWN_RIGHT_ZOOM_IN  int //云台下俯和右转和焦距变大(倍率变大) | ||||||
|  | 	DOWN_RIGHT_ZOOM_OUT int //云台下俯和右转和焦距变小(倍率变小) | ||||||
|  | 	TILT_UP_ZOOM_IN     int //云台上仰和焦距变大(倍率变大) | ||||||
|  | 	TILT_UP_ZOOM_OUT    int //云台上仰和焦距变小(倍率变小) | ||||||
|  | }{LIGHT_PWRON: 2, | ||||||
|  | 	WIPER_PWRON:         3, | ||||||
|  | 	FAN_PWRON:           4, | ||||||
|  | 	HEATER_PWRON:        5, | ||||||
|  | 	AUX_PWRON1:          6, | ||||||
|  | 	AUX_PWRON2:          7, | ||||||
|  | 	ZOOM_IN:             11, | ||||||
|  | 	ZOOM_OUT:            12, | ||||||
|  | 	FOCUS_NEAR:          13, | ||||||
|  | 	FOCUS_FAR:           14, | ||||||
|  | 	IRIS_OPEN:           15, | ||||||
|  | 	IRIS_CLOSE:          16, | ||||||
|  | 	TILT_UP:             21, | ||||||
|  | 	TILT_DOWN:           22, | ||||||
|  | 	PAN_LEFT:            23, | ||||||
|  | 	PAN_RIGHT:           24, | ||||||
|  | 	UP_LEFT:             25, | ||||||
|  | 	UP_RIGHT:            26, | ||||||
|  | 	DOWN_LEFT:           27, | ||||||
|  | 	DOWN_RIGHT:          28, | ||||||
|  | 	PAN_AUTO:            29, | ||||||
|  | 	TILT_DOWN_ZOOM_IN:   58, | ||||||
|  | 	TILT_DOWN_ZOOM_OUT:  59, | ||||||
|  | 	PAN_LEFT_ZOOM_IN:    60, | ||||||
|  | 	PAN_LEFT_ZOOM_OUT:   61, | ||||||
|  | 	PAN_RIGHT_ZOOM_IN:   62, | ||||||
|  | 	PAN_RIGHT_ZOOM_OUT:  63, | ||||||
|  | 	UP_LEFT_ZOOM_IN:     64, | ||||||
|  | 	UP_LEFT_ZOOM_OUT:    65, | ||||||
|  | 	UP_RIGHT_ZOOM_IN:    66, | ||||||
|  | 	UP_RIGHT_ZOOM_OUT:   67, | ||||||
|  | 	DOWN_LEFT_ZOOM_IN:   68, | ||||||
|  | 	DOWN_LEFT_ZOOM_OUT:  69, | ||||||
|  | 	DOWN_RIGHT_ZOOM_IN:  70, | ||||||
|  | 	DOWN_RIGHT_ZOOM_OUT: 71, | ||||||
|  | 	TILT_UP_ZOOM_IN:     72, | ||||||
|  | 	TILT_UP_ZOOM_OUT:    73, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type BallCamera struct { | ||||||
|  | 	userId       core.LONG | ||||||
|  | 	_type        uint8 | ||||||
|  | 	deviceInfo   core.NET_DVR_DEVICEINFO_V30 | ||||||
|  | 	mu           sync.Mutex | ||||||
|  | 	expectedType byte | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func NewBallCamera(Ip string, Port int, Username, Password string, Type uint8) (*BallCamera, error) { | ||||||
|  | 	UserId, DeviceInfo, err := core.Login(Ip, Port, Username, Password) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return &BallCamera{ | ||||||
|  | 		userId:     UserId, | ||||||
|  | 		_type:      Type, | ||||||
|  | 		deviceInfo: DeviceInfo, | ||||||
|  | 	}, nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type PTZ struct { | ||||||
|  | 	P float32 | ||||||
|  | 	T float32 | ||||||
|  | 	Z float32 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (this *BallCamera) GetPTZ() (PTZ, error) { | ||||||
|  | 	if this._type == BuKongQiu { | ||||||
|  | 		var data PTZ | ||||||
|  |  | ||||||
|  | 		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 { | ||||||
|  | 		return PTZ{}, err | ||||||
|  | 	} | ||||||
|  | 	res := data.Go() | ||||||
|  | 	return PTZ{ | ||||||
|  | 		P: float32(res.WPanPos), | ||||||
|  | 		T: float32(res.WTiltPos), | ||||||
|  | 		Z: float32(res.WZoomPos), | ||||||
|  | 	}, nil | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func padding(n int) ([]byte, error) { | ||||||
|  | 	if n < 0 || n > 65535 { | ||||||
|  | 		return []byte{0x00, 0x00}, errors.New("n must be in the range 0-65535") | ||||||
|  | 	} | ||||||
|  | 	return []byte{byte(n >> 8), byte(n & 0xFF)}, nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (this *BallCamera) PtzGotoPut(Action int, P, T, Z float64) error { | ||||||
|  | 	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)) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 		TByte, err := padding(int(T * 100)) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 		ZByte, err := padding(int(Z * 100)) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 		//println(PByte, TByte, ZByte) | ||||||
|  | 		pBuf := append([]byte{0xff, 0x01, 0x00, 0x4b}, PByte...) | ||||||
|  | 		tBuf := append([]byte{0xff, 0x01, 0x00, 0x4d}, TByte...) | ||||||
|  | 		zBuf := append([]byte{0xff, 0x01, 0x00, 0x4f}, ZByte...) | ||||||
|  |  | ||||||
|  | 		pBufv, err := verify(pBuf) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 		tBufv, err := verify(tBuf) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 		zBufv, err := verify(zBuf) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 		pBuf = append(pBuf, pBufv) | ||||||
|  | 		tBuf = append(tBuf, tBufv) | ||||||
|  | 		zBuf = append(zBuf, zBufv) | ||||||
|  | 		switch Action { | ||||||
|  | 		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 { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	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 { | ||||||
|  | 		case success := <-ch: | ||||||
|  | 			if success { | ||||||
|  | 				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 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (receiver *BallCamera) StartBus(direction int, speed int) error { | ||||||
|  | 	err := core.PTZControlWithSpeed_Other(receiver.userId, core.LONG(receiver.deviceInfo.ByStartChan), core.DWORD(direction), core.DWORD(0), core.DWORD(speed)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  | func (receiver *BallCamera) StopBus(direction int, speed int) error { | ||||||
|  | 	err := core.PTZControlWithSpeed_Other(receiver.userId, core.LONG(receiver.deviceInfo.ByStartChan), core.DWORD(direction), core.DWORD(1), core.DWORD(speed)) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func verify(data []byte) (byte, error) { | ||||||
|  | 	if len(data) < 6 { | ||||||
|  | 		return 0, fmt.Errorf("data too short") | ||||||
|  | 	} | ||||||
|  | 	sum := 0 | ||||||
|  | 	for i := 1; i < 6; i++ { | ||||||
|  | 		sum += int(data[i]) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// 取模并转换为16进制 | ||||||
|  | 	checksum := sum % 0x100 | ||||||
|  | 	return byte(checksum), nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (receiver *BallCamera) Logout() error { | ||||||
|  | 	//if receiver._type == BuKongQiu { | ||||||
|  | 	//	err := core.SerialStop(receiver.serialStartHandle) | ||||||
|  | 	//	if err != nil { | ||||||
|  | 	//		return err | ||||||
|  | 	//	} | ||||||
|  | 	//} | ||||||
|  | 	err := core.Logout(receiver.userId) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
							
								
								
									
										48
									
								
								BallCamera_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								BallCamera_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | |||||||
|  | package HikSDK | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"fmt" | ||||||
|  | 	"gitea.com/kunmeng/HikNetSDKPkg/core" | ||||||
|  | 	"testing" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | func TestCamera(t *testing.T) { | ||||||
|  | 	err := core.Init() | ||||||
|  | 	if err != nil { | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	Camera, err := NewBallCamera("192.168.211.48", 8000, "admin", "okwy1234", BuKongQiu) | ||||||
|  | 	//Camera, err := NewBallCamera("192.168.211.64", 8000, "admin", "ubis3333", Base) | ||||||
|  | 	if err != nil { | ||||||
|  | 		t.Errorf("NewBallCamera() error = %v", err) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	//err = Camera.StartBus(PTZEnum.toHikPTZEnum(PTZEnum.PTZ_RIGHT), 1) | ||||||
|  | 	//if err != nil { | ||||||
|  | 	//	return | ||||||
|  | 	//} | ||||||
|  | 	//time.Sleep(2000 * time.Millisecond) | ||||||
|  | 	//err = Camera.StopBus(PTZEnum.toHikPTZEnum(PTZEnum.PTZ_RIGHT), 1) | ||||||
|  | 	//if err != nil { | ||||||
|  | 	//	return | ||||||
|  | 	//} | ||||||
|  |  | ||||||
|  | 	err = Camera.PtzGotoPut(1, 11.11, 22.22, 33.33) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	for i := 0; i < 1; i++ { | ||||||
|  | 		ptzdata, err := Camera.GetPTZ() | ||||||
|  | 		if err != nil { | ||||||
|  | 			t.Errorf("GetPTZ() error = %v", err) | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
|  | 		fmt.Printf("%.2f %.2f %.2f \n", ptzdata.P, ptzdata.T, ptzdata.Z) | ||||||
|  | 	} | ||||||
|  | 	err = Camera.Logout() | ||||||
|  | 	if err != nil { | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										153
									
								
								HikBallCamera.go
									
									
									
									
									
								
							
							
						
						
									
										153
									
								
								HikBallCamera.go
									
									
									
									
									
								
							| @@ -1,153 +0,0 @@ | |||||||
| package HikNetSDK |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"errors" |  | ||||||
| 	"fmt" |  | ||||||
| 	"sync" |  | ||||||
| 	"unsafe" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type HIKBallCamera struct { |  | ||||||
| 	core          unsafe.Pointer |  | ||||||
| 	State         bool |  | ||||||
| 	BallCameraCfg BallCamera |  | ||||||
| 	mux           sync.RWMutex |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func NewHIKBallCamera(BallCameraCfg BallCamera) *HIKBallCamera { |  | ||||||
| 	return &HIKBallCamera{ |  | ||||||
| 		core:          newHIKBallCamera(), |  | ||||||
| 		BallCameraCfg: BallCameraCfg, |  | ||||||
| 		State:         false, |  | ||||||
| 		mux:           sync.RWMutex{}, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) Login() (bool, uint, error) { |  | ||||||
| 	var ErrorCode uint |  | ||||||
| 	ErrorInfo := make([]byte, 128) |  | ||||||
| 	ErrorInfoPtr := &ErrorInfo[0] |  | ||||||
| 	hikBC.mux.Lock() |  | ||||||
| 	hikBC.State = initBallCamera(hikBC.core, hikBC.BallCameraCfg.Ip, hikBC.BallCameraCfg.Port, hikBC.BallCameraCfg.User, hikBC.BallCameraCfg.Password, hikBC.BallCameraCfg.Type, unsafe.Pointer(&ErrorCode), ErrorInfoPtr) |  | ||||||
| 	outState := hikBC.State |  | ||||||
| 	hikBC.mux.Unlock() |  | ||||||
| 	return outState, ErrorCode, errors.New(goString(ErrorInfoPtr)) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) Logout() (bool, uint, error) { |  | ||||||
| 	var ErrorCode uint |  | ||||||
| 	ErrorInfo := make([]byte, 128) |  | ||||||
| 	ErrorInfoPtr := &ErrorInfo[0] |  | ||||||
| 	hikBC.mux.Lock() |  | ||||||
| 	hikBC.State = ballCameraLogout(hikBC.core, unsafe.Pointer(&ErrorCode), ErrorInfoPtr) |  | ||||||
| 	outState := hikBC.State |  | ||||||
| 	hikBC.mux.Unlock() |  | ||||||
| 	return outState, ErrorCode, errors.New(goString(ErrorInfoPtr)) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // goString 将 `char*` 转换为 Go 字符串 |  | ||||||
| func goString(cstr *byte) string { |  | ||||||
| 	if cstr == nil { |  | ||||||
| 		return "" |  | ||||||
| 	} |  | ||||||
| 	// 找到 C 字符串的长度(以 null 结尾) |  | ||||||
| 	data := unsafe.Slice(cstr, 128) // 假设最大长度 128,实际可根据情况调整 |  | ||||||
| 	for i, b := range data { |  | ||||||
| 		if b == 0 { // 遇到 null 终止符 |  | ||||||
| 			return string(data[:i]) |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return string(data) // 如果没有 null 终止符,返回整个 slice |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) opt(action func() bool) bool { |  | ||||||
| 	hikBC.mux.RLock() |  | ||||||
| 	if hikBC.State { |  | ||||||
| 		hikBC.mux.RUnlock() |  | ||||||
| 		hikBC.mux.Lock() |  | ||||||
| 		hikBC.State = action() |  | ||||||
| 		hikBC.mux.Unlock() |  | ||||||
| 	} else { |  | ||||||
| 		hikBC.mux.RUnlock() |  | ||||||
| 	} |  | ||||||
| 	return hikBC.State |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) PTZGet(P, T, Z *float32) bool { |  | ||||||
| 	return hikBC.opt(func() bool { |  | ||||||
| 		return ptzGet(hikBC.core, unsafe.Pointer(P), unsafe.Pointer(T), unsafe.Pointer(Z)) |  | ||||||
| 	}) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) PtzTo(Action int, P, T, Z float32) bool { |  | ||||||
| 	return hikBC.opt(func() bool { |  | ||||||
| 		return ptzTo(hikBC.core, Action, P, T, Z) |  | ||||||
| 	}) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) StartBus(Direction, Speed int) bool { |  | ||||||
| 	return hikBC.opt(func() bool { |  | ||||||
| 		return startBus(hikBC.core, Direction, Speed) |  | ||||||
| 	}) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) StopBus(Direction int) bool { |  | ||||||
| 	return hikBC.opt(func() bool { |  | ||||||
| 		return stopBus(hikBC.core, Direction) |  | ||||||
| 	}) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) OneClickToSeeInFullView(point Point) bool { |  | ||||||
| 	TransPoint := hikBC.WarpingPtByHomography(hikBC.BallCameraCfg.Matrix.Matrix, point) |  | ||||||
| 	return hikBC.PtzTo(5, |  | ||||||
| 		float32(hikBC.mapping(hikBC.BallCameraCfg.Matrix.PStart, hikBC.BallCameraCfg.Matrix.PMax, TransPoint.X, hikBC.BallCameraCfg.Matrix.PPositiveDirection, "inv")), |  | ||||||
| 		float32(hikBC.mapping(hikBC.BallCameraCfg.Matrix.TStart, hikBC.BallCameraCfg.Matrix.TMax, TransPoint.Y, hikBC.BallCameraCfg.Matrix.TPositiveDirection, "inv")), |  | ||||||
| 		0.0, |  | ||||||
| 	) |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) PTZ2FullView() (Point, error) { |  | ||||||
| 	var ptz PTZ |  | ||||||
| 	if !hikBC.PTZGet(&ptz.P, &ptz.T, &ptz.Z) { |  | ||||||
| 		return Point{}, fmt.Errorf("PTZ Get Error") |  | ||||||
| 	} |  | ||||||
| 	return hikBC.WarpingPtByHomography(hikBC.BallCameraCfg.Matrix.InvMatrix, Point{ |  | ||||||
| 		X: hikBC.mapping(hikBC.BallCameraCfg.Matrix.PStart, hikBC.BallCameraCfg.Matrix.PMax, float64(ptz.P), hikBC.BallCameraCfg.Matrix.PPositiveDirection, ""), |  | ||||||
| 		Y: hikBC.mapping(hikBC.BallCameraCfg.Matrix.TStart, hikBC.BallCameraCfg.Matrix.TMax, float64(ptz.T), hikBC.BallCameraCfg.Matrix.TPositiveDirection, "")}), nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) WarpingPtByHomography(matrix []float64, p Point) Point { |  | ||||||
| 	var x, y, z float64 |  | ||||||
| 	x = matrix[0]*p.X + matrix[1]*p.Y + 1.*matrix[2] |  | ||||||
| 	y = matrix[3]*p.X + matrix[4]*p.Y + 1.*matrix[5] |  | ||||||
| 	z = matrix[6]*p.X + matrix[7]*p.Y + 1.*matrix[8] |  | ||||||
|  |  | ||||||
| 	x /= z |  | ||||||
| 	y /= z |  | ||||||
| 	return Point{X: x, Y: y} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (hikBC *HIKBallCamera) mapping(startV float64, max float64, value float64, direction string, method string) float64 { |  | ||||||
| 	if direction == "+" { |  | ||||||
| 		if method == "inv" { |  | ||||||
| 			if value > (max - startV) { |  | ||||||
| 				return value - (max - startV) |  | ||||||
| 			} else { |  | ||||||
| 				return startV + value // 映射 |  | ||||||
| 			} |  | ||||||
| 		} else { |  | ||||||
| 			if value > startV { |  | ||||||
| 				return value - startV |  | ||||||
| 			} else { |  | ||||||
| 				return (max - startV) + value // 映射 |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} else { |  | ||||||
| 		if value > startV { |  | ||||||
| 			return startV + max - value |  | ||||||
| 		} else { |  | ||||||
| 			return startV - value |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -1,24 +0,0 @@ | |||||||
| package HikNetSDK |  | ||||||
|  |  | ||||||
| import "testing" |  | ||||||
|  |  | ||||||
| func TestHIKBallCamera_Login(t *testing.T) { |  | ||||||
| 	Init() |  | ||||||
| 	if DvrInit() != 0 { |  | ||||||
| 		t.Error("Dvr init failed") |  | ||||||
| 	} |  | ||||||
| 	Camera := NewHIKBallCamera(BallCamera{ |  | ||||||
| 		Type:     "BuKongQiu", |  | ||||||
| 		Name:     "布控球", |  | ||||||
| 		Ip:       "192.168.211.44", |  | ||||||
| 		Port:     "8000", |  | ||||||
| 		User:     "admin", |  | ||||||
| 		Password: "okwy1234", |  | ||||||
| 		Channel:  1, |  | ||||||
| 	}) |  | ||||||
| 	State, ErrorCode, ErrorInfo := Camera.Login() |  | ||||||
| 	if !State { |  | ||||||
| 		t.Error(ErrorCode, ErrorInfo) |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
							
								
								
									
										103
									
								
								HikNvr.go
									
									
									
									
									
								
							
							
						
						
									
										103
									
								
								HikNvr.go
									
									
									
									
									
								
							| @@ -1,103 +0,0 @@ | |||||||
| package HikNetSDK |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
|     "sync" |  | ||||||
|     "unsafe" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type HIKNvr struct { |  | ||||||
|     core      unsafe.Pointer |  | ||||||
|     State     bool |  | ||||||
|     NvrConfig Nvr |  | ||||||
|     mux       sync.RWMutex |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func NewHIKNvr(nvrConfig Nvr) *HIKNvr { |  | ||||||
|     return &HIKNvr{ |  | ||||||
|         core:      newHIKNvr(), |  | ||||||
|         NvrConfig: nvrConfig, |  | ||||||
|         State:     false, |  | ||||||
|         mux:       sync.RWMutex{}, |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *HIKNvr) opt(action func() bool) bool { |  | ||||||
|     h.mux.RLock() |  | ||||||
|     if h.State { |  | ||||||
|         h.mux.RUnlock() |  | ||||||
|         h.mux.Lock() |  | ||||||
|         h.State = action() |  | ||||||
|         h.mux.Unlock() |  | ||||||
|     } |  | ||||||
|     h.mux.RUnlock() |  | ||||||
|     return h.State |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *HIKNvr) Login() bool { |  | ||||||
|     h.mux.Lock() |  | ||||||
|     h.State = initNvr(h.core, h.NvrConfig.Ip, h.NvrConfig.Port, h.NvrConfig.User, h.NvrConfig.Password, h.NvrConfig.Channel) |  | ||||||
|     h.mux.Unlock() |  | ||||||
|     return h.State |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *HIKNvr) CheckTimeRegionWithMonth(year int, month int) string { |  | ||||||
|     h.mux.RLock() |  | ||||||
|     if h.State { |  | ||||||
|         h.mux.RUnlock() |  | ||||||
|         data := checkTimeRegionWithMonth(h.core, year, month) |  | ||||||
|         if data == "" { |  | ||||||
|             h.mux.Lock() |  | ||||||
|             h.State = false |  | ||||||
|             h.mux.Unlock() |  | ||||||
|         } else { |  | ||||||
|             h.mux.Lock() |  | ||||||
|             h.State = true |  | ||||||
|             h.mux.Unlock() |  | ||||||
|             return data |  | ||||||
|         } |  | ||||||
|     } else { |  | ||||||
|         h.mux.RUnlock() |  | ||||||
|     } |  | ||||||
|     return "" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *HIKNvr) CheckTimeRegionWithDay(year int, month int, day int) string { |  | ||||||
|     h.mux.RLock() |  | ||||||
|     if h.State { |  | ||||||
|         h.mux.RUnlock() |  | ||||||
|         data := checkTimeRegionWithDay(h.core, year, month, day) |  | ||||||
|         if data == "" { |  | ||||||
|             h.mux.Lock() |  | ||||||
|             h.State = false |  | ||||||
|             h.mux.Unlock() |  | ||||||
|         } else { |  | ||||||
|             h.mux.Lock() |  | ||||||
|             h.State = true |  | ||||||
|             h.mux.Unlock() |  | ||||||
|             return data |  | ||||||
|         } |  | ||||||
|     } else { |  | ||||||
|         h.mux.RUnlock() |  | ||||||
|     } |  | ||||||
|     return "" |  | ||||||
| } |  | ||||||
| func (h *HIKNvr) UTCDiff() int { |  | ||||||
|     h.mux.RLock() |  | ||||||
|     if h.State { |  | ||||||
|         data := nvrUTCDiff(h.core) |  | ||||||
|         h.mux.RUnlock() |  | ||||||
|         if nvrUTCDiff(h.core) == 5000 { |  | ||||||
|             h.mux.Lock() |  | ||||||
|             h.State = false |  | ||||||
|             h.mux.Unlock() |  | ||||||
|         } else { |  | ||||||
|             h.mux.Lock() |  | ||||||
|             h.State = true |  | ||||||
|             h.mux.Unlock() |  | ||||||
|             return data |  | ||||||
|         } |  | ||||||
|     } else { |  | ||||||
|         h.mux.RUnlock() |  | ||||||
|     } |  | ||||||
|     return 5000 |  | ||||||
| } |  | ||||||
							
								
								
									
										69
									
								
								Hikvision.go
									
									
									
									
									
								
							
							
						
						
									
										69
									
								
								Hikvision.go
									
									
									
									
									
								
							| @@ -1,69 +0,0 @@ | |||||||
| package HikNetSDK |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"fmt" |  | ||||||
| 	"github.com/ebitengine/purego" |  | ||||||
| 	"runtime" |  | ||||||
| 	"unsafe" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| var libc uintptr |  | ||||||
|  |  | ||||||
| var ( |  | ||||||
| 	DvrInit func() int |  | ||||||
|  |  | ||||||
| 	newHIKBallCamera func() unsafe.Pointer |  | ||||||
| 	initBallCamera   func(core unsafe.Pointer, ip string, port string, username string, password string, BallMachineType string, ErrorCode unsafe.Pointer, ErrorInfo *byte) bool |  | ||||||
| 	ballCameraLogout func(core unsafe.Pointer, ErrorCode unsafe.Pointer, ErrorInfo *byte) bool |  | ||||||
| 	ptzTo            func(core unsafe.Pointer, Action int, P float32, T float32, Z float32) bool |  | ||||||
| 	ptzGet           func(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) bool |  | ||||||
| 	stopBus          func(unsafe.Pointer, int) bool |  | ||||||
| 	startBus         func(unsafe.Pointer, int, int) bool |  | ||||||
|  |  | ||||||
| 	newHIKNvr                func() unsafe.Pointer |  | ||||||
| 	initNvr                  func(unsafe.Pointer, string, string, string, string, int) bool |  | ||||||
| 	checkTimeRegionWithMonth func(core unsafe.Pointer, year int, month int) string |  | ||||||
| 	checkTimeRegionWithDay   func(core unsafe.Pointer, year int, month int, day int) string |  | ||||||
| 	nvrUTCDiff               func(core unsafe.Pointer) int |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func Init() { |  | ||||||
| 	var err error |  | ||||||
| 	libc, err = openLibrary(getSystemLibrary()) |  | ||||||
| 	if err != nil { |  | ||||||
| 		panic(err) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	purego.RegisterLibFunc(&DvrInit, libc, "DVR_Init") |  | ||||||
|  |  | ||||||
| 	purego.RegisterLibFunc(&newHIKBallCamera, libc, "NewHIKBallCamera") |  | ||||||
| 	purego.RegisterLibFunc(&initBallCamera, libc, "InitBallCamera") |  | ||||||
| 	purego.RegisterLibFunc(&ballCameraLogout, libc, "LogoutBallCamera") |  | ||||||
|  |  | ||||||
| 	purego.RegisterLibFunc(&ptzTo, libc, "PtzGotoPut") |  | ||||||
| 	purego.RegisterLibFunc(&ptzGet, libc, "PtzGet") |  | ||||||
| 	purego.RegisterLibFunc(&stopBus, libc, "StopBus") |  | ||||||
| 	purego.RegisterLibFunc(&startBus, libc, "StartBus") |  | ||||||
|  |  | ||||||
| 	purego.RegisterLibFunc(&newHIKNvr, libc, "NewHIKNvr") |  | ||||||
| 	purego.RegisterLibFunc(&initNvr, libc, "InitNvr") |  | ||||||
| 	purego.RegisterLibFunc(&checkTimeRegionWithMonth, libc, "CheckTimeRegionWithMonth") |  | ||||||
| 	purego.RegisterLibFunc(&checkTimeRegionWithDay, libc, "CheckTimeRegionWithDay") |  | ||||||
| 	purego.RegisterLibFunc(&nvrUTCDiff, libc, "NvrUTCDiff") |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func getSystemLibrary() string { |  | ||||||
| 	switch runtime.GOOS { |  | ||||||
| 	case "linux": |  | ||||||
| 		if runtime.GOARCH == "amd64" || runtime.GOARCH == "386" { |  | ||||||
| 			return "libHikNetSDKPkg_linux_amd64.so" |  | ||||||
| 		} else { |  | ||||||
| 			return "libHikNetSDKPkg_linux_arm64.so" |  | ||||||
| 		} |  | ||||||
| 	case "windows": |  | ||||||
| 		return "HikNetSDKPkg_win_amd64.dll" |  | ||||||
| 	default: |  | ||||||
| 		panic(fmt.Errorf("GOOS=%s is not supported", runtime.GOOS)) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
							
								
								
									
										28
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,28 +0,0 @@ | |||||||
| ## 已验证系统环境 |  | ||||||
|  |  | ||||||
| |   架构    |     系统      |使用docker | |  | ||||||
| |:-------:|:-----------:|:-------:| |  | ||||||
| | aarch64 | alpine:3.19 |   🐳    | |  | ||||||
| | x86_64  | alpine:3.19 |   🐳    | |  | ||||||
| | x86_64  | windows 10  |         | |  | ||||||
|  |  | ||||||
| ## 编译流程 |  | ||||||
| ### 1. 下载库 |  | ||||||
| 在仓库的发行版中 将 HikNetSDK 标签下的不同架构的 lib 放在源码根目录中 |  | ||||||
| ```shell |  | ||||||
| D:. |  | ||||||
| │  V6.1.9.45_build20220902_ArmLinux64_ZH_20240802154010_lib.zip |  | ||||||
| │  V6.1.9.48_build20230410_linux64_20240829112751_lib.zip |  | ||||||
| │  V6.1.9.48_build20230410_win64_20240829112623_lib.zip |  | ||||||
| ``` |  | ||||||
| ### 2.1 编译 Linux 部分 |  | ||||||
| 将下载的zip压缩文件 `ArmLinux64` 和 `linux64` 在源码目录解压,然后重命名 |  | ||||||
| ```shell |  | ||||||
| V6.1.9.45···ArmLinux64···.zip   --解压后重命名为--> arm64_linux_lib |  | ||||||
| V6.1.9.48···linux64···.zip    --解压后重命名为--> amd64_linux_lib |  | ||||||
| ``` |  | ||||||
| ### 2.2 编译 Windows 部分 |  | ||||||
| 将下载的zip压缩文件 `win64` 在源码目录解压,然后重命名 |  | ||||||
| ```shell |  | ||||||
| V6.1.9.45···win64···.zip   --解压后重命名为--> arm64_windows_lib |  | ||||||
| ``` |  | ||||||
|   | |||||||
							
								
								
									
										72
									
								
								Type.go
									
									
									
									
									
								
							
							
						
						
									
										72
									
								
								Type.go
									
									
									
									
									
								
							| @@ -1,72 +0,0 @@ | |||||||
| package HikNetSDK |  | ||||||
|  |  | ||||||
| import "encoding/json" |  | ||||||
|  |  | ||||||
| type HikCfg struct { |  | ||||||
| 	Nvr        map[string]Nvr        `json:"Nvr"` |  | ||||||
| 	BallCamera map[string]BallCamera `json:"BallCamera"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Nvr struct { |  | ||||||
| 	Name     string `json:"Name"` |  | ||||||
| 	Ip       string `json:"Ip"` |  | ||||||
| 	Port     string `json:"Port"` |  | ||||||
| 	User     string `json:"User"` |  | ||||||
| 	Password string `json:"Password"` |  | ||||||
| 	Channel  int    `json:"Channel"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type BallCamera struct { |  | ||||||
| 	Type     string `json:"Type"` |  | ||||||
| 	Name     string `json:"Name"` |  | ||||||
| 	Ip       string `json:"Ip"` |  | ||||||
| 	Port     string `json:"Port"` |  | ||||||
| 	User     string `json:"User"` |  | ||||||
| 	Password string `json:"Password"` |  | ||||||
| 	RtspUrl  string `json:"RtspUrl"` |  | ||||||
| 	Matrix   Matrix `json:"Matrix"` |  | ||||||
| 	Channel  int    `json:"Channel"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Matrix struct { |  | ||||||
| 	PStart             float64   `json:"P_Start"` |  | ||||||
| 	PMax               float64   `json:"P_Max"` |  | ||||||
| 	PPositiveDirection string    `json:"p_Positive_Direction"` |  | ||||||
| 	TStart             float64   `json:"T_Start"` |  | ||||||
| 	TMax               float64   `json:"T_Max"` |  | ||||||
| 	TPositiveDirection string    `json:"T_Positive_Direction"` |  | ||||||
| 	Matrix             []float64 `json:"Matrix"` |  | ||||||
| 	InvMatrix          []float64 `json:"InvMatrix"` |  | ||||||
| 	PointSet           map[string]PointPair `json:"PointSet"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PointPair struct { |  | ||||||
| 	X float64 `json:"X"` |  | ||||||
| 	Y float64 `json:"Y"` |  | ||||||
| 	P float64 `json:"P"` |  | ||||||
| 	T float64 `json:"T"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| type PTZ struct { |  | ||||||
| 	P float32 `json:"P"` |  | ||||||
| 	T float32 `json:"T"` |  | ||||||
| 	Z float32 `json:"Z"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type MoveCfg struct { |  | ||||||
| 	Speed     int `json:"Speed"` |  | ||||||
| 	Direction int `json:"Direction"` |  | ||||||
| } |  | ||||||
| type Point struct { |  | ||||||
| 	X float64 `json:"X"` |  | ||||||
| 	Y float64 `json:"Y"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (h *HikCfg) Json() []byte { |  | ||||||
| 	marshal, err := json.Marshal(h) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil |  | ||||||
| 	} |  | ||||||
| 	return marshal |  | ||||||
| } |  | ||||||
							
								
								
									
										42
									
								
								core/CallBack.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								core/CallBack.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | |||||||
|  | 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) | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										46
									
								
								core/Type.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								core/Type.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  | package core | ||||||
|  |  | ||||||
|  | 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 { | ||||||
|  | 	SSerialNumber        [48]BYTE | ||||||
|  | 	ByAlarmInPortNum     BYTE | ||||||
|  | 	ByAlarmOutPortNum    BYTE | ||||||
|  | 	ByDiskNum            BYTE | ||||||
|  | 	ByDVRType            BYTE | ||||||
|  | 	ByChanNum            BYTE | ||||||
|  | 	ByStartChan          BYTE | ||||||
|  | 	ByAudioChanNum       BYTE | ||||||
|  | 	ByIPChanNum          BYTE | ||||||
|  | 	ByZeroChanNum        BYTE | ||||||
|  | 	ByMainProto          BYTE | ||||||
|  | 	BySubProto           BYTE | ||||||
|  | 	BySupport            BYTE | ||||||
|  | 	BySupport1           BYTE | ||||||
|  | 	BySupport2           BYTE | ||||||
|  | 	WDevType             WORD | ||||||
|  | 	BySupport3           BYTE | ||||||
|  | 	ByMultiStreamProto   BYTE | ||||||
|  | 	ByStartDChan         BYTE | ||||||
|  | 	ByStartDTalkChan     BYTE | ||||||
|  | 	ByHighDChanNum       BYTE | ||||||
|  | 	BySupport4           BYTE | ||||||
|  | 	ByLanguageType       BYTE | ||||||
|  | 	ByVoiceInChanNum     BYTE | ||||||
|  | 	ByStartVoiceInChanNo BYTE | ||||||
|  | 	byMirrorChanNum      BYTE | ||||||
|  | 	wStartMirrorChanNo   WORD | ||||||
|  | } | ||||||
							
								
								
									
										252
									
								
								core/core.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										252
									
								
								core/core.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,252 @@ | |||||||
|  | package core | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | #cgo CFLAGS: -I../include | ||||||
|  | #cgo LDFLAGS: -L../libs/x86_64 -lHCCore -lhcnetsdk -lhpr -lNPQos -lSuperRender | ||||||
|  | #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 C.NET_DVR_DEVICEINFO_V30 | ||||||
|  | 	cUserId := C.NET_DVR_Login_V30(cIp, C.WORD(Port), cUsername, cPassword, &DeviceInfo) | ||||||
|  | 	if LONG(cUserId) == -1 { | ||||||
|  | 		return -1, NET_DVR_DEVICEINFO_V30{}, LastError("NET_DVR_Login_V30") | ||||||
|  | 	} | ||||||
|  | 	DATA := CNET_DVR_DEVICEINFO_V30ToGO(&DeviceInfo) | ||||||
|  | 	return LONG(cUserId), DATA, nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | 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 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) { | ||||||
|  | 	//a1 := DEC2HEX(Action) | ||||||
|  | 	//a2 := DEC2HEX(PanPos) | ||||||
|  | 	//a3 := DEC2HEX(TiltPos) | ||||||
|  | 	//a4 := DEC2HEX(ZoomPos) | ||||||
|  | 	//println(a1, a2, a3, a4) | ||||||
|  | 	d.wAction = C.WORD(Action) | ||||||
|  | 	d.wPanPos = C.WORD(DEC2HEX(PanPos)) | ||||||
|  | 	d.wTiltPos = C.WORD(DEC2HEX(TiltPos)) | ||||||
|  | 	d.wZoomPos = C.WORD(DEC2HEX(ZoomPos)) | ||||||
|  | 	//d.wAction = C.WORD(1) | ||||||
|  | 	//d.wPanPos = C.WORD(0x77) | ||||||
|  | 	//d.wTiltPos = C.WORD(0x88) | ||||||
|  | 	//d.wZoomPos = C.WORD(0x99) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | 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 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 CNET_DVR_DEVICEINFO_V30ToGO(CData *C.NET_DVR_DEVICEINFO_V30) NET_DVR_DEVICEINFO_V30 { | ||||||
|  | 	var goData NET_DVR_DEVICEINFO_V30 | ||||||
|  |  | ||||||
|  | 	// Copy the SSerialNumber field | ||||||
|  | 	for i := 0; i < 48; i++ { | ||||||
|  | 		goData.SSerialNumber[i] = BYTE(byte(CData.sSerialNumber[i])) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Copy other fields | ||||||
|  | 	goData.ByAlarmInPortNum = BYTE(CData.byAlarmInPortNum) | ||||||
|  | 	goData.ByAlarmOutPortNum = BYTE(CData.byAlarmOutPortNum) | ||||||
|  | 	goData.ByDiskNum = BYTE(CData.byDiskNum) | ||||||
|  | 	goData.ByDVRType = BYTE(CData.byDVRType) | ||||||
|  | 	goData.ByChanNum = BYTE(CData.byChanNum) | ||||||
|  | 	goData.ByStartChan = BYTE(CData.byStartChan) | ||||||
|  | 	goData.ByAudioChanNum = BYTE(CData.byAudioChanNum) | ||||||
|  | 	goData.ByIPChanNum = BYTE(CData.byIPChanNum) | ||||||
|  | 	goData.ByZeroChanNum = BYTE(CData.byZeroChanNum) | ||||||
|  | 	goData.ByMainProto = BYTE(CData.byMainProto) | ||||||
|  | 	goData.BySubProto = BYTE(CData.bySubProto) | ||||||
|  | 	goData.BySupport = BYTE(CData.bySupport) | ||||||
|  | 	goData.BySupport1 = BYTE(CData.bySupport1) | ||||||
|  | 	goData.BySupport2 = BYTE(CData.bySupport2) | ||||||
|  | 	goData.WDevType = WORD(CData.wDevType) | ||||||
|  | 	goData.BySupport3 = BYTE(CData.bySupport3) | ||||||
|  | 	goData.ByMultiStreamProto = BYTE(CData.byMultiStreamProto) | ||||||
|  | 	goData.ByStartDChan = BYTE(CData.byStartDChan) | ||||||
|  | 	goData.ByStartDTalkChan = BYTE(CData.byStartDTalkChan) | ||||||
|  | 	goData.ByHighDChanNum = BYTE(CData.byHighDChanNum) | ||||||
|  | 	goData.BySupport4 = BYTE(CData.bySupport4) | ||||||
|  | 	goData.ByLanguageType = BYTE(CData.byLanguageType) | ||||||
|  | 	goData.ByVoiceInChanNum = BYTE(CData.byVoiceInChanNum) | ||||||
|  | 	goData.ByStartVoiceInChanNo = BYTE(CData.byStartVoiceInChanNo) | ||||||
|  |  | ||||||
|  | 	return goData | ||||||
|  | } | ||||||
							
								
								
									
										30
									
								
								core/error.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								core/error.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | package core | ||||||
|  |  | ||||||
|  | import "C" | ||||||
|  | import ( | ||||||
|  | 	"strconv" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | // 构造HcnetError | ||||||
|  | func NewHcnetError(Code int, Msg string, FuncName string) *HcnetError { | ||||||
|  | 	return &HcnetError{Code: Code, Msg: Msg, FuncName: FuncName} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 海康网络sdk自定义错误 | ||||||
|  | type HcnetError struct { | ||||||
|  | 	Code     int    `json:"Code"` // 错误码 | ||||||
|  | 	Msg      string `json:"Msg"`  // 错误码描述 | ||||||
|  | 	FuncName string `json:"FuncName"` | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (p *HcnetError) Error() string { | ||||||
|  | 	return strconv.FormatInt(int64(p.Code), 10) + "," + p.Msg | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (p *HcnetError) IsPasswordError() bool { | ||||||
|  | 	return p.Code == 1 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (p *HcnetError) IsDeviceOfflineError() bool { | ||||||
|  | 	return p.Code == 7 | ||||||
|  | } | ||||||
							
								
								
									
										7
									
								
								core/lib.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								core/lib.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | //go:build linux && amd64 | ||||||
|  |  | ||||||
|  | package core | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  */ | ||||||
|  | import "C" | ||||||
							
								
								
									
										1
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								go.mod
									
									
									
									
									
								
							| @@ -2,4 +2,3 @@ module gitea.com/kunmeng/HikNetSDKPkg | |||||||
|  |  | ||||||
| go 1.23.1 | go 1.23.1 | ||||||
|  |  | ||||||
| require github.com/ebitengine/purego v0.8.1 |  | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.sum
									
									
									
									
									
								
							| @@ -1,2 +0,0 @@ | |||||||
| github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= |  | ||||||
| github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= |  | ||||||
							
								
								
									
										111
									
								
								include/DataType.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								include/DataType.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | |||||||
|  | #ifndef DATA_TYPE_H | ||||||
|  | #define DATA_TYPE_H | ||||||
|  | #define FRAME_HEAD_MAGIC 0x03211546  | ||||||
|  | #define SYSTEM_SYNC_ID    2 | ||||||
|  |  | ||||||
|  | #ifdef __LINUX__ | ||||||
|  | typedef unsigned char            UCHAR; | ||||||
|  | typedef unsigned char*          PBYTE; | ||||||
|  | typedef char*                    LPTSTR; | ||||||
|  | typedef    unsigned short             USHORT; | ||||||
|  | typedef int                     HANDLE; | ||||||
|  | typedef unsigned long           ULONG; | ||||||
|  | typedef unsigned long           DWORD; | ||||||
|  | #endif //#ifdef __LINUX__ | ||||||
|  |  | ||||||
|  | typedef struct tagFrameInfo{ | ||||||
|  |     ULONG    SyncId; /* 00000000000000000000000000010b */ | ||||||
|  |     ULONG    Magic; | ||||||
|  |     USHORT    FrameType; /* I frames , P frames or BBP frames Audio frames or dsp status etc */ | ||||||
|  |     ULONG    Length; /*lenth include this header */ | ||||||
|  |     ULONG    FrameNumber; /* serial number of this frame */ | ||||||
|  |     UCHAR    Breakable; /* indicate if stream breakable, you could restart new file(with PktSysHeader) if true */ | ||||||
|  |     /*ULONG   Ack;*/ | ||||||
|  |     ULONG    PTS; /* system clock when this frames is processed */ | ||||||
|  | }TMFRAME_HEADER, *PTMFRAME_HEADER; | ||||||
|  |  | ||||||
|  | typedef enum { | ||||||
|  |    StandardNone                   = 0x80000000, | ||||||
|  |    StandardNTSC                   = 0x00000001, | ||||||
|  |    StandardPAL                    = 0x00000002, | ||||||
|  |    StandardSECAM                  = 0x00000004, | ||||||
|  | } VideoStandard_t;                | ||||||
|  |  | ||||||
|  |  | ||||||
|  | typedef enum { | ||||||
|  |     PktError = 0, | ||||||
|  |     PktIFrames = 0x0001, | ||||||
|  |     PktPFrames = 0x0002, | ||||||
|  |     PktBBPFrames = 0x0004, | ||||||
|  |     PktAudioFrames = 0x0008, | ||||||
|  |     PktMotionDetection = 0x00010, | ||||||
|  |     PktDspStatus = 0x00020, | ||||||
|  |     PktOrigImage = 0x00040, | ||||||
|  |     PktSysHeader = 0x00080, | ||||||
|  |     PktBPFrames = 0x00100, | ||||||
|  |     PktSFrames = 0x00200, | ||||||
|  |     PktSubIFrames = 0x00400, | ||||||
|  |     PktSubPFrames = 0x00800, | ||||||
|  |     PktSubBBPFrames = 0x01000, | ||||||
|  |     PktSubSysHeader = 0x02000 | ||||||
|  | }FrameType_t; | ||||||
|  |  | ||||||
|  | typedef struct tagVersion{ | ||||||
|  |     ULONG DspVersion, DspBuildNum; | ||||||
|  |     ULONG DriverVersion, DriverBuildNum; | ||||||
|  |     ULONG SDKVersion, SDKBuildNum; | ||||||
|  | }VERSION_INFO, *PVERSION_INFO; | ||||||
|  |  | ||||||
|  | typedef enum { | ||||||
|  |     ENC_CIF_FORMAT = 0, | ||||||
|  |     ENC_QCIF_FORMAT = 1, | ||||||
|  |     ENC_2CIF_FORMAT = 2, | ||||||
|  |     ENC_4CIF_FORMAT = 3, | ||||||
|  |     ENC_QQCIF_FORMAT = 4, | ||||||
|  |     ENC_CIFQCIF_FORMAT =5, | ||||||
|  |     ENC_CIFQQCIF_FORMAT =6, | ||||||
|  |     ENC_DCIF_FORMAT =7, | ||||||
|  |     ENC_VGA_FORMAT=8 | ||||||
|  | }PictureFormat_t; | ||||||
|  |      | ||||||
|  | typedef struct tagMotionData{ | ||||||
|  |     PictureFormat_t PicFormat; | ||||||
|  |     ULONG HorizeBlocks; | ||||||
|  |     ULONG VerticalBlocks; | ||||||
|  |     ULONG BlockSize; | ||||||
|  | }MOTION_DATA_HEADER, *PMOTION_DATA_HEADER; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #define _OSD_BASE            0x9000                /*base address of special character*/ | ||||||
|  | #define    _OSD_YEAR4            (_OSD_BASE+0)        /*show year time by length of 4 , for example: 2005*/ | ||||||
|  | #define _OSD_YEAR2            (_OSD_BASE+1)        /*show year time by length of 2, for example: 05    */ | ||||||
|  | #define _OSD_MONTH3            (_OSD_BASE+2)        /*show month time in English, for example: Jan*/ | ||||||
|  | #define _OSD_MONTH2            (_OSD_BASE+3)        /*show month time by two Arabic numerals, for example: 07*/ | ||||||
|  | #define _OSD_DAY            (_OSD_BASE+4)        /*show day time by two Arabic numerals, for example: 31*/ | ||||||
|  | #define _OSD_WEEK3            (_OSD_BASE+5)        /*show week time in English: MON<4F><4E>SUN*/ | ||||||
|  | #define    _OSD_CWEEK1            (_OSD_BASE+6)        /*show week time in Chinese GB code*/ | ||||||
|  | #define    _OSD_HOUR24            (_OSD_BASE+7)        /*show 24 hours clock: 00<30><30>23    */ | ||||||
|  | #define    _OSD_HOUR12            (_OSD_BASE+8)        /*show 12 hours clock: 00<30><30>12*/ | ||||||
|  | #define    _OSD_MINUTE            (_OSD_BASE+9)        /*show minute time by length of 2: 00<30><30>59*/ | ||||||
|  | #define _OSD_SECOND            (_OSD_BASE+10)        /*show second time by length of 2: 00<30><30>59*/ | ||||||
|  | #define _OSD_MILISECOND        (_OSD_BASE+11)        /*show millisecond time by length of 3: 000~999*/ | ||||||
|  | #define _OSD_APM            (_OSD_BASE+14)        /*show a.m. or p.m. by length of 2 bit, AM or PM*/ | ||||||
|  |  | ||||||
|  | //For new added APIs to set OSD: SetEncoderOsdDisplayMode, SetDecoderOsdDisplayMode and SetDisplayOsdDisplayMode in v6.0 SDK, we use new basic address of special character. | ||||||
|  | #define _OSD_BASE_EX        0x90000                /*base address of special character*/ | ||||||
|  | #define    _OSD_YEAR4_EX        (_OSD_BASE_EX+0)    /*the same as _OSD_YEAR4*/ | ||||||
|  | #define _OSD_YEAR2_EX        (_OSD_BASE_EX+1)    /*the same as _OSD_YEAR2*/ | ||||||
|  | #define _OSD_MONTH3_EX        (_OSD_BASE_EX+2)    /*the same as _OSD_MONTH3*/ | ||||||
|  | #define _OSD_MONTH2_EX        (_OSD_BASE_EX+3)    /*the same as _OSD_MONTH2*/ | ||||||
|  | #define _OSD_DAY_EX            (_OSD_BASE_EX+4)    /*the same as _OSD_DAY*/ | ||||||
|  | #define _OSD_WEEK3_EX        (_OSD_BASE_EX+5)    /*the same as _OSD_WEEK3*/ | ||||||
|  | #define    _OSD_CWEEK1_EX        (_OSD_BASE_EX+6)    /*the same as _OSD_CWEEK1*/ | ||||||
|  | #define    _OSD_HOUR24_EX        (_OSD_BASE_EX+7)    /*the same as _OSD_HOUR24*/ | ||||||
|  | #define    _OSD_HOUR12_EX        (_OSD_BASE_EX+8)    /*the same as _OSD_HOUR12*/ | ||||||
|  | #define    _OSD_MINUTE_EX        (_OSD_BASE_EX+9)    /*the same as _OSD_MINUTE*/ | ||||||
|  | #define _OSD_SECOND_EX        (_OSD_BASE_EX+10)    /*the same as _OSD_SECOND*/ | ||||||
|  | #define _OSD_MILISECOND_EX    (_OSD_BASE_EX+11)    /*the same as _OSD_MILISECOND*/ | ||||||
|  | #define _OSD_APM_EX            (_OSD_BASE_EX+14)    /*the same as _OSD_APM*/ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif | ||||||
							
								
								
									
										451
									
								
								include/DecodeCardSdk.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										451
									
								
								include/DecodeCardSdk.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,451 @@ | |||||||
|  | /////////////////////////////////////////////////////////////////////////// | ||||||
|  | // DS-40xxHC/HF BOARD SYSTEM SDK                     //     | ||||||
|  | ///////////////////////////////////////////////////////////////////////////  | ||||||
|  |  | ||||||
|  | #ifndef DECODECARD_SDK_H | ||||||
|  | #define DECODECARD_SDK_H | ||||||
|  |  | ||||||
|  | #include "datatype.h" | ||||||
|  |  | ||||||
|  | #define DLLEXPORT_API  extern "C" __declspec(dllexport) | ||||||
|  | #define ERR_WAIT_TIMEOUT                0xc0000001 | ||||||
|  | #define ERR_INVALID_HANDLE                0xc0000002 | ||||||
|  | #define ERR_INVALID_ARGUMENT                0xc0000003 | ||||||
|  | #define ERR_DDRAW_CREATE_FAILED                0xc0000004 | ||||||
|  | #define ERR_DDRAW_CAPS_FAULT                0xc0000005 | ||||||
|  | #define ERR_SET_COOPERATIVELEVEL_FAILED            0xc0000006 | ||||||
|  | #define ERR_PRIMARY_SURFACE_CREATE_FAILED        0xc0000007 | ||||||
|  | #define ERR_GET_OVERLAY_ADDRESS_FAILED            0xc0000008 | ||||||
|  | #define ERR_OVERLAY_SURFACE_CREATE_FAILED        0xc0000009 | ||||||
|  | #define ERR_OVERLAY_UPDATE_FAILED            0xc000000a | ||||||
|  | #define ERR_TMMAN_FAILURE                0xc000000b | ||||||
|  | #define ERR_CHANNELMAGIC_MISMATCH            0xc000000c | ||||||
|  | #define ERR_CALLBACK_REGISTERED                0xc000000d | ||||||
|  | #define ERR_QUEUE_OVERFLOW                0xc000000e | ||||||
|  | #define ERR_STREAM_THREAD_FAILURE            0xc000000f | ||||||
|  | #define ERR_THREAD_STOP_ERROR                0xc0000010 | ||||||
|  | #define ERR_NOT_SUPPORT                    0xc0000011 | ||||||
|  | #define ERR_OUTOF_MEMORY                0xc0000012 | ||||||
|  | #define ERR_DSP_BUSY                    0xc0000013 | ||||||
|  | #define ERR_DATA_ERROR                    0xc0000014 | ||||||
|  | #define ERR_KERNEL                    0xc0000016 | ||||||
|  | #define ERR_OFFSCREEN_CREATE_FAILED            0xc0000017 | ||||||
|  | #define ERR_MULTICLOCK_FAILURE                0xc0000018 | ||||||
|  | #define ERR_INVALID_DEVICE                0xc0000019 | ||||||
|  | #define ERR_INVALID_DRIVER                0xc000001a | ||||||
|  | //error code for MD card | ||||||
|  | #define HWERR_SUCCESS                        0 | ||||||
|  | #define HWERR_ALLOCATE_MEMORY                0xc1000001 | ||||||
|  | #define HWERR_INVALID_HANDLE                0xc1000002 | ||||||
|  | #define HWERR_DDRAW_CREATE_FAILED            0xc1000003 | ||||||
|  | #define HWERR_DDRAW_CAPS_FAULT                0xc1000004 | ||||||
|  | #define HWERR_SET_COOPERATIVELEVEL_FAILED        0xc1000005 | ||||||
|  | #define HWERR_PRIMARY_SURFACE_CREATE_FAILED        0xc1000006 | ||||||
|  | #define HWERR_OVERLAY_CREATE_FAILED            0xc1000007 | ||||||
|  | #define HWERR_GET_OVERLAY_ADDRESS_FAILED        0xc1000008 | ||||||
|  | #define HWERR_OVERLAY_UPDATE_FAILED            0xc1000009 | ||||||
|  | #define HWERR_SURFACE_NULL                0xc100000a | ||||||
|  | #define HWERR_FILEHEADER_UNKNOWN            0xc100000b | ||||||
|  | #define HWERR_CREATE_FILE_FAILED            0xc100000c | ||||||
|  | #define HWERR_FILE_SIZE_ZERO                0xc100000d | ||||||
|  | #define HWERR_FILE_SIZE_INVALID                0xc100000d | ||||||
|  | #define HWERR_CREATE_OBJ_FAILED                0xc100000e | ||||||
|  | #define HWERR_CHANNELMAGIC_MISMATCH            0xc100000f | ||||||
|  | #define HWERR_PARA_OVER                    0xc1000010 | ||||||
|  | #define HWERR_ORDER                    0xc1000011 | ||||||
|  | #define HWERR_COMMAND                    0xc1000012 | ||||||
|  | #define HWERR_UNSUPPORTED                0xc1000013 | ||||||
|  | #define HWERR_DSPOPEN                    0xc1000014 | ||||||
|  | #define HWERR_DSPLOAD                    0xc1000015 | ||||||
|  | #define HWERR_ALLOCATE_DSPMEMORY            0xc1000016 | ||||||
|  | #define HWERR_DSPCHECHER                0xc1000017 | ||||||
|  | #define HWERR_IMGFILE_UNKNOWN                0xc1000018 | ||||||
|  | #define HWERR_INVALID_FILE                0xc1000019 | ||||||
|  | //standart | ||||||
|  | #define HW_PAL                            2 | ||||||
|  | #define HW_NTSC                            1 | ||||||
|  | //jump direction | ||||||
|  | #define HW_JUMP_FORWARD                    309  | ||||||
|  | #define HW_JUMP_BACKWARD                310 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | typedef enum tagTypeVideoFormat | ||||||
|  | { | ||||||
|  |    vdfRGB8A_233              = 0x00000001, | ||||||
|  |    vdfRGB8R_332              = 0x00000002, | ||||||
|  |    vdfRGB15Alpha             = 0x00000004, | ||||||
|  |    vdfRGB16                  = 0x00000008, | ||||||
|  |    vdfRGB24                  = 0x00000010, | ||||||
|  |    vdfRGB24Alpha             = 0x00000020, | ||||||
|  |     | ||||||
|  |    vdfYUV420Planar           = 0x00000040, | ||||||
|  |    vdfYUV422Planar           = 0x00000080, | ||||||
|  |    vdfYUV411Planar           = 0x00000100, | ||||||
|  |    vdfYUV420Interspersed     = 0x00000200, | ||||||
|  |    vdfYUV422Interspersed     = 0x00000400, | ||||||
|  |    vdfYUV411Interspersed     = 0x00000800, | ||||||
|  |    vdfYUV422Sequence         = 0x00001000,   /* U0, Y0, V0, Y1:  For VO overlay */ | ||||||
|  |    vdfYUV422SequenceAlpha    = 0x00002000,    | ||||||
|  |    /* U0, Y0, V0, Y1:  For VO overlay, with low bit for alpha blending */ | ||||||
|  |    vdfMono                   = 0x00004000,  /* 8 bit monochrome */ | ||||||
|  |  | ||||||
|  |    vdfYUV444Planar           = 0x00008000, | ||||||
|  | }TypeVideoFormat; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | typedef enum _BitrateControlType_t | ||||||
|  | { | ||||||
|  |     brCBR = 0, | ||||||
|  |     brVBR = 1, | ||||||
|  | }BitrateControlType_t; | ||||||
|  |  | ||||||
|  | typedef enum _BOARD_TYPE_DS | ||||||
|  | { | ||||||
|  |     DS400XM             =0, | ||||||
|  |     DS400XH                =1, | ||||||
|  |     DS4004HC            =2, | ||||||
|  |     DS4008HC            =3, | ||||||
|  |     DS4016HC            =4, | ||||||
|  |     DS4001HF            =5, | ||||||
|  |     DS4004HF            =6, | ||||||
|  |     DS4002MD            =7, | ||||||
|  |     DS4004MD            =8,        //4004MD | ||||||
|  |     DS4016HCS            =9,        //4016HCS | ||||||
|  |     DS4002HT            =10,    //4002HT | ||||||
|  |     DS4004HT            =11,    //4004HT | ||||||
|  |     DS4008HT            =12,    //4008HT | ||||||
|  |     DS4004HC_PLUS        =13,    //4004HC+ | ||||||
|  |     DS4008HC_PLUS        =14,    //4008HC+ | ||||||
|  |     DS4016HC_PLUS        =15,    //4016HC+ | ||||||
|  |     DS4008HF            =16,    //4008HF | ||||||
|  |     DS4008MD            =17,    //4008MD | ||||||
|  |     DS4008HS            =18,    //4008HS | ||||||
|  |     DS4016HS            =19,    //4016HS | ||||||
|  |     INVALID_BOARD_TYPE    =0xffffffff, | ||||||
|  | }BOARD_TYPE_DS; | ||||||
|  |  | ||||||
|  | #define STREAM_TYPE_VIDEO    1 | ||||||
|  | #define STREAM_TYPE_AUDIO    2 | ||||||
|  | #define STREAM_TYPE_AVSYNC    3 | ||||||
|  | #define DRAWFUN(x)                void  (CALLBACK* x)(long nPort,HDC hDc,LONG nUser) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | typedef void (*LOGRECORD_CALLBACK)(char *str, void *context); | ||||||
|  | typedef int (*STREAM_READ_CALLBACK)(ULONG channelNumber, void *context); | ||||||
|  | typedef int (*STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber,void *DataBuf,DWORD Length,int FrameType,void *context); | ||||||
|  |  | ||||||
|  | typedef struct tagChannelCapability{ | ||||||
|  |     UCHAR bAudioPreview; | ||||||
|  |     UCHAR bAlarmIO; | ||||||
|  |     UCHAR bWatchDog; | ||||||
|  | }CHANNEL_CAPABILITY, *PCHANNEL_CAPABILITY; | ||||||
|  |  | ||||||
|  | typedef struct tagFramsStatistics{ | ||||||
|  |     ULONG VideoFrames; | ||||||
|  |     ULONG AudioFrames; | ||||||
|  |     ULONG FramesLost; | ||||||
|  |     ULONG QueueOverflow; | ||||||
|  |     ULONG CurBps; | ||||||
|  | }FRAMES_STATISTICS, *PFRAMES_STATISTICS; | ||||||
|  |  | ||||||
|  | DLLEXPORT_API int __stdcall InitDSPs(); | ||||||
|  | DLLEXPORT_API int __stdcall DeInitDSPs(); | ||||||
|  | DLLEXPORT_API HANDLE __stdcall ChannelOpen(int ChannelNum); | ||||||
|  | DLLEXPORT_API int __stdcall ChannelClose(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall GetTotalChannels(); | ||||||
|  | DLLEXPORT_API int __stdcall GetTotalDSPs(); | ||||||
|  | DLLEXPORT_API int __stdcall StartVideoPreview(HANDLE hChannelHandle,HWND WndHandle, RECT *rect, BOOLEAN bOverlay, int VideoFormat, int FrameRate); | ||||||
|  | DLLEXPORT_API int __stdcall StopVideoPreview(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall SetVideoPara(HANDLE hChannelHandle, int Brightness, int Contrast, int Saturation, int Hue); | ||||||
|  | DLLEXPORT_API int __stdcall GetVideoPara(HANDLE hChannelHandle, VideoStandard_t *VideoStandard, int *Brightness, int *Contrast, int *Saturation, int *Hue); | ||||||
|  | DLLEXPORT_API int __stdcall GetVideoSignal(HANDLE  hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall GetSDKVersion(PVERSION_INFO VersionInfo); | ||||||
|  | DLLEXPORT_API int __stdcall GetCapability(HANDLE hChannelHandle, CHANNEL_CAPABILITY *Capability); | ||||||
|  | DLLEXPORT_API int __stdcall GetLastErrorNum(HANDLE hChannelHandle, ULONG *DspError, ULONG *SdkError); | ||||||
|  | DLLEXPORT_API int __stdcall SetStreamType(HANDLE hChannelHandle, USHORT Type); | ||||||
|  | DLLEXPORT_API int __stdcall GetStreamType(HANDLE hChannelHandle, USHORT *StreamType); | ||||||
|  | DLLEXPORT_API int __stdcall GetFramesStatistics(HANDLE hChannelHandle,     PFRAMES_STATISTICS framesStatistics); | ||||||
|  | DLLEXPORT_API int __stdcall StartMotionDetection(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall GetBoardInfo(HANDLE hChannelHandle, ULONG *BoardType, UCHAR *SerialNo); | ||||||
|  | DLLEXPORT_API int __stdcall StopMotionDetection(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall GetOriginalImage(HANDLE hChannelHandle, UCHAR *ImageBuf, ULONG *Size); | ||||||
|  | DLLEXPORT_API int __stdcall RegisterLogRecordCallback(LOGRECORD_CALLBACK LogRecordFunc, void *Context); | ||||||
|  | DLLEXPORT_API int __stdcall SetAudioPreview(HANDLE hChannelHandle, BOOL bEnable); | ||||||
|  | DLLEXPORT_API int __stdcall ReadStreamData(HANDLE hChannelHandle, void *DataBuf, DWORD *Length, int *FrameType); | ||||||
|  | DLLEXPORT_API int __stdcall RegisterMessageNotifyHandle(HWND hWnd, UINT MessageId); | ||||||
|  | DLLEXPORT_API int __stdcall StartVideoCapture(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall StopVideoCapture(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall SetIBPMode(HANDLE hChannelHandle, int KeyFrameIntervals, int BFrames, int PFrames, int FrameRate); | ||||||
|  | DLLEXPORT_API int __stdcall SetDefaultQuant(HANDLE hChannelHandle, int IQuantVal, int PQuantVal, int BQuantVal); | ||||||
|  | DLLEXPORT_API int __stdcall SetOsd(HANDLE hChannelHandle, BOOL Enable); | ||||||
|  |  | ||||||
|  | DLLEXPORT_API int __stdcall SetLogo(HANDLE hChannelHandle, int x, int y, int w, int h, unsigned char *yuv); | ||||||
|  | DLLEXPORT_API int __stdcall StopLogo(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall SetupMotionDetection(HANDLE hChannelHandle, RECT *RectList, int iAreas); | ||||||
|  | DLLEXPORT_API int __stdcall MotionAnalyzer(HANDLE hChannelHandle, char *MotionData, int iThreshold, int *iResult); | ||||||
|  | DLLEXPORT_API int __stdcall LoadYUVFromBmpFile(char *FileName, unsigned char *yuv, int BufLen, int *Width, int *Height); | ||||||
|  | DLLEXPORT_API int __stdcall SaveYUVToBmpFile(char *FileName, unsigned char *yuv, int Width, int Height); | ||||||
|  | DLLEXPORT_API int __stdcall CaptureIFrame(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall RegisterStreamReadCallback(STREAM_READ_CALLBACK StreamReadCallback, void *Context); | ||||||
|  | DLLEXPORT_API int __stdcall AdjustMotionDetectPrecision(HANDLE hChannelHandle,  | ||||||
|  |                                            int iGrade, int iFastMotionDetectFps,  | ||||||
|  |                                            int iSlowMotionDetectFps); | ||||||
|  | DLLEXPORT_API int __stdcall SetupBitrateControl(HANDLE hChannelHandle, ULONG MaxBps); | ||||||
|  | DLLEXPORT_API int __stdcall SetOverlayColorKey(COLORREF DestColorKey); | ||||||
|  | DLLEXPORT_API int __stdcall SetOsdDisplayMode(HANDLE hChannelHandle, int Brightness, BOOL Translucent, int parameter, USHORT *Format1, USHORT *Format2); | ||||||
|  | DLLEXPORT_API int __stdcall SetLogoDisplayMode(HANDLE hChannelHandle, COLORREF ColorKey, BOOL Translucent, int TwinkleInterval); | ||||||
|  | DLLEXPORT_API int __stdcall SetEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat); | ||||||
|  | DLLEXPORT_API int __stdcall SetVideoStandard(HANDLE hChannelHandle, VideoStandard_t VideoStandard); | ||||||
|  | DLLEXPORT_API int __stdcall RestoreOverlay(); | ||||||
|  | DLLEXPORT_API int __stdcall ResetDSP(int DspNumber); | ||||||
|  | DLLEXPORT_API int __stdcall GetSoundLevel(HANDLE hChannelHandle); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | DLLEXPORT_API int __stdcall SetBitrateControlMode(HANDLE hChannelHandle, BitrateControlType_t brc); | ||||||
|  | DLLEXPORT_API int __stdcall SetupNotifyThreshold(HANDLE hChannelHandle, int iFramesThreshold); | ||||||
|  |  | ||||||
|  | DLLEXPORT_API int __stdcall SetupSubChannel(HANDLE hChannelHandle, int iSubChannel); | ||||||
|  | DLLEXPORT_API int __stdcall GetSubChannelStreamType(void  *DataBuf, int FrameType); | ||||||
|  | //add for HC/HF  | ||||||
|  | DLLEXPORT_API int __stdcall RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback,void *Context); | ||||||
|  | DLLEXPORT_API int __stdcall RegisterDrawFun(DWORD nport, DRAWFUN(DrawFun),LONG nUser); | ||||||
|  | DLLEXPORT_API int __stdcall SetupMask(HANDLE hChannelHandle, RECT *rectList, int iAreas); | ||||||
|  | DLLEXPORT_API int __stdcall StopMask(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall SetSubEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat); | ||||||
|  | DLLEXPORT_API int __stdcall StartSubVideoCapture(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall StopSubVideoCapture(HANDLE hChannelHandle); | ||||||
|  | DLLEXPORT_API int __stdcall SetupDateTime(HANDLE hChannelHandle, SYSTEMTIME *now); | ||||||
|  | /* | ||||||
|  |     <20><><EFBFBD><EFBFBD>Ϊ1.7<EFBFBD>汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD>ܡ<EFBFBD> | ||||||
|  |     <20>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<DEB8><C4BA><EFBFBD><EFBFBD>ơ<EFBFBD> | ||||||
|  | */ | ||||||
|  | //ԭʼͼ<CABC><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | typedef void (*IMAGE_STREAM_CALLBACK)(UINT channelNumber,void *context ); | ||||||
|  | DLLEXPORT_API int __stdcall SetImageStream(HANDLE hChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer); | ||||||
|  | DLLEXPORT_API int __stdcall RegisterImageStreamCallback(IMAGE_STREAM_CALLBACK,void *context); | ||||||
|  | /* | ||||||
|  |     <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD> | ||||||
|  |         (x,y)Ϊϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD><CFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼͼ<CABC><CDBC><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ꡣ | ||||||
|  |         x<><78><EFBFBD><EFBFBD>Ϊ2<CEAA><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |         (x,y)<29><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA>йأ<D0B9><D8A3><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻ƥ<EBB2BB>䣬 | ||||||
|  |     <20><><EFBFBD>ܻᵼ<DCBB><E1B5BC>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | */ | ||||||
|  | DLLEXPORT_API int __stdcall SetInputVideoPosition(HANDLE hChannel,UINT x,UINT y); | ||||||
|  | DLLEXPORT_API int __stdcall StopRegisterDrawFun(DWORD nport); | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |     3.0 | ||||||
|  | */ | ||||||
|  | #define SERIAL_NUMBER_LENGTH    12    //<2F>忨<EFBFBD><E5BFA8><EFBFBD>кų<D0BA><C5B3><EFBFBD> | ||||||
|  | typedef struct tagDS_BOARD_DETAIL | ||||||
|  | { | ||||||
|  |     BOARD_TYPE_DS type;                    //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD> | ||||||
|  |     BYTE sn[16];                        //<2F><><EFBFBD>к<EFBFBD> | ||||||
|  |     UINT dspCount;                        //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DSP<53><50><EFBFBD><EFBFBD> | ||||||
|  |     UINT firstDspIndex;                    //<2F>忨<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB>DSP<53><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT encodeChannelCount;            //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT firstEncodeChannelIndex;        //<2F>忨<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT decodeChannelCount;            //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT firstDecodeChannelIndex;        //<2F>忨<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT displayChannelCount;            //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT firstDisplayChannelIndex;        //<2F>忨<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT reserved1; | ||||||
|  |     UINT reserved2; | ||||||
|  |     UINT reserved3; | ||||||
|  |     UINT reserved4; | ||||||
|  | }DS_BOARD_DETAIL; | ||||||
|  | typedef struct tagDSP_DETAIL | ||||||
|  | { | ||||||
|  |     UINT encodeChannelCount;            //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT firstEncodeChannelIndex;        //<2F>忨<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT decodeChannelCount;            //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT firstDecodeChannelIndex;        //<2F>忨<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT displayChannelCount;            //<2F>忨<EFBFBD><E5BFA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT firstDisplayChannelIndex;        //<2F>忨<EFBFBD>ϵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     UINT reserved1; | ||||||
|  |     UINT reserved2; | ||||||
|  |     UINT reserved3; | ||||||
|  |     UINT reserved4; | ||||||
|  | }DSP_DETAIL; | ||||||
|  | DLLEXPORT_API unsigned int __stdcall GetBoardCount(); | ||||||
|  | DLLEXPORT_API int __stdcall GetBoardDetail(UINT boardNum,DS_BOARD_DETAIL *pBoardDetail); | ||||||
|  | DLLEXPORT_API unsigned int __stdcall GetDspCount(); | ||||||
|  | DLLEXPORT_API int __stdcall GetDspDetail(UINT dspNum,DSP_DETAIL *pDspDetail); | ||||||
|  | DLLEXPORT_API unsigned int __stdcall GetEncodeChannelCount(); | ||||||
|  | DLLEXPORT_API unsigned int __stdcall GetDecodeChannelCount(); | ||||||
|  | DLLEXPORT_API unsigned int __stdcall GetDisplayChannelCount(); | ||||||
|  | DLLEXPORT_API int __stdcall SetDefaultVideoStandard(VideoStandard_t VideoStandard); | ||||||
|  | DLLEXPORT_API int __stdcall SetVideoDetectPrecision(HANDLE hChannel,unsigned int value); | ||||||
|  | DLLEXPORT_API int __stdcall SetSubStreamType(HANDLE hChannelHandle, USHORT Type); | ||||||
|  | DLLEXPORT_API int __stdcall GetSubStreamType(HANDLE hChannelHandle, USHORT *StreamType); | ||||||
|  |  | ||||||
|  | #define MAX_DISPLAY_REGION        16 | ||||||
|  | typedef struct tagREGION_PARAM | ||||||
|  | { | ||||||
|  |     UINT left; | ||||||
|  |     UINT top; | ||||||
|  |     UINT width; | ||||||
|  |     UINT height; | ||||||
|  |     COLORREF color; | ||||||
|  |     UINT param; | ||||||
|  | }REGION_PARAM; | ||||||
|  | DLLEXPORT_API int __stdcall SetDisplayStandard(UINT nDisplayChannel,VideoStandard_t VideoStandard); | ||||||
|  | DLLEXPORT_API int __stdcall SetDisplayRegion(UINT nDisplayChannel,UINT nRegionCount,REGION_PARAM *pParam,UINT nReserved); | ||||||
|  | DLLEXPORT_API int __stdcall ClearDisplayRegion(UINT nDisplayChannel,UINT nRegionFlag); | ||||||
|  | DLLEXPORT_API int __stdcall SetDisplayRegionPosition(UINT nDisplayChannel,UINT nRegion,UINT nLeft,UINT nTop); | ||||||
|  | DLLEXPORT_API int __stdcall FillDisplayRegion(UINT nDisplayChannel,UINT nRegion,unsigned char *pImage); | ||||||
|  | DLLEXPORT_API int __stdcall SetEncoderVideoExtOutput(UINT nEncodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved); | ||||||
|  | DLLEXPORT_API int __stdcall SetDecoderVideoExtOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved); | ||||||
|  | DLLEXPORT_API int __stdcall SetDecoderVideoOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved); | ||||||
|  | DLLEXPORT_API int __stdcall SetDecoderAudioOutput(UINT nDecodeChannel,BOOL bOpen,UINT nOutputChannel); | ||||||
|  | //3.1 | ||||||
|  | DLLEXPORT_API int __stdcall SetDeInterlace(HANDLE hChannelHandle,UINT mode,UINT level); | ||||||
|  | DLLEXPORT_API int __stdcall SetPreviewOverlayMode(BOOL bTrue); | ||||||
|  |  | ||||||
|  | //DECODE functions for DS4002MD | ||||||
|  | #if defined( _WINDLL) | ||||||
|  |     #define PLAYER_API  extern "C"__declspec(dllexport)  | ||||||
|  | #else | ||||||
|  |     #define PLAYER_API  extern "C" __declspec(dllimport)  | ||||||
|  | #endif | ||||||
|  | typedef struct tagDISPLAY_PARA | ||||||
|  | { | ||||||
|  |     long bToScreen; | ||||||
|  |     long bToVideoOut; | ||||||
|  |     long nLeft; | ||||||
|  |     long nTop; | ||||||
|  |     long nWidth; | ||||||
|  |     long nHeight; | ||||||
|  |     long nReserved; | ||||||
|  | }DISPLAY_PARA,*PDISPLAY_PARA; | ||||||
|  | //Version info | ||||||
|  | typedef struct tagVERSION{ | ||||||
|  |     ULONG DspVersion, DspBuildNum; | ||||||
|  |     ULONG DriverVersion, DriverBuildNum; | ||||||
|  |     ULONG SDKVersion, SDKBuildNum; | ||||||
|  | }HW_VERSION, *PHW_VERSION; | ||||||
|  |  | ||||||
|  | //init part | ||||||
|  | PLAYER_API int __stdcall HW_InitDirectDraw(HWND hParent,COLORREF colorKey); | ||||||
|  | PLAYER_API int __stdcall HW_ReleaseDirectDraw(); | ||||||
|  | PLAYER_API int __stdcall HW_InitDecDevice(long *pDeviceTotal); | ||||||
|  | PLAYER_API int __stdcall HW_ReleaseDecDevice(); | ||||||
|  | PLAYER_API int __stdcall HW_ChannelOpen(long nChannelNum,HANDLE* phChannel); | ||||||
|  | PLAYER_API int __stdcall HW_ChannelClose(HANDLE hChannel); | ||||||
|  | //open part | ||||||
|  |  | ||||||
|  | PLAYER_API int __stdcall HW_OpenStream(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize); | ||||||
|  | DLLEXPORT_API int __stdcall HW_ResetStream(HANDLE hChannel); | ||||||
|  | PLAYER_API int __stdcall HW_CloseStream(HANDLE hChannel); | ||||||
|  | PLAYER_API int __stdcall HW_InputData(HANDLE hChannel,PBYTE pBuf,DWORD nSize); | ||||||
|  | PLAYER_API int __stdcall HW_OpenFile(HANDLE hChannel,LPTSTR sFileName); | ||||||
|  | PLAYER_API int __stdcall HW_CloseFile(HANDLE hChannel); | ||||||
|  |  | ||||||
|  | //play part | ||||||
|  | PLAYER_API int __stdcall HW_SetDisplayPara(HANDLE hChannel,DISPLAY_PARA *pPara); | ||||||
|  | PLAYER_API int __stdcall HW_Play(HANDLE hChannel); | ||||||
|  | PLAYER_API int __stdcall HW_Stop(HANDLE hChannel); | ||||||
|  | PLAYER_API int __stdcall HW_Pause(HANDLE hChannel,ULONG bPause); | ||||||
|  |  | ||||||
|  | //sound part | ||||||
|  | PLAYER_API int __stdcall HW_PlaySound(HANDLE hChannel); | ||||||
|  | PLAYER_API int __stdcall HW_StopSound(HANDLE hChannel); | ||||||
|  | PLAYER_API int __stdcall HW_SetVolume(HANDLE hChannel,ULONG nVolume); | ||||||
|  | //overlay part | ||||||
|  | PLAYER_API int __stdcall HW_RefreshSurface(); | ||||||
|  | PLAYER_API int __stdcall HW_RestoreSurface(); | ||||||
|  | PLAYER_API int __stdcall HW_ClearSurface(); | ||||||
|  | PLAYER_API int __stdcall HW_ZoomOverlay(RECT* pSrcClientRect, RECT* pDecScreenRect); | ||||||
|  | //cut file | ||||||
|  | PLAYER_API int __stdcall HW_StartCapFile(HANDLE hChannel,LPTSTR sFileName); | ||||||
|  | PLAYER_API int __stdcall HW_StopCapFile(HANDLE hChannel); | ||||||
|  | //capture picture | ||||||
|  | PLAYER_API int __stdcall HW_GetYV12Image(HANDLE hChannel, PBYTE pBuffer, ULONG nSize); | ||||||
|  | PLAYER_API int __stdcall HW_GetPictureSize(HANDLE hChannel,ULONG* pWidth, ULONG* pHeight); | ||||||
|  | PLAYER_API int __stdcall HW_ConvertToBmpFile(BYTE * pBuf,ULONG nSize,ULONG nWidth,ULONG nHeight,char *sFileName,ULONG nReserved); | ||||||
|  | //setting and getting  part | ||||||
|  | PLAYER_API int __stdcall HW_Jump(HANDLE hChannel,ULONG nDirection); | ||||||
|  | PLAYER_API int __stdcall HW_SetJumpInterval(HANDLE hChannel,ULONG nSecond); | ||||||
|  | PLAYER_API int __stdcall HW_GetSpeed(HANDLE hChannel,long *pSpeed); | ||||||
|  | PLAYER_API int __stdcall HW_SetSpeed(HANDLE hChannel,long nSpeed); | ||||||
|  | PLAYER_API int __stdcall HW_SetPlayPos(HANDLE hChannel,ULONG nPos); | ||||||
|  | PLAYER_API int __stdcall HW_GetPlayPos(HANDLE hChannel,ULONG* pPos); | ||||||
|  | PLAYER_API int __stdcall HW_GetVersion(PHW_VERSION pVersion); | ||||||
|  | PLAYER_API int __stdcall HW_GetCurrentFrameRate(HANDLE hChannel,ULONG* pFrameRate); | ||||||
|  | PLAYER_API int __stdcall HW_GetCurrentFrameNum(HANDLE hChannel,ULONG* pFrameNum); | ||||||
|  | PLAYER_API int __stdcall HW_GetFileTotalFrames(HANDLE hChannel,ULONG* pTotalFrames); | ||||||
|  | PLAYER_API int __stdcall HW_GetFileTime(HANDLE hChannel, ULONG* pFileTime); | ||||||
|  | PLAYER_API int __stdcall HW_GetCurrentFrameTime(HANDLE hChannel,ULONG* pFrameTime); | ||||||
|  | PLAYER_API int __stdcall HW_GetPlayedFrames(HANDLE hChannel,ULONG *pDecVFrames); | ||||||
|  | PLAYER_API int __stdcall HW_GetDeviceSerialNo(HANDLE hChannel,ULONG *pDeviceSerialNo); | ||||||
|  | PLAYER_API int __stdcall HW_SetFileEndMsg(HANDLE hChannel,HWND hWnd,UINT nMsg); | ||||||
|  | PLAYER_API int __stdcall HW_SetStreamOpenMode(HANDLE hChannel,ULONG nMode); | ||||||
|  | PLAYER_API int __stdcall HW_GetStreamOpenMode(HANDLE hChannel,ULONG *pMode); | ||||||
|  | PLAYER_API int __stdcall HW_SetVideoOutStandard(HANDLE hChannel,ULONG nStandard); | ||||||
|  | PLAYER_API int __stdcall HW_SetDspDeadlockMsg(HWND hWnd,UINT nMsg); | ||||||
|  | PLAYER_API int __stdcall HW_GetChannelNum(long nDspNum,long *pChannelNum,ULONG nNumsToGet,ULONG * pNumsGotten); | ||||||
|  | PLAYER_API int __stdcall HW_ResetDsp(long nDspNum); | ||||||
|  | PLAYER_API int __stdcall HW_SetAudioPreview(HANDLE hChannel, BOOL bEnable); | ||||||
|  | ////////////////////////////////////////////// | ||||||
|  |  | ||||||
|  | PLAYER_API int __stdcall HW_OpenStreamEx(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize); | ||||||
|  | PLAYER_API int __stdcall HW_CloseStreamEx(HANDLE hChannel); | ||||||
|  | PLAYER_API int __stdcall HW_InputVideoData(HANDLE hChannel,PBYTE pBuf,DWORD nSize); | ||||||
|  | PLAYER_API int __stdcall HW_InputAudioData(HANDLE hChannel,PBYTE pBuf,DWORD nSize); | ||||||
|  |  | ||||||
|  | //4.0 | ||||||
|  | PLAYER_API int __stdcall SetOsdDisplayModeEx(HANDLE hChannelHandle,int color,BOOL Translucent,int param,int nLineCount,USHORT **Format); | ||||||
|  | typedef void (*MOTION_DETECTION_CALLBACK)(ULONG channelNumber,BOOL bMotionDetected,void *context); | ||||||
|  | PLAYER_API int __stdcall SetupMotionDetectionEx(HANDLE hChannelHandle,int iGrade,int iFastMotionDetectFps, | ||||||
|  |                                                    int iSlowMotionDetectFps,UINT delay,RECT *RectList, int iAreas, | ||||||
|  |                                                    MOTION_DETECTION_CALLBACK MotionDetectionCallback,int reserved); | ||||||
|  | PLAYER_API int __stdcall GetJpegImage(HANDLE hChannelHandle,UCHAR *ImageBuf,ULONG *Size,UINT nQuality); | ||||||
|  | //WatchDog | ||||||
|  | PLAYER_API int __stdcall SetWatchDog(UINT boardNumber,BOOL bEnable); | ||||||
|  | //4.1 | ||||||
|  | typedef void (*FILE_REF_DONE_CALLBACK)(UINT nChannel,UINT nSize); | ||||||
|  | PLAYER_API int __stdcall HW_SetFileRef(HANDLE hChannel,BOOL bEnable,FILE_REF_DONE_CALLBACK FileRefDoneCallback); | ||||||
|  | PLAYER_API int __stdcall HW_LocateByAbsoluteTime(HANDLE hChannel,SYSTEMTIME time); | ||||||
|  | PLAYER_API int __stdcall HW_LocateByFrameNumber(HANDLE hChannel,UINT frmNum); | ||||||
|  | PLAYER_API int __stdcall HW_GetCurrentAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pTime); | ||||||
|  | PLAYER_API int __stdcall HW_GetFileAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pStartTime,SYSTEMTIME *pEndTime); | ||||||
|  | //4.2 | ||||||
|  | DLLEXPORT_API int __stdcall HW_ImportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize); | ||||||
|  | DLLEXPORT_API int __stdcall HW_ExportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize); | ||||||
|  | DLLEXPORT_API int __stdcall SetDisplayVideoCapture(UINT nDisplayChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer); | ||||||
|  | DLLEXPORT_API int __stdcall RegisterDisplayVideoCaptureCallback(IMAGE_STREAM_CALLBACK DisplayVideoCaptureCallback,void *context); | ||||||
|  | DLLEXPORT_API int __stdcall SetDisplayVideoBrightness(UINT chan,int Brightness); | ||||||
|  | DLLEXPORT_API int __stdcall SetChannelStreamCRC(HANDLE hChannel,BOOL bEnable); | ||||||
|  | DLLEXPORT_API int __stdcall SetSubChannelStreamCRC(HANDLE hChannel,BOOL bEnable); | ||||||
|  | DLLEXPORT_API int __stdcall HW_SetDecoderPostProcess(HANDLE hChannel,UINT param); | ||||||
|  | // | ||||||
|  | typedef void (*DECODER_VIDEO_CAPTURE_CALLBACK)(UINT nChannelNumber,void *DataBuf,UINT width,UINT height,UINT nFrameNum,UINT nFrameTime,SYSTEMTIME *pFrameAbsoluteTime,void *context); | ||||||
|  | DLLEXPORT_API int __stdcall RegisterDecoderVideoCaptureCallback(DECODER_VIDEO_CAPTURE_CALLBACK DecoderVideoCaptureCallback,void *context); | ||||||
|  | DLLEXPORT_API int __stdcall HW_SetDecoderVideoCapture(HANDLE hChannel,BOOL bStart,UINT param); | ||||||
|  | DLLEXPORT_API int __stdcall HW_InputDataByFrame(HANDLE hChannel,PBYTE pBuf,DWORD nSize); | ||||||
|  | /* | ||||||
|  | <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD>Ľӿ<EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD>ġ<DEB8> | ||||||
|  | */ | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |     short x,y,width,height; | ||||||
|  | }FACE_AREA_DEMO; | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |     FACE_AREA_DEMO faceArea; | ||||||
|  |     FACE_AREA_DEMO leftEyeArea; | ||||||
|  |     FACE_AREA_DEMO rightEyeArea; | ||||||
|  |     FACE_AREA_DEMO leftPupilArea; | ||||||
|  |     FACE_AREA_DEMO rightPupilArea; | ||||||
|  |     FACE_AREA_DEMO noseArea; | ||||||
|  |     FACE_AREA_DEMO mouthArea; | ||||||
|  | }FACE_INFO_DEMO; | ||||||
|  | typedef void (*FACE_DETECTION_DEMO_CALLBACK)(UINT nChannel,UINT nFaceCount,FACE_INFO_DEMO *pFaceInfo, | ||||||
|  |                                         char *pData,UINT nDataSize,UINT nImageWidth,UINT nImageHeight); | ||||||
|  |  | ||||||
|  | DLLEXPORT_API int __stdcall SetFaceDetectionDemo(HANDLE hChannelHandle,BOOL bEnable, | ||||||
|  |                                                  UINT nFrameInterval,FACE_DETECTION_DEMO_CALLBACK pFunc, | ||||||
|  |                                                  BOOL bCompress,UINT nCompressQuality,BOOL bLocateEyePos); | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
							
								
								
									
										52612
									
								
								include/HCNetSDK.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52612
									
								
								include/HCNetSDK.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										760
									
								
								include/plaympeg4.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										760
									
								
								include/plaympeg4.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,760 @@ | |||||||
|  | #ifndef _PLAYM4_H_  | ||||||
|  | #define _PLAYM4_H_ | ||||||
|  |  | ||||||
|  | #if defined( _WINDLL) | ||||||
|  |     #define PLAYM4_API  extern "C" __declspec(dllexport)  | ||||||
|  | #else  | ||||||
|  |     #define PLAYM4_API  extern "C" __declspec(dllimport)  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | //Max channel numbers | ||||||
|  | #define PLAYM4_MAX_SUPPORTS 500 | ||||||
|  | //Wave coef range; | ||||||
|  | #define MIN_WAVE_COEF -100 | ||||||
|  | #define MAX_WAVE_COEF 100 | ||||||
|  |  | ||||||
|  | //Timer type | ||||||
|  | #define TIMER_1 1 //Only 16 timers for every process.Default TIMER; | ||||||
|  | #define TIMER_2 2 //Not limit;But the precision less than TIMER_1;  | ||||||
|  |  | ||||||
|  | //BUFFER AND DATA TYPE | ||||||
|  | #define BUF_VIDEO_SRC               (1) //mixed input,total src buffer size;splited input,video src buffer size  | ||||||
|  | #define BUF_AUDIO_SRC               (2) //mixed input,not defined;splited input,audio src buffer size | ||||||
|  | #define BUF_VIDEO_RENDER            (3) //video render node count  | ||||||
|  | #define BUF_AUDIO_RENDER            (4) //audio render node count  | ||||||
|  | #define BUF_VIDEO_DECODED           (5) //video decoded node count to render | ||||||
|  | #define BUF_AUDIO_DECODED           (6) //audio decoded node count to render | ||||||
|  | #define BUF_DISPLAY_NODE            (7) //display node | ||||||
|  |  | ||||||
|  | //Error code | ||||||
|  | #define  PLAYM4_NOERROR                            0    //no error | ||||||
|  | #define     PLAYM4_PARA_OVER                        1    //input parameter is invalid; | ||||||
|  | #define  PLAYM4_ORDER_ERROR                        2    //The order of the function to be called is error. | ||||||
|  | #define     PLAYM4_TIMER_ERROR                        3    //Create multimedia clock failed; | ||||||
|  | #define  PLAYM4_DEC_VIDEO_ERROR                    4    //Decode video data failed. | ||||||
|  | #define  PLAYM4_DEC_AUDIO_ERROR                    5    //Decode audio data failed. | ||||||
|  | #define     PLAYM4_ALLOC_MEMORY_ERROR                6    //Allocate memory failed. | ||||||
|  | #define  PLAYM4_OPEN_FILE_ERROR                    7    //Open the file failed. | ||||||
|  | #define  PLAYM4_CREATE_OBJ_ERROR                8    //Create thread or event failed | ||||||
|  | #define  PLAYM4_CREATE_DDRAW_ERROR                9    //Create DirectDraw object failed. | ||||||
|  | #define  PLAYM4_CREATE_OFFSCREEN_ERROR            10    //failed when creating off-screen surface. | ||||||
|  | #define  PLAYM4_BUF_OVER                        11    //buffer is overflow | ||||||
|  | #define  PLAYM4_CREATE_SOUND_ERROR                12    //failed when creating audio device.     | ||||||
|  | #define     PLAYM4_SET_VOLUME_ERROR                13    //Set volume failed | ||||||
|  | #define  PLAYM4_SUPPORT_FILE_ONLY                14    //The function only support play file. | ||||||
|  | #define  PLAYM4_SUPPORT_STREAM_ONLY                15    //The function only support play stream. | ||||||
|  | #define  PLAYM4_SYS_NOT_SUPPORT                    16    //System not support. | ||||||
|  | #define  PLAYM4_FILEHEADER_UNKNOWN                17    //No file header. | ||||||
|  | #define  PLAYM4_VERSION_INCORRECT                18    //The version of decoder and encoder is not adapted.   | ||||||
|  | #define  PLAYM4_INIT_DECODER_ERROR                19    //Initialize decoder failed. | ||||||
|  | #define  PLAYM4_CHECK_FILE_ERROR                20    //The file data is unknown. | ||||||
|  | #define  PLAYM4_INIT_TIMER_ERROR                21    //Initialize multimedia clock failed. | ||||||
|  | #define     PLAYM4_BLT_ERROR                        22    //Blt failed. | ||||||
|  | #define  PLAYM4_UPDATE_ERROR                    23    //Update failed. | ||||||
|  | #define  PLAYM4_OPEN_FILE_ERROR_MULTI            24   //openfile error, streamtype is multi | ||||||
|  | #define  PLAYM4_OPEN_FILE_ERROR_VIDEO            25   //openfile error, streamtype is video | ||||||
|  | #define  PLAYM4_JPEG_COMPRESS_ERROR                26   //JPEG compress error | ||||||
|  | #define  PLAYM4_EXTRACT_NOT_SUPPORT                27    //Don't support the version of this file. | ||||||
|  | #define  PLAYM4_EXTRACT_DATA_ERROR                28    //extract video data failed. | ||||||
|  | #define  PLAYM4_SECRET_KEY_ERROR                29    //Secret key is error //add 20071218 | ||||||
|  | #define  PLAYM4_DECODE_KEYFRAME_ERROR            30   //add by hy 20090318 | ||||||
|  | #define  PLAYM4_NEED_MORE_DATA                    31   //add by hy 20100617 | ||||||
|  | #define  PLAYM4_INVALID_PORT                    32    //add by cj 20100913 | ||||||
|  | #define  PLAYM4_NOT_FIND                        33    //add by cj 20110428 | ||||||
|  | #define  PLAYM4_NEED_LARGER_BUFFER              34  //add by pzj 20130528 | ||||||
|  | #define  PLAYM4_FAIL_UNKNOWN                    99   //Fail, but the reason is unknown;     | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD>۹<EFBFBD><DBB9>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_ENABLEFAIL                100 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> | ||||||
|  | #define PLAYM4_FEC_ERR_NOTENABLE                101 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_NOSUBPORT                102 // <20>Ӷ˿<D3B6>û<EFBFBD>з<EFBFBD><D0B7><EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_PARAMNOTINIT                103 // û<>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ӧ<EFBFBD>˿ڵIJ<DAB5><C4B2><EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_SUBPORTOVER                104 // <20>Ӷ˿<D3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT            105 // <20>ð<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>֧<EFBFBD><D6A7> | ||||||
|  | #define PLAYM4_FEC_ERR_INVALIDWND                106 // <20>Ƿ<EFBFBD><C7B7>Ĵ<EFBFBD><C4B4><EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_PTZOVERFLOW                107 // PTZλ<5A><CEBB>Խ<EFBFBD><D4BD> | ||||||
|  | #define PLAYM4_FEC_ERR_RADIUSINVALID            108 // Բ<>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>Ƿ<EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_UPDATENOTSUPPORT            109 // ָ<><D6B8><EFBFBD>İ<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD>֧<EFBFBD><D6A7> | ||||||
|  | #define PLAYM4_FEC_ERR_NOPLAYPORT                110 // <20><><EFBFBD>ſ<EFBFBD><C5BF>˿<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_PARAMVALID                111 // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA> | ||||||
|  | #define PLAYM4_FEC_ERR_INVALIDPORT                112 // <20>Ƿ<EFBFBD><C7B7>Ӷ˿<D3B6> | ||||||
|  | #define PLAYM4_FEC_ERR_PTZZOOMOVER                113 // PTZ<54><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΧԽ<CEA7><D4BD> | ||||||
|  | #define PLAYM4_FEC_ERR_OVERMAXPORT                114  // <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵĽ<D6B5><C4BD><EFBFBD>ͨ<EFBFBD><CDA8>Ϊ<EFBFBD>ĸ<EFBFBD> | ||||||
|  | #define PLAYM4_FEC_ERR_ENABLED                  115  //<2F>ö˿<C3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> | ||||||
|  | #define PLAYM4_FEC_ERR_D3DACCENOTENABLE            116 // D3D<33><44><EFBFBD><EFBFBD>û<EFBFBD>п<EFBFBD><D0BF><EFBFBD> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | //Max display regions. | ||||||
|  | #define MAX_DISPLAY_WND 4 | ||||||
|  |  | ||||||
|  | //Display type | ||||||
|  | #define DISPLAY_NORMAL                0x00000001    | ||||||
|  | #define DISPLAY_QUARTER                0x00000002 | ||||||
|  | #define DISPLAY_YC_SCALE            0x00000004    //add by gb 20091116 | ||||||
|  | #define DISPLAY_NOTEARING            0x00000008 | ||||||
|  | //Display buffers | ||||||
|  | #define MAX_DIS_FRAMES 50 | ||||||
|  | #define MIN_DIS_FRAMES 1 | ||||||
|  |  | ||||||
|  | //Locate by | ||||||
|  | #define BY_FRAMENUM  1 | ||||||
|  | #define BY_FRAMETIME 2 | ||||||
|  |  | ||||||
|  | //Source buffer | ||||||
|  | #define SOURCE_BUF_MAX    1024*100000 | ||||||
|  | #define SOURCE_BUF_MIN    1024*50 | ||||||
|  |  | ||||||
|  | //Stream type | ||||||
|  | #define STREAME_REALTIME 0 | ||||||
|  | #define STREAME_FILE     1 | ||||||
|  |  | ||||||
|  | //frame type | ||||||
|  | #define T_AUDIO16    101 | ||||||
|  | #define T_AUDIO8    100 | ||||||
|  | #define T_UYVY        1 | ||||||
|  | #define T_YV12        3 | ||||||
|  | #define T_RGB32        7 | ||||||
|  |  | ||||||
|  | //capability | ||||||
|  | #define SUPPORT_DDRAW        1  | ||||||
|  | #define SUPPORT_BLT         2  | ||||||
|  | #define SUPPORT_BLTFOURCC   4  | ||||||
|  | #define SUPPORT_BLTSHRINKX  8  | ||||||
|  | #define SUPPORT_BLTSHRINKY  16 | ||||||
|  | #define SUPPORT_BLTSTRETCHX 32 | ||||||
|  | #define SUPPORT_BLTSTRETCHY 64 | ||||||
|  | #define SUPPORT_SSE         128 | ||||||
|  | #define SUPPORT_MMX            256  | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD>º궨<C2BA><EAB6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HIK_MEDIAINFO<46>ṹ | ||||||
|  | #define FOURCC_HKMI            0x484B4D49    // "HKMI" HIK_MEDIAINFO<46>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD> | ||||||
|  | // ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>ʽ     | ||||||
|  | #define SYSTEM_NULL            0x0                // û<><C3BB>ϵͳ<CFB5>㣬<EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>     | ||||||
|  | #define SYSTEM_HIK          0x1                // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> | ||||||
|  | #define SYSTEM_MPEG2_PS     0x2                // PS<50><53>װ | ||||||
|  | #define SYSTEM_MPEG2_TS     0x3                // TS<54><53>װ | ||||||
|  | #define SYSTEM_RTP          0x4                // rtp<74><70>װ | ||||||
|  | #define SYSTEM_RTPHIK       0x401                // rtp<74><70>װ | ||||||
|  |  | ||||||
|  | // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | #define VIDEO_NULL          0x0 // û<><C3BB><EFBFBD><EFBFBD>Ƶ | ||||||
|  | #define VIDEO_H264          0x1 // <20><><EFBFBD><EFBFBD>H.264 | ||||||
|  | #define VIDEO_MPEG4         0x3 // <20><>MPEG4 | ||||||
|  | #define VIDEO_MJPEG            0x4 | ||||||
|  | #define VIDEO_AVC264        0x0100 | ||||||
|  |  | ||||||
|  | // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | #define AUDIO_NULL          0x0000 // û<><C3BB><EFBFBD><EFBFBD>Ƶ | ||||||
|  | #define AUDIO_ADPCM         0x1000 // ADPCM  | ||||||
|  | #define AUDIO_MPEG          0x2000 // MPEG ϵ<><CFB5><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>MPEG<45><47>Ƶ | ||||||
|  | #define AUDIO_AAC            0X2001 // AAC <20><><EFBFBD><EFBFBD> | ||||||
|  | // Gϵ<47><CFB5><EFBFBD><EFBFBD>Ƶ | ||||||
|  | #define AUDIO_RAW_DATA8        0x7000      //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ8k<38><6B>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> | ||||||
|  | #define AUDIO_RAW_UDATA16    0x7001      //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16k<36><6B>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>L16 | ||||||
|  | #define AUDIO_G711_U        0x7110 | ||||||
|  | #define AUDIO_G711_A        0x7111 | ||||||
|  | #define AUDIO_G722_1        0x7221 | ||||||
|  | #define AUDIO_G723_1        0x7231 | ||||||
|  | #define AUDIO_G726_U        0x7260 | ||||||
|  | #define AUDIO_G726_A        0x7261 | ||||||
|  | #define AUDIO_G726_16       0x7262  | ||||||
|  | #define AUDIO_G729          0x7290 | ||||||
|  | #define AUDIO_AMR_NB        0x3000 | ||||||
|  |  | ||||||
|  | #define SYNCDATA_VEH        1 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ     | ||||||
|  | #define SYNCDATA_IVS        2 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ | ||||||
|  |  | ||||||
|  | //motion flow type | ||||||
|  | #define    MOTION_FLOW_NONE            0 | ||||||
|  | #define MOTION_FLOW_CPU                1 | ||||||
|  | #define MOTION_FLOW_GPU                2 | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | #define ENCRYPT_AES_3R_VIDEO     1  | ||||||
|  | #define ENCRYPT_AES_10R_VIDEO    2  | ||||||
|  | #define ENCRYPT_AES_3R_AUDIO     1   | ||||||
|  | #define ENCRYPT_AES_10R_AUDIO    2 | ||||||
|  |  | ||||||
|  | //Frame position | ||||||
|  | typedef struct{ | ||||||
|  |     long nFilePos; | ||||||
|  |     long nFrameNum; | ||||||
|  |     long nFrameTime; | ||||||
|  |     long nErrorFrameNum; | ||||||
|  |     SYSTEMTIME *pErrorTime; | ||||||
|  |     long nErrorLostFrameNum; | ||||||
|  |     long nErrorFrameSize; | ||||||
|  | }FRAME_POS,*PFRAME_POS; | ||||||
|  |  | ||||||
|  | //Frame Info | ||||||
|  | typedef struct{ | ||||||
|  |     long nWidth; | ||||||
|  |     long nHeight; | ||||||
|  |     long nStamp; | ||||||
|  |     long nType; | ||||||
|  |     long nFrameRate; | ||||||
|  |     DWORD dwFrameNum; | ||||||
|  | }FRAME_INFO; | ||||||
|  |  | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |     long         nPort;        //ͨ<><CDA8><EFBFBD><EFBFBD> | ||||||
|  |     char         *pBuf;        //<2F><><EFBFBD>صĵ<D8B5>һ·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> | ||||||
|  |     unsigned int nBufLen;      //<2F><><EFBFBD>صĵ<D8B5>һ·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С | ||||||
|  |     char         *pBuf1;       //<2F><><EFBFBD>صĵڶ<C4B5>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> | ||||||
|  |     unsigned int nBufLen1;     //<2F><><EFBFBD>صĵڶ<C4B5>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С | ||||||
|  |     char         *pBuf2;       //<2F><><EFBFBD>صĵ<D8B5><C4B5><EFBFBD>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> | ||||||
|  |     unsigned int nBufLen2;     //<2F><><EFBFBD>صĵ<D8B5><C4B5><EFBFBD>·ͼ<C2B7><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С | ||||||
|  |     unsigned int nWidth;       //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     unsigned int nHeight;      //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     unsigned int nStamp;       //ʱ<><CAB1><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> | ||||||
|  |     unsigned int nType;        //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     void         *pUser;       //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     unsigned int reserved[4];  //<2F><><EFBFBD><EFBFBD> | ||||||
|  | }DISPLAY_INFO_YUV; | ||||||
|  |  | ||||||
|  | //Frame  | ||||||
|  | typedef struct{ | ||||||
|  |     char *pDataBuf; | ||||||
|  |     long  nSize; | ||||||
|  |     long  nFrameNum; | ||||||
|  |     BOOL  bIsAudio; | ||||||
|  |     long  nReserved; | ||||||
|  | }FRAME_TYPE; | ||||||
|  |  | ||||||
|  | //Watermark Info    //add by gb 080119 | ||||||
|  | typedef struct{ | ||||||
|  |     char *pDataBuf; | ||||||
|  |     long  nSize; | ||||||
|  |     long  nFrameNum; | ||||||
|  |     BOOL  bRsaRight; | ||||||
|  |     long  nReserved; | ||||||
|  | }WATERMARK_INFO; | ||||||
|  |  | ||||||
|  | typedef struct SYNCDATA_INFO  | ||||||
|  | { | ||||||
|  |     DWORD dwDataType;        //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD>Ŀǰ<C4BF>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ | ||||||
|  |     DWORD dwDataLen;        //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> | ||||||
|  |     BYTE* pData;            //ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݽṹ<DDBD><E1B9B9>ָ<EFBFBD><D6B8>,<2C><><EFBFBD><EFBFBD>IVS_INFO<46>ṹ | ||||||
|  | } SYNCDATA_INFO; | ||||||
|  |  | ||||||
|  | #ifndef _HIK_MEDIAINFO_FLAG_ | ||||||
|  | #define _HIK_MEDIAINFO_FLAG_ | ||||||
|  | typedef struct _HIK_MEDIAINFO_                // modified by gb 080425 | ||||||
|  | { | ||||||
|  |     unsigned int    media_fourcc;            // "HKMI": 0x484B4D49 Hikvision Media Information | ||||||
|  |     unsigned short  media_version;            // <20>汾<EFBFBD>ţ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD>汾<EFBFBD>ţ<EFBFBD>ĿǰΪ0x0101,<2C><>1.01<EFBFBD>汾<EFBFBD><EFBFBD>01<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD>ţ<EFBFBD>01<EFBFBD><EFBFBD><EFBFBD>Ӱ汾<EFBFBD>š<EFBFBD> | ||||||
|  |     unsigned short  device_id;                // <20>豸ID<49><44><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>/<2F><><EFBFBD><EFBFBD>             | ||||||
|  |      | ||||||
|  |     unsigned short  system_format;          // ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0> | ||||||
|  |     unsigned short  video_format;           // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |  | ||||||
|  |     unsigned short  audio_format;           // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     unsigned char   audio_channels;         // ͨ<><CDA8><EFBFBD><EFBFBD>   | ||||||
|  |     unsigned char   audio_bits_per_sample;  // <20><>λ<EFBFBD><CEBB> | ||||||
|  |     unsigned int    audio_samplesrate;      // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>  | ||||||
|  |     unsigned int    audio_bitrate;          // ѹ<><D1B9><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>,<2C><>λ<EFBFBD><CEBB>bit | ||||||
|  |  | ||||||
|  |     unsigned int    reserved[4];            // <20><><EFBFBD><EFBFBD> | ||||||
|  | }HIK_MEDIAINFO; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | typedef struct   | ||||||
|  | { | ||||||
|  |     long nPort; | ||||||
|  |     char * pBuf; | ||||||
|  |     long nBufLen; | ||||||
|  |     long nWidth; | ||||||
|  |     long nHeight; | ||||||
|  |     long nStamp; | ||||||
|  |     long nType; | ||||||
|  |     long nUser; | ||||||
|  | }DISPLAY_INFO; | ||||||
|  |  | ||||||
|  | typedef struct | ||||||
|  | { | ||||||
|  |     long nPort; | ||||||
|  |     char *pVideoBuf; | ||||||
|  |     long nVideoBufLen; | ||||||
|  |     char *pPriBuf; | ||||||
|  |     long nPriBufLen; | ||||||
|  |     long nWidth; | ||||||
|  |     long nHeight; | ||||||
|  |     long nStamp; | ||||||
|  |     long nType; | ||||||
|  |     long nUser; | ||||||
|  | }DISPLAY_INFOEX; | ||||||
|  |  | ||||||
|  | typedef struct PLAYM4_SYSTEM_TIME //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>  | ||||||
|  | { | ||||||
|  |     DWORD dwYear;    //<2F><> | ||||||
|  |     DWORD dwMon;    //<2F><> | ||||||
|  |     DWORD dwDay;    //<2F><> | ||||||
|  |     DWORD dwHour;    //ʱ | ||||||
|  |     DWORD dwMin;    //<2F><> | ||||||
|  |     DWORD dwSec;    //<2F><> | ||||||
|  |     DWORD dwMs;        //<2F><><EFBFBD><EFBFBD> | ||||||
|  | } PLAYM4_SYSTEM_TIME; | ||||||
|  |  | ||||||
|  | //ENCRYPT Info | ||||||
|  | typedef struct{ | ||||||
|  |     long nVideoEncryptType;  //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     long nAudioEncryptType;  //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     long nSetSecretKey;      //<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ã<EFBFBD>1<EFBFBD><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>0<EFBFBD><30>ʾû<CABE><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ | ||||||
|  | }ENCRYPT_INFO; | ||||||
|  |  | ||||||
|  | ////////////////////////////////////////////////////////////////////////////// | ||||||
|  | //API | ||||||
|  | ////////////////////////////////////////////////////////////////////////////// | ||||||
|  |  | ||||||
|  | ////////////////ver 1.0/////////////////////////////////////// | ||||||
|  | //Initialize DirecDraw.Now invalid. | ||||||
|  | PLAYM4_API BOOL __stdcall  PlayM4_InitDDraw(HWND hWnd); | ||||||
|  | //Release directDraw; Now invalid. | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_RealeseDDraw(); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_OpenFile(LONG nPort,LPSTR sFileName); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_CloseFile(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_Play(LONG nPort, HWND hWnd); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_Stop(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_Pause(LONG nPort,DWORD nPause); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_Fast(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_Slow(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_OneByOne(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetPlayPos(LONG nPort,float fRelativePos); | ||||||
|  | PLAYM4_API float __stdcall PlayM4_GetPlayPos(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetFileEndMsg(LONG nPort,HWND hWnd,UINT nMsg); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetVolume(LONG nPort,WORD nVolume); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_StopSound(); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_PlaySound(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_InputData(LONG nPort,PBYTE pBuf,DWORD nSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_CloseStream(LONG nPort); | ||||||
|  | PLAYM4_API int  __stdcall  PlayM4_GetCaps(); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetFileTime(LONG nPort); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTime(LONG nPort); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetPlayedFrames(LONG nPort); | ||||||
|  |  | ||||||
|  | //23 | ||||||
|  | ////////////////ver 2.0 added/////////////////////////////////////// | ||||||
|  | PLAYM4_API BOOL __stdcall    PlayM4_SetDecCallBack(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2)); | ||||||
|  | PLAYM4_API BOOL __stdcall    PlayM4_SetDisplayCallBackYUV(LONG nPort, void (CALLBACK* DisplayCBFun)(DISPLAY_INFO_YUV *pstDisplayInfo), BOOL bTrue, void* pUser); | ||||||
|  | PLAYM4_API BOOL __stdcall    PlayM4_SetDisplayCallBack(LONG nPort,void (CALLBACK* DisplayCBFun)(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved)); | ||||||
|  | PLAYM4_API BOOL __stdcall    PlayM4_ConvertToBmpFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName); | ||||||
|  | PLAYM4_API DWORD __stdcall    PlayM4_GetFileTotalFrames(LONG nPort); | ||||||
|  | PLAYM4_API DWORD __stdcall    PlayM4_GetCurrentFrameRate(LONG nPort); | ||||||
|  | PLAYM4_API DWORD __stdcall    PlayM4_GetPlayedTimeEx(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall    PlayM4_SetPlayedTimeEx(LONG nPort,DWORD nTime); | ||||||
|  | PLAYM4_API DWORD __stdcall    PlayM4_GetCurrentFrameNum(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall    PlayM4_SetStreamOpenMode(LONG nPort,DWORD nMode); | ||||||
|  | PLAYM4_API DWORD __stdcall    PlayM4_GetFileHeadLength(); | ||||||
|  | PLAYM4_API DWORD __stdcall    PlayM4_GetSdkVersion(); | ||||||
|  | //11 | ||||||
|  | ////////////////ver 2.2 added/////////////////////////////////////// | ||||||
|  | PLAYM4_API DWORD __stdcall  PlayM4_GetLastError(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_RefreshPlay(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetOverlayMode(LONG nPort,BOOL bOverlay,COLORREF colorKey); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetPictureSize(LONG nPort,LONG *pWidth,LONG *pHeight); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetPicQuality(LONG nPort,BOOL bHighQuality); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_PlaySoundShare(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_StopSoundShare(LONG nPort); | ||||||
|  | //7 | ||||||
|  | ////////////////ver 2.4 added/////////////////////////////////////// | ||||||
|  | PLAYM4_API LONG __stdcall PlayM4_GetStreamOpenMode(LONG nPort); | ||||||
|  | PLAYM4_API LONG __stdcall PlayM4_GetOverlayMode(LONG nPort); | ||||||
|  | PLAYM4_API COLORREF __stdcall PlayM4_GetColorKey(LONG nPort); | ||||||
|  | PLAYM4_API WORD __stdcall PlayM4_GetVolume(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetPictureQuality(LONG nPort,BOOL *bHighQuality); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetSourceBufferRemain(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBuffer(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetSourceBufCallBack(LONG nPort,DWORD nThreShold,void (CALLBACK * SourceBufCallBack)(long nPort,DWORD nBufSize,DWORD dwUser,void*pResvered),DWORD dwUser,void *pReserved); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBufFlag(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDisplayBuf(LONG nPort,DWORD nNum); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetDisplayBuf(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_OneByOneBack(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetFileRefCallBack(LONG nPort, void (__stdcall *pFileRefDone)(DWORD nPort,DWORD nUser),DWORD nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetCurrentFrameNum(LONG nPort,DWORD nFrameNum); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetNextKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos); | ||||||
|  | #if (WINVER >= 0x0400) | ||||||
|  | //Note: These funtion must be builded under win2000 or above with Microsoft Platform sdk. | ||||||
|  | //        You can download the sdk from "http://www.microsoft.com/msdownload/platformsdk/sdkupdate/"; | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_InitDDrawDevice(); | ||||||
|  | PLAYM4_API void __stdcall PlayM4_ReleaseDDrawDevice(); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetDDrawDeviceTotalNums(); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDevice(LONG nPort,DWORD nDeviceNum); | ||||||
|  | //PLAYM4_API BOOL __stdcall PlayM4_GetDDrawDeviceInfo(DWORD nDeviceNum,LPSTR  lpDriverDescription,DWORD nDespLen,LPSTR lpDriverName ,DWORD nNameLen,HMONITOR *hhMonitor); | ||||||
|  | PLAYM4_API int  __stdcall  PlayM4_GetCapsEx(DWORD nDDrawDeviceNum); | ||||||
|  | #endif | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_ThrowBFrameNum(LONG nPort,DWORD nNum); | ||||||
|  | //23 | ||||||
|  | ////////////////ver 2.5 added/////////////////////////////////////// | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDisplayType(LONG nPort,LONG nType); | ||||||
|  | PLAYM4_API long __stdcall PlayM4_GetDisplayType(LONG nPort); | ||||||
|  | //2 | ||||||
|  | ////////////////ver 3.0 added/////////////////////////////////////// | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDecCBStream(LONG nPort,DWORD nStream); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDisplayRegion(LONG nPort,DWORD nRegionNum, RECT *pSrcRect, HWND hDestWnd, BOOL bEnable); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_RefreshPlayEx(LONG nPort,DWORD nRegionNum); | ||||||
|  | #if (WINVER >= 0x0400) | ||||||
|  | //Note: The funtion must be builded under win2000 or above with Microsoft Platform sdk. | ||||||
|  | //        You can download the sdk from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/; | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDeviceEx(LONG nPort,DWORD nRegionNum,DWORD nDeviceNum); | ||||||
|  | #endif | ||||||
|  | //4 | ||||||
|  | /////////////////v3.2 added///////////////////////////////////////// | ||||||
|  |  | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetRefValue(LONG nPort,BYTE *pBuffer, DWORD *pSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetRefValue(LONG nPort,BYTE *pBuffer, DWORD nSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_OpenStreamEx(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_CloseStreamEx(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_InputVideoData(LONG nPort,PBYTE pBuf,DWORD nSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_InputAudioData(LONG nPort,PBYTE pBuf,DWORD nSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_RegisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_RigisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser); | ||||||
|  | //8 | ||||||
|  | //////////////////v3.4///////////////////////////////////////////////////// | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetTimerType(LONG nPort,DWORD nTimerType,DWORD nReserved); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetTimerType(LONG nPort,DWORD *pTimerType,DWORD *pReserved); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_ResetBuffer(LONG nPort,DWORD nBufType); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetBufferValue(LONG nPort,DWORD nBufType); | ||||||
|  |  | ||||||
|  | //////////////////V3.6///////////////////////////////////////////////////////// | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_AdjustWaveAudio(LONG nPort,LONG nCoefficient); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetVerifyCallBack(LONG nPort, DWORD nBeginTime, DWORD nEndTime, void (__stdcall * funVerify)(long nPort, FRAME_POS * pFilePos, DWORD bIsVideo, DWORD nUser),  DWORD  nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetAudioCallBack(LONG nPort, void (__stdcall * funAudio)(long nPort, char * pAudioBuf, long nSize, long nStamp, long nType, long nUser), long nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetEncTypeChangeCallBack(LONG nPort,void(CALLBACK *funEncChange)(long nPort,long nUser),long nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetColor(LONG nPort, DWORD nRegionNum, int nBrightness, int nContrast, int nSaturation, int nHue); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetColor(LONG nPort, DWORD nRegionNum, int *pBrightness, int *pContrast, int *pSaturation, int *pHue); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetEncChangeMsg(LONG nPort,HWND hWnd,UINT nMsg); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetOriginalFrameCallBack(LONG nPort, BOOL bIsChange,BOOL bNormalSpeed,long nStartFrameNum,long nStartStamp,long nFileHeader,void(CALLBACK *funGetOrignalFrame)(long nPort,FRAME_TYPE *frameType, long nUser),long nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetFileSpecialAttr(LONG nPort, DWORD *pTimeStamp,DWORD *pFileNum ,DWORD *pReserved); | ||||||
|  | PLAYM4_API DWORD __stdcall PlayM4_GetSpecialData(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetCheckWatermarkCallBack(LONG nPort,void(CALLBACK* funCheckWatermark)(long nPort,WATERMARK_INFO* pWatermarkInfo,DWORD nUser),DWORD nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetImageSharpen(LONG nPort,DWORD nLevel); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDecodeFrameType(LONG nPort,DWORD nFrameType); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetPlayMode(LONG nPort,BOOL bNormal); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetOverlayFlipMode(LONG nPort,BOOL bTrue); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetOverlayPriInfoFlag(LONG nPort, DWORD nIntelType, BOOL bTrue,const char *pFontPath); | ||||||
|  |  | ||||||
|  | //PLAYM4_API DWORD __stdcall PlayM4_GetAbsFrameNum(LONG nPort);  | ||||||
|  |  | ||||||
|  | //////////////////V4.7.0.0////////////////////////////////////////////////////// | ||||||
|  | ////convert yuv to jpeg | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_ConvertToJpegFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetJpegQuality(long nQuality); | ||||||
|  | //set deflash | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDeflash(LONG nPort,BOOL bDefalsh); | ||||||
|  | //PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackEx(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2), char* pDest, long nDestSize); | ||||||
|  | //////////////////V4.8.0.0///////////////////////////////////////////////////////// | ||||||
|  | //check discontinuous frame number as error data? | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_CheckDiscontinuousFrameNum(LONG nPort, BOOL bCheck); | ||||||
|  | //get bmp or jpeg | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetBMP(LONG nPort,PBYTE pBitmap,DWORD nBufSize,DWORD* pBmpSize); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetJPEG(LONG nPort,PBYTE pJpeg,DWORD nBufSize,DWORD* pJpegSize); | ||||||
|  | //dec call back mend | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackMend(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nUser,long nReserved2), long nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetSecretKey(LONG nPort, LONG lKeyType, char *pSecretKey, LONG lKeyLen); | ||||||
|  |  | ||||||
|  | // add by gb 2007-12-23 | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetFileEndCallback(LONG nPort, void(CALLBACK*FileEndCallback)(long nPort, void *pUser), void *pUser); | ||||||
|  |  | ||||||
|  | // add by gb 080131 version 4.9.0.1 | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetPort(LONG* nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FreePort(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBackEx(LONG nPort,void (CALLBACK* DisplayCBFun)(DISPLAY_INFO *pstDisplayInfo), long nUser); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SkipErrorData(LONG nPort, BOOL bSkip); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackExMend(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char* pBuf, long nSize, FRAME_INFO* pFrameInfo,  | ||||||
|  |                                                       long nUser, long nReserved2), char* pDest, long nDestSize, long nUser); | ||||||
|  | //reverse play add by chenjie 110609 | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_ReversePlay(LONG nPort); | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetSystemTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime); | ||||||
|  |  | ||||||
|  | //PLAYM4_API BOOL __stdcall PlayM4_SetDecodeERC(long nPort, unsigned int nLevel); | ||||||
|  |  | ||||||
|  | #ifndef PLAYM4_SESSION_INFO_TAG | ||||||
|  | #define PLAYM4_SESSION_INFO_TAG | ||||||
|  | //nProtocolType | ||||||
|  | #define PLAYM4_PROTOCOL_RTSP    1 | ||||||
|  | //nSessionInfoType | ||||||
|  | #define PLAYM4_SESSION_INFO_SDP 1 | ||||||
|  |  | ||||||
|  | typedef struct _PLAYM4_SESSION_INFO_     //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ | ||||||
|  | { | ||||||
|  |       int            nSessionInfoType;   //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>SDP<44><50><EFBFBD><EFBFBD><EFBFBD>纣<EFBFBD><E7BAA3>˽<EFBFBD><CBBD><EFBFBD><EFBFBD>Ϣͷ | ||||||
|  |       int            nSessionInfoLen;    //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> | ||||||
|  |       unsigned char* pSessionInfoData;   //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> | ||||||
|  |  | ||||||
|  | } PLAYM4_SESSION_INFO; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_OpenStreamAdvanced(LONG nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, DWORD nBufPoolSize); | ||||||
|  |  | ||||||
|  | #define R_ANGLE_0   -1  //<2F><><EFBFBD><EFBFBD>ת | ||||||
|  | #define R_ANGLE_L90  0  //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30> | ||||||
|  | #define R_ANGLE_R90  1  //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30> | ||||||
|  | #define R_ANGLE_180  2  //<2F><>ת180<38><30> | ||||||
|  |  | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetRotateAngle(LONG nPort, DWORD nRegionNum, DWORD dwType); | ||||||
|  |  | ||||||
|  | #ifndef PLAYM4_ADDITION_INFO_TAG | ||||||
|  | #define PLAYM4_ADDITION_INFO_TAG | ||||||
|  | typedef struct _PLAYM4_ADDITION_INFO_     //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ | ||||||
|  | { | ||||||
|  |     BYTE*   pData;            //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     DWORD   dwDatalen;        //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> | ||||||
|  |     DWORD    dwDataType;        //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     DWORD    dwTimeStamp;    //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> | ||||||
|  | } PLAYM4_ADDITION_INFO; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | //dwGroupIndex <20><>Լ<EFBFBD><D4BC>ȡֵ0~3<><33><EFBFBD><EFBFBD>һ<EFBFBD>汾ȡ<E6B1BE><C8A1>ͬ<EFBFBD><CDAC>ֻ<EFBFBD><D6BB>ͬ<EFBFBD><CDAC>closestream<61><6D><EFBFBD><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetSycGroup(LONG nPort, DWORD dwGroupIndex); | ||||||
|  | //<2F>ݲ<EFBFBD>ʵ<EFBFBD>ִ˺<D6B4><CBBA><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʼʱ<CABC>䲻һ<E4B2BB>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣬ͬһ<CDAC><D2BB><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ· | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetSycStartTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صĽӿ<C4BD> | ||||||
|  | #ifndef FISH_EYE_TAG | ||||||
|  | #define FISH_EYE_TAG | ||||||
|  |  | ||||||
|  | // <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD> | ||||||
|  | typedef enum tagFECPlaceType | ||||||
|  | { | ||||||
|  |     FEC_PLACE_WALL    = 0x1,        // <20><>װ<EFBFBD><D7B0>ʽ        (<28><><EFBFBD><EFBFBD>ˮƽ) | ||||||
|  |     FEC_PLACE_FLOOR   = 0x2,        // <20><><EFBFBD>氲װ        (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) | ||||||
|  |     FEC_PLACE_CEILING = 0x3,        // <20><>װ<EFBFBD><D7B0>ʽ        (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) | ||||||
|  |  | ||||||
|  | }FECPLACETYPE; | ||||||
|  |  | ||||||
|  | typedef enum tagFECCorrectType | ||||||
|  | { | ||||||
|  |     FEC_CORRECT_PTZ = 0x100,        // PTZ | ||||||
|  |     FEC_CORRECT_180 = 0x200,        // 180<38>Ƚ<EFBFBD><C8BD><EFBFBD>  <20><><EFBFBD><EFBFBD>Ӧ2P<32><50> | ||||||
|  |     FEC_CORRECT_360 = 0x300,        // 360ȫ<30><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ӧ1P<31><50> | ||||||
|  |     FEC_CORRECT_LAT = 0x400         //γ<><CEB3>չ<EFBFBD><D5B9> | ||||||
|  |  | ||||||
|  | }FECCORRECTTYPE; | ||||||
|  |  | ||||||
|  | typedef struct tagCycleParam | ||||||
|  | { | ||||||
|  |     float    fRadiusLeft;    // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD> | ||||||
|  |     float    fRadiusRight;    // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD> | ||||||
|  |     float   fRadiusTop;        // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD> | ||||||
|  |     float   fRadiusBottom;    // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD> | ||||||
|  |  | ||||||
|  | }CYCLEPARAM; | ||||||
|  |  | ||||||
|  | typedef struct tagPTZParam | ||||||
|  | { | ||||||
|  |     float fPTZPositionX;        // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> X<><58><EFBFBD><EFBFBD> | ||||||
|  |     float fPTZPositionY;        // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> Y<><59><EFBFBD><EFBFBD>     | ||||||
|  |  | ||||||
|  | }PTZPARAM; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | /********************************************* | ||||||
|  |       | ||||||
|  |  | ||||||
|  |  ********************************************/ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD>±<EFBFBD><C2B1>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |   | ||||||
|  |  | ||||||
|  | #define         FEC_UPDATE_RADIUS             0x1 | ||||||
|  | #define         FEC_UPDATE_PTZZOOM             0x2 | ||||||
|  | #define         FEC_UPDATE_WIDESCANOFFSET     0x4 | ||||||
|  | #define         FEC_UPDATE_PTZPARAM             0x8 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | typedef struct tagFECParam | ||||||
|  | { | ||||||
|  |  | ||||||
|  |      | ||||||
|  |     unsigned int     nUpDateType;            // <20><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |  | ||||||
|  |     unsigned int    nPlaceAndCorrect;        // <20><>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1>SetParam<61><6D>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ч,<2C><>ֵ<EFBFBD><D6B5>ʾ<EFBFBD><CABE>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>ĺ<EFBFBD> | ||||||
|  |  | ||||||
|  |     PTZPARAM        stPTZParam;                // PTZ У<><D0A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD> | ||||||
|  |  | ||||||
|  |     CYCLEPARAM        stCycleParam;            // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Բ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD> | ||||||
|  |  | ||||||
|  |     float            fZoom;                    // PTZ <20><>ʾ<EFBFBD>ķ<EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD> | ||||||
|  |  | ||||||
|  |     float            fWideScanOffset;        // 180<38><30><EFBFBD><EFBFBD>360<36><30>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ƫ<EFBFBD>ƽǶ<C6BD> | ||||||
|  |  | ||||||
|  |     int                nResver[16];            // <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD> | ||||||
|  |  | ||||||
|  | }FISHEYEPARAM; | ||||||
|  |  | ||||||
|  | typedef void (__stdcall * FISHEYE_CallBack )( void* pUser  , unsigned int  nSubPort , unsigned int nCBType , void * hDC ,   unsigned int nWidth , unsigned int nHeight);  | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FEC_Enable(LONG nPort); | ||||||
|  |  | ||||||
|  | // <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FEC_Disable(LONG nPort); | ||||||
|  |  | ||||||
|  | // <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6> [1~31]  | ||||||
|  | PLAYM4_API BOOL  __stdcall PlayM4_FEC_GetPort(LONG nPort, unsigned int* nSubPort,FECPLACETYPE emPlaceType,FECCORRECTTYPE emCorrectType); | ||||||
|  |  | ||||||
|  | // ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FEC_DelPort(LONG nPort , unsigned int nSubPort); | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FEC_SetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara); | ||||||
|  |  | ||||||
|  | // <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FEC_GetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara); | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>л<EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FEC_SetWnd(LONG nPort , unsigned int nSubPort , void * hWnd); | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۴<EFBFBD><DBB4>ڵĻ<DAB5>ͼ<EFBFBD>ص<EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_FEC_SetCallBack(LONG nPort , unsigned int nSubPort , FISHEYE_CallBack cbFunc , void * pUser); | ||||||
|  |  | ||||||
|  | //motionflow | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_MotionFlow(LONG nPort, DWORD dwAdjustType); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | //ͼ<><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD> | ||||||
|  | #ifndef PLAYM4_HIKVIE_TAG | ||||||
|  | #define PLAYM4_HIKVIE_TAG | ||||||
|  |  | ||||||
|  | typedef struct _PLAYM4_VIE_DYNPARAM_ | ||||||
|  | { | ||||||
|  |     int moduFlag;      //<2F><><EFBFBD>õ<EFBFBD><C3B5>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD>ģ<EFBFBD>飬<EFBFBD><E9A3AC>PLAYM4_VIE_MODULES<45>ж<EFBFBD><D0B6><EFBFBD> | ||||||
|  |     //<2F><> PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN | ||||||
|  |     //ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>ú<C3BA><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     //PLAYM4_VIE_MODU_ADJ | ||||||
|  |     int brightVal;     //<2F><><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-255, 255] | ||||||
|  |     int contrastVal;   //<2F>Աȶȵ<C8B6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255] | ||||||
|  |     int colorVal;      //<2F><><EFBFBD>Ͷȵ<CDB6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255] | ||||||
|  |     //PLAYM4_VIE_MODU_EHAN | ||||||
|  |     int toneScale;     //<2F>˲<EFBFBD><CBB2><EFBFBD>Χ<EFBFBD><CEA7>[0, 100] | ||||||
|  |     int toneGain;      //<2F>Աȶȵ<C8B6><C8B5>ڣ<EFBFBD>ȫ<EFBFBD>ֶԱȶ<D4B1><C8B6><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255] | ||||||
|  |     int toneOffset;    //<2F><><EFBFBD>ȵ<EFBFBD><C8B5>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵƫ<D6B5>ƣ<EFBFBD>[-255, 255] | ||||||
|  |     int toneColor;     //<2F><>ɫ<EFBFBD><C9AB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255] | ||||||
|  |     //PLAYM4_VIE_MODU_DEHAZE | ||||||
|  |     int dehazeLevel;   //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255] | ||||||
|  |     int dehazeTrans;   //<><CDB8>ֵ<EFBFBD><D6B5>[0, 255] | ||||||
|  |     int dehazeBright;  //<2F><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD><EFBFBD>[0, 255] | ||||||
|  |     //PLAYM4_VIE_MODU_DENOISE | ||||||
|  |     int denoiseLevel;  //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255] | ||||||
|  |     //PLAYM4_VIE_MODU_SHARPEN | ||||||
|  |     int usmAmount;     //<2F><><EFBFBD><EFBFBD>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255] | ||||||
|  |     int usmRadius;     //<2F>뾶<F1BBAFB0><EBBEB6>[1, 15] | ||||||
|  |     int usmThreshold;  //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[0, 255] | ||||||
|  |     //PLAYM4_VIE_MODU_DEBLOCK | ||||||
|  |     int deblockLevel;  //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 100] | ||||||
|  |     //PLAYM4_VIE_MODU_LENS | ||||||
|  |     int lensWarp;      //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255] | ||||||
|  |     int lensZoom;      //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255] | ||||||
|  |     //PLAYM4_VIE_MODU_CRB | ||||||
|  |     //<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD> | ||||||
|  | } PLAYM4_VIE_PARACONFIG; | ||||||
|  |  | ||||||
|  | typedef enum _PLAYM4_VIE_MODULES | ||||||
|  | { | ||||||
|  |     PLAYM4_VIE_MODU_ADJ      = 0x00000001, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     PLAYM4_VIE_MODU_EHAN     = 0x00000002, //<2F>ֲ<EFBFBD><D6B2><EFBFBD>ǿģ<C7BF><C4A3> | ||||||
|  |     PLAYM4_VIE_MODU_DEHAZE   = 0x00000004, //ȥ<><C8A5>ģ<EFBFBD><C4A3> | ||||||
|  |     PLAYM4_VIE_MODU_DENOISE  = 0x00000008, //ȥ<><C8A5>ģ<EFBFBD><C4A3> | ||||||
|  |     PLAYM4_VIE_MODU_SHARPEN  = 0x00000010, //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> | ||||||
|  |     PLAYM4_VIE_MODU_DEBLOCK  = 0x00000020, //ȥ<><C8A5><EFBFBD>˲<EFBFBD>ģ<EFBFBD><C4A3> | ||||||
|  |     PLAYM4_VIE_MODU_CRB      = 0x00000040, //ɫ<><C9AB>ƽ<EFBFBD><C6BD>ģ<EFBFBD><C4A3> | ||||||
|  |     PLAYM4_VIE_MODU_LENS     = 0x00000080, //<2F><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> | ||||||
|  | }PLAYM4_VIE_MODULES; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD>ùر<C3B9>/<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> | ||||||
|  | //dwModuFlag<61><67>ӦPLAYM4_VIE_MODULES<45><53>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>鿪<EFBFBD><E9BFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵIJ<CFB5><C4B2><EFBFBD>; | ||||||
|  | //<2F>ر<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>õIJ<C3B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | //<2F><><EFBFBD><EFBFBD><EFBFBD>ӿڵ<D3BF><DAB5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸýӿڿ<D3BF><DABF><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><F3A3BBB7><EFBFBD><F2A3ACB7>ش<EFBFBD><D8B4><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_VIE_SetModuConfig(LONG lPort,int nModuFlag,BOOL bEnable); | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULLȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>16*16<31><36><EFBFBD><EFBFBD> | ||||||
|  | //<2F><>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD>˵4<CBB5><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>ֻ֧<D6BB><D6A7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>ͱ<EFBFBD><CDB1><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_VIE_SetRegion(LONG lPort,LONG lRegNum,RECT* pRect); | ||||||
|  |  | ||||||
|  | //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_VIE_GetModuConfig(LONG lPort,int* pdwModuFlag); | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD> | ||||||
|  | //δ<><CEB4><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_VIE_SetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig); | ||||||
|  |  | ||||||
|  | //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_VIE_GetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig); | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD><EFBFBD>Ƶͬ<C6B5><CDAC><EFBFBD>ӿ<EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio); | ||||||
|  |  | ||||||
|  | // ˽<><CBBD><EFBFBD><EFBFBD>Ϣģ<CFA2><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | typedef enum _PLAYM4_PRIDATA_RENDER | ||||||
|  | {     | ||||||
|  |     PLAYM4_RENDER_ANA_INTEL_DATA   = 0x00000001, //<2F><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD> | ||||||
|  |     PLAYM4_RENDER_MD               = 0x00000002, //<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     PLAYM4_RENDER_ADD_POS          = 0x00000004, //POS<4F><53>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>         | ||||||
|  |     PLAYM4_RENDER_ADD_PIC          = 0x00000008, //ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD> | ||||||
|  |     PLAYM4_RENDER_FIRE_DETCET      = 0x00000010,  //<2F>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ | ||||||
|  |     PLAYM4_RENDER_TEM              = 0x00000020,   //<2F>¶<EFBFBD><C2B6><EFBFBD>Ϣ | ||||||
|  |     PLAYM4_RENDER_TRACK_TEM        = 0x00000040,    //<2F>켣<EFBFBD><ECBCA3>Ϣ | ||||||
|  |     PLAYM4_RENDER_THERMAL          = 0x00000080 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ | ||||||
|  | }PLAYM4_PRIDATA_RENDER; | ||||||
|  |  | ||||||
|  | typedef enum _PLAYM4_THERMAL_FLAG | ||||||
|  | { | ||||||
|  |     PLAYM4_THERMAL_FIREMASK = 0x00000001, //<2F>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     PLAYM4_THERMAL_RULEGAS = 0x00000002, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     PLAYM4_THERMAL_TARGETGAS = 0x00000004 //Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | }PLAYM4_THERMAL_FLAG; | ||||||
|  |  | ||||||
|  | typedef enum _PLAYM4_FIRE_ALARM{ | ||||||
|  |     PLAYM4_FIRE_FRAME_DIS           = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ | ||||||
|  |     PLAYM4_FIRE_MAX_TEMP            = 0x00000002, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> | ||||||
|  |     PLAYM4_FIRE_MAX_TEMP_POSITION   = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ | ||||||
|  |     PLAYM4_FIRE_DISTANCE            = 0x00000008, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶Ⱦ<C2B6><C8BE><EFBFBD>}PLAYM4_FIRE_ALARM | ||||||
|  | }PLAYM4_FIRE_ALARM; | ||||||
|  |  | ||||||
|  | typedef enum _PLAYM4_TEM_FLAG{ | ||||||
|  |     PLAYM4_TEM_REGION_BOX           = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  |     PLAYM4_TEM_REGION_LINE          = 0x00000002, //<2F>߲<EFBFBD><DFB2><EFBFBD> | ||||||
|  |     PLAYM4_TEM_REGION_POINT         = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}PLAYM4_TEM_FLAG | ||||||
|  | }PLAYM4_TEM_FLAG; | ||||||
|  |  | ||||||
|  | typedef enum _PLAYM4_TRACK_FLAG | ||||||
|  | { | ||||||
|  |     PLAYM4_TRACK_PEOPLE = 0x00000001, //<2F>˹켣 | ||||||
|  |     PLAYM4_TRACK_VEHICLE = 0x00000002, //<2F><><EFBFBD>켣 | ||||||
|  | }PLAYM4_TRACK_FLAG; | ||||||
|  |  | ||||||
|  | typedef struct TI_PTZ_INFO_ | ||||||
|  | { | ||||||
|  |     unsigned short dwDefVer;    //<2F>ṹ<EFBFBD><E1B9B9><EFBFBD>汾 | ||||||
|  |     unsigned short dwLength;    //PTZ_info<66><6F><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD>8<EFBFBD>ֽ<EFBFBD>Ϊ<EFBFBD><CEAA>λ | ||||||
|  |     DWORD          dwP;    //P<><50>0~3600<30><30> | ||||||
|  |     DWORD          dwT;         //T<><54>0~3600<30><30> | ||||||
|  |     DWORD          dwZ;         //Z<><5A>0~3600<30><30> | ||||||
|  |     BYTE        chFSMState; //<2F><><EFBFBD><EFBFBD>״̬ | ||||||
|  |     BYTE           bClearFocusState; //<2F>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>0,1<><31> | ||||||
|  |     BYTE        reserved[6]; //6<><36><EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD> | ||||||
|  | }PTZ_INFO; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateData(LONG nPort, int nIntelType, BOOL bTrue); | ||||||
|  |  | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateDataEx(LONG nPort, int nIntelType, int nSubType, BOOL bTrue); | ||||||
|  |  | ||||||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>,nType=0<><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD>ͻص<CDBB><D8B5><EFBFBD>nType=1<><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_SetEncryptTypeCallBack(LONG nPort, DWORD nType, | ||||||
|  |                                                         void (CALLBACK* EncryptTypeCBFun)(long nPort, ENCRYPT_INFO* pEncryptInfo, long nUser, long nReserved2), long nUser); | ||||||
|  | //lType: 1 <20><>ʾ<EFBFBD><CABE>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ʾ֡PTZ<54><5A>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>ʽ<EFBFBD>洢<EFBFBD><E6B4A2>pInfo<66>ڣ<EFBFBD>plLen<65><6E><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ | ||||||
|  | PLAYM4_API BOOL __stdcall PlayM4_GetStreamAdditionalInfo(LONG nPort, LONG lType, BYTE* pInfo, LONG* plLen); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif //_PLAYM4_H_ | ||||||
							
								
								
									
										12
									
								
								libs/x86_64/HCNetSDK_Log_Switch.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								libs/x86_64/HCNetSDK_Log_Switch.xml
									
									
									
									
									
										Normal 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> | ||||||
							
								
								
									
										
											BIN
										
									
								
								libs/x86_64/libcrypto.so.1.1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/x86_64/libcrypto.so.1.1
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/x86_64/libopenal.so.1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/x86_64/libopenal.so.1
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/x86_64/libssl.so.1.1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/x86_64/libssl.so.1.1
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										46
									
								
								libs/x86_64/动态库加载说明.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								libs/x86_64/动态库加载说明.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  | <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||||
|  | 1. lib<69>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF>ļ<EFBFBD>libhcnetsdk.so<73><6F>libHCCore.so<73><6F>libssl.so.1.1<EFBFBD><EFBFBD>libcrypto.so.1.1<EFBFBD>Լ<EFBFBD>HCNetSDKCom<EFBFBD>ļ<EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD> | ||||||
|  |  | ||||||
|  | 2. HCNetSDKCom<6F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>libhcnetsdk.so<73><6F>libhpr.so<73><6F>libHCCore<72>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>NET_DVR_SetSDKInitCfg(enumType<70><65><EFBFBD><EFBFBD>ֵΪ2<CEAA><32>lpInBuff<66><66>Ӧ<EFBFBD>ṹ<EFBFBD><E1B9B9>NET_DVR_LOCAL_SDK_PATH)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD> | ||||||
|  |  | ||||||
|  | 3. libcrypto.so.1.1<EFBFBD><EFBFBD>libssl.so.1.1<EFBFBD>ǿ<EFBFBD>Դ<EFBFBD>⣬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD><EFBFBD>NET_DVR_SetSDKInitCfg(enumType<70><65><EFBFBD><EFBFBD>ֵΪ3<CEAA><33>lpInBuff<66><66>Ӧlibcrypto.so.1.1<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>)<29><>NET_DVR_SetSDKInitCfg(enumType<70><65><EFBFBD><EFBFBD>ֵΪ4<CEAA><34>lpInBuff<66><66>Ӧlibssl.so.1.1<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>)ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD> | ||||||
|  |  | ||||||
|  | 4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ղ<EFBFBD><D5B2>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>Գ<EFBFBD><D4B3>Խ<EFBFBD>SDK<44><4B><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>LD_LIBRARY_PATH<54><48><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | <EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>Javaʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롿 | ||||||
|  | //<2F><><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>ľ<EFBFBD><C4BE><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD>Ȩ<EFBFBD><C8A8> | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD><EFBFBD>HCNetSDKCom<6F><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>		 | ||||||
|  | String strPathCom = "/home/test/Desktop/JavaDemoLinux/lib"; | ||||||
|  | HCNetSDK.NET_DVR_LOCAL_SDK_PATH struComPath = new HCNetSDK.NET_DVR_LOCAL_SDK_PATH(); | ||||||
|  | System.arraycopy(strPathCom.getBytes(), 0, struComPath.sPath, 0, strPathCom.length()); | ||||||
|  | struComPath.write(); | ||||||
|  | hCNetSDK.NET_DVR_SetSDKInitCfg(2, struComPath.getPointer()); | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD><EFBFBD>libcrypto.so<73><6F><EFBFBD><EFBFBD>·<EFBFBD><C2B7>	 | ||||||
|  | HCNetSDK.BYTE_ARRAY ptrByteArrayCrypto = new HCNetSDK.BYTE_ARRAY(256); | ||||||
|  | String strPathCrypto = "/home/test/Desktop/JavaDemoLinux/lib/libcrypto.so.1.1";		 | ||||||
|  | System.arraycopy(strPathCrypto.getBytes(), 0, ptrByteArrayCrypto.byValue, 0, strPathCrypto.length()); | ||||||
|  | ptrByteArrayCrypto.write(); | ||||||
|  | hCNetSDK.NET_DVR_SetSDKInitCfg(3, ptrByteArrayCrypto.getPointer()); | ||||||
|  |  | ||||||
|  | //<2F><><EFBFBD><EFBFBD>libssl.so<73><6F><EFBFBD><EFBFBD>·<EFBFBD><C2B7>	 | ||||||
|  | HCNetSDK.BYTE_ARRAY ptrByteArraySsl = new HCNetSDK.BYTE_ARRAY(256);	 | ||||||
|  | String strPathSsl = "/home/test/Desktop/JavaDemoLinux/lib/libssl.so.1.1";	 | ||||||
|  | System.arraycopy(strPathSsl.getBytes(), 0, ptrByteArraySsl.byValue, 0, strPathSsl.length()); | ||||||
|  | ptrByteArraySsl.write(); | ||||||
|  | hCNetSDK.NET_DVR_SetSDKInitCfg(4, ptrByteArraySsl.getPointer()); | ||||||
|  |  | ||||||
|  | <EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>C++ʾ<><CABE><EFBFBD><EFBFBD><EFBFBD>롿 | ||||||
|  | char cryptoPath[2048] = {0}; | ||||||
|  | sprintf(cryptoPath, "/home/test/Desktop/alarm_demo/libcrypto.so.1.1"); | ||||||
|  | NET_DVR_SetSDKInitCfg(NET_SDK_INIT_CFG_LIBEAY_PATH, cryptoPath); | ||||||
|  |  | ||||||
|  | char sslPath[2048] = {0}; | ||||||
|  | sprintf(sslPath, "/home/test/Desktop/alarm_demo/libssl.so.1.1"); | ||||||
|  | NET_DVR_SetSDKInitCfg(NET_SDK_INIT_CFG_SSLEAY_PATH, sslPath);  | ||||||
|  |      | ||||||
|  | NET_DVR_LOCAL_SDK_PATH struComPath = {0}; | ||||||
|  | sprintf(struComPath.sPath, "/home/test/Desktop/alarm_demo"); //HCNetSDKCom<6F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>·<EFBFBD><C2B7> | ||||||
|  | NET_DVR_SetSDKInitCfg(NET_SDK_INIT_CFG_SDK_PATH, &struComPath); | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| // SPDX-License-Identifier: Apache-2.0 |  | ||||||
| // SPDX-FileCopyrightText: 2023 The Ebitengine Authors |  | ||||||
|  |  | ||||||
| //go:build darwin || freebsd || linux |  | ||||||
|  |  | ||||||
| package HikNetSDK |  | ||||||
|  |  | ||||||
| import "github.com/ebitengine/purego" |  | ||||||
|  |  | ||||||
| func openLibrary(name string) (uintptr, error) { |  | ||||||
| 	return purego.Dlopen(name, purego.RTLD_NOW|purego.RTLD_GLOBAL) |  | ||||||
| } |  | ||||||
| @@ -1,13 +0,0 @@ | |||||||
| // SPDX-License-Identifier: Apache-2.0 |  | ||||||
| // SPDX-FileCopyrightText: 2023 The Ebitengine Authors |  | ||||||
|  |  | ||||||
| package HikNetSDK |  | ||||||
|  |  | ||||||
| import "syscall" |  | ||||||
|  |  | ||||||
| func openLibrary(name string) (uintptr, error) { |  | ||||||
| 	// Use [syscall.LoadLibrary] here to avoid external dependencies (#270). |  | ||||||
| 	// For actual use cases, [golang.org/x/sys/windows.NewLazySystemDLL] is recommended. |  | ||||||
| 	handle, err := syscall.LoadLibrary(name) |  | ||||||
| 	return uintptr(handle), err |  | ||||||
| } |  | ||||||
		Reference in New Issue
	
	Block a user
	 kunmeng
					kunmeng