From 1d747d79f12d0343d2f49b4cbcb9a505122c302c Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 21 Apr 2012 22:36:19 +0300 Subject: [PATCH] NowPlaying.dll: Fixed negative duration with Winamp --- Plugins/PluginNowPlaying/PlayerWinamp.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Plugins/PluginNowPlaying/PlayerWinamp.cpp b/Plugins/PluginNowPlaying/PlayerWinamp.cpp index 8f29a223..4fd222ff 100644 --- a/Plugins/PluginNowPlaying/PlayerWinamp.cpp +++ b/Plugins/PluginNowPlaying/PlayerWinamp.cpp @@ -165,8 +165,10 @@ void CPlayerWinamp::UpdateData() if (!m_PlayingStream) { + int duration = SendMessage(m_Window, WM_WA_IPC, 1, IPC_GETOUTPUTTIME); + m_Duration = (duration != -1) ? duration : 0; + m_Rating = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETRATING); - m_Duration = SendMessage(m_Window, WM_WA_IPC, 1, IPC_GETOUTPUTTIME); m_Shuffle = (bool)SendMessage(m_Window, WM_WA_IPC, 0, IPC_GET_SHUFFLE); m_Repeat = (bool)SendMessage(m_Window, WM_WA_IPC, 0, IPC_GET_REPEAT); @@ -266,6 +268,12 @@ void CPlayerWinamp::UpdateData() } else if (!m_PlayingStream) { + if (m_Duration == 0) + { + int duration = SendMessage(m_Window, WM_WA_IPC, 1, IPC_GETOUTPUTTIME); + m_Duration = (duration != -1) ? duration : 0; + } + return; }