summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi.c
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-11 15:50:09 -0300
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2014-03-11 16:37:22 -0300
commita0347e0651e27be9910015f12baad58f50998203 (patch)
tree9d5ad7c7d8bd509c0fa4b0f3e90b8f955f6a4221 /audio/out/ao_wasapi.c
parentc5012946ee8273cb1c2879c9299e5959e7766ffc (diff)
downloadmpv-a0347e0651e27be9910015f12baad58f50998203.tar.bz2
mpv-a0347e0651e27be9910015f12baad58f50998203.tar.xz
ao_wasapi: Use the character set conversion functions from io.h
...rather than rolling out our own. The only possible advantage is that the "custom" ones didn't use talloc.
Diffstat (limited to 'audio/out/ao_wasapi.c')
-rw-r--r--audio/out/ao_wasapi.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c
index 2353fc4cc2..3d59554dcd 100644
--- a/audio/out/ao_wasapi.c
+++ b/audio/out/ao_wasapi.c
@@ -35,6 +35,7 @@
#include "audio/format.h"
#include "compat/atomics.h"
#include "osdep/timer.h"
+#include "osdep/io.h"
#define EXIT_ON_ERROR(hres) \
do { if (FAILED(hres)) { goto exit_label; } } while(0)
@@ -233,16 +234,6 @@ static int init(struct ao *ao)
return state->init_ret;
}
-static wchar_t* utf8_to_wstring(char *string) {
- if (string) {
- int len = MultiByteToWideChar(CP_UTF8, 0, string, -1, NULL, 0);
- wchar_t *ret = malloc(len * sizeof(wchar_t));
- MultiByteToWideChar(CP_UTF8, 0, string, -1, ret, len);
- return ret;
- }
- return NULL;
-}
-
static int control(struct ao *ao, enum aocontrol cmd, void *arg)
{
struct wasapi_state *state = (struct wasapi_state *)ao->priv;
@@ -297,7 +288,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
return CONTROL_OK;
case AOCONTROL_UPDATE_STREAM_TITLE: {
MP_VERBOSE(state, "Updating stream title to \"%s\"\n", (char*)arg);
- wchar_t *title = utf8_to_wstring((char*)arg);
+ wchar_t *title = mp_from_utf8(NULL, (char*)arg);
wchar_t *tmp = NULL;
@@ -311,7 +302,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
IAudioSessionControl_GetDisplayName(state->pSessionControlProxy, &tmp);
} while (lstrcmpW(title, tmp));
SAFE_RELEASE(tmp, CoTaskMemFree(tmp));
- free(title);
+ talloc_free(title);
return CONTROL_OK;
}