From: jmarshallnz Date: Fri, 14 Mar 2014 20:22:07 +0000 (+1300) Subject: Merge pull request #4425 from wsoltys/suspendinggb X-Git-Tag: Gotham_beta2~25 X-Git-Url: http://code.vuplus.com/gitweb/?a=commitdiff_plain;h=0e08c1259382a330bb25935ffb5efeb0820f2e36;hp=86de5b5e46408789f0f14feea5716452721a91eb;p=vuplus_xbmc Merge pull request #4425 from wsoltys/suspendinggb [WIN32] changed: don't call CAEFactory::DeviceChange() when PBT_APMSUSPEND was sent. --- diff --git a/xbmc/powermanagement/windows/Win32PowerSyscall.h b/xbmc/powermanagement/windows/Win32PowerSyscall.h index 02eb11b..87d2a15 100644 --- a/xbmc/powermanagement/windows/Win32PowerSyscall.h +++ b/xbmc/powermanagement/windows/Win32PowerSyscall.h @@ -45,6 +45,7 @@ public: static void SetOnResume() { m_OnResume = true; } static void SetOnSuspend() { m_OnSuspend = true; } + static bool IsSuspending() { return m_OnSuspend; } private: diff --git a/xbmc/win32/IMMNotificationClient.h b/xbmc/win32/IMMNotificationClient.h index aa07537..f240b1b 100644 --- a/xbmc/win32/IMMNotificationClient.h +++ b/xbmc/win32/IMMNotificationClient.h @@ -24,6 +24,7 @@ #include "system.h" // for SAFE_RELEASE #include "utils/log.h" #include "cores/AudioEngine/AEFactory.h" +#include "powermanagement/windows/Win32PowerSyscall.h" class CMMNotificationClient : public IMMNotificationClient { @@ -107,7 +108,7 @@ public: break; case eCommunications: pszRole = "eCommunications"; - CAEFactory::DeviceChange(); + NotifyAE(); break; } @@ -118,14 +119,14 @@ public: HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId) { CLog::Log(LOGDEBUG, "%s: Added device: %s", __FUNCTION__, pwstrDeviceId); - CAEFactory::DeviceChange(); + NotifyAE(); return S_OK; } HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId) { CLog::Log(LOGDEBUG, "%s: Removed device: %s", __FUNCTION__, pwstrDeviceId); - CAEFactory::DeviceChange(); + NotifyAE(); return S_OK; } @@ -149,7 +150,7 @@ public: break; } CLog::Log(LOGDEBUG, "%s: New device state is DEVICE_STATE_%s", __FUNCTION__, pszState); - CAEFactory::DeviceChange(); + NotifyAE(); return S_OK; } @@ -164,4 +165,10 @@ public: key.pid); return S_OK; } + + void STDMETHODCALLTYPE NotifyAE() + { + if(!CWin32PowerSyscall::IsSuspending()) + CAEFactory::DeviceChange(); + } }; \ No newline at end of file