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/formats/fmt_mp3.pas | 16 +- plugins/Watrack/formats/fmt_ogg.pas | 24 +- plugins/Watrack/formats/fmt_real.pas | 40 ++-- plugins/Watrack/formats/fmt_wma.pas | 4 +- plugins/Watrack/formats/tag_id3v1.inc | 10 +- plugins/Watrack/formats/tag_id3v2.inc | 12 +- plugins/Watrack/i_cover.inc | 8 +- plugins/Watrack/i_opt_1.inc | 2 +- plugins/Watrack/i_options.inc | 4 +- plugins/Watrack/lastfm/i_last_api.inc | 27 ++- plugins/Watrack/lastfm/i_last_dlg.inc | 12 +- plugins/Watrack/lst_players.inc | 2 +- plugins/Watrack/myshows/i_myshows_api.inc | 16 +- plugins/Watrack/myshows/i_myshows_dlg.inc | 12 +- plugins/Watrack/player.ini | 7 + 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 ---------- plugins/Watrack/popup/pop_vars.inc | 16 +- plugins/Watrack/popup/popups.pas | 13 +- plugins/Watrack/srv_format.pas | 6 +- plugins/Watrack/srv_player.pas | 6 +- plugins/Watrack/stat/statlog.pas | 18 +- plugins/Watrack/status/i_opt_11.inc | 12 +- plugins/Watrack/watrack.dpr | 6 +- 26 files changed, 160 insertions(+), 661 deletions(-) delete mode 100644 plugins/Watrack/players/pl_vlc.pas delete mode 100644 plugins/Watrack/players/pl_wmp.pas (limited to 'plugins/Watrack') diff --git a/plugins/Watrack/formats/fmt_mp3.pas b/plugins/Watrack/formats/fmt_mp3.pas index 45c0888daa..e9d5d68eed 100644 --- a/plugins/Watrack/formats/fmt_mp3.pas +++ b/plugins/Watrack/formats/fmt_mp3.pas @@ -125,18 +125,18 @@ end; function SearchStart(f:THANDLE; var l:array of byte):Boolean; var CurPos:longint; - Buf:array [0..ScanSize] of byte; + buf:array [0..ScanSize] of byte; i,j:integer; begin CurPos:=FilePos(f)-4; Seek(f,CurPos); - j:=BlockRead(f,Buf,ScanSize); + j:=BlockRead(f,buf,ScanSize); i:=0; while i$F0) then + if (i<(j-2)) and (buf[i]=$FF) and //FF FB E4 + ((buf[i+1] and $E0)=$E0) and + ((buf[i+2] and $F0)<>$F0) then begin Seek(f,CurPos+i); BlockRead(f,l,4); @@ -257,7 +257,7 @@ var w:word; b:byte; flag:integer; - version,layer:integer; + version,Layer:integer; // vbitrate:integer; // FrmCnt:integer; begin @@ -385,8 +385,8 @@ begin end; l:=ReadDWord(p,endptr); version:=(l2b(l)[1] and $18) shr 3; - layer :=(l2b(l)[1] and $06) shr 1; - Info.kbps :=btable[version and 1][layer-1][l2b(l)[2] shr 4]; + Layer :=(l2b(l)[1] and $06) shr 1; + Info.kbps :=btable[version and 1][Layer-1][l2b(l)[2] shr 4]; Info.khz :=(stable[version][(l2b(l)[2] and $0C) shr 2]) div 1000; Info.channels:=l2b(l)[3] shr 6; if Info.channels=3 then diff --git a/plugins/Watrack/formats/fmt_ogg.pas b/plugins/Watrack/formats/fmt_ogg.pas index d0ba567d08..c02a2392be 100644 --- a/plugins/Watrack/formats/fmt_ogg.pas +++ b/plugins/Watrack/formats/fmt_ogg.pas @@ -5,12 +5,12 @@ unit fmt_OGG; interface uses wat_api; -function ReadOGG(var Info:wat_api.tSongInfo):boolean; cdecl; -function ReadSPX(var Info:wat_api.tSongInfo):boolean; cdecl; -function ReadfLaC(var Info:wat_api.tSongInfo):boolean; cdecl; +function ReadOGG(var Info:tSongInfo):boolean; cdecl; +function ReadSPX(var Info:tSongInfo):boolean; cdecl; +function ReadfLaC(var Info:tSongInfo):boolean; cdecl; implementation -uses windows,common,io,tags,srv_format,utils, m_api; +uses windows,common,io,tags,srv_format,utils; const OGGSign = $5367674F; //OggS @@ -95,12 +95,12 @@ const 5 : CUESHEET } type - MetaHdr = packed record + tMetaHdr = packed record blocktype:byte; blocklen:array [0..2] of byte; end; type - StreamInfo = packed record + tStreamInfo = packed record MinBlockSize:word; MaxBlocksize:word; MinFrameSize:array [0..2] of byte; @@ -109,7 +109,7 @@ type MD5:array [0..15] of byte; end; -procedure OGGGetComment(ptr:PAnsiChar;size:integer;var Info:wat_api.tSongInfo); +procedure OGGGetComment(ptr:PAnsiChar;size:integer;var Info:tSongInfo); var alen,len,values:dword; clen:int; @@ -185,7 +185,7 @@ begin end; end; -function ReadSPX(var Info:wat_api.tSongInfo):boolean; cdecl; +function ReadSPX(var Info:tSongInfo):boolean; cdecl; var f:THANDLE; OGGHdr:tOGGHdr; @@ -243,7 +243,7 @@ begin result:=0; end; -function ReadOGG(var Info:wat_api.tSongInfo):boolean; cdecl; +function ReadOGG(var Info:tSongInfo):boolean; cdecl; var f:THANDLE; OGGHdr:tOGGHdr; @@ -368,12 +368,12 @@ begin CloseHandle(f); end; -function ReadfLaC(var Info:wat_api.tSongInfo):boolean; cdecl; +function ReadfLaC(var Info:tSongInfo):boolean; cdecl; var f:THANDLE; data64:int64; - hdr:MetaHdr; - frm:StreamInfo; + hdr:tMetaHdr; + frm:tStreamInfo; id:dword; flag:integer; size:dword; diff --git a/plugins/Watrack/formats/fmt_real.pas b/plugins/Watrack/formats/fmt_real.pas index 8d5f5bf72d..1d69a2f353 100644 --- a/plugins/Watrack/formats/fmt_real.pas +++ b/plugins/Watrack/formats/fmt_real.pas @@ -23,7 +23,7 @@ const type tChunk = packed record ID:dword; - Len:dword; //with Chunk; + len:dword; //with Chunk; end; type @@ -43,32 +43,32 @@ type procedure SkipStr(var p:PAnsiChar;alen:integer); var - len:integer; + llen:integer; begin if alen=2 then - len:=(ord(p[0]) shl 8)+ord(p[1]) + llen:=(ord(p[0]) shl 8)+ord(p[1]) else - len:=ord(p[0]); + llen:=ord(p[0]); inc(p,alen); -// if len>0 then - inc(p,len); +// if llen>0 then + inc(p,llen); end; function ReadStr(var p:PAnsiChar;alen:integer):PAnsiChar; var - len:integer; + llen:integer; begin if alen=2 then - len:=(ord(p[0]) shl 8)+ord(p[1]) + llen:=(ord(p[0]) shl 8)+ord(p[1]) else - len:=ord(p[0]); + llen:=ord(p[0]); inc(p,alen); - if len>0 then + if llen>0 then begin - mGetMem(result,len+1); - move(p^,result^,len); - result[len]:=#0; - inc(p,len); + mGetMem(result,llen+1); + move(p^,result^,llen); + result[llen]:=#0; + inc(p,llen); end else result:=nil; @@ -103,15 +103,15 @@ begin while FilePos(f)SizeOf(chunk) then // channels-1: ofs=$0A break; - Skip(f,chunk.Len-SizeOf(chunk)); + Skip(f,chunk.len-SizeOf(chunk)); end; end; ReadID3v1(f,Info); diff --git a/plugins/Watrack/formats/fmt_wma.pas b/plugins/Watrack/formats/fmt_wma.pas index ed575147ac..8027ce052d 100644 --- a/plugins/Watrack/formats/fmt_wma.pas +++ b/plugins/Watrack/formats/fmt_wma.pas @@ -295,7 +295,7 @@ type size :word; bitmap :BITMAPINFOHEADER; end; - Prefix = packed record + tPrefix = packed record StreamType :tGUID; ECGUID :tGUID; // Error Correction TimeOffset :int64; @@ -309,7 +309,7 @@ var tmpguid:pGUID; begin tmpguid:=pointer(ptr); - inc(ptr,SizeOf(Prefix)); //ofset to Type-Specific Data + inc(ptr,SizeOf(tPrefix)); //ofset to Type-Specific Data if CompareGUID(tmpguid^,ASF_Audio_Media) then begin Info.channels:=pAudio(ptr)^.Channels; diff --git a/plugins/Watrack/formats/tag_id3v1.inc b/plugins/Watrack/formats/tag_id3v1.inc index bd1db906bb..5e1f89539a 100644 --- a/plugins/Watrack/formats/tag_id3v1.inc +++ b/plugins/Watrack/formats/tag_id3v1.inc @@ -61,7 +61,7 @@ procedure ID3v1_CheckLyric(var Info:tSongInfo;f:THANDLE;ofs:integer); const maxlen = 5100; var - tagHdr:array [0..9] of AnsiChar; + TagHdr:array [0..9] of AnsiChar; buf:array [0..maxlen] of AnsiChar; ptr,ptr1:PAnsiChar; i,size:integer; @@ -69,9 +69,9 @@ var c:dword; begin Seek(f,ofs); - BlockRead(f,tagHdr,LyricEndLen); - tagHdr[9]:=#0; - if StrCmp(tagHdr,Lyric1End,LyricEndLen)=0 then + BlockRead(f,TagHdr,LyricEndLen); + TagHdr[9]:=#0; + if StrCmp(TagHdr,Lyric1End,LyricEndLen)=0 then begin if Info.lyric=nil then begin @@ -91,7 +91,7 @@ begin end; end; end - else if StrCmp(tagHdr,Lyric2End,LyricEndLen)=0 then + else if StrCmp(TagHdr,Lyric2End,LyricEndLen)=0 then begin Seek(f,ofs-6); BlockRead(f,buf,6); diff --git a/plugins/Watrack/formats/tag_id3v2.inc b/plugins/Watrack/formats/tag_id3v2.inc index 78660fdb6d..5ee98ca9e1 100644 --- a/plugins/Watrack/formats/tag_id3v2.inc +++ b/plugins/Watrack/formats/tag_id3v2.inc @@ -307,17 +307,17 @@ begin end; end; -function ID3v2_PreReadTag(var frm:tID3v2FrameHdr;var src:PAnsiChar;ver:integer):PAnsiChar; +function ID3v2_PreReadTag(var Frm:tID3v2FrameHdr;var src:PAnsiChar;ver:integer):PAnsiChar; var i:cardinal; dst:PAnsiChar; begin - mGetMem(result,frm.Size); - if Unsync or ((frm.Flags and $0200)<>0) then + mGetMem(result,Frm.Size); + if Unsync or ((Frm.Flags and $0200)<>0) then begin dst:=result; i:=0; - while i#0 do begin @@ -121,12 +122,12 @@ begin pc:=StrCopyE(pc,'s='); pc:=StrCopyE(pc,session_id); //'?s=' pc:=StrCopyE(pc,'&a='); if si^.artist=nil then pc:=StrCopyE(pc,'Unknown') - else pc:=encode(pc,si^.artist); + else pc:=Encode(pc,si^.artist); pc:=StrCopyE(pc,'&t='); if si^.title =nil then pc:=StrCopyE(pc,'Unknown') - else pc:=encode(pc,si^.title); + else pc:=Encode(pc,si^.title); pc:=StrCopyE(pc,'&l='); if si^.total>0 then pc:=StrCopyE(pc,IntToStr(buf,si^.total)); - pc:=StrCopyE(pc,'&b='); pc:=encode(pc,si^.album); + pc:=StrCopyE(pc,'&b='); pc:=Encode(pc,si^.album); pc:=StrCopyE(pc,'&n='); if si^.track<>0 then {pc:=}StrCopyE(pc,IntToStr(buf,si^.track)); @@ -160,10 +161,10 @@ begin pc:=StrCopyE(pc,'s=' ); pc:=StrCopyE(pc,session_id); pc:=StrCopyE(pc,'&a[0]='); if si^.artist=nil then pc:=StrCopyE(pc,'Unknown') - else pc:=encode(pc,si^.artist); + else pc:=Encode(pc,si^.artist); pc:=StrCopyE(pc,'&t[0]='); if si^.title =nil then pc:=StrCopyE(pc,'Unknown') - else pc:=encode(pc,si^.title); + else pc:=Encode(pc,si^.title); pc:=StrCopyE(pc,'&i[0]='); pc:=StrCopyE(pc,timestamp); pc:=StrCopyE(pc,'&r[0]=&m[0]='); pc:=StrCopyE(pc,'&l[0]='); @@ -176,7 +177,7 @@ begin begin pc:=StrCopyE(pc,'&o[0]=R'); end; - pc:=StrCopyE(pc,'&b[0]='); pc:=encode(pc,si^.album); + pc:=StrCopyE(pc,'&b[0]='); pc:=Encode(pc,si^.album); pc:=StrCopyE(pc,'&n[0]='); if si^.track<>0 then {pc:=}StrCopyE(pc,IntToStr(buf,si^.track)); @@ -225,13 +226,13 @@ end; var xmlparser:TXML_API_W; -function FixInfo(info:pWideChar):pWideChar; +function FixInfo(Info:pWideChar):pWideChar; var pc,ppc:pWideChar; cnt:cardinal; need:boolean; begin - pc:=info; + pc:=Info; cnt:=0; need:=false; while pc^<>#0 do @@ -248,8 +249,8 @@ begin end; if need then begin - mGetMem(result,(StrLenW(info)+1+cnt)*SizeOf(WideChar)); - pc:=info; + mGetMem(result,(StrLenW(Info)+1+cnt)*SizeOf(WideChar)); + pc:=Info; ppc:=result; while pc^<>#0 do begin @@ -265,7 +266,7 @@ begin ppc^:=#0; end else - StrDupW(result,info); + StrDupW(result,Info); end; function GetArtistInfo(var data:tLastFMInfo;lang:integer):int; diff --git a/plugins/Watrack/lastfm/i_last_dlg.inc b/plugins/Watrack/lastfm/i_last_dlg.inc index ee1f96092f..44beb5bdf7 100644 --- a/plugins/Watrack/lastfm/i_last_dlg.inc +++ b/plugins/Watrack/lastfm/i_last_dlg.inc @@ -18,13 +18,13 @@ const (code:'es' ; name: 'Spanish' ;) ); -procedure ClearInfo(dlg:HWND); +procedure ClearInfo(Dlg:HWND); begin - SetDlgItemTextW(dlg,IDC_DATA_ARTIST,''); - SetDlgItemTextW(dlg,IDC_DATA_ALBUM ,''); - SetDlgItemTextW(dlg,IDC_DATA_TRACK ,''); - SetDlgItemTextW(dlg,IDC_DATA_TAGS ,''); - SetDlgItemTextW(dlg,IDC_DATA_INFO ,''); + SetDlgItemTextW(Dlg,IDC_DATA_ARTIST,''); + SetDlgItemTextW(Dlg,IDC_DATA_ALBUM ,''); + SetDlgItemTextW(Dlg,IDC_DATA_TRACK ,''); + SetDlgItemTextW(Dlg,IDC_DATA_TAGS ,''); + SetDlgItemTextW(Dlg,IDC_DATA_INFO ,''); end; procedure ClearData(var data:tLastFMInfo); diff --git a/plugins/Watrack/lst_players.inc b/plugins/Watrack/lst_players.inc index 759b06cf51..6595e9766c 100644 --- a/plugins/Watrack/lst_players.inc +++ b/plugins/Watrack/lst_players.inc @@ -8,7 +8,7 @@ ,pl_mmonkey in 'players\pl_mmonkey.pas' ,pl_itunes in 'players\pl_itunes.pas' ,pl_cowon in 'players\pl_cowon.pas' -,pl_vlc in 'players\pl_vlc.pas' +//,pl_vlc in 'players\pl_vlc.pas' // keep file for check in future //,pl_wmp in 'players\pl_wmp.pas' ,pl_mpc in 'players\pl_mpc.pas' diff --git a/plugins/Watrack/myshows/i_myshows_api.inc b/plugins/Watrack/myshows/i_myshows_api.inc index 6341793016..f753da56f4 100644 --- a/plugins/Watrack/myshows/i_myshows_api.inc +++ b/plugins/Watrack/myshows/i_myshows_api.inc @@ -42,7 +42,7 @@ begin MessageBoxW(0,@buf,'ERROR',MB_ICONERROR) end; -function GetMD5Str(digest:TMD5Hash; buf:pAnsiChar):PAnsiChar; +function GetMD5Str(const digest:TMD5Hash; buf:pAnsiChar):PAnsiChar; begin buf[00]:=HexDigitChrLo[digest[00] shr 4]; buf[01]:=HexDigitChrLo[digest[00] and $0F]; buf[02]:=HexDigitChrLo[digest[01] shr 4]; buf[03]:=HexDigitChrLo[digest[01] and $0F]; @@ -189,11 +189,13 @@ begin // Show mark as "watching" pc:=StrCopyE(buf,API_URL+'profile/shows/'); FastWideToAnsiBuf(shId,pc); + {!!json_free(shId);} mir_free(shId); StrCat(pc,'/watching'); if SendMSRequest(buf,show) then begin // Episode check StrCopy(StrCopyE(buf,API_URL+'profile/episodes/check/'),epId); +// json_free(epId); // !! cause memory error (no need for GetName?) // StrCopy(request,API_URL+'profile/shows/'); if SendMSRequest(buf,show) then begin @@ -206,16 +208,15 @@ begin FastAnsiToWide(img,pSongInfoW(si)^.cover); json_free(img); end; -} +} + //!! add option to show it?? if ServiceExists(MS_POPUP_SHOWMESSAGEW)<>0 then begin - json_free(shId); - json_free(epId); - jn:=json_get(jroot,'show'); shId:=json_as_string(json_get(jn,'title')); + jn:=json_get(jn,'episodes'); jn:=json_get(jn,'episodes'); pWideChar(epId):=json_as_string(json_get(jn,'title')); @@ -231,12 +232,13 @@ begin '" checked'); CallService(MS_POPUP_SHOWMESSAGEW,TWPARAM(pc),SM_NOTIFY); mFreeMem(pc); + + {!!json_free(shId);} mir_free(shId); + {!!json_free(epId);} mir_free(epId); end; result:=true; end; end; - json_free(shId); - json_free(epId); json_delete(jroot); end; diff --git a/plugins/Watrack/myshows/i_myshows_dlg.inc b/plugins/Watrack/myshows/i_myshows_dlg.inc index 1f51ed7d11..da128900d9 100644 --- a/plugins/Watrack/myshows/i_myshows_dlg.inc +++ b/plugins/Watrack/myshows/i_myshows_dlg.inc @@ -3,13 +3,13 @@ const kinopoisk_info = 'http://www.kinopoisk.ru/level/1/film/'; -procedure ClearInfo(dlg:HWND); +procedure ClearInfo(Dlg:HWND); begin - SetDlgItemTextW(dlg,IDC_DATA_SERIES ,''); - SetDlgItemTextW(dlg,IDC_DATA_EPISODE,''); - SetDlgItemTextW(dlg,IDC_DATA_TAGS ,''); - SetDlgItemTextW(dlg,IDC_DATA_TAGS ,''); - SetDlgItemTextW(dlg,IDC_DATA_INFO ,''); + SetDlgItemTextW(Dlg,IDC_DATA_SERIES ,''); + SetDlgItemTextW(Dlg,IDC_DATA_EPISODE,''); + SetDlgItemTextW(Dlg,IDC_DATA_TAGS ,''); + SetDlgItemTextW(Dlg,IDC_DATA_TAGS ,''); + SetDlgItemTextW(Dlg,IDC_DATA_INFO ,''); end; function DlgProcOptions(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall; diff --git a/plugins/Watrack/player.ini b/plugins/Watrack/player.ini index 3006b4e83c..9e835bd950 100644 --- a/plugins/Watrack/player.ini +++ b/plugins/Watrack/player.ini @@ -236,6 +236,13 @@ class='TotalMedia2FDVDPlayerFrame' class='UltraPlayerMainWindowClass88667' url='http://www.ultraplayer.com/' +[VideoLAN VLC] +class='wxWindowClassNR' +class1='QWidget' +title='VLC media player' +file='VLC.EXE' +url='http://www.videolan.org/' + [ViPlay] class='ViPlay3' url='http://www.urusoft.net/' 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. diff --git a/plugins/Watrack/popup/pop_vars.inc b/plugins/Watrack/popup/pop_vars.inc index 2bbfce178b..0eee668070 100644 --- a/plugins/Watrack/popup/pop_vars.inc +++ b/plugins/Watrack/popup/pop_vars.inc @@ -5,14 +5,14 @@ var PopTitle, PopText:pWideChar; PopRequest, - PopUpFile:dword; - PopUpColor:dword; - PopUpFore, - PopUpBack:cardinal; - PopUpPause:cardinal; - PopUpDelay:integer; - PopUpAction:cardinal; - PopUpButtons:cardinal; + PopupFile:dword; + PopupColor:dword; + PopupFore, + PopupBack:cardinal; + PopupPause:cardinal; + PopupDelay:integer; + PopupAction:cardinal; + PopupButtons:cardinal; DisablePlugin:integer; IsPopup2Present:boolean; diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas index 212409324e..ca9462a12d 100644 --- a/plugins/Watrack/popup/popups.pas +++ b/plugins/Watrack/popup/popups.pas @@ -71,7 +71,7 @@ begin mFreeMem(buf); end; -function DumbPopupDlgProc(Wnd:HWND;msg:dword;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall; +function DumbPopupDlgProc(wnd:HWND;msg:dword;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall; var si:pSongInfo; h:HBITMAP; @@ -88,7 +88,7 @@ begin 2: ShowWindow(si^.plwnd,SW_RESTORE); 3: CallServiceSync(MS_WAT_PRESSBUTTON,WAT_CTRL_NEXT,0); end; - SendMessage(Wnd,UM_DESTROYPOPUP,0,0); + SendMessage(wnd,UM_DESTROYPOPUP,0,0); result:=1; end; UM_POPUPACTION: begin @@ -97,13 +97,13 @@ begin end; UM_FREEPLUGINDATA: begin h:=0; - h:=CallService(MS_POPUP_GETPLUGINDATA,Wnd,h); + h:=CallService(MS_POPUP_GETPLUGINDATA,wnd,h); if h<>0 then DeleteObject(h); result:=0; end; else - result:=DefWindowProc(Wnd,msg,wParam,lParam); + result:=DefWindowProc(wnd,msg,wParam,lParam); end; end; @@ -150,7 +150,6 @@ var Icon:HICON; sec:integer; cb,ct:TCOLORREF; - tmp:pAnsiChar; begin descr:=PWideChar(CallService(MS_WAT_REPLACETEXT,0,lparam(PopText))); title:=PWideChar(CallService(MS_WAT_REPLACETEXT,0,lparam(PopTitle))); @@ -218,9 +217,7 @@ begin hbmAvatar:=0; if hbmAvatar=0 then begin - WideToAnsi(si.cover,tmp); - hbmAvatar:=CallService(MS_UTILS_LOADBITMAP,0,lparam(tmp)); - mFreeMem(tmp); + hbmAvatar:=CallService(MS_UTILS_LOADBITMAPW,0,lparam(si.cover)); end; end; PluginData:=pointer(hbmAvatar); diff --git a/plugins/Watrack/srv_format.pas b/plugins/Watrack/srv_format.pas index c5f2cef6ed..d07f600411 100644 --- a/plugins/Watrack/srv_format.pas +++ b/plugins/Watrack/srv_format.pas @@ -25,9 +25,9 @@ function ServiceFormat(wParam:WPARAM;lParam:LPARAM):integer;cdecl; procedure RegisterFormat(ext:PAnsiChar;proc:tReadFormatProc;flags:dword=0); type - MusEnumProc = function(param:PAnsiChar;lParam:LPARAM):bool;stdcall; + TMusEnumProc = function(param:PAnsiChar;lParam:LPARAM):bool;stdcall; -function EnumFormats(param:MusEnumProc;lParam:LPARAM):bool; +function EnumFormats(param:TMusEnumProc;lParam:LPARAM):bool; function GetActiveFormat:pMusicFormat; type @@ -65,7 +65,7 @@ begin result:=@fmtLink^[0]; end; -function EnumFormats(param:MusEnumProc;lParam:LPARAM):bool; +function EnumFormats(param:TMusEnumProc;lParam:LPARAM):bool; var tmp:pFmtArray; i,j:integer; diff --git a/plugins/Watrack/srv_player.pas b/plugins/Watrack/srv_player.pas index 61429c345d..4c921500d2 100644 --- a/plugins/Watrack/srv_player.pas +++ b/plugins/Watrack/srv_player.pas @@ -22,9 +22,9 @@ procedure DefFillPlayerList (hwndList:HWND); procedure DefCheckPlayerList(hwndList:HWND); type - MusEnumProc = function(param:PAnsiChar;lParam:LPARAM):bool;stdcall; + TMusEnumProc = function(param:PAnsiChar;lParam:LPARAM):bool;stdcall; -function EnumPlayers(param:MusEnumProc;lParam:LPARAM):bool; +function EnumPlayers(param:TMusEnumProc;lParam:LPARAM):bool; function GetPlayerNote(name:PAnsiChar):pWideChar; function CheckAllPlayers(flags:integer;var status:integer; var PlayerChanged:bool):HWND; function GetActivePlayer:pPlayerCell; @@ -149,7 +149,7 @@ begin result:=@plyLink^[0]; end; -function EnumPlayers(param:MusEnumProc;lParam:LPARAM):bool; +function EnumPlayers(param:TMusEnumProc;lParam:LPARAM):bool; var tmp:pPlyArray; i,j:integer; diff --git a/plugins/Watrack/stat/statlog.pas b/plugins/Watrack/stat/statlog.pas index 5ff486747c..f2064f42c2 100644 --- a/plugins/Watrack/stat/statlog.pas +++ b/plugins/Watrack/stat/statlog.pas @@ -23,7 +23,7 @@ type Title :PAnsiChar; MFile :PAnsiChar; Album :PAnsiChar; - next :pStatCell; // only for fill + Next :pStatCell; // only for fill end; type @@ -269,12 +269,12 @@ begin result:=0; end; -procedure Resort(var Root:pCells;sort:integer;adirection:integer=smDirect); +procedure Resort(var Root:pCells;Sort:integer;aDirection:integer=smDirect); function CompareProc(First,Second:integer):integer; begin - result:=Compare(Root^.cells[First],Root^.cells[Second],sort); - if direction=smReverse then + result:=Compare(Root^.Cells[First],Root^.Cells[Second],sort); + if aDirection=smReverse then result:=-result; end; @@ -356,7 +356,7 @@ begin end else begin - CurCell^.next:=Cell; + CurCell^.Next:=Cell; CurCell:=Cell; end; end; @@ -374,7 +374,7 @@ begin while CurCell<>nil do begin arr^.Cells[i]:=CurCell; - CurCell:=CurCell.next; + CurCell:=CurCell.Next; inc(i); end; result:=arr; @@ -406,7 +406,7 @@ begin end; end; -procedure SortFile(fname:PAnsiChar;mode:integer;adirection:integer); +procedure SortFile(fname:PAnsiChar;mode:integer;aDirection:integer); var Root:pCells; buf:PAnsiChar; @@ -418,8 +418,8 @@ begin Root:=BuildTree(buf1,buf); if Root<>nil then begin - if (mode<>stArtist) or (adirection<>smDirect) then - Resort(Root,mode,adirection); + if (mode<>stArtist) or (aDirection<>smDirect) then + Resort(Root,mode,aDirection); OutputStat(buf1,Root); ClearStatCells(Root); end; diff --git a/plugins/Watrack/status/i_opt_11.inc b/plugins/Watrack/status/i_opt_11.inc index 2bb1546015..8039dae4c1 100644 --- a/plugins/Watrack/status/i_opt_11.inc +++ b/plugins/Watrack/status/i_opt_11.inc @@ -254,7 +254,7 @@ end; function DlgProcOptions11(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall; var - Item:LV_ITEMA; + item:LV_ITEMA; buf:array [0..127] of AnsiChar; i,j:integer; wnd:HWND; @@ -418,11 +418,11 @@ begin else //IDC_STATUSLIST begin - Item.iItem:=PNMLISTVIEW(lParam)^.iItem; - Item.mask:=LVIF_PARAM; - SendMessageA(PNMLISTVIEW(lParam)^.hdr.hwndFrom,LVM_GETITEMA,0,tlparam(@Item)); -// ListView_GetItemA(PNMLISTVIEW(lParam)^.hdr.hwndFrom,Item); - CurStatus:=GetStatusNum(Item.lParam); + item.iItem:=PNMLISTVIEW(lParam)^.iItem; + item.mask:=LVIF_PARAM; + SendMessageA(PNMLISTVIEW(lParam)^.hdr.hwndFrom,LVM_GETITEMA,0,tlparam(@item)); +// ListView_GetItemA(PNMLISTVIEW(lParam)^.hdr.hwndFrom,item); + CurStatus:=GetStatusNum(item.lParam); RedrawFields(Dialog); end; end diff --git a/plugins/Watrack/watrack.dpr b/plugins/Watrack/watrack.dpr index 7bd1de326b..54f3fbe986 100644 --- a/plugins/Watrack/watrack.dpr +++ b/plugins/Watrack/watrack.dpr @@ -568,7 +568,7 @@ begin CallService(MS_SYSTEM_WAITONHANDLE,hEvent,tlparam(p)); end; - loadopt; + LoadOpt; if DisablePlugin=dsPermanent then CallService(MS_WAT_PLUGINSTATUS,1,0); @@ -577,7 +577,7 @@ begin result:=0; HookEvent(ME_SYSTEM_MODULELOAD ,@OnPluginLoad); - HookEvent(ME_SYSTEM_MODULEUNLOAD,@OnPluginUnLoad); + HookEvent(ME_SYSTEM_MODULEUNLOAD,@OnPluginUnload); end; procedure FreeVariables; @@ -647,7 +647,7 @@ begin result:=0; end; -function Load():int; cdecl; +function Load:int; cdecl; begin result:=0; Langpack_register; -- cgit v1.2.3