summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2013-07-20 20:05:14 -0300
committerwm4 <wm4@nowhere>2013-07-22 02:42:38 +0200
commit32cb190855bf9547ba70cef1c320c2033d8fcded (patch)
tree0c90b401435c7fbceae9d1da654618ab34309a16
parentefc3668fbe0d97de56e8399918f12f65b02fbaaa (diff)
downloadmpv-32cb190855bf9547ba70cef1c320c2033d8fcded.tar.bz2
mpv-32cb190855bf9547ba70cef1c320c2033d8fcded.tar.xz
ao_wasapi: Annotate the default device when listing devices
-rw-r--r--audio/out/ao_wasapi.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c
index 500627095e..4d8280d9dd 100644
--- a/audio/out/ao_wasapi.c
+++ b/audio/out/ao_wasapi.c
@@ -648,6 +648,15 @@ static HRESULT enumerate_with_state(char *header, int status, int with_id) {
&IID_IMMDeviceEnumerator, (void **)&pEnumerator);
EXIT_ON_ERROR(hr)
+ hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(pEnumerator,
+ eRender, eConsole,
+ &pDevice);
+ EXIT_ON_ERROR(hr)
+
+ char *defid = get_device_id(pDevice);
+
+ SAFE_RELEASE(pDevice, IMMDevice_Release(pDevice));
+
hr = IMMDeviceEnumerator_EnumAudioEndpoints(pEnumerator, eRender,
status, &pDevices);
EXIT_ON_ERROR(hr)
@@ -665,12 +674,16 @@ static HRESULT enumerate_with_state(char *header, int status, int with_id) {
char *name = get_device_name(pDevice);
char *id = get_device_id(pDevice);
+ char *mark = "";
+ if (strcmp(id, defid) == 0)
+ mark = " (default)";
+
if (with_id) {
- mp_msg(MSGT_AO, MSGL_INFO, "ao-wasapi: Device #%d: %s, ID: %s\n",
- i, name, id);
+ mp_msg(MSGT_AO, MSGL_INFO, "ao-wasapi: Device #%d: %s, ID: %s%s\n",
+ i, name, id, mark);
} else {
- mp_msg(MSGT_AO, MSGL_INFO, "ao-wasapi: %s, ID: %s\n",
- name, id);
+ mp_msg(MSGT_AO, MSGL_INFO, "ao-wasapi: %s, ID: %s%s\n",
+ name, id, mark);
}
free(name);