summaryrefslogtreecommitdiff
path: root/plugins/Watrack/players
diff options
context:
space:
mode:
authorAlexey Kulakov <panda75@bk.ru>2014-04-05 17:52:11 +0000
committerAlexey Kulakov <panda75@bk.ru>2014-04-05 17:52:11 +0000
commitc4e2e2cfa438205154e7a074e46bd0fb267bb35d (patch)
treed75c11082a4d9f71a4858af52d216e3b2b907fd9 /plugins/Watrack/players
parent0b9c05beba5766dfc43e127244b1c4893e9c8a5d (diff)
mRadio "Quick Open" added
git-svn-id: http://svn.miranda-ng.org/main/trunk@8863 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack/players')
-rw-r--r--plugins/Watrack/players/pl_aimp.pas142
1 files changed, 74 insertions, 68 deletions
diff --git a/plugins/Watrack/players/pl_aimp.pas b/plugins/Watrack/players/pl_aimp.pas
index 17c52bc5b6..1711490e33 100644
--- a/plugins/Watrack/players/pl_aimp.pas
+++ b/plugins/Watrack/players/pl_aimp.pas
@@ -34,7 +34,7 @@ type
TAIMP2FileInfo = packed record
cbSizeOF :dword;
//
- nActive :LONGBOOL;
+ nActive :LongBool;
nBitRate :dword;
nChannels :dword;
nDuration :dword;
@@ -142,28 +142,31 @@ begin
s:=AIMP2_RemoteFileSize;
p:=AIMP2_RemoteClass;
FFile:=OpenFileMappingA(FILE_MAP_READ,True,p);
- pStr:=MapViewOfFile(FFile,FILE_MAP_READ,0,0,s);
- try
+ if FFile<>0 then
+ begin
+ pStr:=MapViewOfFile(FFile,FILE_MAP_READ,0,0,s);
if pStr<>nil then
begin
- with PAIMP2FileInfo(pStr)^ do
- begin
- StrDupW(result,
- pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo)+
- (nAlbumLen+nArtistLen+nDateLen)*SizeOf(WideChar)),
- nFileNameLen);
- // Delete rest index (like "filename.cue:3")
- pw :=StrRScanW(result,':');
- if pw<>nil then
- begin
- pw1:=StrScanW (result,':');
- if pw<>pw1 then
- pw^:=#0;
- end;
+ try
+ with PAIMP2FileInfo(pStr)^ do
+ begin
+ StrDupW(result,
+ pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo)+
+ (nAlbumLen+nArtistLen+nDateLen)*SizeOf(WideChar)),
+ nFileNameLen);
+ // Delete rest index (like "filename.cue:3")
+ pw :=StrRScanW(result,':');
+ if pw<>nil then
+ begin
+ pw1:=StrScanW (result,':');
+ if pw<>pw1 then
+ pw^:=#0;
+ end;
+ end;
+ except
end;
+ UnmapViewOfFile(pStr);
end;
- finally
- UnmapViewOfFile(pStr);
CloseHandle(FFile);
end;
end;
@@ -250,65 +253,68 @@ begin
s:=AIMP2_RemoteFileSize;
p:=AIMP2_RemoteClass;
FFile:=OpenFileMappingA(FILE_MAP_READ,True,p);
- pStr:=MapViewOfFile(FFile,FILE_MAP_READ,0,0,s);
- try
+ if FFile<>0 then
+ begin
+ pStr:=MapViewOfFile(FFile,FILE_MAP_READ,0,0,s);
if pStr<>nil then
begin
- with SongInfo do
- begin
- with pStr^ do
+ try
+ with SongInfo do
begin
- if channels=0 then channels:=nChannels;
- if kbps =0 then kbps :=nBitRate div 1000;
- if khz =0 then khz :=nSampleRate div 1000;
- if total =0 then total :=nduration;
- if fsize =0 then fsize :=nFileSize;
- if track =0 then track :=nTrackID;
-
- with PAIMP2FileInfo(pStr)^ do
+ with pStr^ do
begin
- if (artist=nil) and (nArtistLen>0) then
- begin
- StrDupW(artist,
- pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
- nAlbumLen,nArtistLen);
- end;
- if (album=nil) and (nAlbumLen>0) then
- begin
- StrDupW(album,
- pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo)),
- nAlbumLen);
- end;
- if (title=nil) and (nTitleLen>0) then
- begin
- StrDupW(title,
- pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
- nAlbumLen+nArtistLen+nDateLen+nFileNameLen+nGenreLen,
- nTitleLen);
- end;
- if (year=nil) and (nDateLen>0) then
- begin
- StrDupW(year,
- pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
- nAlbumLen+nArtistLen,
- nDateLen);
- end;
- if (genre=nil) and (nGenreLen>0) then
+ if channels=0 then channels:=nChannels;
+ if kbps =0 then kbps :=nBitRate div 1000;
+ if khz =0 then khz :=nSampleRate div 1000;
+ if total =0 then total :=nduration;
+ if fsize =0 then fsize :=nFileSize;
+ if track =0 then track :=nTrackID;
+
+ with PAIMP2FileInfo(pStr)^ do
begin
- StrDupW(genre,
- pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
- nAlbumLen+nArtistLen+nDateLen+nFileNameLen,
- nGenreLen);
- end;
+ if (artist=nil) and (nArtistLen>0) then
+ begin
+ StrDupW(artist,
+ pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
+ nAlbumLen,nArtistLen);
+ end;
+ if (album=nil) and (nAlbumLen>0) then
+ begin
+ StrDupW(album,
+ pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo)),
+ nAlbumLen);
+ end;
+ if (title=nil) and (nTitleLen>0) then
+ begin
+ StrDupW(title,
+ pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
+ nAlbumLen+nArtistLen+nDateLen+nFileNameLen+nGenreLen,
+ nTitleLen);
+ end;
+ if (year=nil) and (nDateLen>0) then
+ begin
+ StrDupW(year,
+ pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
+ nAlbumLen+nArtistLen,
+ nDateLen);
+ end;
+ if (genre=nil) and (nGenreLen>0) then
+ begin
+ StrDupW(genre,
+ pWideChar(PAnsiChar(pStr)+SizeOf(TAIMP2FileInfo))+
+ nAlbumLen+nArtistLen+nDateLen+nFileNameLen,
+ nGenreLen);
+ end;
- if StrPosW(mfile,'://')<>nil then
- TranslateRadio(SongInfo);
+ if StrPosW(mfile,'://')<>nil then
+ TranslateRadio(SongInfo);
+ end;
end;
end;
+ except
end;
+ UnmapViewOfFile(pStr);
end;
- finally
- UnmapViewOfFile(pStr);
CloseHandle(FFile);
end;
end