| 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 |
|
|---|
| 29 |
#ifdef HAVE_CONFIG_H |
|---|
| 30 |
# include "config.h" |
|---|
| 31 |
#endif |
|---|
| 32 |
|
|---|
| 33 |
#include <vlc_common.h> |
|---|
| 34 |
#include <vlc_plugin.h> |
|---|
| 35 |
#include <vlc_aout.h> |
|---|
| 36 |
|
|---|
| 37 |
#include <windows.h> |
|---|
| 38 |
#include <mmsystem.h> |
|---|
| 39 |
#include <dsound.h> |
|---|
| 40 |
|
|---|
| 41 |
#define FRAME_SIZE ((int)p_aout->output.output.i_rate/20) |
|---|
| 42 |
#define FRAMES_NUM 8 |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
#include <initguid.h> |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 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 DSSPEAKER_DSSPEAKER_DIRECTOUT |
|---|
| 89 |
# define DSSPEAKER_DSSPEAKER_DIRECTOUT 0x00000000 |
|---|
| 90 |
#endif |
|---|
| 91 |
#ifndef DSSPEAKER_HEADPHONE |
|---|
| 92 |
# define DSSPEAKER_HEADPHONE 0x00000001 |
|---|
| 93 |
#endif |
|---|
| 94 |
#ifndef DSSPEAKER_MONO |
|---|
| 95 |
# define DSSPEAKER_MONO 0x00000002 |
|---|
| 96 |
#endif |
|---|
| 97 |
#ifndef DSSPEAKER_QUAD |
|---|
| 98 |
# define DSSPEAKER_QUAD 0x00000003 |
|---|
| 99 |
#endif |
|---|
| 100 |
#ifndef DSSPEAKER_STEREO |
|---|
| 101 |
# define DSSPEAKER_STEREO 0x00000004 |
|---|
| 102 |
#endif |
|---|
| 103 |
#ifndef DSSPEAKER_SURROUND |
|---|
| 104 |
# define DSSPEAKER_SURROUND 0x00000005 |
|---|
| 105 |
#endif |
|---|
| 106 |
#ifndef DSSPEAKER_5POINT1 |
|---|
| 107 |
# define DSSPEAKER_5POINT1 0x00000006 |
|---|
| 108 |
#endif |
|---|
| 109 |
#ifndef DSSPEAKER_7POINT1 |
|---|
| 110 |
# define DSSPEAKER_7POINT1 0x00000007 |
|---|
| 111 |
#endif |
|---|
| 112 |
#ifndef DSSPEAKER_7POINT1_SURROUND |
|---|
| 113 |
# define DSSPEAKER_7POINT1_SURROUND 0x00000008 |
|---|
| 114 |
#endif |
|---|
| 115 |
#ifndef DSSPEAKER_7POINT1_WIDE |
|---|
| 116 |
# define DSSPEAKER_7POINT1_WIDE DSSPEAKER_7POINT1 |
|---|
| 117 |
#endif |
|---|
| 118 |
|
|---|
| 119 |
#ifndef _WAVEFORMATEXTENSIBLE_ |
|---|
| 120 |
typedef struct { |
|---|
| 121 |
WAVEFORMATEX Format; |
|---|
| 122 |
union { |
|---|
| 123 |
WORD wValidBitsPerSample; |
|---|
| 124 |
WORD wSamplesPerBlock; |
|---|
| 125 |
WORD wReserved; |
|---|
| 126 |
} Samples; |
|---|
| 127 |
DWORD dwChannelMask; |
|---|
| 128 |
|
|---|
| 129 |
GUID SubFormat; |
|---|
| 130 |
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; |
|---|
| 131 |
#endif |
|---|
| 132 |
|
|---|
| 133 |
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); |
|---|
| 134 |
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); |
|---|
| 135 |
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); |
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
typedef struct notification_thread_t |
|---|
| 141 |
{ |
|---|
| 142 |
VLC_COMMON_MEMBERS |
|---|
| 143 |
|
|---|
| 144 |
aout_instance_t *p_aout; |
|---|
| 145 |
int i_frame_size; |
|---|
| 146 |
int i_write_slot; |
|---|
| 147 |
|
|---|
| 148 |
mtime_t start_date; |
|---|
| 149 |
HANDLE event; |
|---|
| 150 |
|
|---|
| 151 |
} notification_thread_t; |
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
struct aout_sys_t |
|---|
| 160 |
{ |
|---|
| 161 |
HINSTANCE hdsound_dll; |
|---|
| 162 |
|
|---|
| 163 |
int i_device_id; |
|---|
| 164 |
LPGUID p_device_guid; |
|---|
| 165 |
|
|---|
| 166 |
LPDIRECTSOUND p_dsobject; |
|---|
| 167 |
LPDIRECTSOUNDBUFFER p_dsbuffer; |
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
notification_thread_t *p_notif; |
|---|
| 172 |
|
|---|
| 173 |
int b_playing; |
|---|
| 174 |
|
|---|
| 175 |
int i_frame_size; |
|---|
| 176 |
|
|---|
| 177 |
bool b_chan_reorder; |
|---|
| 178 |
int pi_chan_table[AOUT_CHAN_MAX]; |
|---|
| 179 |
uint32_t i_channel_mask; |
|---|
| 180 |
uint32_t i_bits_per_sample; |
|---|
| 181 |
uint32_t i_channels; |
|---|
| 182 |
}; |
|---|
| 183 |
|
|---|
| 184 |
static const uint32_t pi_channels_src[] = |
|---|
| 185 |
{ AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, |
|---|
| 186 |
AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, |
|---|
| 187 |
AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER, |
|---|
| 188 |
AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 }; |
|---|
| 189 |
static const uint32_t pi_channels_in[] = |
|---|
| 190 |
{ SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT, |
|---|
| 191 |
SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, |
|---|
| 192 |
SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER, |
|---|
| 193 |
SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 }; |
|---|
| 194 |
static const uint32_t pi_channels_out[] = |
|---|
| 195 |
{ SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT, |
|---|
| 196 |
SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, |
|---|
| 197 |
SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, |
|---|
| 198 |
SPEAKER_BACK_CENTER, |
|---|
| 199 |
SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 }; |
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
static int OpenAudio ( vlc_object_t * ); |
|---|
| 205 |
static void CloseAudio ( vlc_object_t * ); |
|---|
| 206 |
static void Play ( aout_instance_t * ); |
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
static void Probe ( aout_instance_t * ); |
|---|
| 210 |
static int InitDirectSound ( aout_instance_t * ); |
|---|
| 211 |
static int CreateDSBuffer ( aout_instance_t *, int, int, int, int, int, bool ); |
|---|
| 212 |
static int CreateDSBufferPCM ( aout_instance_t *, int*, int, int, int, bool ); |
|---|
| 213 |
static void DestroyDSBuffer ( aout_instance_t * ); |
|---|
| 214 |
static void* DirectSoundThread( vlc_object_t * ); |
|---|
| 215 |
static int FillBuffer ( aout_instance_t *, int, aout_buffer_t * ); |
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
#define DEVICE_TEXT N_("Output device") |
|---|
| 221 |
#define DEVICE_LONGTEXT N_( \ |
|---|
| 222 |
"DirectX device number: 0 default device, 1..N device by number" \ |
|---|
| 223 |
"(Note that the default device appears as 0 AND another number)." ) |
|---|
| 224 |
#define FLOAT_TEXT N_("Use float32 output") |
|---|
| 225 |
#define FLOAT_LONGTEXT N_( \ |
|---|
| 226 |
"The option allows you to enable or disable the high-quality float32 " \ |
|---|
| 227 |
"audio output mode (which is not well supported by some soundcards)." ) |
|---|
| 228 |
|
|---|
| 229 |
vlc_module_begin(); |
|---|
| 230 |
set_description( N_("DirectX audio output") ); |
|---|
| 231 |
set_shortname( "DirectX" ); |
|---|
| 232 |
set_capability( "audio output", 100 ); |
|---|
| 233 |
set_category( CAT_AUDIO ); |
|---|
| 234 |
set_subcategory( SUBCAT_AUDIO_AOUT ); |
|---|
| 235 |
add_shortcut( "directx" ); |
|---|
| 236 |
add_integer( "directx-audio-device", 0, NULL, DEVICE_TEXT, |
|---|
| 237 |
DEVICE_LONGTEXT, true ); |
|---|
| 238 |
add_bool( "directx-audio-float32", 0, 0, FLOAT_TEXT, |
|---|
| 239 |
FLOAT_LONGTEXT, true ); |
|---|
| 240 |
set_callbacks( OpenAudio, CloseAudio ); |
|---|
| 241 |
vlc_module_end(); |
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
static int OpenAudio( vlc_object_t *p_this ) |
|---|
| 249 |
{ |
|---|
| 250 |
aout_instance_t * p_aout = (aout_instance_t *)p_this; |
|---|
| 251 |
vlc_value_t val; |
|---|
| 252 |
|
|---|
| 253 |
msg_Dbg( p_aout, "OpenAudio" ); |
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 |
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 257 |
if( p_aout->output.p_sys == NULL ) |
|---|
| 258 |
return VLC_ENOMEM; |
|---|
| 259 |
|
|---|
| 260 |
|
|---|
| 261 |
p_aout->output.p_sys->p_dsobject = NULL; |
|---|
| 262 |
p_aout->output.p_sys->p_dsbuffer = NULL; |
|---|
| 263 |
p_aout->output.p_sys->p_notif = NULL; |
|---|
| 264 |
p_aout->output.p_sys->b_playing = 0; |
|---|
| 265 |
|
|---|
| 266 |
p_aout->output.pf_play = Play; |
|---|
| 267 |
aout_VolumeSoftInit( p_aout ); |
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 |
var_Create( p_aout, "directx-audio-float32", |
|---|
| 271 |
VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); |
|---|
| 272 |
var_Create( p_aout, "directx-audio-device", |
|---|
| 273 |
VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); |
|---|
| 274 |
var_Get( p_aout, "directx-audio-device", &val ); |
|---|
| 275 |
p_aout->output.p_sys->i_device_id = val.i_int; |
|---|
| 276 |
p_aout->output.p_sys->p_device_guid = 0; |
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 |
if( InitDirectSound( p_aout ) ) |
|---|
| 280 |
{ |
|---|
| 281 |
msg_Err( p_aout, "cannot initialize DirectSound" ); |
|---|
| 282 |
goto error; |
|---|
| 283 |
} |
|---|
| 284 |
|
|---|
| 285 |
if( var_Type( p_aout, "audio-device" ) == 0 ) |
|---|
| 286 |
{ |
|---|
| 287 |
Probe( p_aout ); |
|---|
| 288 |
} |
|---|
| 289 |
|
|---|
| 290 |
if( var_Get( p_aout, "audio-device", &val ) < 0 ) |
|---|
| 291 |
{ |
|---|
| 292 |
|
|---|
| 293 |
goto error; |
|---|
| 294 |
} |
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 |
if( val.i_int == AOUT_VAR_SPDIF ) |
|---|
| 298 |
{ |
|---|
| 299 |
p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i'); |
|---|
| 300 |
|
|---|
| 301 |
|
|---|
| 302 |
p_aout->output.i_nb_samples = A52_FRAME_NB; |
|---|
| 303 |
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE; |
|---|
| 304 |
p_aout->output.output.i_frame_length = A52_FRAME_NB; |
|---|
| 305 |
p_aout->output.p_sys->i_frame_size = |
|---|
| 306 |
p_aout->output.output.i_bytes_per_frame; |
|---|
| 307 |
|
|---|
| 308 |
if( CreateDSBuffer( p_aout, VLC_FOURCC('s','p','d','i'), |
|---|
| 309 |
p_aout->output.output.i_physical_channels, |
|---|
| 310 |
aout_FormatNbChannels( &p_aout->output.output ), |
|---|
| 311 |
p_aout->output.output.i_rate, |
|---|
| 312 |
p_aout->output.p_sys->i_frame_size, false ) |
|---|
| 313 |
!= VLC_SUCCESS ) |
|---|
| 314 |
{ |
|---|
| 315 |
msg_Err( p_aout, "cannot open directx audio device" ); |
|---|
| 316 |
free( p_aout->output.p_sys ); |
|---|
| 317 |
return VLC_EGENERIC; |
|---|
| 318 |
} |
|---|
| 319 |
|
|---|
| 320 |
aout_VolumeNoneInit( p_aout ); |
|---|
| 321 |
} |
|---|
| 322 |
else |
|---|
| 323 |
{ |
|---|
| 324 |
if( val.i_int == AOUT_VAR_5_1 ) |
|---|
| 325 |
{ |
|---|
| 326 |
p_aout->output.output.i_physical_channels |
|---|
| 327 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
|---|
| 328 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT |
|---|
| 329 |
| AOUT_CHAN_LFE; |
|---|
| 330 |
} |
|---|
| 331 |
else if( val.i_int == AOUT_VAR_7_1 ) |
|---|
| 332 |
{ |
|---|
| 333 |
p_aout->output.output.i_physical_channels |
|---|
| 334 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
|---|
| 335 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT |
|---|
| 336 |
| AOUT_CHAN_MIDDLELEFT | AOUT_CHAN_MIDDLERIGHT |
|---|
| 337 |
| AOUT_CHAN_LFE; |
|---|
| 338 |
} |
|---|
| 339 |
else if( val.i_int == AOUT_VAR_3F2R ) |
|---|
| 340 |
{ |
|---|
| 341 |
p_aout->output.output.i_physical_channels |
|---|
| 342 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
|---|
| 343 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; |
|---|
| 344 |
} |
|---|
| 345 |
else if( val.i_int == AOUT_VAR_2F2R ) |
|---|
| 346 |
{ |
|---|
| 347 |
p_aout->output.output.i_physical_channels |
|---|
| 348 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
|---|
| 349 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; |
|---|
| 350 |
} |
|---|
| 351 |
else if( val.i_int == AOUT_VAR_MONO ) |
|---|
| 352 |
{ |
|---|
| 353 |
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER; |
|---|
| 354 |
} |
|---|
| 355 |
else |
|---|
| 356 |
{ |
|---|
| 357 |
p_aout->output.output.i_physical_channels |
|---|
| 358 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; |
|---|
| 359 |
} |
|---|
| 360 |
|
|---|
| 361 |
if( CreateDSBufferPCM( p_aout, &p_aout->output.output.i_format, |
|---|
| 362 |
p_aout->output.output.i_physical_channels, |
|---|
| 363 |
aout_FormatNbChannels( &p_aout->output.output ), |
|---|
| 364 |
p_aout->output.output.i_rate, false ) |
|---|
| 365 |
!= VLC_SUCCESS ) |
|---|
| 366 |
{ |
|---|
| 367 |
msg_Err( p_aout, "cannot open directx audio device" ); |
|---|
| 368 |
free( p_aout->output.p_sys ); |
|---|
| 369 |
return VLC_EGENERIC; |
|---|
| 370 |
} |
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
p_aout->output.i_nb_samples = FRAME_SIZE; |
|---|
| 374 |
aout_FormatPrepare( &p_aout->output.output ); |
|---|
| 375 |
aout_VolumeSoftInit( p_aout ); |
|---|
| 376 |
} |
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
p_aout->output.p_sys->p_notif = |
|---|
| 380 |
vlc_object_create( p_aout, sizeof(notification_thread_t) ); |
|---|
| 381 |
p_aout->output.p_sys->p_notif->p_aout = p_aout; |
|---|
| 382 |
|
|---|
| 383 |
p_aout->output.p_sys->p_notif->event = CreateEvent( 0, FALSE, FALSE, 0 ); |
|---|
| 384 |
p_aout->output.p_sys->p_notif->i_frame_size = |
|---|
| 385 |
p_aout->output.p_sys->i_frame_size; |
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
msg_Dbg( p_aout, "creating DirectSoundThread" ); |
|---|
| 389 |
if( vlc_thread_create( p_aout->output.p_sys->p_notif, |
|---|
| 390 |
"DirectSound Notification Thread", |
|---|
| 391 |
DirectSoundThread, |
|---|
| 392 |
VLC_THREAD_PRIORITY_HIGHEST, false ) ) |
|---|
| 393 |
{ |
|---|
| 394 |
msg_Err( p_aout, "cannot create DirectSoundThread" ); |
|---|
| 395 |
CloseHandle( p_aout->output.p_sys->p_notif->event ); |
|---|
| 396 |
vlc_object_release( p_aout->output.p_sys->p_notif ); |
|---|
| 397 |
p_aout->output.p_sys->p_notif = NULL; |
|---|
| 398 |
goto error; |
|---|
| 399 |
} |
|---|
| 400 |
|
|---|
| 401 |
vlc_object_attach( p_aout->output.p_sys->p_notif, p_aout ); |
|---|
| 402 |
|
|---|
| 403 |
return VLC_SUCCESS; |
|---|
| 404 |
|
|---|
| 405 |
error: |
|---|
| 406 |
CloseAudio( VLC_OBJECT(p_aout) ); |
|---|
| 407 |
return VLC_EGENERIC; |
|---|
| 408 |
} |
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 |
static void Probe( aout_instance_t * p_aout ) |
|---|
| 414 |
{ |
|---|
| 415 |
vlc_value_t val, text; |
|---|
| 416 |
int i_format; |
|---|
| 417 |
unsigned int i_physical_channels; |
|---|
| 418 |
DWORD ui_speaker_config; |
|---|
| 419 |
bool is_default_output_set = false; |
|---|
| 420 |
|
|---|
| 421 |
var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); |
|---|
| 422 |
text.psz_string = _("Audio Device"); |
|---|
| 423 |
var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 424 |
|
|---|
| 425 |
|
|---|
| 426 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | |
|---|
| 427 |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | |
|---|
| 428 |
AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE; |
|---|
| 429 |
if( p_aout->output.output.i_physical_channels == i_physical_channels ) |
|---|
| 430 |
{ |
|---|
| 431 |
if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 6, |
|---|
| 432 |
p_aout->output.output.i_rate, true ) |
|---|
| 433 |
== VLC_SUCCESS ) |
|---|
| 434 |
{ |
|---|
| 435 |
val.i_int = AOUT_VAR_5_1; |
|---|
| 436 |
text.psz_string = "5.1"; |
|---|
| 437 |
var_Change( p_aout, "audio-device", |
|---|
| 438 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 439 |
var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL ); |
|---|
| 440 |
is_default_output_set = true; |
|---|
| 441 |
msg_Dbg( p_aout, "device supports 5.1 channels" ); |
|---|
| 442 |
} |
|---|
| 443 |
} |
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | |
|---|
| 447 |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | |
|---|
| 448 |
AOUT_CHAN_MIDDLELEFT | AOUT_CHAN_MIDDLERIGHT | |
|---|
| 449 |
AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE; |
|---|
| 450 |
if( p_aout->output.output.i_physical_channels == i_physical_channels ) |
|---|
| 451 |
{ |
|---|
| 452 |
if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 8, |
|---|
| 453 |
p_aout->output.output.i_rate, true ) |
|---|
| 454 |
== VLC_SUCCESS ) |
|---|
| 455 |
{ |
|---|
| 456 |
val.i_int = AOUT_VAR_7_1; |
|---|
| 457 |
text.psz_string = "7.1"; |
|---|
| 458 |
var_Change( p_aout, "audio-device", |
|---|
| 459 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 460 |
var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL ); |
|---|
| 461 |
is_default_output_set = true; |
|---|
| 462 |
msg_Dbg( p_aout, "device supports 7.1 channels" ); |
|---|
| 463 |
} |
|---|
| 464 |
} |
|---|
| 465 |
|
|---|
| 466 |
|
|---|
| 467 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | |
|---|
| 468 |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | |
|---|
| 469 |
AOUT_CHAN_REARRIGHT; |
|---|
| 470 |
if( p_aout->output.output.i_physical_channels == i_physical_channels ) |
|---|
| 471 |
{ |
|---|
| 472 |
if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 5, |
|---|
| 473 |
p_aout->output.output.i_rate, true ) |
|---|
| 474 |
== VLC_SUCCESS ) |
|---|
| 475 |
{ |
|---|
| 476 |
val.i_int = AOUT_VAR_3F2R; |
|---|
| 477 |
text.psz_string = N_("3 Front 2 Rear"); |
|---|
| 478 |
var_Change( p_aout, "audio-device", |
|---|
| 479 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 480 |
if(!is_default_output_set) |
|---|
| 481 |
{ |
|---|
| 482 |
var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL ); |
|---|
| 483 |
is_default_output_set = true; |
|---|
| 484 |
} |
|---|
| 485 |
msg_Dbg( p_aout, "device supports 5 channels" ); |
|---|
| 486 |
} |
|---|
| 487 |
} |
|---|
| 488 |
|
|---|
| 489 |
|
|---|
| 490 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | |
|---|
| 491 |
AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; |
|---|
| 492 |
if( ( p_aout->output.output.i_physical_channels & i_physical_channels ) |
|---|
| 493 |
== i_physical_channels ) |
|---|
| 494 |
{ |
|---|
| 495 |
if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 4, |
|---|
| 496 |
p_aout->output.output.i_rate, true ) |
|---|
| 497 |
== VLC_SUCCESS ) |
|---|
| 498 |
{ |
|---|
| 499 |
val.i_int = AOUT_VAR_2F2R; |
|---|
| 500 |
text.psz_string = N_("2 Front 2 Rear"); |
|---|
| 501 |
var_Change( p_aout, "audio-device", |
|---|
| 502 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 503 |
if(!is_default_output_set) |
|---|
| 504 |
{ |
|---|
| 505 |
var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL ); |
|---|
| 506 |
is_default_output_set = true; |
|---|
| 507 |
} |
|---|
| 508 |
msg_Dbg( p_aout, "device supports 4 channels" ); |
|---|
| 509 |
} |
|---|
| 510 |
} |
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 |
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; |
|---|
| 514 |
if( CreateDSBufferPCM( p_aout, &i_format, 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 = N_("Stereo"); |
|---|
| 520 |
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 521 |
if(!is_default_output_set) |
|---|
| 522 |
{ |
|---|
| 523 |
var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL ); |
|---|
| 524 |
is_default_output_set = true; |
|---|
| 525 |
msg_Dbg( p_aout, "device supports 2 channels (DEFAULT!)" ); |
|---|
| 526 |
} |
|---|
| 527 |
msg_Dbg( p_aout, "device supports 2 channels" ); |
|---|
| 528 |
} |
|---|
| 529 |
|
|---|
| 530 |
|
|---|
| 531 |
i_physical_channels = AOUT_CHAN_CENTER; |
|---|
| 532 |
if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 1, |
|---|
| 533 |
p_aout->output.output.i_rate, true ) |
|---|
| 534 |
== VLC_SUCCESS ) |
|---|
| 535 |
{ |
|---|
| 536 |
val.i_int = AOUT_VAR_MONO; |
|---|
| 537 |
text.psz_string = N_("Mono"); |
|---|
| 538 |
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 539 |
msg_Dbg( p_aout, "device supports 1 channel" ); |
|---|
| 540 |
} |
|---|
| 541 |
|
|---|
| 542 |
|
|---|
| 543 |
|
|---|
| 544 |
if FAILED( IDirectSound_GetSpeakerConfig( p_aout->output.p_sys->p_dsobject, |
|---|
| 545 |
&ui_speaker_config ) ) |
|---|
| 546 |
{ |
|---|
| 547 |
ui_speaker_config = DSSPEAKER_STEREO; |
|---|
| 548 |
msg_Dbg( p_aout, "GetSpeakerConfig failed" ); |
|---|
| 549 |
} |
|---|
| 550 |
switch( DSSPEAKER_CONFIG(ui_speaker_config) ) |
|---|
| 551 |
{ |
|---|
| 552 |
case DSSPEAKER_7POINT1: |
|---|
| 553 |
msg_Dbg( p_aout, "Windows says your SpeakerConfig is 7.1" ); |
|---|
| 554 |
val.i_int = AOUT_VAR_7_1; |
|---|
| 555 |
break; |
|---|
| 556 |
case DSSPEAKER_5POINT1: |
|---|
| 557 |
msg_Dbg( p_aout, "Windows says your SpeakerConfig is 5.1" ); |
|---|
| 558 |
val.i_int = AOUT_VAR_5_1; |
|---|
| 559 |
break; |
|---|
| 560 |
case DSSPEAKER_QUAD: |
|---|
| 561 |
msg_Dbg( p_aout, "Windows says your SpeakerConfig is Quad" ); |
|---|
| 562 |
val.i_int = AOUT_VAR_2F2R; |
|---|
| 563 |
break; |
|---|
| 564 |
#if 0 |
|---|
| 565 |
* this is a problem with VLC so just don't ever set mono by default. */ |
|---|
| 566 |
case DSSPEAKER_MONO: |
|---|
| 567 |
val.i_int = AOUT_VAR_MONO; |
|---|
| 568 |
break; |
|---|
| 569 |
#endif |
|---|
| 570 |
case DSSPEAKER_SURROUND: |
|---|
| 571 |
msg_Dbg( p_aout, "Windows says your SpeakerConfig is surround" ); |
|---|
| 572 |
case DSSPEAKER_STEREO: |
|---|
| 573 |
msg_Dbg( p_aout, "Windows says your SpeakerConfig is stereo" ); |
|---|
| 574 |
default: |
|---|
| 575 |
|
|---|
| 576 |
val.i_int = AOUT_VAR_STEREO; |
|---|
| 577 |
break; |
|---|
| 578 |
} |
|---|
| 579 |
var_Set( p_aout, "audio-device", val ); |
|---|
| 580 |
|
|---|
| 581 |
|
|---|
| 582 |
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) |
|---|
| 583 |
{ |
|---|
| 584 |
if( CreateDSBuffer( p_aout, VLC_FOURCC('s','p','d','i'), |
|---|
| 585 |
p_aout->output.output.i_physical_channels, |
|---|
| 586 |
aout_FormatNbChannels( &p_aout->output.output ), |
|---|
| 587 |
p_aout->output.output.i_rate, |
|---|
| 588 |
AOUT_SPDIF_SIZE, true ) |
|---|
| 589 |
== VLC_SUCCESS ) |
|---|
| 590 |
{ |
|---|
| 591 |
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" ); |
|---|
| 592 |
val.i_int = AOUT_VAR_SPDIF; |
|---|
| 593 |
text.psz_string = N_("A/52 over S/PDIF"); |
|---|
| 594 |
var_Change( p_aout, "audio-device", |
|---|
| 595 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 596 |
if( config_GetInt( p_aout, "spdif" ) ) |
|---|
| 597 |
var_Set( p_aout, "audio-device", val ); |
|---|
| 598 |
} |
|---|
| 599 |
} |
|---|
| 600 |
|
|---|
| 601 |
var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL ); |
|---|
| 602 |
if( val.i_int <= 0 ) |
|---|
| 603 |
{ |
|---|
| 604 |
|
|---|
| 605 |
var_Destroy( p_aout, "audio-device" ); |
|---|
| 606 |
return; |
|---|
| 607 |
} |
|---|
| 608 |
|
|---|
| 609 |
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL ); |
|---|
| 610 |
|
|---|
| 611 |
val.b_bool = true; |
|---|
| 612 |
var_Set( p_aout, "intf-change", val ); |
|---|
| 613 |
} |
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 |
|
|---|
| 620 |
static void Play( aout_instance_t *p_aout ) |
|---|
| 621 |
{ |
|---|
| 622 |
if( !p_aout->output.p_sys->b_playing ) |
|---|
| 623 |
{ |
|---|
| 624 |
aout_buffer_t *p_buffer; |
|---|
| 625 |
int i; |
|---|
| 626 |
|
|---|
| 627 |
p_aout->output.p_sys->b_playing = 1; |
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 |
p_aout->output.p_sys->p_notif->start_date = |
|---|
| 631 |
aout_FifoFirstDate( p_aout, &p_aout->output.fifo ); |
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
for( i = 0; i < FRAMES_NUM; i++ ) |
|---|
| 635 |
{ |
|---|
| 636 |
p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); |
|---|
| 637 |
if( !p_buffer ) break; |
|---|
| 638 |
FillBuffer( p_aout, i, p_buffer ); |
|---|
| 639 |
} |
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 |
SetEvent( p_aout->output.p_sys->p_notif->event ); |
|---|
| 643 |
} |
|---|
| 644 |
} |
|---|
| 645 |
|
|---|
| 646 |
|
|---|
| 647 |
|
|---|
| 648 |
|
|---|
| 649 |
static void CloseAudio( vlc_object_t *p_this ) |
|---|
| 650 |
{ |
|---|
| 651 |
aout_instance_t * p_aout = (aout_instance_t *)p_this; |
|---|
| 652 |
aout_sys_t *p_sys = p_aout->output.p_sys; |
|---|
| 653 |
|
|---|
| 654 |
msg_Dbg( p_aout, "closing audio device" ); |
|---|
| 655 |
|
|---|
| 656 |
|
|---|
| 657 |
if( p_sys->p_notif ) |
|---|
| 658 |
{ |
|---|
| 659 |
vlc_object_detach( p_sys->p_notif ); |
|---|
| 660 |
vlc_object_kill( p_sys->p_notif ); |
|---|
| 661 |
|
|---|
| 662 |
if( !p_sys->b_playing ) SetEvent( p_sys->p_notif->event ); |
|---|
| 663 |
|
|---|
| 664 |
vlc_thread_join( p_sys->p_notif ); |
|---|
| 665 |
vlc_object_release( p_sys->p_notif ); |
|---|
| 666 |
} |
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
DestroyDSBuffer( p_aout ); |
|---|
| 670 |
|
|---|
| 671 |
|
|---|
| 672 |
if( p_sys->p_dsobject ) IDirectSound_Release( p_sys->p_dsobject ); |
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 |
if( p_sys->hdsound_dll ) FreeLibrary( p_sys->hdsound_dll ); |
|---|
| 676 |
|
|---|
| 677 |
free( p_aout->output.p_sys->p_device_guid ); |
|---|
| 678 |
free( p_sys ); |
|---|
| 679 |
} |
|---|
| 680 |
|
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 |
|
|---|
| 684 |
static int CALLBACK CallBackDirectSoundEnum( LPGUID p_guid, LPCSTR psz_desc, |
|---|
| 685 |
LPCSTR psz_mod, LPVOID _p_aout ) |
|---|
| 686 |
{ |
|---|
| 687 |
aout_instance_t *p_aout = (aout_instance_t *)_p_aout; |
|---|
| 688 |
|
|---|
| 689 |
msg_Dbg( p_aout, "found device: %s", psz_desc ); |
|---|
| 690 |
|
|---|
| 691 |
if( p_aout->output.p_sys->i_device_id == 0 && p_guid ) |
|---|
| 692 |
{ |
|---|
| 693 |
p_aout->output.p_sys->p_device_guid = malloc( sizeof( GUID ) ); |
|---|
| 694 |
*p_aout->output.p_sys->p_device_guid = *p_guid; |
|---|
| 695 |
msg_Dbg( p_aout, "using device: %s", psz_desc ); |
|---|
| 696 |
} |
|---|
| 697 |
|
|---|
| 698 |
p_aout->output.p_sys->i_device_id--; |
|---|
| 699 |
return 1; |
|---|
| 700 |
} |
|---|
| 701 |
|
|---|
| 702 |
|
|---|
| 703 |
|
|---|
| 704 |
|
|---|
| 705 |
static int InitDirectSound( aout_instance_t *p_aout ) |
|---|
| 706 |
{ |
|---|
| 707 |
HRESULT (WINAPI *OurDirectSoundCreate)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN); |
|---|
| 708 |
HRESULT (WINAPI *OurDirectSoundEnumerate)(LPDSENUMCALLBACK, LPVOID); |
|---|
| 709 |
|
|---|
| 710 |
p_aout->output.p_sys->hdsound_dll = LoadLibrary("DSOUND.DLL"); |
|---|
| 711 |
if( p_aout->output.p_sys->hdsound_dll == NULL ) |
|---|
| 712 |
{ |
|---|
| 713 |
msg_Warn( p_aout, "cannot open DSOUND.DLL" ); |
|---|
| 714 |
goto error; |
|---|
| 715 |
} |
|---|
| 716 |
|
|---|
| 717 |
OurDirectSoundCreate = (void *) |
|---|
| 718 |
GetProcAddress( p_aout->output.p_sys->hdsound_dll, |
|---|
| 719 |
"DirectSoundCreate" ); |
|---|
| 720 |
if( OurDirectSoundCreate == NULL ) |
|---|
| 721 |
{ |
|---|
| 722 |
msg_Warn( p_aout, "GetProcAddress FAILED" ); |
|---|
| 723 |
goto error; |
|---|
| 724 |
} |
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 |
OurDirectSoundEnumerate = (void *) |
|---|
| 728 |
GetProcAddress( p_aout->output.p_sys->hdsound_dll, |
|---|
| 729 |
"DirectSoundEnumerateA" ); |
|---|
| 730 |
if( OurDirectSoundEnumerate ) |
|---|
| 731 |
{ |
|---|
| 732 |
|
|---|
| 733 |
if( FAILED( OurDirectSoundEnumerate( CallBackDirectSoundEnum, |
|---|
| 734 |
p_aout ) ) ) |
|---|
| 735 |
{ |
|---|
| 736 |
msg_Dbg( p_aout, "enumeration of DirectSound devices failed" ); |
|---|
| 737 |
} |
|---|
| 738 |
} |
|---|
| 739 |
|
|---|
| 740 |
|
|---|
| 741 |
if FAILED( OurDirectSoundCreate( p_aout->output.p_sys->p_device_guid, |
|---|
| 742 |
&p_aout->output.p_sys->p_dsobject, |
|---|
| 743 |
NULL ) ) |
|---|
| 744 |
{ |
|---|
| 745 |
msg_Warn( p_aout, "cannot create a direct sound device" ); |
|---|
| 746 |
goto error; |
|---|
| 747 |
} |
|---|
| 748 |
|
|---|
| 749 |
|
|---|
| 750 |
|
|---|
| 751 |
|
|---|
| 752 |
|
|---|
| 753 |
|
|---|
| 754 |
|
|---|
| 755 |
|
|---|
| 756 |
|
|---|
| 757 |
|
|---|
| 758 |
|
|---|
| 759 |
if( IDirectSound_SetCooperativeLevel( p_aout->output.p_sys->p_dsobject, |
|---|
| 760 |
GetDesktopWindow(), |
|---|
| 761 |
DSSCL_EXCLUSIVE) ) |
|---|
| 762 |
{ |
|---|
| 763 |
msg_Warn( p_aout, "cannot set direct sound cooperative level" ); |
|---|
| 764 |
} |
|---|
| 765 |
|
|---|
| 766 |
return VLC_SUCCESS; |
|---|
| 767 |
|
|---|
| 768 |
error: |
|---|
| 769 |
p_aout->output.p_sys->p_dsobject = NULL; |
|---|
| 770 |
if( p_aout->output.p_sys->hdsound_dll ) |
|---|
| 771 |
{ |
|---|
| 772 |
FreeLibrary( p_aout->output.p_sys->hdsound_dll ); |
|---|
| 773 |
p_aout->output.p_sys->hdsound_dll = NULL; |
|---|
| 774 |
} |
|---|
| 775 |
return VLC_EGENERIC; |
|---|
| 776 |
|
|---|
| 777 |
} |
|---|
| 778 |
|
|---|
| 779 |
|
|---|
| 780 |
|
|---|
| 781 |
|
|---|
| 782 |
|
|---|
| 783 |
|
|---|
| 784 |
|
|---|
| 785 |
|
|---|
| 786 |
|
|---|
| 787 |
|
|---|
| 788 |
|
|---|
| 789 |
|
|---|
| 790 |
|
|---|
| 791 |
static int CreateDSBuffer( aout_instance_t *p_aout, int i_format, |
|---|
| 792 |
int i_channels, int i_nb_channels, int i_rate, |
|---|
| 793 |
int i_bytes_per_frame, bool b_probe ) |
|---|
| 794 |
{ |
|---|
| 795 |
WAVEFORMATEXTENSIBLE waveformat; |
|---|
| 796 |
DSBUFFERDESC dsbdesc; |
|---|
| 797 |
unsigned int i; |
|---|
| 798 |
|
|---|
| 799 |
|
|---|
| 800 |
waveformat.dwChannelMask = 0; |
|---|
| 801 |
for( i = 0; i < sizeof(pi_channels_src)/sizeof(uint32_t); i++ ) |
|---|
| 802 |
{ |
|---|
| 803 |
if( i_channels & pi_channels_src[i] ) |
|---|
| 804 |
waveformat.dwChannelMask |= pi_channels_in[i]; |
|---|
| 805 |
} |
|---|
| 806 |
|
|---|
| 807 |
switch( i_format ) |
|---|
| 808 |
{ |
|---|
| 809 |
case VLC_FOURCC('s','p','d','i'): |
|---|
| 810 |
i_nb_channels = 2; |
|---|
| 811 |
|
|---|
| 812 |
waveformat.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; |
|---|
| 813 |
waveformat.Format.wBitsPerSample = 16; |
|---|
| 814 |
waveformat.Samples.wValidBitsPerSample = |
|---|
| 815 |
waveformat.Format.wBitsPerSample; |
|---|
| 816 |
waveformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; |
|---|
| 817 |
waveformat.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF; |
|---|
| 818 |
break; |
|---|
| 819 |
|
|---|
| 820 |
case VLC_FOURCC('f','l','3','2'): |
|---|
| 821 |
waveformat.Format.wBitsPerSample = sizeof(float) * 8; |
|---|
| 822 |
waveformat.Samples.wValidBitsPerSample = |
|---|
| 823 |
waveformat.Format.wBitsPerSample; |
|---|
| 824 |
waveformat.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; |
|---|
| 825 |
waveformat.SubFormat = _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; |
|---|
| 826 |
break; |
|---|
| 827 |
|
|---|
| 828 |
case VLC_FOURCC('s','1','6','l'): |
|---|
| 829 |
waveformat.Format.wBitsPerSample = 16; |
|---|
| 830 |
waveformat.Samples.wValidBitsPerSample = |
|---|
| 831 |
waveformat.Format.wBitsPerSample; |
|---|
| 832 |
waveformat.Format.wFormatTag = WAVE_FORMAT_PCM; |
|---|
| 833 |
waveformat.SubFormat = _KSDATAFORMAT_SUBTYPE_PCM; |
|---|
| 834 |
break; |
|---|
| 835 |
} |
|---|
| 836 |
|
|---|
| 837 |
waveformat.Format.nChannels = i_nb_channels; |
|---|
| 838 |
waveformat.Format.nSamplesPerSec = i_rate; |
|---|
| 839 |
waveformat.Format.nBlockAlign = |
|---|
| 840 |
waveformat.Format.wBitsPerSample / 8 * i_nb_channels; |
|---|
| 841 |
waveformat.Format.nAvgBytesPerSec = |
|---|
| 842 |
waveformat.Format.nSamplesPerSec * waveformat.Format.nBlockAlign; |
|---|
| 843 |
|
|---|
| 844 |
p_aout->output.p_sys->i_bits_per_sample = waveformat.Format.wBitsPerSample; |
|---|
| 845 |
|---|