Commit 68831708 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

waveout: force and use UNICODE

parent 983d967b
...@@ -30,11 +30,15 @@ ...@@ -30,11 +30,15 @@
# include "config.h" # include "config.h"
#endif #endif
#include <stdio.h>
#include <wchar.h>
#define UNICODE
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_aout_intf.h> #include <vlc_aout_intf.h>
#include <vlc_charset.h> /* FromLocaleDup, LocaleFree */ #include <vlc_charset.h> /* FromWide() */
#include <vlc_atomic.h> #include <vlc_atomic.h>
#include "windows_audio_common.h" #include "windows_audio_common.h"
...@@ -71,7 +75,7 @@ static int ReloadWaveoutDevices( vlc_object_t *, char const *, ...@@ -71,7 +75,7 @@ static int ReloadWaveoutDevices( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static uint32_t findDeviceID(char *); static uint32_t findDeviceID(char *);
static const char psz_device_name_fmt[] = "%s ($%x,$%x)"; static const wchar_t device_name_fmt[] = L"%ls ($%x,$%x)";
static const char *const ppsz_adev[] = { "wavemapper", }; static const char *const ppsz_adev[] = { "wavemapper", };
static const char *const ppsz_adev_text[] = { N_("Microsoft Soundmapper") }; static const char *const ppsz_adev_text[] = { N_("Microsoft Soundmapper") };
...@@ -192,7 +196,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -192,7 +196,7 @@ static int Open( vlc_object_t *p_this )
{ {
/* log debug some infos about driver, to know who to blame /* log debug some infos about driver, to know who to blame
if it doesn't work */ if it doesn't work */
msg_Dbg( p_aout, "Drivername: %s", waveoutcaps.szPname); msg_Dbg( p_aout, "Drivername: %ls", waveoutcaps.szPname);
msg_Dbg( p_aout, "Driver Version: %d.%d", msg_Dbg( p_aout, "Driver Version: %d.%d",
(waveoutcaps.vDriverVersion>>8)&255, (waveoutcaps.vDriverVersion>>8)&255,
waveoutcaps.vDriverVersion & 255); waveoutcaps.vDriverVersion & 255);
...@@ -1052,25 +1056,23 @@ static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name, ...@@ -1052,25 +1056,23 @@ static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,
p_item->ppsz_list_text = xrealloc( p_item->ppsz_list_text, p_item->ppsz_list_text = xrealloc( p_item->ppsz_list_text,
(wave_devices+2) * sizeof(char *) ); (wave_devices+2) * sizeof(char *) );
WAVEOUTCAPS caps;
char sz_dev_name[MAXPNAMELEN+32];
int j=1; int j=1;
for(int i=0; i<wave_devices; i++) for(int i=0; i<wave_devices; i++)
{ {
WAVEOUTCAPS caps;
wchar_t dev_name[MAXPNAMELEN+32];
if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS)) if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))
== MMSYSERR_NOERROR) != MMSYSERR_NOERROR)
{ continue;
sprintf( sz_dev_name, psz_device_name_fmt, caps.szPname,
caps.wMid, swprintf(dev_name, MAXPNAMELEN + 32, device_name_fmt,
caps.wPid caps.szPname, caps.wMid, caps.wPid);
); p_item->ppsz_list[j] = FromWide( dev_name );
p_item->ppsz_list[j] = FromLocaleDup( sz_dev_name ); p_item->ppsz_list_text[j] = FromWide( dev_name );
p_item->ppsz_list_text[j] = FromLocaleDup( sz_dev_name );
p_item->i_list++; p_item->i_list++;
j++; j++;
} }
}
p_item->ppsz_list[j] = NULL; p_item->ppsz_list[j] = NULL;
p_item->ppsz_list_text[j] = NULL; p_item->ppsz_list_text[j] = NULL;
...@@ -1092,27 +1094,25 @@ static uint32_t findDeviceID(char *psz_device_name) ...@@ -1092,27 +1094,25 @@ static uint32_t findDeviceID(char *psz_device_name)
return WAVE_MAPPER; return WAVE_MAPPER;
uint32_t wave_devices = waveOutGetNumDevs(); uint32_t wave_devices = waveOutGetNumDevs();
WAVEOUTCAPS caps;
char sz_dev_name[MAXPNAMELEN+32];
for( uint32_t i = 0; i < wave_devices; i++ ) for( uint32_t i = 0; i < wave_devices; i++ )
{ {
WAVEOUTCAPS caps;
wchar_t dev_name[MAXPNAMELEN+32];
if( waveOutGetDevCaps( i, &caps, sizeof(WAVEOUTCAPS) ) if( waveOutGetDevCaps( i, &caps, sizeof(WAVEOUTCAPS) )
== MMSYSERR_NOERROR) != MMSYSERR_NOERROR )
{ continue;
sprintf( sz_dev_name, psz_device_name_fmt, caps.szPname,
caps.wMid,
caps.wPid
);
char *psz_temp = FromLocaleDup(sz_dev_name);
if( !stricmp(psz_temp, psz_device_name) ) swprintf( dev_name, MAXPNAMELEN + 32, device_name_fmt,
caps.szPname, caps.wMid, caps.wPid );
char *u8 = FromWide(dev_name);
if( !stricmp(u8, psz_device_name) )
{ {
LocaleFree( psz_temp ); free( u8 );
return i; return i;
} }
LocaleFree( psz_temp ); free( u8 );
}
} }
return WAVE_MAPPER; return WAVE_MAPPER;
......
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