WHPlaySDK.~pas
上传用户:mjqmds
上传日期:2022-05-05
资源大小:2827k
文件大小:14k
- unit WHPlaySDK;
- interface
- uses windows, Messages, Classes, SysUtils, Forms;
- Const
- WM_GRAPHNOTIFY=WM_USER+20;
- IDC_EMBOSS= 1002;
- IDC_GREY= 1003;
- IDC_BLUR= 1004;
- IDC_POSTERIZE= 1005;
- IDC_XOR= 1006;
- IDC_DARKEN= 1007;
- IDC_BLUE= 1008;
- IDC_GREEN= 1009;
- IDC_RED= 1010;
- IDC_NONE= 1011;
- ProcAmpControl9_Brightness = $00000001;
- ProcAmpControl9_Contrast = $00000002;
- ProcAmpControl9_Hue = $00000004;
- ProcAmpControl9_Saturation = $00000008;
- EC_WMT_EVENT_BASE =$0251;
- EC_SYSTEMBASE =$00;
- EC_USER =$8000;
- EC_COMPLETE =$01;
- EC_USERABORT =$02;
- EC_ERRORABORT =$03;
- EC_TIME =$04;
- EC_REPAINT =$05;
- EC_STREAM_ERROR_STOPPED =$06;
- EC_STREAM_ERROR_STILLPLAYING =$07;
- EC_ERROR_STILLPLAYING =$08;
- EC_PALETTE_CHANGED =$09;
- EC_VIDEO_SIZE_CHANGED =$0A;
- EC_QUALITY_CHANGE =$0B;
- EC_SHUTTING_DOWN =$0C;
- EC_CLOCK_CHANGED =$0D;
- EC_PAUSED =$0E;
- EC_OPENING_FILE =$10;
- EC_BUFFERING_DATA =$11;
- EC_FULLSCREEN_LOST =$12;
- EC_ACTIVATE =$13;
- EC_NEED_RESTART =$14;
- EC_WINDOW_DESTROYED =$15;
- EC_DISPLAY_CHANGED =$16;
- EC_STARVATION =$17;
- EC_OLE_EVENT =$18;
- EC_NOTIFY_WINDOW =$19;
- EC_STREAM_CONTROL_STOPPED =$1A;
- EC_STREAM_CONTROL_STARTED =$1B;
- EC_END_OF_SEGMENT =$1C;
- EC_SEGMENT_STARTED =$1D;
- EC_LENGTH_CHANGED =$1E;
- EC_DEVICE_LOST =$1f;
- EC_STEP_COMPLETE =$24;
- EC_TIMECODE_AVAILABLE =$30;
- EC_EXTDEVICE_MODE_CHANGE =$31;
- EC_STATE_CHANGE =$32;
- EC_GRAPH_CHANGED =$50;
- EC_CLOCK_UNSET =$51;
- EC_VMR_RENDERDEVICE_SET =$53;
- VMR_RENDER_DEVICE_OVERLAY =$01;
- VMR_RENDER_DEVICE_VIDMEM =$02;
- VMR_RENDER_DEVICE_SYSMEM =$04;
- EC_VMR_SURFACE_FLIPPED =$54;
- EC_VMR_RECONNECTION_FAILED =$55;
- EC_PREPROCESS_COMPLETE =$56;
- EC_CODECAPI_EVENT =$57;
- EC_WMT_INDEX_EVENT =EC_WMT_EVENT_BASE;
- EC_WMT_EVENT =EC_WMT_EVENT_BASE+1;
- EC_BUILT =$300;
- EC_UNBUILT =$301;
- Type
- PVMR9ProcAmpControl=^TVMR9ProcAmpControl;
- TVMR9ProcAmpControl=record
- dwSize:DWORD;
- dwFlags:DWORD;
- Brightness:Single;
- Contrast:Single;
- Hue:Single;
- Saturation:Single;
- end;
- PVMR9NormalizedRect=^TVMR9NormalizedRect;
- TVMR9NormalizedRect=record
- left:Single;
- top:Single;
- right:Single;
- bottom:Single;
- end;
- PMediaInfo=^TMediaInfo;
- TMediaInfo=record
- PlayMinites:Integer;
- PlaySeconds:Integer;
- PlayHours:Integer;
- end;
- TOnNotifyEvent=procedure (event:LongInt; Param:Pointer; var IsContinue:Boolean);stdcall;
- TdllOpenUnLockFile=function (FileName:PChar):Integer;stdcall;
- TdllOpenLockFile=function (FileName,Password:PChar):Integer;stdcall;
- TdllCaptureToBmp=function (FileName:PChar):Integer;stdcall;
- TdllPause=function ():Integer;stdcall;
- TdllPlay=function ():Integer;stdcall;
- TdllStop=function ():Integer;stdcall;
- TdllSetPosition=function (nPos:UINT):Integer;stdcall;
- TdllGetPostion=function():Integer;stdcall;
- TdllFullscreen=function ():Integer;stdcall;
- TdllRestoreFromFullScreen=function ():Integer;stdcall;
- //TdllFindFilterByInterface=function (riid:REFIID, var ppFilter:^IBaseFilter):HRESULT;stdcall;
- TdllShowVRPropertyPage=function ():Integer;stdcall;
- TdllRegisterVideoHandle=function (vHandle:HWND):Integer;stdcall;
- TdllRegisterMsgHandle=function (vHandle:HWND):Integer;stdcall;
- TdllRegisterLockFilterGUID=function (g:TGUID):Integer;stdcall;
- TdllCreateLockGraph=function (Password:PChar):Integer;stdcall;
- TdllCreateUnLockGraph=function ():Integer;stdcall;
- TdllDestroyGraph=function ():Integer;stdcall;
- TdllDefaultOnGraphNotify=function (inWParam:WPARAM; inLParam:LPARAM; Param:Pointer; OnNotifyEvent:TOnNotifyEvent):LRESULT;stdcall;
- TdllGetSize=function():Integer;stdcall;
- TdllSwitchStepFrame=function :Boolean;stdcall;
- TdllStepFrames=function(nFramesToStep:Integer):HRESULT;stdcall;
- TdllStepOneFrame=function:HRESULT;stdcall;
- TdllModifyRate=function(dRateAdjust:double):HRESULT;stdcall;
- TdllSetRate=function(dRate:double):HRESULT;stdcall;
- TdllToggleMute=function:HRESULT;stdcall;
- TdllMuteAudio=function:HRESULT;stdcall;
- TdllResumeAudio=function:HRESULT;stdcall;
- TdllVolume=function(lVolume:longInt):HRESULT;stdcall;
- TdllGetVolume=function:longint;stdcall;
- TdllGetNoInitVolume=function:longint;stdcall;
- TdllQuit=function ():Integer;stdcall;
- TdllResetDisplay=function (VideoHandle:HWND):Integer;stdcall;
- TdllConfig=function (Command:PChar; var Param1,Param2:LongInt):Integer;stdcall;
- TdllAddLockGraph=function (SourceFile:PChar):Integer;stdcall;
- TdllAddUnLockGraph=function (SourceFile:PChar):Integer;stdcall;
- TdllSetAlpha=function (streamID:DWORD;alpha:Single):Integer;stdcall;
- TdllGetAlpha=function (streamID:DWORD;var alpha:Single):Integer;stdcall;
- TdllSetAmpControl=function (streamID:DWORD; amp:PVMR9ProcAmpControl):Integer;stdcall;
- TdllGetAmpControl=function (streamID:DWORD; amp:PVMR9ProcAmpControl):Integer;stdcall;
- TdllSetVideoRect=function (streamID:WORD; Rec:PVMR9NormalizedRect):Integer;stdcall;
- TdllGetLockMediaInfo=function (FileName:PChar;Info:PMediaInfo):Integer;stdcall;
- TdllGetNoLockMediaInfo=function (FileName:PChar;Info:PMediaInfo):Integer;stdcall;
- TdllReadMediaPosition=function (var nSeconds,nMinutes:Integer):Integer;stdcall;
- TdllGetEvent=function (var eventCode:LongInt):Boolean;stdcall;
- TdllDisplayRatio=function (mode:Integer):Integer;stdcall;
- TdllRepaint=function (hwnd:HWND; hdc:HDC):HRESULT;stdcall;
- TdllDefaultProcessMsg=function (hwd:HWND; Msg:LongInt; wParam:WPARAM; lParam:LPARAM):LongInt;stdcall;
- TdllGetVideoRect=function (pRec:PRect):Boolean;stdcall;
- TdllEndPreview=procedure ();stdcall;
- TdllBeginPreview=procedure (PreviewHandle:HWND; PreviewCount:Integer);stdcall;
- TdllSetPreviewMedia=procedure (FileName:PChar; m_nLayer:Integer);stdcall;
- TdllSetPreviewMediaRect=procedure (m_nLayer:Integer; var rec:TRect);stdcall;
- TdllPreviewPlay=procedure ();stdcall;
- TdllPreviewGetSM=procedure (var nSeconds,nMinutes:Integer);stdcall;
- TdllPreviewGetPosition=function():Integer;stdcall;
- TdllPreviewSetPosition=procedure (Pos:Integer);stdcall;
- TdllPreviewSetAudio=procedure (nLayer,volume:Integer);stdcall;
- TdllPreviewPause=procedure ();stdcall;
- Var
- dllOpenUnLockFile:TdllOpenUnLockFile;
- dllOpenLockFile:TdllOpenLockFile;
- dllCaptureToBmp:TdllCaptureToBmp;
- dllPause:TdllPause;
- dllPlay:TdllPlay;
- dllStop:TdllStop;
- dllSetPosition:TdllSetPosition;
- dllGetPostion:TdllGetPostion;
- dllFullscreen:TdllFullscreen;
- dllRestoreFromFullScreen:TdllRestoreFromFullScreen;
- // dllFindFilterByInterface:TdllFindFilterByInterface;
- dllShowVRPropertyPage:TdllShowVRPropertyPage;
- dllRegisterVideoHandle:TdllRegisterVideoHandle;
- dllRegisterMsgHandle:TdllRegisterMsgHandle;
- dllRegisterLockFilterGUID:TdllRegisterLockFilterGUID;
- dllCreateLockGraph:TdllCreateLockGraph;
- dllCreateUnLockGraph:TdllCreateUnLockGraph;
- dllDestroyGraph:TdllDestroyGraph;
- dllDefaultOnGraphNotify:TdllDefaultOnGraphNotify;
- dllGetSize:TdllGetSize;
- dllSwitchStepFrame:TdllSwitchStepFrame;
- dllStepFrames:TdllStepFrames;
- dllStepOneFrame:TdllStepOneFrame;
- dllModifyRate:TdllModifyRate;
- dllSetRate:TdllSetRate;
- dllToggleMute:TdllToggleMute;
- dllMuteAudio:TdllMuteAudio;
- dllResumeAudio:TdllResumeAudio;
- dllVolume:TdllVolume;
- dllGetVolume:TdllGetVolume;
- dllGetNoInitVolume:TdllGetNoInitVolume;
- dllQuit:TdllQuit;
- dllResetDisplay:TdllResetDisplay;
- dllConfig:TdllConfig;
- dllAddLockGraph:TdllAddLockGraph;
- dllSetAlpha:TdllSetAlpha;
- dllAddUnLockGraph:TdllAddUnLockGraph;
- dllSetAmpControl:TdllSetAmpControl;
- dllGetAmpControl:TdllGetAmpControl;
- dllSetVideoRect:TdllSetVideoRect;
- dllGetAlpha:TdllGetAlpha;
- dllGetLockMediaInfo:TdllGetLockMediaInfo;
- dllGetNoLockMediaInfo:TdllGetNoLockMediaInfo;
- dllReadMediaPosition:TdllReadMediaPosition;
- dllGetEvent:TdllGetEvent;
- dllDisplayRatio:TdllDisplayRatio;
- dllRepaint:TdllRepaint;
- dllDefaultProcessMsg:TdllDefaultProcessMsg;
- dllGetVideoRect:TdllGetVideoRect;
- dllEndPreview:TdllEndPreview;
- dllBeginPreview:TdllBeginPreview;
- dllSetPreviewMedia:TdllSetPreviewMedia;
- dllSetPreviewMediaRect:TdllSetPreviewMediaRect;
- dllPreviewPlay:TdllPreviewPlay;
- dllPreviewGetSM:TdllPreviewGetSM;
- dllPreviewGetPosition:TdllPreviewGetPosition;
- dllPreviewSetPosition:TdllPreviewSetPosition;
- dllPreviewSetAudio:TdllPreviewSetAudio;
- dllPreviewPause:TdllPreviewPause;
- function IsLockFile(FileName:String):Boolean;
- implementation
- Var
- Lib:THandle;
- function IsLockFile(FileName:String):Boolean;
- Var
- Ext:String;
- begin
- Result:=false;
- Ext:=UpperCase(ExtractFileExt(FileName));
- if Ext='.WHL' then
- begin
- Result:=true;
- end;
- end;
- Initialization
- Lib:=LoadLibrary(PChar(ExtractFilePath(Application.ExeName)+'WH_PLAYERSDK.dll'));
- dllOpenUnLockFile:=GetProcAddress(Lib,'dllOpenUnLockFile');
- dllOpenLockFile:=GetProcAddress(Lib,'dllOpenLockFile');
- dllCaptureToBmp:=GetProcAddress(Lib,'dllCaptureToBmp');
- dllPause:=GetProcAddress(Lib,'dllPause');
- dllPlay:=GetProcAddress(Lib,'dllPlay');
- dllStop:=GetProcAddress(Lib,'dllStop');
- dllSetPosition:=GetProcAddress(Lib,'dllSetPosition');
- dllGetPostion:=GetProcAddress(Lib,'dllGetPostion');
- dllFullscreen:=GetProcAddress(Lib,'dllFullscreen');
- dllRestoreFromFullScreen:=GetProcAddress(Lib,'dllRestoreFromFullScreen');
- // dllFindFilterByInterface:=GetProcAddress(Lib,'dllFindFilterByInterface');
- dllShowVRPropertyPage:=GetProcAddress(Lib,'dllShowVRPropertyPage');
- dllRegisterVideoHandle:=GetProcAddress(Lib,'dllRegisterVideoHandle');
- dllRegisterMsgHandle:=GetProcAddress(Lib,'dllRegisterMsgHandle');
- dllRegisterLockFilterGUID:=GetProcAddress(Lib,'dllRegisterLockFilterGUID');
- dllCreateLockGraph:=GetProcAddress(Lib,'dllCreateLockGraph');
- dllCreateUnLockGraph:=GetProcAddress(Lib,'dllCreateUnLockGraph');
- dllDestroyGraph:=GetProcAddress(Lib,'dllDestroyGraph');
- dllDefaultOnGraphNotify:=GetProcAddress(Lib,'dllDefaultOnGraphNotify');
- dllGetSize:=GetProcAddress(Lib,'dllGetSize');
- dllSwitchStepFrame:=GetProcAddress(Lib,'dllSwitchStepFrame');
- dllStepFrames:=GetProcAddress(Lib,'dllStepFrames');
- dllStepOneFrame:=GetProcAddress(Lib,'dllStepOneFrame');
- dllModifyRate:=GetProcAddress(Lib,'dllModifyRate');
- dllSetRate:=GetProcAddress(Lib,'dllSetRate');
- dllToggleMute:=GetProcAddress(Lib,'dllToggleMute');
- dllMuteAudio:=GetProcAddress(Lib,'dllMuteAudio');
- dllResumeAudio:=GetProcAddress(Lib,'dllResumeAudio');
- dllVolume:=GetProcAddress(Lib,'dllVolume');
- dllGetVolume:=GetProcAddress(Lib,'dllGetVolume');
- dllGetNoInitVolume:=GetProcAddress(Lib,'dllGetNoInitVolume');
- dllQuit:=GetProcAddress(Lib,'dllQuit');
- dllResetDisplay:=GetProcAddress(Lib,'dllResetDisplay');
- dllConfig:=GetProcAddress(Lib,'dllConfig');
- dllAddLockGraph:=GetProcAddress(Lib,'dllAddLockGraph');
- dllSetAlpha:=GetProcAddress(Lib,'dllSetAlpha');
- dllAddUnLockGraph:=GetProcAddress(Lib,'dllAddUnLockGraph');
- dllSetAmpControl:=GetProcAddress(Lib,'dllSetAmpControl');
- dllGetAmpControl:=GetProcAddress(Lib,'dllGetAmpControl');
- dllSetVideoRect:=GetProcAddress(Lib,'dllSetVideoRect');
- dllGetAlpha:=GetProcAddress(Lib,'dllGetAlpha');
- dllGetNoLockMediaInfo:=GetProcAddress(Lib,'dllGetNoLockMediaInfo');
- dllGetLockMediaInfo:=GetProcAddress(Lib,'dllGetLockMediaInfo');
- dllReadMediaPosition:=GetProcAddress(Lib,'dllReadMediaPosition');
- dllGetEvent:=GetProcAddress(Lib,'dllGetEvent');
- dllDisplayRatio:=GetProcAddress(Lib,'dllDisplayRatio');
- dllRepaint:=GetProcAddress(Lib,'dllRepaint');
- dllDefaultProcessMsg:=GetProcAddress(Lib,'dllDefaultProcessMsg');
- dllGetVideoRect:=GetProcAddress(Lib,'dllGetVideoRect');
- dllEndPreview:=GetProcAddress(Lib,'dllEndPreview');
- dllBeginPreview:=GetProcAddress(Lib,'dllBeginPreview');
- dllSetPreviewMedia:=GetProcAddress(Lib,'dllSetPreviewMedia');
- dllSetPreviewMediaRect:=GetProcAddress(Lib,'dllSetPreviewMediaRect');
- dllPreviewPlay:=GetProcAddress(Lib,'dllPreviewPlay');
- dllPreviewGetSM:=GetProcAddress(Lib,'dllPreviewGetSM');
- dllPreviewGetPosition:=GetProcAddress(Lib,'dllPreviewGetPosition');
- dllPreviewSetPosition:=GetProcAddress(Lib,'dllPreviewSetPosition');
- dllPreviewSetAudio:=GetProcAddress(Lib,'dllPreviewSetAudio');
- dllPreviewPause:=GetProcAddress(Lib,'dllPreviewPause');
- Finalization
- FreeLibrary(Lib);
- end.