WHPlaySDK.~pas
上传用户:mjqmds
上传日期:2022-05-05
资源大小:2827k
文件大小:14k
源码类别:

DirextX编程

开发平台:

Delphi

  1. unit WHPlaySDK;
  2. interface
  3. uses windows, Messages, Classes, SysUtils, Forms;
  4. Const
  5.     WM_GRAPHNOTIFY=WM_USER+20;
  6.     IDC_EMBOSS=                      1002;
  7.     IDC_GREY=                        1003;
  8.     IDC_BLUR=                        1004;
  9.     IDC_POSTERIZE=                   1005;
  10.     IDC_XOR=                         1006;
  11.     IDC_DARKEN=                      1007;
  12.     IDC_BLUE=                        1008;
  13.     IDC_GREEN=                       1009;
  14.     IDC_RED=                         1010;
  15.     IDC_NONE=                        1011;
  16.     ProcAmpControl9_Brightness = $00000001;
  17.     ProcAmpControl9_Contrast   = $00000002;
  18.     ProcAmpControl9_Hue        = $00000004;
  19.     ProcAmpControl9_Saturation = $00000008;
  20.     EC_WMT_EVENT_BASE                   =$0251;
  21.     EC_SYSTEMBASE                       =$00;
  22.     EC_USER                             =$8000;
  23.     EC_COMPLETE                         =$01;
  24.     EC_USERABORT                        =$02;
  25.     EC_ERRORABORT                       =$03;
  26.     EC_TIME                             =$04;
  27.     EC_REPAINT                          =$05;
  28.     EC_STREAM_ERROR_STOPPED             =$06;
  29.     EC_STREAM_ERROR_STILLPLAYING        =$07;
  30.     EC_ERROR_STILLPLAYING               =$08;
  31.     EC_PALETTE_CHANGED                  =$09;
  32.     EC_VIDEO_SIZE_CHANGED               =$0A;
  33.     EC_QUALITY_CHANGE                   =$0B;
  34.     EC_SHUTTING_DOWN                    =$0C;
  35.     EC_CLOCK_CHANGED                    =$0D;
  36.     EC_PAUSED                           =$0E;
  37.     EC_OPENING_FILE                     =$10;
  38.     EC_BUFFERING_DATA                   =$11;
  39.     EC_FULLSCREEN_LOST                  =$12;
  40.     EC_ACTIVATE                         =$13;
  41.     EC_NEED_RESTART                     =$14;
  42.     EC_WINDOW_DESTROYED                 =$15;
  43.     EC_DISPLAY_CHANGED                  =$16;
  44.     EC_STARVATION                       =$17;
  45.     EC_OLE_EVENT                        =$18;
  46.     EC_NOTIFY_WINDOW                    =$19;
  47.     EC_STREAM_CONTROL_STOPPED           =$1A;
  48.     EC_STREAM_CONTROL_STARTED           =$1B;
  49.     EC_END_OF_SEGMENT                   =$1C;
  50.     EC_SEGMENT_STARTED                  =$1D;
  51.     EC_LENGTH_CHANGED                   =$1E;
  52.     EC_DEVICE_LOST                      =$1f;
  53.     EC_STEP_COMPLETE                    =$24;
  54.     EC_TIMECODE_AVAILABLE           =$30;
  55.     EC_EXTDEVICE_MODE_CHANGE        =$31;
  56.     EC_STATE_CHANGE                 =$32;
  57.     EC_GRAPH_CHANGED                =$50;
  58.     EC_CLOCK_UNSET                  =$51;
  59.     EC_VMR_RENDERDEVICE_SET         =$53;
  60.     VMR_RENDER_DEVICE_OVERLAY       =$01;
  61.     VMR_RENDER_DEVICE_VIDMEM        =$02;
  62.     VMR_RENDER_DEVICE_SYSMEM        =$04;
  63.     EC_VMR_SURFACE_FLIPPED          =$54;
  64.     EC_VMR_RECONNECTION_FAILED      =$55;
  65.     EC_PREPROCESS_COMPLETE          =$56;
  66.     EC_CODECAPI_EVENT               =$57;
  67.     EC_WMT_INDEX_EVENT              =EC_WMT_EVENT_BASE;
  68.     EC_WMT_EVENT                    =EC_WMT_EVENT_BASE+1;
  69.     EC_BUILT                        =$300;
  70.     EC_UNBUILT                      =$301;
  71. Type
  72.     PVMR9ProcAmpControl=^TVMR9ProcAmpControl;
  73.     TVMR9ProcAmpControl=record
  74.         dwSize:DWORD;
  75.         dwFlags:DWORD;
  76.         Brightness:Single;
  77.         Contrast:Single;
  78.         Hue:Single;
  79.         Saturation:Single;
  80.     end;
  81.     PVMR9NormalizedRect=^TVMR9NormalizedRect;
  82.     TVMR9NormalizedRect=record
  83.         left:Single;
  84.         top:Single;
  85.         right:Single;
  86.         bottom:Single;
  87.     end;
  88.     PMediaInfo=^TMediaInfo;
  89.     TMediaInfo=record
  90.         PlayMinites:Integer;
  91.         PlaySeconds:Integer;
  92.         PlayHours:Integer;
  93.     end;
  94.     TOnNotifyEvent=procedure (event:LongInt; Param:Pointer; var IsContinue:Boolean);stdcall;
  95.     TdllOpenUnLockFile=function (FileName:PChar):Integer;stdcall;
  96.     TdllOpenLockFile=function (FileName,Password:PChar):Integer;stdcall;
  97.     TdllCaptureToBmp=function (FileName:PChar):Integer;stdcall;
  98.     TdllPause=function ():Integer;stdcall;
  99.     TdllPlay=function ():Integer;stdcall;
  100.     TdllStop=function ():Integer;stdcall;
  101.     TdllSetPosition=function (nPos:UINT):Integer;stdcall;
  102.     TdllGetPostion=function():Integer;stdcall;
  103.     TdllFullscreen=function ():Integer;stdcall;
  104.     TdllRestoreFromFullScreen=function ():Integer;stdcall;
  105.     //TdllFindFilterByInterface=function (riid:REFIID, var ppFilter:^IBaseFilter):HRESULT;stdcall;
  106.     TdllShowVRPropertyPage=function ():Integer;stdcall;
  107.     TdllRegisterVideoHandle=function (vHandle:HWND):Integer;stdcall;
  108.     TdllRegisterMsgHandle=function (vHandle:HWND):Integer;stdcall;
  109.     TdllRegisterLockFilterGUID=function (g:TGUID):Integer;stdcall;
  110.     TdllCreateLockGraph=function (Password:PChar):Integer;stdcall;
  111.     TdllCreateUnLockGraph=function ():Integer;stdcall;
  112.     TdllDestroyGraph=function ():Integer;stdcall;
  113.     TdllDefaultOnGraphNotify=function (inWParam:WPARAM; inLParam:LPARAM; Param:Pointer; OnNotifyEvent:TOnNotifyEvent):LRESULT;stdcall;
  114.     TdllGetSize=function():Integer;stdcall;
  115.     TdllSwitchStepFrame=function :Boolean;stdcall;
  116.     TdllStepFrames=function(nFramesToStep:Integer):HRESULT;stdcall;
  117.     TdllStepOneFrame=function:HRESULT;stdcall;
  118.     TdllModifyRate=function(dRateAdjust:double):HRESULT;stdcall;
  119.     TdllSetRate=function(dRate:double):HRESULT;stdcall;
  120.     TdllToggleMute=function:HRESULT;stdcall;
  121.     TdllMuteAudio=function:HRESULT;stdcall;
  122.     TdllResumeAudio=function:HRESULT;stdcall;
  123.     TdllVolume=function(lVolume:longInt):HRESULT;stdcall;
  124.     TdllGetVolume=function:longint;stdcall;
  125.     TdllGetNoInitVolume=function:longint;stdcall;
  126.     TdllQuit=function ():Integer;stdcall;
  127.     TdllResetDisplay=function (VideoHandle:HWND):Integer;stdcall;
  128.     TdllConfig=function (Command:PChar; var Param1,Param2:LongInt):Integer;stdcall;
  129.     TdllAddLockGraph=function (SourceFile:PChar):Integer;stdcall;
  130.     TdllAddUnLockGraph=function (SourceFile:PChar):Integer;stdcall;
  131.     TdllSetAlpha=function (streamID:DWORD;alpha:Single):Integer;stdcall;
  132.     TdllGetAlpha=function (streamID:DWORD;var alpha:Single):Integer;stdcall;
  133.     TdllSetAmpControl=function (streamID:DWORD; amp:PVMR9ProcAmpControl):Integer;stdcall;
  134.     TdllGetAmpControl=function (streamID:DWORD; amp:PVMR9ProcAmpControl):Integer;stdcall;
  135.     TdllSetVideoRect=function (streamID:WORD; Rec:PVMR9NormalizedRect):Integer;stdcall;
  136.     TdllGetLockMediaInfo=function (FileName:PChar;Info:PMediaInfo):Integer;stdcall;
  137.     TdllGetNoLockMediaInfo=function (FileName:PChar;Info:PMediaInfo):Integer;stdcall;
  138.     TdllReadMediaPosition=function (var nSeconds,nMinutes:Integer):Integer;stdcall;
  139.     TdllGetEvent=function (var eventCode:LongInt):Boolean;stdcall;
  140.     TdllDisplayRatio=function (mode:Integer):Integer;stdcall;
  141.     TdllRepaint=function (hwnd:HWND; hdc:HDC):HRESULT;stdcall;
  142.     TdllDefaultProcessMsg=function (hwd:HWND; Msg:LongInt; wParam:WPARAM; lParam:LPARAM):LongInt;stdcall;
  143.     TdllGetVideoRect=function (pRec:PRect):Boolean;stdcall;
  144.     TdllEndPreview=procedure ();stdcall;
  145.     TdllBeginPreview=procedure (PreviewHandle:HWND; PreviewCount:Integer);stdcall;
  146.     TdllSetPreviewMedia=procedure (FileName:PChar; m_nLayer:Integer);stdcall;
  147.     TdllSetPreviewMediaRect=procedure (m_nLayer:Integer; var rec:TRect);stdcall;
  148.     TdllPreviewPlay=procedure ();stdcall;
  149.     TdllPreviewGetSM=procedure (var nSeconds,nMinutes:Integer);stdcall;
  150.     TdllPreviewGetPosition=function():Integer;stdcall;
  151.     TdllPreviewSetPosition=procedure (Pos:Integer);stdcall;
  152.     TdllPreviewSetAudio=procedure (nLayer,volume:Integer);stdcall;
  153.     TdllPreviewPause=procedure ();stdcall;
  154. Var
  155.     dllOpenUnLockFile:TdllOpenUnLockFile;
  156.     dllOpenLockFile:TdllOpenLockFile;
  157.     dllCaptureToBmp:TdllCaptureToBmp;
  158.     dllPause:TdllPause;
  159.     dllPlay:TdllPlay;
  160.     dllStop:TdllStop;
  161.     dllSetPosition:TdllSetPosition;
  162.     dllGetPostion:TdllGetPostion;
  163.     dllFullscreen:TdllFullscreen;
  164.     dllRestoreFromFullScreen:TdllRestoreFromFullScreen;
  165. //    dllFindFilterByInterface:TdllFindFilterByInterface;
  166.     dllShowVRPropertyPage:TdllShowVRPropertyPage;
  167.     dllRegisterVideoHandle:TdllRegisterVideoHandle;
  168.     dllRegisterMsgHandle:TdllRegisterMsgHandle;
  169.     dllRegisterLockFilterGUID:TdllRegisterLockFilterGUID;
  170.     dllCreateLockGraph:TdllCreateLockGraph;
  171.     dllCreateUnLockGraph:TdllCreateUnLockGraph;
  172.     dllDestroyGraph:TdllDestroyGraph;
  173.     dllDefaultOnGraphNotify:TdllDefaultOnGraphNotify;
  174.     dllGetSize:TdllGetSize;
  175.     dllSwitchStepFrame:TdllSwitchStepFrame;
  176.     dllStepFrames:TdllStepFrames;
  177.     dllStepOneFrame:TdllStepOneFrame;
  178.     dllModifyRate:TdllModifyRate;
  179.     dllSetRate:TdllSetRate;
  180.     dllToggleMute:TdllToggleMute;
  181.     dllMuteAudio:TdllMuteAudio;
  182.     dllResumeAudio:TdllResumeAudio;
  183.     dllVolume:TdllVolume;
  184.     dllGetVolume:TdllGetVolume;
  185.     dllGetNoInitVolume:TdllGetNoInitVolume;
  186.     dllQuit:TdllQuit;
  187.     dllResetDisplay:TdllResetDisplay;
  188.     dllConfig:TdllConfig;
  189.     dllAddLockGraph:TdllAddLockGraph;
  190.     dllSetAlpha:TdllSetAlpha;
  191.     dllAddUnLockGraph:TdllAddUnLockGraph;
  192.     dllSetAmpControl:TdllSetAmpControl;
  193.     dllGetAmpControl:TdllGetAmpControl;
  194.     dllSetVideoRect:TdllSetVideoRect;
  195.     dllGetAlpha:TdllGetAlpha;
  196.     dllGetLockMediaInfo:TdllGetLockMediaInfo;
  197.     dllGetNoLockMediaInfo:TdllGetNoLockMediaInfo;
  198.     dllReadMediaPosition:TdllReadMediaPosition;
  199.     dllGetEvent:TdllGetEvent;
  200.     dllDisplayRatio:TdllDisplayRatio;
  201.     dllRepaint:TdllRepaint;
  202.     dllDefaultProcessMsg:TdllDefaultProcessMsg;
  203.     dllGetVideoRect:TdllGetVideoRect;
  204.     dllEndPreview:TdllEndPreview;
  205.     dllBeginPreview:TdllBeginPreview;
  206.     dllSetPreviewMedia:TdllSetPreviewMedia;
  207.     dllSetPreviewMediaRect:TdllSetPreviewMediaRect;
  208.     dllPreviewPlay:TdllPreviewPlay;
  209.     dllPreviewGetSM:TdllPreviewGetSM;
  210.     dllPreviewGetPosition:TdllPreviewGetPosition;
  211.     dllPreviewSetPosition:TdllPreviewSetPosition;
  212.     dllPreviewSetAudio:TdllPreviewSetAudio;
  213.     dllPreviewPause:TdllPreviewPause;
  214. function IsLockFile(FileName:String):Boolean;
  215. implementation
  216. Var
  217.     Lib:THandle;
  218. function IsLockFile(FileName:String):Boolean;
  219. Var
  220.     Ext:String;
  221. begin
  222.     Result:=false;
  223.     Ext:=UpperCase(ExtractFileExt(FileName));
  224.     if Ext='.WHL' then
  225.     begin
  226.         Result:=true;
  227.     end;
  228. end;
  229. Initialization
  230.     Lib:=LoadLibrary(PChar(ExtractFilePath(Application.ExeName)+'WH_PLAYERSDK.dll'));
  231.     dllOpenUnLockFile:=GetProcAddress(Lib,'dllOpenUnLockFile');
  232.     dllOpenLockFile:=GetProcAddress(Lib,'dllOpenLockFile');
  233.     dllCaptureToBmp:=GetProcAddress(Lib,'dllCaptureToBmp');
  234.     dllPause:=GetProcAddress(Lib,'dllPause');
  235.     dllPlay:=GetProcAddress(Lib,'dllPlay');
  236.     dllStop:=GetProcAddress(Lib,'dllStop');
  237.     dllSetPosition:=GetProcAddress(Lib,'dllSetPosition');
  238.     dllGetPostion:=GetProcAddress(Lib,'dllGetPostion');
  239.     dllFullscreen:=GetProcAddress(Lib,'dllFullscreen');
  240.     dllRestoreFromFullScreen:=GetProcAddress(Lib,'dllRestoreFromFullScreen');
  241. //    dllFindFilterByInterface:=GetProcAddress(Lib,'dllFindFilterByInterface');
  242.     dllShowVRPropertyPage:=GetProcAddress(Lib,'dllShowVRPropertyPage');
  243.     dllRegisterVideoHandle:=GetProcAddress(Lib,'dllRegisterVideoHandle');
  244.     dllRegisterMsgHandle:=GetProcAddress(Lib,'dllRegisterMsgHandle');
  245.     dllRegisterLockFilterGUID:=GetProcAddress(Lib,'dllRegisterLockFilterGUID');
  246.     dllCreateLockGraph:=GetProcAddress(Lib,'dllCreateLockGraph');
  247.     dllCreateUnLockGraph:=GetProcAddress(Lib,'dllCreateUnLockGraph');
  248.     dllDestroyGraph:=GetProcAddress(Lib,'dllDestroyGraph');
  249.     dllDefaultOnGraphNotify:=GetProcAddress(Lib,'dllDefaultOnGraphNotify');
  250.     dllGetSize:=GetProcAddress(Lib,'dllGetSize');
  251.     dllSwitchStepFrame:=GetProcAddress(Lib,'dllSwitchStepFrame');
  252.     dllStepFrames:=GetProcAddress(Lib,'dllStepFrames');
  253.     dllStepOneFrame:=GetProcAddress(Lib,'dllStepOneFrame');
  254.     dllModifyRate:=GetProcAddress(Lib,'dllModifyRate');
  255.     dllSetRate:=GetProcAddress(Lib,'dllSetRate');
  256.     dllToggleMute:=GetProcAddress(Lib,'dllToggleMute');
  257.     dllMuteAudio:=GetProcAddress(Lib,'dllMuteAudio');
  258.     dllResumeAudio:=GetProcAddress(Lib,'dllResumeAudio');
  259.     dllVolume:=GetProcAddress(Lib,'dllVolume');
  260.     dllGetVolume:=GetProcAddress(Lib,'dllGetVolume');
  261.     dllGetNoInitVolume:=GetProcAddress(Lib,'dllGetNoInitVolume');
  262.     dllQuit:=GetProcAddress(Lib,'dllQuit');
  263.     dllResetDisplay:=GetProcAddress(Lib,'dllResetDisplay');
  264.     dllConfig:=GetProcAddress(Lib,'dllConfig');
  265.     dllAddLockGraph:=GetProcAddress(Lib,'dllAddLockGraph');
  266.     dllSetAlpha:=GetProcAddress(Lib,'dllSetAlpha');
  267.     dllAddUnLockGraph:=GetProcAddress(Lib,'dllAddUnLockGraph');
  268.     dllSetAmpControl:=GetProcAddress(Lib,'dllSetAmpControl');
  269.     dllGetAmpControl:=GetProcAddress(Lib,'dllGetAmpControl');
  270.     dllSetVideoRect:=GetProcAddress(Lib,'dllSetVideoRect');
  271.     dllGetAlpha:=GetProcAddress(Lib,'dllGetAlpha');
  272.     dllGetNoLockMediaInfo:=GetProcAddress(Lib,'dllGetNoLockMediaInfo');
  273.     dllGetLockMediaInfo:=GetProcAddress(Lib,'dllGetLockMediaInfo');
  274.     dllReadMediaPosition:=GetProcAddress(Lib,'dllReadMediaPosition');
  275.     dllGetEvent:=GetProcAddress(Lib,'dllGetEvent');
  276.     dllDisplayRatio:=GetProcAddress(Lib,'dllDisplayRatio');
  277.     dllRepaint:=GetProcAddress(Lib,'dllRepaint');
  278.     dllDefaultProcessMsg:=GetProcAddress(Lib,'dllDefaultProcessMsg');
  279.     dllGetVideoRect:=GetProcAddress(Lib,'dllGetVideoRect');
  280.     dllEndPreview:=GetProcAddress(Lib,'dllEndPreview');
  281.     dllBeginPreview:=GetProcAddress(Lib,'dllBeginPreview');
  282.     dllSetPreviewMedia:=GetProcAddress(Lib,'dllSetPreviewMedia');
  283.     dllSetPreviewMediaRect:=GetProcAddress(Lib,'dllSetPreviewMediaRect');
  284.     dllPreviewPlay:=GetProcAddress(Lib,'dllPreviewPlay');
  285.     dllPreviewGetSM:=GetProcAddress(Lib,'dllPreviewGetSM');
  286.     dllPreviewGetPosition:=GetProcAddress(Lib,'dllPreviewGetPosition');
  287.     dllPreviewSetPosition:=GetProcAddress(Lib,'dllPreviewSetPosition');
  288.     dllPreviewSetAudio:=GetProcAddress(Lib,'dllPreviewSetAudio');
  289.     dllPreviewPause:=GetProcAddress(Lib,'dllPreviewPause');
  290. Finalization
  291.     FreeLibrary(Lib);
  292. end.