| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
#ifdef HAVE_CONFIG_H |
|---|
| 29 |
# include "config.h" |
|---|
| 30 |
#endif |
|---|
| 31 |
|
|---|
| 32 |
#include <vlc_common.h> |
|---|
| 33 |
#include <vlc_plugin.h> |
|---|
| 34 |
#include <vlc_aout.h> |
|---|
| 35 |
#include <vlc_charset.h> |
|---|
| 36 |
|
|---|
| 37 |
#include <windows.h> |
|---|
| 38 |
#include <mmsystem.h> |
|---|
| 39 |
|
|---|
| 40 |
#define FRAME_SIZE 4096 |
|---|
| 41 |
#define FRAMES_NUM 8 |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
#ifdef UNDER_CE |
|---|
| 47 |
# define DWORD_PTR DWORD |
|---|
| 48 |
# ifdef waveOutGetDevCaps |
|---|
| 49 |
# undef waveOutGetDevCaps |
|---|
| 50 |
MMRESULT WINAPI waveOutGetDevCaps(UINT, LPWAVEOUTCAPS, UINT); |
|---|
| 51 |
# endif |
|---|
| 52 |
#endif |
|---|
| 53 |
|
|---|
| 54 |
#ifndef WAVE_FORMAT_IEEE_FLOAT |
|---|
| 55 |
# define WAVE_FORMAT_IEEE_FLOAT 0x0003 |
|---|
| 56 |
#endif |
|---|
| 57 |
|
|---|
| 58 |
#ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF |
|---|
| 59 |
# define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 |
|---|
| 60 |
#endif |
|---|
| 61 |
|
|---|
| 62 |
#ifndef WAVE_FORMAT_EXTENSIBLE |
|---|
| 63 |
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE |
|---|
| 64 |
#endif |
|---|
| 65 |
|
|---|
| 66 |
#ifndef SPEAKER_FRONT_LEFT |
|---|
| 67 |
# define SPEAKER_FRONT_LEFT 0x1 |
|---|
| 68 |
# define SPEAKER_FRONT_RIGHT 0x2 |
|---|
| 69 |
# define SPEAKER_FRONT_CENTER 0x4 |
|---|
| 70 |
# define SPEAKER_LOW_FREQUENCY 0x8 |
|---|
| 71 |
# define SPEAKER_BACK_LEFT 0x10 |
|---|
| 72 |
# define SPEAKER_BACK_RIGHT 0x20 |
|---|
| 73 |
# define SPEAKER_FRONT_LEFT_OF_CENTER 0x40 |
|---|
| 74 |
# define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80 |
|---|
| 75 |
# define SPEAKER_BACK_CENTER 0x100 |
|---|
| 76 |
# define SPEAKER_SIDE_LEFT 0x200 |
|---|
| 77 |
# define SPEAKER_SIDE_RIGHT 0x400 |
|---|
| 78 |
# define SPEAKER_TOP_CENTER 0x800 |
|---|
| 79 |
# define SPEAKER_TOP_FRONT_LEFT 0x1000 |
|---|
| 80 |
# define SPEAKER_TOP_FRONT_CENTER 0x2000 |
|---|
| 81 |
# define SPEAKER_TOP_FRONT_RIGHT 0x4000 |
|---|
| 82 |
# define SPEAKER_TOP_BACK_LEFT 0x8000 |
|---|
| 83 |
# define SPEAKER_TOP_BACK_CENTER 0x10000 |
|---|
| 84 |
# define SPEAKER_TOP_BACK_RIGHT 0x20000 |
|---|
| 85 |
# define SPEAKER_RESERVED 0x80000000 |
|---|
| 86 |
#endif |
|---|
| 87 |
|
|---|
| 88 |
#ifndef _WAVEFORMATEXTENSIBLE_ |
|---|
| 89 |
typedef struct { |
|---|
| 90 |
WAVEFORMATEX Format; |
|---|
| 91 |
union { |
|---|
| 92 |
WORD wValidBitsPerSample; |
|---|
| 93 |
WORD wSamplesPerBlock; |
|---|
| 94 |
WORD wReserved; |
|---|
| 95 |
} Samples; |
|---|
| 96 |
DWORD dwChannelMask; |
|---|
| 97 |
|
|---|
| 98 |
GUID SubFormat; |
|---|
| 99 |
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; |
|---|
| 100 |
#endif |
|---|
| 101 |
|
|---|
| 102 |
static const GUID __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = {WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; |
|---|
| 103 |
static const GUID __KSDATAFORMAT_SUBTYPE_PCM = {WAVE_FORMAT_PCM, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; |
|---|
| 104 |
static const GUID __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
static int Open ( vlc_object_t * ); |
|---|
| 110 |
static void Close ( vlc_object_t * ); |
|---|
| 111 |
static void Play ( aout_instance_t * ); |
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
typedef struct notification_thread_t |
|---|
| 117 |
{ |
|---|
| 118 |
VLC_COMMON_MEMBERS |
|---|
| 119 |
aout_instance_t *p_aout; |
|---|
| 120 |
|
|---|
| 121 |
} notification_thread_t; |
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
static void Probe ( aout_instance_t * ); |
|---|
| 125 |
static int OpenWaveOut ( aout_instance_t *, uint32_t, |
|---|
| 126 |
int, int, int, int, bool ); |
|---|
| 127 |
static int OpenWaveOutPCM( aout_instance_t *, uint32_t, |
|---|
| 128 |
int*, int, int, int, bool ); |
|---|
| 129 |
static int PlayWaveOut ( aout_instance_t *, HWAVEOUT, WAVEHDR *, |
|---|
| 130 |
aout_buffer_t *, bool ); |
|---|
| 131 |
|
|---|
| 132 |
static void CALLBACK WaveOutCallback ( HWAVEOUT, UINT, DWORD, DWORD, DWORD ); |
|---|
| 133 |
static void* WaveOutThread( vlc_object_t * ); |
|---|
| 134 |
|
|---|
| 135 |
static int VolumeInfos( aout_instance_t *, audio_volume_t * ); |
|---|
| 136 |
static int VolumeGet( aout_instance_t *, audio_volume_t * ); |
|---|
| 137 |
static int VolumeSet( aout_instance_t *, audio_volume_t ); |
|---|
| 138 |
|
|---|
| 139 |
static int WaveOutClearDoneBuffers(aout_sys_t *p_sys); |
|---|
| 140 |
|
|---|
| 141 |
static int ReloadWaveoutDevices( vlc_object_t *, char const *, |
|---|
| 142 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 143 |
static uint32_t findDeviceID(char *); |
|---|
| 144 |
|
|---|
| 145 |
static const char psz_device_name_fmt[] = "%s ($%x,$%x)"; |
|---|
| 146 |
|
|---|
| 147 |
static const char *const ppsz_adev[] = { "wavemapper", }; |
|---|
| 148 |
static const char *const ppsz_adev_text[] = { N_("Microsoft Soundmapper") }; |
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
#define FLOAT_TEXT N_("Use float32 output") |
|---|
| 156 |
#define FLOAT_LONGTEXT N_( \ |
|---|
| 157 |
"The option allows you to enable or disable the high-quality float32 " \ |
|---|
| 158 |
"audio output mode (which is not well supported by some soundcards)." ) |
|---|
| 159 |
#define DEVICE_TEXT N_("Select Audio Device") |
|---|
| 160 |
#define DEVICE_LONG N_("Select special Audio device, or let windows "\ |
|---|
| 161 |
"decide (default), change needs VLC restart "\ |
|---|
| 162 |
"to apply.") |
|---|
| 163 |
#define DEFAULT_AUDIO_DEVICE N_("Default Audio Device") |
|---|
| 164 |
|
|---|
| 165 |
vlc_module_begin(); |
|---|
| 166 |
set_shortname( "WaveOut" ); |
|---|
| 167 |
set_description( N_("Win32 waveOut extension output") ); |
|---|
| 168 |
set_capability( "audio output", 50 ); |
|---|
| 169 |
set_category( CAT_AUDIO ); |
|---|
| 170 |
set_subcategory( SUBCAT_AUDIO_AOUT ); |
|---|
| 171 |
add_bool( "waveout-float32", 1, 0, FLOAT_TEXT, FLOAT_LONGTEXT, true ); |
|---|
| 172 |
|
|---|
| 173 |
add_string( "waveout-audio-device", "wavemapper", NULL, |
|---|
| 174 |
DEVICE_TEXT, DEVICE_LONG, false ); |
|---|
| 175 |
add_deprecated_alias( "waveout-dev" ); |
|---|
| 176 |
change_string_list( ppsz_adev, ppsz_adev_text, ReloadWaveoutDevices ); |
|---|
| 177 |
change_need_restart(); |
|---|
| 178 |
change_action_add( ReloadWaveoutDevices, N_("Refresh list") ); |
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
set_callbacks( Open, Close ); |
|---|
| 182 |
vlc_module_end(); |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
struct aout_sys_t |
|---|
| 191 |
{ |
|---|
| 192 |
uint32_t i_wave_device_id; |
|---|
| 193 |
|
|---|
| 194 |
HWAVEOUT h_waveout; |
|---|
| 195 |
|
|---|
| 196 |
WAVEFORMATEXTENSIBLE waveformat; |
|---|
| 197 |
|
|---|
| 198 |
WAVEHDR waveheader[FRAMES_NUM]; |
|---|
| 199 |
|
|---|
| 200 |
notification_thread_t *p_notif; |
|---|
| 201 |
HANDLE event; |
|---|
| 202 |
HANDLE new_buffer_event; |
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
int b_playing; |
|---|
| 206 |
mtime_t start_date; |
|---|
| 207 |
|
|---|
| 208 |
int i_repeat_counter; |
|---|
| 209 |
|
|---|
| 210 |
int i_buffer_size; |
|---|
| 211 |
|
|---|
| 212 |
uint8_t *p_silence_buffer; |
|---|
| 213 |
|
|---|
| 214 |
bool b_chan_reorder; |
|---|
| 215 |
int pi_chan_table[AOUT_CHAN_MAX]; |
|---|
| 216 |
}; |
|---|
| 217 |
|
|---|
| 218 |
static const uint32_t pi_channels_src[] = |
|---|
| 219 |
{ AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, |
|---|
| 220 |
AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, |
|---|
| 221 |
AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER, |
|---|
| 222 |
AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 }; |
|---|
| 223 |
static const uint32_t pi_channels_in[] = |
|---|
| 224 |
{ SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT, |
|---|
| 225 |
SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, |
|---|
| 226 |
SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER, |
|---|
| 227 |
SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 }; |
|---|
| 228 |
static const uint32_t pi_channels_out[] = |
|---|
| 229 |
{ SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT, |
|---|
| 230 |
SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, |
|---|
| 231 |
SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, |
|---|
| 232 |
SPEAKER_BACK_CENTER, |
|---|
| 233 |
SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 }; |
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
static int Open( vlc_object_t *p_this ) |
|---|
| 241 |
{ |
|---|
| 242 |
aout_instance_t *p_aout = (aout_instance_t *)p_this; |
|---|
| 243 |
vlc_value_t val; |
|---|
| 244 |
int i; |
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 248 |
|
|---|
| 249 |
if( p_aout->output.p_sys == NULL ) |
|---|
| 250 |
return VLC_ENOMEM; |
|---|
| 251 |
|
|---|
| 252 |
p_aout->output.pf_play = Play; |
|---|
| 253 |
p_aout->b_die = false; |
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 |
ReloadWaveoutDevices( p_this, "waveout-audio-device", val, val, NULL); |
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 |
char *psz_waveout_dev = var_CreateGetString( p_aout, "waveout-audio-device"); |
|---|
| 266 |
|
|---|
| 267 |
p_aout->output.p_sys->i_wave_device_id = |
|---|
| 268 |
findDeviceID( psz_waveout_dev ); |
|---|
| 269 |
|
|---|
| 270 |
if(p_aout->output.p_sys->i_wave_device_id == WAVE_MAPPER) |
|---|
| 271 |
{ |
|---|
| 272 |
if(psz_waveout_dev && |
|---|
| 273 |
stricmp(psz_waveout_dev,"wavemapper")) |
|---|
| 274 |
{ |
|---|
| 275 |
msg_Warn( p_aout, "configured audio device '%s' not available, "\ |
|---|
| 276 |
"use default instead", psz_waveout_dev ); |
|---|
| 277 |
} |
|---|
| 278 |
} |
|---|
| 279 |
free( psz_waveout_dev ); |
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
WAVEOUTCAPS waveoutcaps; |
|---|
| 283 |
if(waveOutGetDevCaps( p_aout->output.p_sys->i_wave_device_id, |
|---|
| 284 |
&waveoutcaps, |
|---|
| 285 |
sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) |
|---|
| 286 |
{ |
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
msg_Dbg( p_aout, "Drivername: %s", waveoutcaps.szPname); |
|---|
| 290 |
msg_Dbg( p_aout, "Driver Version: %d.%d", |
|---|
| 291 |
(waveoutcaps.vDriverVersion>>8)&255, |
|---|
| 292 |
waveoutcaps.vDriverVersion & 255); |
|---|
| 293 |
msg_Dbg( p_aout, "Manufacturer identifier: 0x%x", waveoutcaps.wMid ); |
|---|
| 294 |
msg_Dbg( p_aout, "Product identifier: 0x%x", waveoutcaps.wPid ); |
|---|
| 295 |
} |
|---|
| 296 |
|
|---|
| 297 |
|
|---|
| 298 |
|
|---|
| 299 |
if( var_Type( p_aout, "audio-device" ) == 0 ) |
|---|
| 300 |
{ |
|---|
| 301 |
Probe( p_aout ); |
|---|
| 302 |
} |
|---|
| 303 |
|
|---|
| 304 |
if( var_Get( p_aout, "audio-device", &val ) < 0 ) |
|---|
| 305 |
{ |
|---|
| 306 |
|
|---|
| 307 |
var_Destroy( p_aout, "waveout-audio-device"); |
|---|
| 308 |
free( p_aout->output.p_sys ); |
|---|
| 309 |
return VLC_EGENERIC; |
|---|
| 310 |
} |
|---|
| 311 |
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
if( val.i_int == AOUT_VAR_SPDIF ) |
|---|
| 315 |
{ |
|---|
| 316 |
p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i'); |
|---|
| 317 |
|
|---|
| 318 |
if( OpenWaveOut( p_aout, |
|---|
| 319 |
p_aout->output.p_sys->i_wave_device_id, |
|---|
| 320 |
VLC_FOURCC('s','p','d','i'), |
|---|
| 321 |
p_aout->output.output.i_physical_channels, |
|---|
| 322 |
aout_FormatNbChannels( &p_aout->output.output ), |
|---|
| 323 |
p_aout->output.output.i_rate, false ) |
|---|
| 324 |
!= VLC_SUCCESS ) |
|---|
| 325 |
{ |
|---|
| 326 |
msg_Err( p_aout, "cannot open waveout audio device" ); |
|---|
| 327 |
free( p_aout->output.p_sys ); |
|---|
| 328 |
return VLC_EGENERIC; |
|---|
| 329 |
} |
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
p_aout->output.i_nb_samples = A52_FRAME_NB; |
|---|
| 333 |
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE; |
|---|
| 334 |
p_aout->output.output.i_frame_length = A52_FRAME_NB; |
|---|
| 335 |
p_aout->output.p_sys->i_buffer_size = |
|---|
| 336 |
p_aout->output.output.i_bytes_per_frame; |
|---|
| 337 |
|
|---|
| 338 |
aout_VolumeNoneInit( p_aout ); |
|---|
| 339 |
} |
|---|
| 340 |
else |
|---|
| 341 |
{ |
|---|
| 342 |
WAVEOUTCAPS wocaps; |
|---|
| 343 |
|
|---|
| 344 |
if( val.i_int == AOUT_VAR_5_1 ) |
|---|
| 345 |
{ |
|---|
| 346 |
p_aout->output.output.i_physical_channels |
|---|
| 347 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
|---|
| 348 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT |
|---|
| 349 |
| AOUT_CHAN_LFE; |
|---|
| 350 |
} |
|---|
| 351 |
else if( val.i_int == AOUT_VAR_2F2R ) |
|---|
| 352 |
{ |
|---|
| 353 |
p_aout->output.output.i_physical_channels |
|---|
| 354 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
|---|
| 355 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; |
|---|
| 356 |
} |
|---|
| 357 |
else if( val.i_int == AOUT_VAR_MONO ) |
|---|
| 358 |
{ |
|---|
| 359 |
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER; |
|---|
| 360 |
} |
|---|
| 361 |
else |
|---|
| 362 |
{ |
|---|
| 363 |
p_aout->output.output.i_physical_channels |
|---|
| 364 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; |
|---|
| 365 |
} |
|---|
| 366 |
|
|---|
| 367 |
if( OpenWaveOutPCM( p_aout, |
|---|
| 368 |
p_aout->output.p_sys->i_wave_device_id, |
|---|
| 369 |
&p_aout->output.output.i_format, |
|---|
| 370 |
p_aout->output.output.i_physical_channels, |
|---|
| 371 |
aout_FormatNbChannels( &p_aout->output.output ), |
|---|
| 372 |
p_aout->output.output.i_rate, false ) |
|---|
| 373 |
!= VLC_SUCCESS ) |
|---|
| 374 |
{ |
|---|
| 375 |
msg_Err( p_aout, "cannot open waveout audio device" ); |
|---|
| 376 |
free( p_aout->output.p_sys ); |
|---|
| 377 |
return VLC_EGENERIC; |
|---|
| 378 |
} |
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
p_aout->output.i_nb_samples = FRAME_SIZE; |
|---|
| 382 |
aout_FormatPrepare( &p_aout->output.output ); |
|---|
| 383 |
p_aout->output.p_sys->i_buffer_size = FRAME_SIZE * |
|---|
| 384 |
p_aout->output.output.i_bytes_per_frame; |
|---|
| 385 |
|
|---|
| 386 |
aout_VolumeSoftInit( p_aout ); |
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 |
if( waveOutGetDevCaps( (UINT_PTR)p_aout->output.p_sys->h_waveout, |
|---|
| 390 |
&wocaps, sizeof(wocaps) ) == MMSYSERR_NOERROR && |
|---|
| 391 |
wocaps.dwSupport & WAVECAPS_VOLUME ) |
|---|
| 392 |
{ |
|---|
| 393 |
DWORD i_dummy; |
|---|
| 394 |
if( waveOutGetVolume( p_aout->output.p_sys->h_waveout, &i_dummy ) |
|---|
| 395 |
== MMSYSERR_NOERROR ) |
|---|
| 396 |
{ |
|---|
| 397 |
p_aout->output.pf_volume_infos = VolumeInfos; |
|---|
| 398 |
p_aout->output.pf_volume_get = VolumeGet; |
|---|
| 399 |
p_aout->output.pf_volume_set = VolumeSet; |
|---|
| 400 |
} |
|---|
| 401 |
} |
|---|
| 402 |
} |
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
waveOutReset( p_aout->output.p_sys->h_waveout ); |
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
p_aout->output.p_sys->p_silence_buffer = |
|---|
| 409 |
malloc( p_aout->output.p_sys->i_buffer_size ); |
|---|
| 410 |
if( p_aout->output.p_sys->p_silence_buffer == NULL ) |
|---|
| 411 |
{ |
|---|
| 412 |
free( p_aout->output.p_sys ); |
|---|
| 413 |
return 1; |
|---|
| 414 |
} |
|---|
| 415 |
p_aout->output.p_sys->i_repeat_counter = 0; |
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
memset( p_aout->output.p_sys->p_silence_buffer, 0, |
|---|
| 420 |
p_aout->output.p_sys->i_buffer_size ); |
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
p_aout->output.p_sys->p_notif = |
|---|
| 424 |
vlc_object_create( p_aout, sizeof(notification_thread_t) ); |
|---|
| 425 |
p_aout->output.p_sys->p_notif->p_aout = p_aout; |
|---|
| 426 |
p_aout->output.p_sys->event = CreateEvent( NULL, FALSE, FALSE, NULL ); |
|---|
| 427 |
p_aout->output.p_sys->new_buffer_event = CreateEvent( NULL, FALSE, FALSE, NULL ); |
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 |
p_aout->output.p_sys->b_playing = 0; |
|---|
| 432 |
p_aout->output.p_sys->start_date = 0; |
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 |
if( vlc_thread_create( p_aout->output.p_sys->p_notif, |
|---|
| 437 |
"waveOut Notification Thread", WaveOutThread, |
|---|
| 438 |
VLC_THREAD_PRIORITY_OUTPUT, false ) ) |
|---|
| 439 |
{ |
|---|
| 440 |
msg_Err( p_aout, "cannot create WaveOutThread" ); |
|---|
| 441 |
} |
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
for( i = 0; i < FRAMES_NUM; i++ ) |
|---|
| 446 |
{ |
|---|
| 447 |
p_aout->output.p_sys->waveheader[i].dwFlags = WHDR_DONE; |
|---|
| 448 |
p_aout->output.p_sys->waveheader[i].dwUser = 0; |
|---|
| 449 |
} |
|---|
| 450 |
|
|---|
| 451 |
return 0; |
|---|
| 452 |
} |
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
static void Probe( aout_instance_t * p_aout ) |
|---|
| 458 |
{ |
|---|
| 459 |
vlc_value_t val, text; |
|---|
| 460 |
int i_format; |
|---|
| 461 |
unsigned int i_physical_channels; |
|---|
| 462 |
|
|---|
| 463 |
var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); |
|---|
| 464 |
text.psz_string = _("Audio Device"); |
|---|
| 465 |
var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 466 |
|
|---|
| 467 |
|
|---|
| 468 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | |
|---|
| 469 |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | |
|---|
| 470 |
AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE; |
|---|
| 471 |
if( p_aout->output.output.i_physical_channels == i_physical_channels ) |
|---|
| 472 |
{ |
|---|
| 473 |
if( OpenWaveOutPCM( p_aout, |
|---|
| 474 |
p_aout->output.p_sys->i_wave_device_id, |
|---|
| 475 |
&i_format, |
|---|
| 476 |
i_physical_channels, 6, |
|---|
| 477 |
p_aout->output.output.i_rate, true ) |
|---|
| 478 |
== VLC_SUCCESS ) |
|---|
| 479 |
{ |
|---|
| 480 |
val.i_int = AOUT_VAR_5_1; |
|---|
| 481 |
text.psz_string = (char *)N_("5.1"); |
|---|
| 482 |
var_Change( p_aout, "audio-device", |
|---|
| 483 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 484 |
msg_Dbg( p_aout, "device supports 5.1 channels" ); |
|---|
| 485 |
} |
|---|
| 486 |
} |
|---|
| 487 |
|
|---|
| 488 |
|
|---|
| 489 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | |
|---|
| 490 |
AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; |
|---|
| 491 |
if( ( p_aout->output.output.i_physical_channels & i_physical_channels ) |
|---|
| 492 |
== i_physical_channels ) |
|---|
| 493 |
{ |
|---|
| 494 |
if( OpenWaveOutPCM( p_aout, |
|---|
| 495 |
p_aout->output.p_sys->i_wave_device_id, |
|---|
| 496 |
&i_format, |
|---|
| 497 |
i_physical_channels, 4, |
|---|
| 498 |
p_aout->output.output.i_rate, true ) |
|---|
| 499 |
== VLC_SUCCESS ) |
|---|
| 500 |
{ |
|---|
| 501 |
val.i_int = AOUT_VAR_2F2R; |
|---|
| 502 |
text.psz_string = (char *)N_("2 Front 2 Rear"); |
|---|
| 503 |
var_Change( p_aout, "audio-device", |
|---|
| 504 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 505 |
msg_Dbg( p_aout, "device supports 4 channels" ); |
|---|
| 506 |
} |
|---|
| 507 |
} |
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; |
|---|
| 511 |
if( OpenWaveOutPCM( p_aout, |
|---|
| 512 |
p_aout->output.p_sys->i_wave_device_id, |
|---|
| 513 |
&i_format, |
|---|
| 514 |
i_physical_channels, 2, |
|---|
| 515 |
p_aout->output.output.i_rate, true ) |
|---|
| 516 |
== VLC_SUCCESS ) |
|---|
| 517 |
{ |
|---|
| 518 |
val.i_int = AOUT_VAR_STEREO; |
|---|
| 519 |
text.psz_string = (char *)N_("Stereo"); |
|---|
| 520 |
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 521 |
msg_Dbg( p_aout, "device supports 2 channels" ); |
|---|
| 522 |
} |
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 |
i_physical_channels = AOUT_CHAN_CENTER; |
|---|
| 526 |
if( OpenWaveOutPCM( p_aout, |
|---|
| 527 |
p_aout->output.p_sys->i_wave_device_id, |
|---|
| 528 |
&i_format, |
|---|
| 529 |
i_physical_channels, 1, |
|---|
| 530 |
p_aout->output.output.i_rate, true ) |
|---|
| 531 |
== VLC_SUCCESS ) |
|---|
| 532 |
{ |
|---|
| 533 |
val.i_int = AOUT_VAR_MONO; |
|---|
| 534 |
text.psz_string = (char *)N_("Mono"); |
|---|
| 535 |
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 536 |
msg_Dbg( p_aout, "device supports 1 channel" ); |
|---|
| 537 |
} |
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 |
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) |
|---|
| 541 |
{ |
|---|
| 542 |
if( OpenWaveOut( p_aout, |
|---|
| 543 |
p_aout->output.p_sys->i_wave_device_id, |
|---|
| 544 |
VLC_FOURCC('s','p','d','i'), |
|---|
| 545 |
p_aout->output.output.i_physical_channels, |
|---|
| 546 |
aout_FormatNbChannels( &p_aout->output.output ), |
|---|
| 547 |
p_aout->output.output.i_rate, true ) |
|---|
| 548 |
== VLC_SUCCESS ) |
|---|
| 549 |
{ |
|---|
| 550 |
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" ); |
|---|
| 551 |
val.i_int = AOUT_VAR_SPDIF; |
|---|
| 552 |
text.psz_string = (char *)N_("A/52 over S/PDIF"); |
|---|
| 553 |
var_Change( p_aout, "audio-device", |
|---|
| 554 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 555 |
if( config_GetInt( p_aout, "spdif" ) ) |
|---|
| 556 |
var_Set( p_aout, "audio-device", val ); |
|---|
| 557 |
} |
|---|
| 558 |
} |
|---|
| 559 |
|
|---|
| 560 |
var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL ); |
|---|
| 561 |
if( val.i_int <= 0 ) |
|---|
| 562 |
{ |
|---|
| 563 |
|
|---|
| 564 |
var_Destroy( p_aout, "audio-device" ); |
|---|
| 565 |
return; |
|---|
| 566 |
} |
|---|
| 567 |
|
|---|
| 568 |
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL ); |
|---|
| 569 |
|
|---|
| 570 |
val.b_bool = true; |
|---|
| 571 |
var_Set( p_aout, "intf-change", val ); |
|---|
| 572 |
} |
|---|
| 573 |
|
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 |
|
|---|
| 578 |
|
|---|
| 579 |
|
|---|
| 580 |
static void Play( aout_instance_t *_p_aout ) |
|---|
| 581 |
{ |
|---|
| 582 |
if( !_p_aout->output.p_sys->b_playing ) |
|---|
| 583 |
{ |
|---|
| 584 |
_p_aout->output.p_sys->b_playing = 1; |
|---|
| 585 |
|
|---|
| 586 |
|
|---|
| 587 |
_p_aout->output.p_sys->start_date = |
|---|
| 588 |
aout_FifoFirstDate( _p_aout, &_p_aout->output.fifo ); |
|---|
| 589 |
|
|---|
| 590 |
msg_Dbg( _p_aout, "Wakeup sleeping output thread."); |
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 |
SetEvent( _p_aout->output.p_sys->event ); |
|---|
| 594 |
} else { |
|---|
| 595 |
SetEvent( _p_aout->output.p_sys->new_buffer_event ); |
|---|
| 596 |
} |
|---|
| 597 |
} |
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 |
|
|---|
| 601 |
|
|---|
| 602 |
static void Close( vlc_object_t *p_this ) |
|---|
| 603 |
{ |
|---|
| 604 |
aout_instance_t *p_aout = (aout_instance_t *)p_this; |
|---|
| 605 |
aout_sys_t *p_sys = p_aout->output.p_sys; |
|---|
| 606 |
|
|---|
| 607 |
|
|---|
| 608 |
vlc_object_kill( p_aout ); |
|---|
| 609 |
|
|---|
| 610 |
|
|---|
| 611 |
SetEvent( p_sys->event ); |
|---|
| 612 |
SetEvent( p_sys->new_buffer_event ); |
|---|
| 613 |
|
|---|
| 614 |
vlc_thread_join( p_sys->p_notif ); |
|---|
| 615 |
vlc_object_release( p_sys->p_notif ); |
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 |
|
|---|
| 620 |
|
|---|
| 621 |
|
|---|
| 622 |
|
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 |
|
|---|
| 627 |
MMRESULT result = waveOutReset( p_sys->h_waveout ); |
|---|
| 628 |
if(result != MMSYSERR_NOERROR) |
|---|
| 629 |
{ |
|---|
| 630 |
msg_Err( p_aout, "waveOutReset failed 0x%x", result ); |
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
|
|---|
| 635 |
if(result == MMSYSERR_NOTSUPPORTED) |
|---|
| 636 |
{ |
|---|
| 637 |
|
|---|
| 638 |
|
|---|
| 639 |
|
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 |
|
|---|
| 644 |
|
|---|
| 645 |
|
|---|
| 646 |
while( |
|---|
| 647 |
(WaveOutClearDoneBuffers( p_sys ) > 0) |
|---|
| 648 |
&& |
|---|
| 649 |
(WaitForSingleObject( p_sys->event, 5000) == WAIT_OBJECT_0) |
|---|
| 650 |
) |
|---|
| 651 |
{ |
|---|
| 652 |
msg_Dbg( p_aout, "Wait for waveout device..."); |
|---|
| 653 |
} |
|---|
| 654 |
} |
|---|
| 655 |
} else { |
|---|
| 656 |
WaveOutClearDoneBuffers( p_sys ); |
|---|
| 657 |
} |
|---|
| 658 |
|
|---|
| 659 |
|
|---|
| 660 |
if( waveOutClose( p_sys->h_waveout ) != MMSYSERR_NOERROR ) |
|---|
| 661 |
{ |
|---|
| 662 |
msg_Err( p_aout, "waveOutClose failed" ); |
|---|
| 663 |
} |
|---|
| 664 |
|
|---|
| 665 |
|
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
CloseHandle( p_sys->event ); |
|---|
| 670 |
CloseHandle( p_sys->new_buffer_event); |
|---|
| 671 |
|
|---|
| 672 |
free( p_sys->p_silence_buffer ); |
|---|
| 673 |
free( p_sys ); |
|---|
| 674 |
} |
|---|
| 675 |
|
|---|
| 676 |
|
|---|
| 677 |
|
|---|
| 678 |
|
|---|
| 679 |
static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_format, |
|---|
| 680 |
int i_channels, int i_nb_channels, int i_rate, |
|---|
| 681 |
bool b_probe ) |
|---|
| 682 |
{ |
|---|
| 683 |
MMRESULT result; |
|---|
| 684 |
unsigned int i; |
|---|
| 685 |
|
|---|
| 686 |
|
|---|
| 687 |
|
|---|
| 688 |
#define waveformat p_aout->output.p_sys->waveformat |
|---|
| 689 |
|
|---|
| 690 |
waveformat.dwChannelMask = 0; |
|---|
| 691 |
for( i = 0; i < sizeof(pi_channels_src)/sizeof(uint32_t); i++ ) |
|---|
| 692 |
{ |
|---|
| 693 |
if( i_channels & pi_channels_src[i] ) |
|---|
| 694 |
waveformat.dwChannelMask |= pi_channels_in[i]; |
|---|
| 695 |
} |
|---|
| 696 |
|
|---|
| 697 |
switch( i_format ) |
|---|
| 698 |
{ |
|---|
| 699 |
case VLC_FOURCC('s','p','d','i'): |
|---|
| 700 |
i_nb_channels = 2; |
|---|
| 701 |
|
|---|
| 702 |
waveformat.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; |
|---|
| 703 |
waveformat.Format.wBitsPerSample = 16; |
|---|
| 704 |
waveformat.Samples.wValidBitsPerSample = |
|---|
| 705 |
waveformat.Format.wBitsPerSample; |
|---|
| 706 |
waveformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; |
|---|
| 707 |
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF; |
|---|
| 708 |
break; |
|---|
| 709 |
|
|---|
| 710 |
case VLC_FOURCC('f','l','3','2'): |
|---|
| 711 |
waveformat.Format.wBitsPerSample = sizeof(float) * 8; |
|---|
| 712 |
waveformat.Samples.wValidBitsPerSample = |
|---|
| 713 |
waveformat.Format.wBitsPerSample; |
|---|
| 714 |
waveformat.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; |
|---|
| 715 |
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; |
|---|
| 716 |
break; |
|---|
| 717 |
|
|---|
| 718 |
case VLC_FOURCC('s','1','6','l'): |
|---|
| 719 |
waveformat.Format.wBitsPerSample = 16; |
|---|
| 720 |
waveformat.Samples.wValidBitsPerSample = |
|---|
| 721 |
waveformat.Format.wBitsPerSample; |
|---|
| 722 |
waveformat.Format.wFormatTag = WAVE_FORMAT_PCM; |
|---|
| 723 |
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_PCM; |
|---|
| 724 |
break; |
|---|
| 725 |
} |
|---|
| 726 |
|
|---|
| 727 |
waveformat.Format.nChannels = i_nb_channels; |
|---|
| 728 |
waveformat.Format.nSamplesPerSec = i_rate; |
|---|
| 729 |
waveformat.Format.nBlockAlign = |
|---|
| 730 |
waveformat.Format.wBitsPerSample / 8 * i_nb_channels; |
|---|
| 731 |
waveformat.Format.nAvgBytesPerSec = |
|---|
| 732 |
waveformat.Format.nSamplesPerSec * waveformat.Format.nBlockAlign; |
|---|
| 733 |
|
|---|
| 734 |
|
|---|
| 735 |
if( i_nb_channels <= 2 ) |
|---|
| 736 |
{ |
|---|
| 737 |
waveformat.Format.cbSize = 0; |
|---|
| 738 |
} |
|---|
| 739 |
else |
|---|
| 740 |
{ |
|---|
| 741 |
waveformat.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; |
|---|
| 742 |
waveformat.Format.cbSize = |
|---|
| 743 |
sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); |
|---|
| 744 |
} |
|---|
| 745 |
|
|---|
| 746 |
if(!b_probe) { |
|---|
| 747 |
msg_Dbg( p_aout, "OpenWaveDevice-ID: %u", i_device_id); |
|---|
| 748 |
msg_Dbg( p_aout,"waveformat.Format.cbSize = %d", |
|---|
| 749 |
waveformat.Format.cbSize); |
|---|
| 750 |
msg_Dbg( p_aout,"waveformat.Format.wFormatTag = %u", |
|---|
| 751 |
waveformat.Format.wFormatTag); |
|---|
| 752 |
msg_Dbg( p_aout,"waveformat.Format.nChannels = %u", |
|---|
| 753 |
waveformat.Format.nChannels); |
|---|
| 754 |
msg_Dbg( p_aout,"waveformat.Format.nSamplesPerSec = %d", |
|---|
| 755 |
(int)waveformat.Format.nSamplesPerSec); |
|---|
| 756 |
msg_Dbg( p_aout,"waveformat.Format.nAvgBytesPerSec = %u", |
|---|
| 757 |
(int)waveformat.Format.nAvgBytesPerSec); |
|---|
| 758 |
msg_Dbg( p_aout,"waveformat.Format.nBlockAlign = %d", |
|---|
| 759 |
waveformat.Format.nBlockAlign); |
|---|
| 760 |
msg_Dbg( p_aout,"waveformat.Format.wBitsPerSample = %d", |
|---|
| 761 |
waveformat.Format.wBitsPerSample); |
|---|
| 762 |
msg_Dbg( p_aout,"waveformat.Samples.wValidBitsPerSample = %d", |
|---|
| 763 |
waveformat.Samples.wValidBitsPerSample); |
|---|
| 764 |
msg_Dbg( p_aout,"waveformat.Samples.wSamplesPerBlock = %d", |
|---|
| 765 |
waveformat.Samples.wSamplesPerBlock); |
|---|
| 766 |
msg_Dbg( p_aout,"waveformat.dwChannelMask = %lu", |
|---|
| 767 |
waveformat.dwChannelMask); |
|---|
| 768 |
} |
|---|
| 769 |
|
|---|
| 770 |
|
|---|
| 771 |
result = waveOutOpen( &p_aout->output.p_sys->h_waveout, i_device_id, |
|---|
| 772 |
(WAVEFORMATEX *)&waveformat, |
|---|
| 773 |
(DWORD_PTR)WaveOutCallback, (DWORD_PTR)p_aout, |
|---|
| 774 |
CALLBACK_FUNCTION | (b_probe?WAVE_FORMAT_QUERY:0) ); |
|---|
| 775 |
if( result == WAVERR_BADFORMAT ) |
|---|
| 776 |
{ |
|---|
| 777 |
msg_Warn( p_aout, "waveOutOpen failed WAVERR_BADFORMAT" ); |
|---|
| 778 |
return VLC_EGENERIC; |
|---|
| 779 |
} |
|---|
| 780 |
if( result == MMSYSERR_ALLOCATED ) |
|---|
| 781 |
{ |
|---|
| 782 |
msg_Warn( p_aout, "waveOutOpen failed WAVERR_ALLOCATED" ); |
|---|
| 783 |
return VLC_EGENERIC; |
|---|
| 784 |
} |
|---|
| 785 |
if( result != MMSYSERR_NOERROR ) |
|---|
| 786 |
{ |
|---|
| 787 |
msg_Warn( p_aout, "waveOutOpen failed" ); |
|---|
| 788 |
return VLC_EGENERIC; |
|---|
| 789 |
} |
|---|
| 790 |
|
|---|
| 791 |
p_aout->output.p_sys->b_chan_reorder = |
|---|
| 792 |
aout_CheckChannelReorder( pi_channels_in, pi_channels_out, |
|---|
| 793 |
waveformat.dwChannelMask, i_nb_channels, |
|---|
| 794 |
p_aout->output.p_sys->pi_chan_table ); |
|---|
| 795 |
|
|---|
| 796 |
if( p_aout->output.p_sys->b_chan_reorder ) |
|---|
| 797 |
{ |
|---|
| 798 |
msg_Dbg( p_aout, "channel reordering needed" ); |
|---|
| 799 |
} |
|---|
| 800 |
|
|---|
| 801 |
return VLC_SUCCESS; |
|---|
| 802 |
|
|---|
| 803 |
#undef waveformat |
|---|
| 804 |
|
|---|
| 805 |
} |
|---|
| 806 |
|
|---|
| 807 |
|
|---|
| 808 |
|
|---|
| 809 |
|
|---|
| 810 |
static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i_format, |
|---|
| 811 |
int i_channels, int i_nb_channels, int i_rate, |
|---|
| 812 |
bool b_probe ) |
|---|
| 813 |
{ |
|---|
| 814 |
bool b_use_float32 = var_CreateGetBool( p_aout, "waveout-float32"); |
|---|
| 815 |
|
|---|
| 816 |
if( !b_use_float32 || OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('f','l','3','2'), |
|---|
| 817 |
i_channels, i_nb_channels, i_rate, b_probe ) |
|---|
| 818 |
!= VLC_SUCCESS ) |
|---|
| 819 |
{ |
|---|
| 820 |
if ( OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('s','1','6','l'), |
|---|
| 821 |
i_channels, i_nb_channels, i_rate, b_probe ) |
|---|
| 822 |
!= VLC_SUCCESS ) |
|---|
| 823 |
{ |
|---|
| 824 |
return VLC_EGENERIC; |
|---|
| 825 |
} |
|---|
| 826 |
else |
|---|
| 827 |
{ |
|---|
| 828 |
*i_format = VLC_FOURCC('s','1','6','l'); |
|---|
| 829 |
return VLC_SUCCESS; |
|---|
| 830 |
} |
|---|
| 831 |
} |
|---|
| 832 |
else |
|---|
| 833 |
{ |
|---|
| 834 |
*i_format = VLC_FOURCC('f','l','3','2'); |
|---|
| 835 |
return VLC_SUCCESS; |
|---|
| 836 |
} |
|---|
| 837 |
} |
|---|
| 838 |
|
|---|
| 839 |
|
|---|
| 840 |
|
|---|
| 841 |
|
|---|
| 842 |
static int PlayWaveOut( aout_instance_t *p_aout, HWAVEOUT h_waveout, |
|---|
| 843 |
WAVEHDR *p_waveheader, aout_buffer_t *p_buffer, |
|---|
| 844 |
bool b_spdif) |
|---|
| 845 |
{ |
|---|
| 846 |
MMRESULT result; |
|---|
| 847 |
|
|---|
| 848 |
|
|---|
| 849 |
if( p_buffer != NULL ) |
|---|
| 850 |
{ |
|---|
| 851 |
p_waveheader->lpData = p_buffer->p_buffer; |
|---|
| 852 |
|
|---|
| 853 |
|
|---|
| 854 |
|
|---|
| 855 |
|
|---|
| 856 |
|
|---|
| 857 |
|
|---|