aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWiSo <wiso@xbmc.org>2014-02-22 18:44:57 +0100
committerWiSo <wiso@xbmc.org>2014-02-23 13:20:04 +0100
commit815a2197b9ad40272da45d6e2991bb0c034d6e24 (patch)
treecf9a8b07302b6d2f78f6d47b70c37eff57a858f5
parentce69e5e2010b9eb0187f023bebfce3b5fe69da41 (diff)
[WIN32] hook up audio engine to device changes.
-rw-r--r--xbmc/win32/XBMC_PC.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/xbmc/win32/XBMC_PC.cpp b/xbmc/win32/XBMC_PC.cpp
index 97b552e3c9..fa20f4a04d 100644
--- a/xbmc/win32/XBMC_PC.cpp
+++ b/xbmc/win32/XBMC_PC.cpp
@@ -32,6 +32,8 @@
#include "GUIInfoManager.h"
#include "utils/StringUtils.h"
#include "utils/CPUInfo.h"
+#include <mmdeviceapi.h>
+#include "win32/IMMNotificationClient.h"
#ifndef _DEBUG
#define XBMC_TRACK_EXCEPTIONS
@@ -221,12 +223,28 @@ INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR commandLine, INT )
}
#endif
+ HRESULT hr = E_FAIL;
+ IMMDeviceEnumerator *pEnumerator = NULL;
+ CMMNotificationClient cMMNC;
+ hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator);
+ if(SUCCEEDED(hr))
+ {
+ pEnumerator->RegisterEndpointNotificationCallback(&cMMNC);
+ SAFE_RELEASE(pEnumerator);
+ }
+
g_application.Run();
// clear previously set timer resolution
timeEndPeriod(1);
// the end
+ hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator);
+ if(SUCCEEDED(hr))
+ {
+ pEnumerator->UnregisterEndpointNotificationCallback(&cMMNC);
+ SAFE_RELEASE(pEnumerator);
+ }
WSACleanup();
CoUninitialize();