From 86dfe0c06437f79fd6f5bdfe34659339ef9cf525 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Wed, 28 Jan 2015 06:34:10 +0000 Subject: Watrack: VLC processing moved to INI-file MyShows fixes Code style fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@11936 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Watrack/players/pl_cowon.pas | 32 +-- plugins/Watrack/players/pl_mpc.pas | 8 +- plugins/Watrack/players/pl_vlc.pas | 380 ----------------------------------- plugins/Watrack/players/pl_wmp.pas | 128 ------------ 4 files changed, 20 insertions(+), 528 deletions(-) delete mode 100644 plugins/Watrack/players/pl_vlc.pas delete mode 100644 plugins/Watrack/players/pl_wmp.pas (limited to 'plugins/Watrack/players') diff --git a/plugins/Watrack/players/pl_cowon.pas b/plugins/Watrack/players/pl_cowon.pas index 0ac7027426..5ee5ab4be6 100644 --- a/plugins/Watrack/players/pl_cowon.pas +++ b/plugins/Watrack/players/pl_cowon.pas @@ -65,8 +65,8 @@ const GET_STATUS_JETAUDIO_VER3 = 997; const - titlewnd:HWND = 0; - hostwnd :HWND = 0; + TitleWnd:HWND = 0; + HostWnd :HWND = 0; tmpstr :pWideChar=nil; function HiddenWindProc(wnd:HWND; msg:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall; @@ -90,19 +90,19 @@ end; function Init:integer;cdecl; begin - hostwnd:=CreateWindowExW(0,'STATIC',nil,0,1,1,1,1,HWND_MESSAGE,0,hInstance,nil); - if hostwnd<>0 then - SetWindowLongPtrW(hostwnd,GWL_WNDPROC,LONG_PTR(@HiddenWindProc)); - result:=hostwnd; + HostWnd:=CreateWindowExW(0,'STATIC',nil,0,1,1,1,1,HWND_MESSAGE,0,hInstance,nil); + if HostWnd<>0 then + SetWindowLongPtrW(HostWnd,GWL_WNDPROC,LONG_PTR(@HiddenWindProc)); + result:=HostWnd; end; function DeInit:integer;cdecl; begin result:=0; - if hostwnd<>0 then + if HostWnd<>0 then begin - DestroyWindow(hostwnd); - hostwnd:=0; + DestroyWindow(HostWnd); + HostWnd:=0; end; end; @@ -134,8 +134,8 @@ begin result:=FindWindow(PluginClass,PluginName); } if (result<>0) {and (result<>wnd)} then - if EnumWindows(@chwnd,int_ptr(@titlewnd)) then - titlewnd:=0; + if EnumWindows(@chwnd,int_ptr(@TitleWnd)) then + TitleWnd:=0; end; function GetWndText:pWideChar; @@ -143,9 +143,9 @@ var p:pWideChar; begin result:=nil; - if titlewnd<>0 then + if TitleWnd<>0 then begin - result:=GetDlgText(titlewnd); + result:=GetDlgText(TitleWnd); if result<>nil then begin if StrScanW(result,'[')<>nil then @@ -205,19 +205,19 @@ end; function GetFileName(wnd:HWND;flags:integer):pWideChar;cdecl; begin - SendMessage(wnd,WM_REMOCON_GETSTATUS,hostwnd,GET_STATUS_TRACK_FILENAME); + SendMessage(wnd,WM_REMOCON_GETSTATUS,HostWnd,GET_STATUS_TRACK_FILENAME); result:=tmpstr; end; function GetArtist(wnd:HWND):pWideChar; begin - SendMessage(wnd,WM_REMOCON_GETSTATUS,hostwnd,GET_STATUS_TRACK_ARTIST); + SendMessage(wnd,WM_REMOCON_GETSTATUS,HostWnd,GET_STATUS_TRACK_ARTIST); result:=tmpstr; end; function GetTitle(wnd:HWND):pWideChar; begin - SendMessage(wnd,WM_REMOCON_GETSTATUS,hostwnd,GET_STATUS_TRACK_TITLE); + SendMessage(wnd,WM_REMOCON_GETSTATUS,HostWnd,GET_STATUS_TRACK_TITLE); result:=tmpstr; end; diff --git a/plugins/Watrack/players/pl_mpc.pas b/plugins/Watrack/players/pl_mpc.pas index bd0fade514..f5ac986c28 100644 --- a/plugins/Watrack/players/pl_mpc.pas +++ b/plugins/Watrack/players/pl_mpc.pas @@ -19,7 +19,7 @@ begin result:=FindWindowEx(0,wnd,MPCClass98,NIL); end; -function chwnd(awnd:HWND;Param:pdword):boolean; stdcall; +function chwnd(awnd:HWND;param:pdword):boolean; stdcall; var s:array [0..31] of AnsiChar; i:integer; @@ -29,14 +29,14 @@ begin i:=StrIndex(PAnsiChar(@s),' / '); if i<>0 then begin - if Param^=0 then + if param^=0 then begin s[i-1]:=#0; - Param^:=TimeToInt(s); + param^:=TimeToInt(s); end else begin - Param^:=TimeToInt(s+i+2); + param^:=TimeToInt(s+i+2); end; result:=false; end diff --git a/plugins/Watrack/players/pl_vlc.pas b/plugins/Watrack/players/pl_vlc.pas deleted file mode 100644 index 1a8f3185f1..0000000000 --- a/plugins/Watrack/players/pl_vlc.pas +++ /dev/null @@ -1,380 +0,0 @@ -{Video Lan player} -unit pl_VLC; -{$include compilers.inc} - -interface - -implementation -uses windows,common,srv_player,wat_api,syswin,wrapper - {$IFDEF DELPHI_7_UP} - ,variants - {$ENDIF} - {$IFDEF KOL_MCK} - ,kolcomobj - {$ELSE} - ,ComObj - {$ENDIF} -; - -{ - procedure play; safecall; - procedure pause; safecall; - procedure stop; safecall; - procedure playlistNext; safecall; - procedure playlistPrev; safecall; - property Playing: WordBool read Get_Playing; - property Position: Single read Get_Position write Set_Position; - property Time: SYSINT read Get_Time write Set_Time; - property Length: SYSINT read Get_Length; - (0)1-97(100) - property Volume: SYSINT read Get_Volume write Set_Volume; - property VersionInfo: WideString read Get_VersionInfo; -} - -const -// GuidOld: TGUID = '{E23FE9C6-778E-49D4-B537-38FCDE4887D8}'; - VLCClass = 'wxWindowClassNR'; - VLCName = 'VLC media player'; - COMName = 'VideoLAN.VLCPlugin.1'; // IVLCControl - -// GuidNew: TGUID = '{9BE31822-FDAD-461B-AD51-BE1D1C159921}'; - VLCClassSkin = 'SkinWindowClass'; - VLCClassNew = 'QWidget'; - VLCEXEName = 'VLC.EXE'; - COMNameNew = 'VideoLAN.VLCPlugin2'; // IVLCControl2 - -function Check(wnd:HWND;flags:integer):HWND;cdecl; -var - tmp,EXEName:PAnsiChar; -begin - if wnd<>0 then - begin - result:=0; - exit; - end; - result:=FindWindow(VLCClass,VLCName); - if result=0 then - result:=FindWindow(VLCClassSkin,nil); // VLCName - if result=0 then - result:=FindWindow(VLCClassNew,nil); - if result<>0 then - begin - tmp:=Extract(GetEXEByWnd(result,EXEName),true); - if lstrcmpia(tmp,VLCEXEName)<>0 then - result:=0; - mFreeMem(tmp); - mFreeMem(EXEName); - end; -{ if result<>0 then - begin - tmp:=Extract(GetEXEByWnd(result,EXEName),true); - if lstrcmpia(tmp,'VLC.EXE')<>0 then - result:=0; - mFreeMem(tmp); - mFreeMem(EXEName); - end; -} -end; - -function SplitVersion(p:pWideChar):integer; -begin - result:=StrToInt(p); - while (p^>='0') and (p^<='9') do inc(p); inc(p); - result:=result*16+StrToInt(p); - while (p^>='0') and (p^<='9') do inc(p); inc(p); - result:=(result*16+StrToInt(p))*16; - while (p^>='0') and (p^<='9') do inc(p); inc(p); - result:=result*16+StrToInt(p); -end; - -function GetVersion(const ver:pWideChar):integer; -begin - try - result:=SplitVersion(ver); - except - result:=0; - end; -end; - -function GetVersionText(const v:variant):PWideChar; -begin - try - StrDupW(result,PWideChar(WideString(v.VersionInfo))); - except - result:=nil; - end; -end; - -function GetWndText(wnd:HWND):pWideChar; -var - p:pWideChar; -begin - result:=GetDlgText(wnd); -{ -need to clear " - lalala VLC" at the end -} - if result<>nil then - begin - p:=StrRScanW(result,'-'); - if p<>nil then // found - begin - if (p>result) and ((p-1)^=' ') and ((p+1)^=' ') then - (p-1)^:=#0; - end; - end; -end; - -{ -function GetTotalTime:integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.Length; - except - result:=inherited GetTotalTime; - end; - v:=Null; -end; - -function GetElapsedTime:integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.Time; - except - result:=inherited GetElapsedTime; - end; - v:=Null; -end; - -function GetStatus:integer; cdecl; -var - v:variant; - tmp:boolean; -begin - try - v:=CreateOleObject(COMName); - tmp:=v.Playing; - if tmp then - result:=WAT_PLS_PLAYING - else - result:=WAT_PLS_STOPPED; - except - result:=inherited GetStatus; - end; - v:=Null; -end; - -function Play(fname:PWideChar=nil):integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.play; - except - result:=inherited Play(fname); - end; - v:=Null; -end; - -function Pause:integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.pause; - except - result:=inherited Pause; - end; - v:=Null; -end; - -function Stop:integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.stop; - except - result:=inherited Stop; - end; - v:=Null; -end; - -function Next:integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.playlistNext; - except - result:=inherited Next; - end; - v:=Null; -end; - -function Prev:integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.playlistPrev; - except - result:=inherited Prev; - end; - v:=Null; -end; - -function Seek(value:integer):integer; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.Position; - if value>0 then - v.Position:=value - else - result:=0; - except - result:=inherited Seek(value); - end; - v:=Null; -end; - -function GetVolume:cardinal; -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - result:=v.Volume; - result:=(result shl 16)+((result shl 4) div 100); - except - result:=0; - end; - v:=Null; -end; - -procedure SetVolume(value:cardinal); -var - v:variant; -begin - try - v:=CreateOleObject(COMName); - v.Volume:=(value*100) shr 4; - end; - except - result:=inherited SetVolume(value); - end; - v:=Null; -end; - -function VolDn:integer; -var - val:integer; -begin - result:=GetVolume; - val:=loword(result); - if val>0 then - SetVolume(val-1); -end; - -function VolUp:integer; -var - val:integer; -begin - result:=GetVolume; - val:=loword(result); - if val<16 then - SetVolume(val+1); -end; - -} -function GetInfo(var SongInfo:tSongInfo;flags:integer):integer;cdecl; -var - v:variant; -begin - result:=0; - if (flags and WAT_OPT_PLAYERDATA)<>0 then - begin - if SongInfo.plyver=0 then - begin - try - try - v:=CreateOleObject(COMName); - except - try - v:=CreateOleObject(COMNameNew); - except - v:=Null; - end; - end; - if v<>Null then - with SongInfo do - begin - txtver:=GetVersionText(v); - plyver:=GetVersion(txtver); - end; - except - end; - v:=Null; - if (flags and WAT_OPT_CHANGES)<>0 then - SongInfo.wndtext:=GetWndText(SongInfo.plwnd); - end; - end; -end; -{ -function Command(wnd:HWND;cmd:integer;value:integer):integer;cdecl; -begin - result:=0; - case cmd of - WAT_CTRL_PREV : result:=Prev; - WAT_CTRL_PLAY : result:=Play(pWideChar(value)); - WAT_CTRL_PAUSE: result:=Pause; - WAT_CTRL_STOP : result:=Stop; - WAT_CTRL_NEXT : result:=Next; - WAT_CTRL_VOLDN: result:=VolDn; - WAT_CTRL_VOLUP: result:=VolUp; - WAT_CTRL_SEEK : result:=Seek(value); - end; -end; -} -const - plRec:tPlayerCell=( - Desc :'VideoLAN player'; - flags :WAT_OPT_HASURL; - Icon :0; - Init :nil; - DeInit :nil; - Check :@Check; - GetStatus:nil; - GetName :nil; - GetInfo :@GetInfo; - Command :nil; - URL :'http://www.videolan.org/'; - Notes :nil); - -var - LocalPlayerLink:twPlayer; - -procedure InitLink; -begin - LocalPlayerLink.Next:=PlayerLink; - LocalPlayerLink.This:=@plRec; - PlayerLink :=@LocalPlayerLink; -end; - -initialization -// ServicePlayer(WAT_ACT_REGISTER,dword(@plRec)); - InitLink; -end. diff --git a/plugins/Watrack/players/pl_wmp.pas b/plugins/Watrack/players/pl_wmp.pas deleted file mode 100644 index 971cb28ac6..0000000000 --- a/plugins/Watrack/players/pl_wmp.pas +++ /dev/null @@ -1,128 +0,0 @@ -{Windows Media Player} -unit pl_WMP; -{$include compilers.inc} - -interface - -implementation -uses windows,common,messages,srv_player,wat_api - {$IFDEF DELPHI_7_UP} - ,variants - {$ENDIF} - {$IFDEF KOL_MCK} - ,kolcomobj - {$ELSE} - ,ComObj - {$ENDIF} -; - -const - WMPOld:boolean=false; - -const -// CLASS_MP :TGUID = '{22D6F312-B0F6-11D0-94AB-0080C74C7E95}'; -// CLASS_WMP:TGUID = '{6BF52A52-394A-11D3-B153-00C04F79FAA6}'; CLASS_WindowsMediaPlayer - MPCOMName = 'MediaPlayer.MediaPlayer.1'; - WMPCOMName = 'WMPlayer.OCX.7'; -const - MPClass = 'Media Player 2'; - WMPClass = 'WMPlayerApp'; - -function Check(wnd:HWND;flags:integer):HWND;cdecl; -begin - result:=FindWindowEx(0,wnd,MPClass,NIL); - if result=0 then - begin - result:=FindWindowEx(0,wnd,WMPClass,NIL); //? - WMPOld:=false; - end - else - WMPOld:=true; -end; - -{ Version detect - fHasWMP64 = (WMP64.FileName="") ' WMP64 was create above via OBJECT tag else this returns False. - fHasWMP7 = (WMP7.URL = "") ' WMP7 or later was create above via OBJECT tag else this returns False. -} - -const - MPVersion:PWideChar = '6.4'; - -function GetVersionText(flags:integer):PWideChar; -var - v:variant; -begin - if WMPOld then - StrDupW(result,MPVersion) - else - begin - try - v:=CreateOleObject(WMPCOMName); - StrDupW(result,pWideChar(Widestring(v.versionInfo))); - except - result:=nil; - end; -// VarClear(v); - v:=Null; - end; -end; - -function GetInfo(var SongInfo:tSongInfo;flags:integer):integer;cdecl; -begin - result:=0; - if (flags and WAT_OPT_PLAYERDATA)<>0 then - begin - if SongInfo.txtver=nil then - SongInfo.txtver:=GetVersionText(flags); - end; -end; - -{ -function Command(wnd:HWND;cmd:integer;value:integer):integer;cdecl; -var - c:integer; -begin - result:=0; - case cmd of -// WAT_CTRL_PREV : c:=VK_B; -// WAT_CTRL_PLAY : c:=VK_C; -// WAT_CTRL_PAUSE: c:=VK_X; -// WAT_CTRL_STOP : c:=VK_Z; -// WAT_CTRL_NEXT : c:=VK_V; - WAT_CTRL_VOLDN: c:=VK_F9; - WAT_CTRL_VOLUP: c:=VK_F10; - else - exit; - end; - PostMessageW(wnd,WM_KEYDOWN,c,1); -end; -} -const - plRec:tPlayerCell=( - Desc :'WMP'; - flags :WAT_OPT_APPCOMMAND or WAT_OPT_SINGLEINST; - Icon :0; - Init :nil; - DeInit :nil; - Check :@Check; - GetStatus:nil; - GetName :nil; - GetInfo :@GetInfo; - Command :nil; - URL :'http://www.microsoft.com/windows/windowsmedia/players.aspx'; - Notes :nil); - -var - LocalPlayerLink:twPlayer; - -procedure InitLink; -begin - LocalPlayerLink.Next:=PlayerLink; - LocalPlayerLink.This:=@plRec; - PlayerLink :=@LocalPlayerLink; -end; - -initialization -// ServicePlayer(WAT_ACT_REGISTER,dword(@plRec)); - InitLink; -end. -- cgit v1.2.3