?? hikserver32.pas
字號:
{*******************************************************}
{ }
{ 海康威視(DS4XXXHC) SDK-2 集成開發包 }
{ 服務端 }
{ 版權所有 (C) 2007 EMAIL:366733082@163.com }
{ }
{*******************************************************}
{
更新日期:2007年8月8日
}
unit HikServer32;
interface
uses
Windows, SysUtils, MMSystem, Classes;
type
//回調(通道號;回調號;返回字符)
TCallBackFunc = procedure(Channels: Byte; War_Style: Byte; ReturnStr: string = ''); stdcall;
//連接類型(0普通寬帶,40窄帶不支持聲音,30QCIF及以下圖像使用窄帶/寬帶,不進行自動調節,支持聲音)
TConnectType = (NORMAL = 50, DIALING = 40, SMALLPIC = 30);
//設備類型(主音量,話筒音量,波形輸出,綜合)
TDeviceName = (Master, Microphone, WaveOut, Synth);
PictureFormat_t = LongWord;
PFRAMES_STATISTICS = ^FRAMES_STATISTICS;
FRAMES_STATISTICS = record
VideoFrames: ULong; //視頻幀
AudioFrames: ULong; //音頻幀
FramesLost: ULong; //丟幀
QueueOverflow: ULong; //隊列溢出
CurBps: ULong; //當前比特率
end;
PVERSION_INFO = ^VERSION_INFO;
VERSION_INFO = record
DspVersion: ULong; //DSP版本號
DspBuildNum: ULong; //創建號
DriverVersion: ULong; //驅動版本號
DriverBuildNum: ULong; //驅動創建號
SDKVersion: ULong; //SDK版本號
SDKBuildNum: ULong; //SDK創建號
end;
TBoard_Info = record
boardType: PChar; //型號
boardSN: string[12]; //序列號
BoardCount: Byte; //系統中板卡的個數。包括 HC、MD卡
TotalChannels: Byte; //編碼通道總數
DspCount: Byte; //系統中DSP個數
DSPs: Byte; //視頻處理器數
EncodeChannelCount: Byte; //編碼通道個數
DecodeChannelCount: Byte; //解碼通道個數
DisplayChannelCount: Byte; //顯示通道(視頻輸出)個數
SDKVersion: PVERSION_INFO; //當前使用的 SDK 版本信息
end;
TSdkState = record
Board_IsLoad: Boolean; //是否加載采集卡
Server_IsLoad: Boolean; //是否加載服務
Video_IsSCROUT: Boolean; //是否啟動屏幕輸出
Video_IsPreview: Boolean; //是否啟動預覽
Video_IsWar: Boolean; //是否啟動視頻丟失報警
Video_IsOSD: Boolean; //是否顯示OSD
Video_IsLOGO: Boolean; //是否顯示LOGO
Video_IsCapture: Boolean; //是否啟動錄像
Video_IsMask: Boolean; //是否啟動屏幕遮擋
Video_IsMotion: Boolean; //是否啟動移動偵測
Audio_IsPreview: Boolean; //是否聲音監聽
Audio_IsWar: Boolean; //是否啟動音頻丟失報警
end;
const
HikRunSDK = 'HikServer32.dll'; //SDK-2鏈接庫文件名,請保存與文件實名同步修改
var
CallBackFunc : TCallBackFunc;
Board_Info : TBoard_Info;
FRAMES_STATISTIC : PFRAMES_STATISTICS;
//獲取錯誤信息(錯誤值)
function Get_SDK_Err(Err_Code: Integer): PChar; stdcall; external HikRunSDK;
//回調函數接口
procedure Set_CallBack_Func(Func: TCallBackFunc); stdcall; stdcall; external HikRunSDK;
//創建線程(線程類型:4-20系統預定義類型,>20為用戶自定義類型,線程周期:分鐘)
procedure Start_Process(ThreadStyle: Byte; NumCycles: Word; Channels_Index: Byte = 1); stdcall; external HikRunSDK;
//板卡初始化(通道被除數,如8通道板卡,DSP_Div=2實際有效的只有1357四個通道,默認全部通道有效)
function Load_Board(DSP_Div: Byte = 1): Integer; stdcall; external HikRunSDK;
//卸載板卡
function UnLoad_Board(): Integer; stdcall; external HikRunSDK;
//獲取板卡序列號等信息(通道號-決定板卡序列號的不同)
function Get_Board_Info(Channel_Index: Byte = 1): TBoard_Info; stdcall; external HikRunSDK;
//初始化網絡服務(通道數據類型:寬帶NORMAL,窄帶DIALING<不支持聲音>,窄帶/寬帶SMALLPIC<支持聲音>,服務端的網絡端口號和客戶端的網絡端口號)
function Load_Net_Server(Data_Type: TConnectType = NORMAL; Port_Server: Integer = 5050; Port_Client: Integer = 6050): Integer; stdcall; external HikRunSDK;
//停止網絡服務
function UnLoad_Net_Server(): Boolean; stdcall; external HikRunSDK;
//啟動預覽(通道號,預覽句柄,預覽區域,是否設置預覽用 Overlay 方式(MD卡兼容))
function Start_Video_Preview(Channels_Index: Byte; Preview_Handle: THandle; Preview_Rect: TRect; IsOverlayMode: Boolean = False): Integer; stdcall; external HikRunSDK;
//停止預覽(通道號)
function Stop_Video_Preview(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//啟動錄像(通道號,保存錄像文件名,自動停止錄像時間:優先權低,自動錄像大小:優先權高)
function Start_Video_Capture(Channels_Index: Byte; Filename: WideString = ''; StopMinute: Word = 0; AutoSize: Word = 0): Integer; stdcall; external HikRunSDK;
//停止錄像(通道號)
function Stop_Video_Capture(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//啟動聲音監聽(通道號)
function Start_Audio_Preview(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//停止聲音監聽(通道號,是否停止所有通道聲音)
function Stop_Audio_Preview(Channels_Index: Byte; Is_StopAll: Boolean = False): Integer; stdcall; external HikRunSDK;
//視頻截圖(通道號,保存截圖文件名,是否JPEG格式,JPEG 圖片質量:1 到 100,1 最差,100 最好)
function Start_Image_Capture(Channels_Index: Byte; Filename: string = ''; IsJpeg: Boolean = False; JpegQuality: Byte = 100): Integer; stdcall; external HikRunSDK;
//顯示OSD(通道號,第一行座標,內容,第二行座標,內容,是否自動進行顏色翻轉,OSD顯示亮度:255 最亮0 最暗,是否顯示時間)
function Start_Video_OSD(Channels_Index: Byte; F_x, F_y: Integer; F_Text: PChar; T_x, T_y: Integer; T_Text: PChar; IsColorReversal: Boolean = True; Brightness: Byte = 255; IsDataTime: Boolean = False): Integer; stdcall; external HikRunSDK;
//隱藏OSD(通道號)
function Stop_Video_OSD(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//顯示LOGO(通道號,座標X,座標Y,LOGO圖片文件,是否半透明處理,透明色值(紅綠藍))
function Start_Video_Logo(Channels_Index: Byte; Logo_x, Logo_y: Integer; Filename: string; IsTranslucent: Boolean = False; Color_R: Byte = 255; Color_G: Byte = 255; Color_B: Byte = 255): Integer; stdcall; external HikRunSDK;
//隱藏LOGO(通道號)
function Stop_Video_Logo(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//獲取視頻參數(通道號,亮度,對比度,飽和度,色度)
function Get_Video_Para(Channels_Index: Byte; var P_Ld, P_Dbd, P_Bhd, P_Sd: Byte): Integer; stdcall; external HikRunSDK;
//設置視頻參數(通道號,亮度,對比度,飽和度,色度)
function Set_Video_Para(Channels_Index: Byte; P_Ld, P_Dbd, P_Bhd, P_Sd: Byte): Integer; stdcall; external HikRunSDK;
//快速黑白、彩色圖像切換(通道號,是否黑白)
function Set_Video_NoColor(Channels_Index: Byte; IsNoColor: Boolean = True): Integer; stdcall; external HikRunSDK;
//復位視頻圖像參數(通道號)
function Reset_Video_Para(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//黑屏 (通道號)
function Set_Screen_Black(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//白屏 (通道號)
function Set_Screen_White(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//改變屏幕分辨率 (XY值,刷新率:默認60HZ)
function Set_Screen_Para(X, Y: Word; Frequency: Byte = 60): Boolean; stdcall; external HikRunSDK;
//調用全屏窗口(通道號,是否自動巡回顯示各通道監控畫面,默認不自動切換,值=0)
function Start_Video_FullScreen(Channels_Index: Byte; AutoCircuit: Byte = 0): Integer; stdcall; external HikRunSDK;
//設置編碼分辨率格式(通道號,編碼圖象大小:4CIF、2CIF、DCIF、CIF 、QCIF)
{設置主通道的編碼格式,編碼分辨率可以在錄像的時候動態更改,而不必停止錄像;}
function Set_EncoderPicture_Format(Channels_Index: Byte; PictureFormat: PictureFormat_t): Integer; stdcall; external HikRunSDK;
//獲取幀統計信息(通道號,幀統計信息)
function Get_Frames_Statistics(Channels_Index: Byte; var frame_Statistic: PFRAMES_STATISTICS): Integer; stdcall; external HikRunSDK;
//當系統按下 CTRL+ALT+DEL 時系統的 OVERLAY 表面會被強制關閉,調用該函數時可以恢復 OVERLAY表面
function Restore_Overlay(): Integer; stdcall; external HikRunSDK;
//設置看門狗(通道號,是否打開狗):可以實現對上層軟件和系統中所有壓縮板卡的運行狀態監控
function Set_WatchDog(Channels_Index: Byte; IsWatch: Boolean = False): Integer; stdcall; external HikRunSDK;
//設置屏幕遮擋(通道號,左,上,右,下)
function Start_Video_Mask(Channels_Index: Byte; T_Left, T_Top, T_Right, T_Bottom: Integer): Integer; stdcall; external HikRunSDK;
//停止屏幕遮擋(通道號)
function Stop_Video_Mask(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//設置移動偵測(通道號,左,上,右,下,移動偵測靈敏度默認值為2,是否錄像,警前幀數,錄像文件名)
function Start_Motion_Detection(Channels_Index: Byte; T_Left: Integer = 0; T_Top: Integer = 0; T_Right: Integer = 703; T_Bottom: Integer = 575; DetectPrec: Byte = 2; IsAlarmFile: Boolean = False; framesBeforeAlarm: ULong = 100; AlarmFilename: string = 'AlarmFile'): Integer; stdcall; external HikRunSDK;
//停止移動偵測(通道號)
function Stop_Motion_Detection(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//啟動音頻丟失報警:多線程方式
function Start_Audio_Warnning(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//停止音頻丟失報警 (通道號)
function Stop_Audio_Warnning(Channels_Index: Byte = 0): Integer; stdcall; external HikRunSDK;
//啟動視頻丟失報警:多線程方式
function Start_Video_Warnning(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//停止視頻丟失報警 (通道號)
function Stop_Video_Warnning(Channels_Index: Byte = 0): Integer; stdcall; external HikRunSDK;
//計算音頻丟失報警:單次調用
function Check_Audio_Warnning: Byte; stdcall; external HikRunSDK;
//計算視頻丟失報警:單次調用
function Check_Video_Warnning: Byte; stdcall; external HikRunSDK;
//監視視頻錄像文件大小:單次調用
function Check_Video_Size: Byte; stdcall; external HikRunSDK;
//獲取音視頻報警狀態(通道號,返回方式:音頻或視頻)
function Get_AV_State(Channel_Index: Byte = 1; IsAudio: Boolean = True): Boolean; stdcall; external HikRunSDK;
//獲取報警線程運行狀態:為真表示線程正在運行
function Get_Warnning_State: Boolean; stdcall; external HikRunSDK;
//檢測報警線程狀態(為真是表明線程并未終止)
function Check_Warnning_State: Boolean; stdcall; external HikRunSDK;
//開始屏幕輸出(輸出內容,輸出左上角座標位置,是否透明輸出,輸出字體顏色RGB,是否輸出時間)
function Start_Screen_Draw(Channels_Index: Byte; I_Text: string; I_Left: Integer = 0; I_Top: Integer = 0; I_IsTransparence: Boolean = True; I_R: Byte = 255; I_G: Byte = 255; I_B: Byte = 255; I_IsDateTime: Boolean = False): Integer; stdcall; external HikRunSDK;
//停止屏幕輸出(通道號)
function Stop_Screen_Draw(Channels_Index: Byte): Integer; stdcall; external HikRunSDK;
//獲取指定通道工作狀態(通道號)
function Get_SDK_State(Channel_Index: Byte): TSdkState; stdcall; external HikRunSDK;
//是否加載采集卡
function Get_Board_State: Boolean; stdcall; external HikRunSDK;
//是否加載服務
function Get_Server_State: Boolean; stdcall; external HikRunSDK;
//獲取Master音量
function Get_Volume_Master(): Word; stdcall; external HikRunSDK;
//設置Master音量
procedure Set_Volume_Master(Value: Word); stdcall; external HikRunSDK;
//獲取WaveOut音量
function Get_Volume_WaveOut(): Word; stdcall; external HikRunSDK;
//設置WaveOut音量
procedure Set_Volume_WaveOut(Value: Word); stdcall; external HikRunSDK;
//獲取Synth音量
function Get_Volume_Synth(): Word; stdcall; external HikRunSDK;
//設置Synth音量
procedure Set_Volume_Synth(Value: Word); stdcall; external HikRunSDK;
//靜音自動切換
procedure Set_Volume_Mute; stdcall; external HikRunSDK;
//系統校時
procedure Set_Winclock(Datetime: TDateTime); stdcall; external HikRunSDK;
//獲取本SDK版本信息
function Get_SDK_Version(): PChar; stdcall; external HikRunSDK;
//獲取機器碼
function Get_UserID: PChar; stdcall; external HikRunSDK;
//獲取注冊狀態
function Get_SDK_Reg: Boolean; stdcall; external HikRunSDK;
//發送郵件(郵件服務器域名,用戶名,密碼,發送信箱,目的信息,主題,信件正文內容:字符串):布爾
function Send_Mail(TSmtp, TUser, TPass, TGetMail, TTOMail, TSubject, TMailText: string): Boolean; stdcall; external HikRunSDK;
//本地IP
function Get_LocalIP: PChar; stdcall; external HikRunSDK;
implementation
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -