summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi_utils.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-06-19 19:52:10 +0200
committersfan5 <sfan5@live.de>2023-06-21 17:31:59 +0200
commit71c80826f1e213012a92a786f5190abcf9e34ae9 (patch)
tree13ded44ea26df6193c1f1e4dcf852f4292ec8acf /audio/out/ao_wasapi_utils.c
parent3dc661fe8e262014567c5850b9d71f49de3df79a (diff)
downloadmpv-71c80826f1e213012a92a786f5190abcf9e34ae9.tar.bz2
mpv-71c80826f1e213012a92a786f5190abcf9e34ae9.tar.xz
ao_wasapi: use client name instead of hardcoded string
Diffstat (limited to 'audio/out/ao_wasapi_utils.c')
-rw-r--r--audio/out/ao_wasapi_utils.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index a696040dba..97a8e17b2f 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -31,8 +31,6 @@
#include "osdep/strnlen.h"
#include "ao_wasapi.h"
-#define MIXER_DEFAULT_LABEL L"mpv - video player"
-
DEFINE_PROPERTYKEY(mp_PKEY_Device_FriendlyName,
0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20,
0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
@@ -545,7 +543,7 @@ exit_label:
return hr;
}
-static void init_session_display(struct wasapi_state *state) {
+static void init_session_display(struct wasapi_state *state, const char *name) {
HRESULT hr = IAudioClient_GetService(state->pAudioClient,
&IID_IAudioSessionControl,
(void **)&state->pSessionControl);
@@ -560,14 +558,20 @@ static void init_session_display(struct wasapi_state *state) {
mp_HRESULT_to_str(hr));
}
- hr = IAudioSessionControl_SetDisplayName(state->pSessionControl,
- MIXER_DEFAULT_LABEL, NULL);
+ assert(name);
+ if (!name)
+ return;
+
+ wchar_t *title = mp_from_utf8(NULL, name);
+ hr = IAudioSessionControl_SetDisplayName(state->pSessionControl, title, NULL);
+ talloc_free(title);
+
EXIT_ON_ERROR(hr);
return;
exit_label:
// if we got here then the session control is useless - release it
SAFE_RELEASE(state->pSessionControl);
- MP_WARN(state, "Error setting audio session display name: %s\n",
+ MP_WARN(state, "Error setting audio session name: %s\n",
mp_HRESULT_to_str(hr));
return;
}
@@ -668,7 +672,7 @@ static HRESULT fix_format(struct ao *ao, bool align_hack)
hr = init_clock(state);
EXIT_ON_ERROR(hr);
- init_session_display(state);
+ init_session_display(state, ao->client_name);
init_volume_control(state);
#if !HAVE_UWP