summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwatrack_mpd/main.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/watrack_mpd/main.c b/watrack_mpd/main.c
index ce0f60b..637580d 100755
--- a/watrack_mpd/main.c
+++ b/watrack_mpd/main.c
@@ -72,15 +72,16 @@ LPINFOPROC GetPlayerInfo(LPSONGINFO info, int flags)
info->total = SongInfo.total;
info->track = SongInfo.track;*/
info->time = SongInfo.time;
- _tcscpy(info->mfile, SongInfo.mfile);
- _tcscpy(info->txtver, SongInfo.txtver); //??
+ info->mfile = SongInfo.mfile;
+ info->txtver = SongInfo.txtver;
+ info->title = SongInfo.title;
/* info->url = SongInfo.url; //??
info->vbr = SongInfo.vbr;
info->volume = SongInfo.volume;
info->year = SongInfo.year;*/
- free(SongInfo.txtver);
- free(SongInfo.mfile);
- free(SongInfo.title);
+// free(SongInfo.txtver);
+// free(SongInfo.mfile);
+// free(SongInfo.title);
return 0;
}
@@ -102,7 +103,7 @@ void RegisterPlayer()
player.DeInit = (LPDEINITPROC)DeInit;
player.GetStatus = (LPGETSTATUSPROC)GetStatus;
player.Command = (LPCOMMANDPROC)SendCommand;
-// player.flags = (WAT_OPT_HASURL|WAT_OPT_SINGLEINST);
+ player.flags = (WAT_OPT_HASURL|WAT_OPT_SINGLEINST);
player.GetName = (LPNAMEPROC)GetFileName;
player.GetInfo = (LPINFOPROC)GetPlayerInfo;
// player.Icon = //TODO:implement icon support
@@ -154,7 +155,7 @@ int Parser(unsigned char *buf, int len)
return len;
}
-DWORD Reciever(LPVOID lp)
+DWORD __stdcall Reciever(LPVOID lp)
{
NETLIBOPENCONNECTION nloc = {0};
NETLIBPACKETRECVER nlpr = {0};
@@ -168,7 +169,7 @@ DWORD Reciever(LPVOID lp)
free(tmp);
nlpr.cbSize = sizeof(nlpr);
nlpr.dwTimeout = INFINITE;
- ghPacketReciever = (HANDLE)CallService(MS_NETLIB_RECV,(WPARAM)ghConnection,0x2400);
+ ghPacketReciever = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER,(WPARAM)ghConnection,0x2400);
while(ghConnection)
{
Netlib_Send(ghConnection, "currentsong\n", strlen("currentsong\n") + 1, 0);
@@ -179,6 +180,7 @@ DWORD Reciever(LPVOID lp)
if (recvResult == SOCKET_ERROR)
break;
nlpr.bytesUsed = Parser(nlpr.buffer, nlpr.bytesAvailable);
+ Sleep(1000);
}
return 0;
}
@@ -190,6 +192,7 @@ void Start()
}
void Stop()
{
+ TerminateThread(ghRecieverThread, 0);
if(ghNetlibUser && (ghNetlibUser != INVALID_HANDLE_VALUE))
CallService(MS_NETLIB_SHUTDOWN,(WPARAM)ghNetlibUser,0);
}