Commit 81059f80 authored by Max Kellermann's avatar Max Kellermann

output/winmm: convert device name to filesystem charset

parent a2614422
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "../OutputAPI.hxx" #include "../OutputAPI.hxx"
#include "pcm/PcmBuffer.hxx" #include "pcm/PcmBuffer.hxx"
#include "mixer/MixerList.hxx" #include "mixer/MixerList.hxx"
#include "fs/AllocatedPath.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
...@@ -108,6 +109,11 @@ get_device_id(const char *device_name, UINT *device_id, Error &error) ...@@ -108,6 +109,11 @@ get_device_id(const char *device_name, UINT *device_id, Error &error)
} }
/* check for device name */ /* check for device name */
const AllocatedPath device_name_fs =
AllocatedPath::FromUTF8(device_name, error);
if (device_name_fs.IsNull())
return false;
for (UINT i = 0; i < numdevs; i++) { for (UINT i = 0; i < numdevs; i++) {
WAVEOUTCAPS caps; WAVEOUTCAPS caps;
MMRESULT result = waveOutGetDevCaps(i, &caps, sizeof(caps)); MMRESULT result = waveOutGetDevCaps(i, &caps, sizeof(caps));
...@@ -115,7 +121,7 @@ get_device_id(const char *device_name, UINT *device_id, Error &error) ...@@ -115,7 +121,7 @@ get_device_id(const char *device_name, UINT *device_id, Error &error)
continue; continue;
/* szPname is only 32 chars long, so it is often truncated. /* szPname is only 32 chars long, so it is often truncated.
Use partial match to work around this. */ Use partial match to work around this. */
if (StringStartsWith(device_name, caps.szPname)) { if (StringStartsWith(device_name_fs.c_str(), caps.szPname)) {
*device_id = i; *device_id = i;
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment