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.     TdllPreviewResize=procedure ();stdcall;
  155. Var
  156.     dllOpenUnLockFile:TdllOpenUnLockFile;
  157.     dllOpenLockFile:TdllOpenLockFile;
  158.     dllCaptureToBmp:TdllCaptureToBmp;
  159.     dllPause:TdllPause;
  160.     dllPlay:TdllPlay;
  161.     dllStop:TdllStop;
  162.     dllSetPosition:TdllSetPosition;
  163.     dllGetPostion:TdllGetPostion;
  164.     dllFullscreen:TdllFullscreen;
  165.     dllRestoreFromFullScreen:TdllRestoreFromFullScreen;
  166. //    dllFindFilterByInterface:TdllFindFilterByInterface;
  167.     dllShowVRPropertyPage:TdllShowVRPropertyPage;
  168.     dllRegisterVideoHandle:TdllRegisterVideoHandle;
  169.     dllRegisterMsgHandle:TdllRegisterMsgHandle;
  170.     dllRegisterLockFilterGUID:TdllRegisterLockFilterGUID;
  171.     dllCreateLockGraph:TdllCreateLockGraph;
  172.     dllCreateUnLockGraph:TdllCreateUnLockGraph;
  173.     dllDestroyGraph:TdllDestroyGraph;
  174.     dllDefaultOnGraphNotify:TdllDefaultOnGraphNotify;
  175.     dllGetSize:TdllGetSize;
  176.     dllSwitchStepFrame:TdllSwitchStepFrame;
  177.     dllStepFrames:TdllStepFrames;
  178.     dllStepOneFrame:TdllStepOneFrame;
  179.     dllModifyRate:TdllModifyRate;
  180.     dllSetRate:TdllSetRate;
  181.     dllToggleMute:TdllToggleMute;
  182.     dllMuteAudio:TdllMuteAudio;
  183.     dllResumeAudio:TdllResumeAudio;
  184.     dllVolume:TdllVolume;
  185.     dllGetVolume:TdllGetVolume;
  186.     dllGetNoInitVolume:TdllGetNoInitVolume;
  187.     dllQuit:TdllQuit;
  188.     dllResetDisplay:TdllResetDisplay;
  189.     dllConfig:TdllConfig;
  190.     dllAddLockGraph:TdllAddLockGraph;
  191.     dllSetAlpha:TdllSetAlpha;
  192.     dllAddUnLockGraph:TdllAddUnLockGraph;
  193.     dllSetAmpControl:TdllSetAmpControl;
  194.     dllGetAmpControl:TdllGetAmpControl;
  195.     dllSetVideoRect:TdllSetVideoRect;
  196.     dllGetAlpha:TdllGetAlpha;
  197.     dllGetLockMediaInfo:TdllGetLockMediaInfo;
  198.     dllGetNoLockMediaInfo:TdllGetNoLockMediaInfo;
  199.     dllReadMediaPosition:TdllReadMediaPosition;
  200.     dllGetEvent:TdllGetEvent;
  201.     dllDisplayRatio:TdllDisplayRatio;
  202.     dllRepaint:TdllRepaint;
  203.     dllDefaultProcessMsg:TdllDefaultProcessMsg;
  204.     dllGetVideoRect:TdllGetVideoRect;
  205.     dllEndPreview:TdllEndPreview;
  206.     dllBeginPreview:TdllBeginPreview;
  207.     dllSetPreviewMedia:TdllSetPreviewMedia;
  208.     dllSetPreviewMediaRect:TdllSetPreviewMediaRect;
  209.     dllPreviewPlay:TdllPreviewPlay;
  210.     dllPreviewGetSM:TdllPreviewGetSM;
  211.     dllPreviewGetPosition:TdllPreviewGetPosition;
  212.     dllPreviewSetPosition:TdllPreviewSetPosition;
  213.     dllPreviewSetAudio:TdllPreviewSetAudio;
  214.     dllPreviewPause:TdllPreviewPause;
  215.     dllPreviewResize:TdllPreviewResize;
  216. function IsLockFile(FileName:String):Boolean;
  217. implementation
  218. Var
  219.     Lib:THandle;
  220. function IsLockFile(FileName:String):Boolean;
  221. Var
  222.     Ext:String;
  223. begin
  224.     Result:=false;
  225.     Ext:=UpperCase(ExtractFileExt(FileName));
  226.     if Ext='.WHL' then
  227.     begin
  228.         Result:=true;
  229.     end;
  230. end;
  231. Initialization
  232.     Lib:=LoadLibrary(PChar(ExtractFilePath(Application.ExeName)+'WH_PLAYERSDK.dll'));
  233.     dllOpenUnLockFile:=GetProcAddress(Lib,'dllOpenUnLockFile');
  234.     dllOpenLockFile:=GetProcAddress(Lib,'dllOpenLockFile');
  235.     dllCaptureToBmp:=GetProcAddress(Lib,'dllCaptureToBmp');
  236.     dllPause:=GetProcAddress(Lib,'dllPause');
  237.     dllPlay:=GetProcAddress(Lib,'dllPlay');
  238.     dllStop:=GetProcAddress(Lib,'dllStop');
  239.     dllSetPosition:=GetProcAddress(Lib,'dllSetPosition');
  240.     dllGetPostion:=GetProcAddress(Lib,'dllGetPostion');
  241.     dllFullscreen:=GetProcAddress(Lib,'dllFullscreen');
  242.     dllRestoreFromFullScreen:=GetProcAddress(Lib,'dllRestoreFromFullScreen');
  243. //    dllFindFilterByInterface:=GetProcAddress(Lib,'dllFindFilterByInterface');
  244.     dllShowVRPropertyPage:=GetProcAddress(Lib,'dllShowVRPropertyPage');
  245.     dllRegisterVideoHandle:=GetProcAddress(Lib,'dllRegisterVideoHandle');
  246.     dllRegisterMsgHandle:=GetProcAddress(Lib,'dllRegisterMsgHandle');
  247.     dllRegisterLockFilterGUID:=GetProcAddress(Lib,'dllRegisterLockFilterGUID');
  248.     dllCreateLockGraph:=GetProcAddress(Lib,'dllCreateLockGraph');
  249.     dllCreateUnLockGraph:=GetProcAddress(Lib,'dllCreateUnLockGraph');
  250.     dllDestroyGraph:=GetProcAddress(Lib,'dllDestroyGraph');
  251.     dllDefaultOnGraphNotify:=GetProcAddress(Lib,'dllDefaultOnGraphNotify');
  252.     dllGetSize:=GetProcAddress(Lib,'dllGetSize');
  253.     dllSwitchStepFrame:=GetProcAddress(Lib,'dllSwitchStepFrame');
  254.     dllStepFrames:=GetProcAddress(Lib,'dllStepFrames');
  255.     dllStepOneFrame:=GetProcAddress(Lib,'dllStepOneFrame');
  256.     dllModifyRate:=GetProcAddress(Lib,'dllModifyRate');
  257.     dllSetRate:=GetProcAddress(Lib,'dllSetRate');
  258.     dllToggleMute:=GetProcAddress(Lib,'dllToggleMute');
  259.     dllMuteAudio:=GetProcAddress(Lib,'dllMuteAudio');
  260.     dllResumeAudio:=GetProcAddress(Lib,'dllResumeAudio');
  261.     dllVolume:=GetProcAddress(Lib,'dllVolume');
  262.     dllGetVolume:=GetProcAddress(Lib,'dllGetVolume');
  263.     dllGetNoInitVolume:=GetProcAddress(Lib,'dllGetNoInitVolume');
  264.     dllQuit:=GetProcAddress(Lib,'dllQuit');
  265.     dllResetDisplay:=GetProcAddress(Lib,'dllResetDisplay');
  266.     dllConfig:=GetProcAddress(Lib,'dllConfig');
  267.     dllAddLockGraph:=GetProcAddress(Lib,'dllAddLockGraph');
  268.     dllSetAlpha:=GetProcAddress(Lib,'dllSetAlpha');
  269.     dllAddUnLockGraph:=GetProcAddress(Lib,'dllAddUnLockGraph');
  270.     dllSetAmpControl:=GetProcAddress(Lib,'dllSetAmpControl');
  271.     dllGetAmpControl:=GetProcAddress(Lib,'dllGetAmpControl');
  272.     dllSetVideoRect:=GetProcAddress(Lib,'dllSetVideoRect');
  273.     dllGetAlpha:=GetProcAddress(Lib,'dllGetAlpha');
  274.     dllGetNoLockMediaInfo:=GetProcAddress(Lib,'dllGetNoLockMediaInfo');
  275.     dllGetLockMediaInfo:=GetProcAddress(Lib,'dllGetLockMediaInfo');
  276.     dllReadMediaPosition:=GetProcAddress(Lib,'dllReadMediaPosition');
  277.     dllGetEvent:=GetProcAddress(Lib,'dllGetEvent');
  278.     dllDisplayRatio:=GetProcAddress(Lib,'dllDisplayRatio');
  279.     dllRepaint:=GetProcAddress(Lib,'dllRepaint');
  280.     dllDefaultProcessMsg:=GetProcAddress(Lib,'dllDefaultProcessMsg');
  281.     dllGetVideoRect:=GetProcAddress(Lib,'dllGetVideoRect');
  282.     dllEndPreview:=GetProcAddress(Lib,'dllEndPreview');
  283.     dllBeginPreview:=GetProcAddress(Lib,'dllBeginPreview');
  284.     dllSetPreviewMedia:=GetProcAddress(Lib,'dllSetPreviewMedia');
  285.     dllSetPreviewMediaRect:=GetProcAddress(Lib,'dllSetPreviewMediaRect');
  286.     dllPreviewPlay:=GetProcAddress(Lib,'dllPreviewPlay');
  287.     dllPreviewGetSM:=GetProcAddress(Lib,'dllPreviewGetSM');
  288.     dllPreviewGetPosition:=GetProcAddress(Lib,'dllPreviewGetPosition');
  289.     dllPreviewSetPosition:=GetProcAddress(Lib,'dllPreviewSetPosition');
  290.     dllPreviewSetAudio:=GetProcAddress(Lib,'dllPreviewSetAudio');
  291.     dllPreviewPause:=GetProcAddress(Lib,'dllPreviewPause');
  292.     dllPreviewResize:=GetProcAddress(Lib,'dllPreviewResize');
  293. Finalization
  294.     FreeLibrary(Lib);
  295. end.