/*****************************************************************************
* waveout.c : Windows waveOut plugin for vlc
*****************************************************************************
- * Copyright (C) 2001 the VideoLAN team
+ * Copyright (C) 2001-2009 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
+ * André Weber
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_charset.h>
-#include <windows.h>
-#include <mmsystem.h>
+#include "windows_audio_common.h"
#define FRAME_SIZE 4096 /* The size is in samples, not in bytes */
-#define FRAMES_NUM 8
-
-/*****************************************************************************
- * Useful macros
- *****************************************************************************/
-#ifdef UNDER_CE
-# define DWORD_PTR DWORD
-# ifdef waveOutGetDevCaps
-# undef waveOutGetDevCaps
- MMRESULT WINAPI waveOutGetDevCaps(UINT, LPWAVEOUTCAPS, UINT);
-# endif
-#endif
-
-#ifndef WAVE_FORMAT_IEEE_FLOAT
-# define WAVE_FORMAT_IEEE_FLOAT 0x0003
-#endif
-
-#ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
-# define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
-#endif
-
-#ifndef WAVE_FORMAT_EXTENSIBLE
-#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
-#endif
-
-#ifndef SPEAKER_FRONT_LEFT
-# define SPEAKER_FRONT_LEFT 0x1
-# define SPEAKER_FRONT_RIGHT 0x2
-# define SPEAKER_FRONT_CENTER 0x4
-# define SPEAKER_LOW_FREQUENCY 0x8
-# define SPEAKER_BACK_LEFT 0x10
-# define SPEAKER_BACK_RIGHT 0x20
-# define SPEAKER_FRONT_LEFT_OF_CENTER 0x40
-# define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
-# define SPEAKER_BACK_CENTER 0x100
-# define SPEAKER_SIDE_LEFT 0x200
-# define SPEAKER_SIDE_RIGHT 0x400
-# define SPEAKER_TOP_CENTER 0x800
-# define SPEAKER_TOP_FRONT_LEFT 0x1000
-# define SPEAKER_TOP_FRONT_CENTER 0x2000
-# define SPEAKER_TOP_FRONT_RIGHT 0x4000
-# define SPEAKER_TOP_BACK_LEFT 0x8000
-# define SPEAKER_TOP_BACK_CENTER 0x10000
-# define SPEAKER_TOP_BACK_RIGHT 0x20000
-# define SPEAKER_RESERVED 0x80000000
-#endif
-
-#ifndef _WAVEFORMATEXTENSIBLE_
-typedef struct {
- WAVEFORMATEX Format;
- union {
- WORD wValidBitsPerSample; /* bits of precision */
- WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
- WORD wReserved; /* If neither applies, set to zero. */
- } Samples;
- DWORD dwChannelMask; /* which channels are */
- /* present in stream */
- GUID SubFormat;
-} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
-#endif
-
-static const GUID __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = {WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-static const GUID __KSDATAFORMAT_SUBTYPE_PCM = {WAVE_FORMAT_PCM, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
-static const GUID __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
/*****************************************************************************
* Local prototypes
/* local functions */
static void Probe ( aout_instance_t * );
static int OpenWaveOut ( aout_instance_t *, uint32_t,
- int, int, int, int, vlc_bool_t );
+ int, int, int, int, bool );
static int OpenWaveOutPCM( aout_instance_t *, uint32_t,
- int*, int, int, int, vlc_bool_t );
+ vlc_fourcc_t*, int, int, int, bool );
static int PlayWaveOut ( aout_instance_t *, HWAVEOUT, WAVEHDR *,
- aout_buffer_t *, vlc_bool_t );
+ aout_buffer_t *, bool );
static void CALLBACK WaveOutCallback ( HWAVEOUT, UINT, DWORD, DWORD, DWORD );
-static void WaveOutThread( notification_thread_t * );
+static void* WaveOutThread( vlc_object_t * );
-static int VolumeInfos( aout_instance_t *, audio_volume_t * );
static int VolumeGet( aout_instance_t *, audio_volume_t * );
static int VolumeSet( aout_instance_t *, audio_volume_t );
static const char psz_device_name_fmt[] = "%s ($%x,$%x)";
-static const char *ppsz_adev[] = { "wavemapper", };
-static const char *ppsz_adev_text[] = { N_("Microsoft Soundmapper") };
+static const char *const ppsz_adev[] = { "wavemapper", };
+static const char *const ppsz_adev_text[] = { N_("Microsoft Soundmapper") };
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-#define FLOAT_TEXT N_("Use float32 output")
-#define FLOAT_LONGTEXT N_( \
- "The option allows you to enable or disable the high-quality float32 " \
- "audio output mode (which is not well supported by some soundcards)." )
#define DEVICE_TEXT N_("Select Audio Device")
#define DEVICE_LONG N_("Select special Audio device, or let windows "\
"decide (default), change needs VLC restart "\
"to apply.")
#define DEFAULT_AUDIO_DEVICE N_("Default Audio Device")
-vlc_module_begin();
- set_shortname( "WaveOut" );
- set_description( _("Win32 waveOut extension output") );
- set_capability( "audio output", 50 );
- set_category( CAT_AUDIO );
- set_subcategory( SUBCAT_AUDIO_AOUT );
- add_bool( "waveout-float32", 1, 0, FLOAT_TEXT, FLOAT_LONGTEXT, VLC_TRUE );
+vlc_module_begin ()
+ set_shortname( "WaveOut" )
+ set_description( N_("Win32 waveOut extension output") )
+ set_capability( "audio output", 50 )
+ set_category( CAT_AUDIO )
+ set_subcategory( SUBCAT_AUDIO_AOUT )
+ add_bool( "waveout-float32", true, NULL, FLOAT_TEXT, FLOAT_LONGTEXT, true )
- add_string( "waveout-dev", "wavemapper", NULL,
- DEVICE_TEXT, DEVICE_LONG, VLC_FALSE );
- change_string_list( ppsz_adev, ppsz_adev_text, ReloadWaveoutDevices );
- change_need_restart();
- change_action_add( ReloadWaveoutDevices, N_("Refresh list") );
+ add_string( "waveout-audio-device", "wavemapper", NULL,
+ DEVICE_TEXT, DEVICE_LONG, false )
+ add_deprecated_alias( "waveout-dev" ) /* deprecated since 0.9.3 */
+ change_string_list( ppsz_adev, ppsz_adev_text, ReloadWaveoutDevices )
+ change_need_restart ()
+ change_action_add( ReloadWaveoutDevices, N_("Refresh list") )
- set_callbacks( Open, Close );
-vlc_module_end();
+ set_callbacks( Open, Close )
+vlc_module_end ()
/*****************************************************************************
* aout_sys_t: waveOut audio output method descriptor
int i_buffer_size;
- byte_t *p_silence_buffer; /* buffer we use to play silence */
+ uint8_t *p_silence_buffer; /* buffer we use to play silence */
- vlc_bool_t b_chan_reorder; /* do we need channel reordering */
+ bool b_chan_reorder; /* do we need channel reordering */
int pi_chan_table[AOUT_CHAN_MAX];
};
-static const uint32_t pi_channels_src[] =
- { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
- AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
- AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
- AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
-static const uint32_t pi_channels_in[] =
- { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
- SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
- SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
- SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 };
-static const uint32_t pi_channels_out[] =
- { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
- SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
- SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
- SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 };
-
/*****************************************************************************
* Open: open the audio device
*****************************************************************************
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
vlc_value_t val;
- int i;
/* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL )
- {
- msg_Err( p_aout, "out of memory" );
- return VLC_EGENERIC;
- }
+ return VLC_ENOMEM;
p_aout->output.pf_play = Play;
- p_aout->b_die = VLC_FALSE;
+ p_aout->b_die = false;
/*
initialize/update Device selection List
*/
- ReloadWaveoutDevices( p_this, "waveout-dev", val, val, NULL);
+ ReloadWaveoutDevices( p_this, "waveout-audio-device", val, val, NULL);
/*
check for configured audio device!
*/
- char *psz_waveout_dev = var_CreateGetString( p_aout, "waveout-dev");
+ char *psz_waveout_dev = var_CreateGetString( p_aout, "waveout-audio-device");
p_aout->output.p_sys->i_wave_device_id =
findDeviceID( psz_waveout_dev );
"use default instead", psz_waveout_dev );
}
}
- if(psz_waveout_dev) free( psz_waveout_dev );
+ free( psz_waveout_dev );
WAVEOUTCAPS waveoutcaps;
if( var_Get( p_aout, "audio-device", &val ) < 0 )
{
/* Probe() has failed. */
- var_Destroy( p_aout, "waveout-device");
+ var_Destroy( p_aout, "waveout-audio-device");
free( p_aout->output.p_sys );
return VLC_EGENERIC;
}
/* Open the device */
if( val.i_int == AOUT_VAR_SPDIF )
{
- p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
+ p_aout->output.output.i_format = VLC_CODEC_SPDIFL;
if( OpenWaveOut( p_aout,
p_aout->output.p_sys->i_wave_device_id,
- VLC_FOURCC('s','p','d','i'),
+ VLC_CODEC_SPDIFL,
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
- p_aout->output.output.i_rate, VLC_FALSE )
+ p_aout->output.output.i_rate, false )
!= VLC_SUCCESS )
{
msg_Err( p_aout, "cannot open waveout audio device" );
{
WAVEOUTCAPS wocaps;
- if( val.i_int == AOUT_VAR_5_1 )
+ switch( val.i_int )
{
+ case AOUT_VAR_5_1:
p_aout->output.output.i_physical_channels
- = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
- | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
- | AOUT_CHAN_LFE;
- }
- else if( val.i_int == AOUT_VAR_2F2R )
- {
+ = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
+ | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
+ | AOUT_CHAN_LFE;
+ break;
+ case AOUT_VAR_2F2R:
p_aout->output.output.i_physical_channels
- = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
- | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
- }
- else if( val.i_int == AOUT_VAR_MONO )
- {
+ = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
+ | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
+ break;
+ case AOUT_VAR_MONO:
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER;
- }
- else
- {
+ break;
+ default:
p_aout->output.output.i_physical_channels
- = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
+ = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
if( OpenWaveOutPCM( p_aout,
&p_aout->output.output.i_format,
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
- p_aout->output.output.i_rate, VLC_FALSE )
+ p_aout->output.output.i_rate, false )
!= VLC_SUCCESS )
{
msg_Err( p_aout, "cannot open waveout audio device" );
if( waveOutGetVolume( p_aout->output.p_sys->h_waveout, &i_dummy )
== MMSYSERR_NOERROR )
{
- p_aout->output.pf_volume_infos = VolumeInfos;
p_aout->output.pf_volume_get = VolumeGet;
p_aout->output.pf_volume_set = VolumeSet;
}
if( p_aout->output.p_sys->p_silence_buffer == NULL )
{
free( p_aout->output.p_sys );
- msg_Err( p_aout, "out of memory" );
- return 1;
+ return VLC_ENOMEM;
}
p_aout->output.p_sys->i_repeat_counter = 0;
/* Then launch the notification thread */
if( vlc_thread_create( p_aout->output.p_sys->p_notif,
"waveOut Notification Thread", WaveOutThread,
- VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) )
+ VLC_THREAD_PRIORITY_OUTPUT ) )
{
msg_Err( p_aout, "cannot create WaveOutThread" );
}
/* We need to kick off the playback in order to have the callback properly
* working */
- for( i = 0; i < FRAMES_NUM; i++ )
+ for( int i = 0; i < FRAMES_NUM; i++ )
{
p_aout->output.p_sys->waveheader[i].dwFlags = WHDR_DONE;
p_aout->output.p_sys->waveheader[i].dwUser = 0;
}
- return 0;
+ return VLC_SUCCESS;
}
/*****************************************************************************
static void Probe( aout_instance_t * p_aout )
{
vlc_value_t val, text;
- int i_format;
+ vlc_fourcc_t i_format;
unsigned int i_physical_channels;
var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 6,
- p_aout->output.output.i_rate, VLC_TRUE )
+ p_aout->output.output.i_rate, true )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_5_1;
- text.psz_string = (char *)N_("5.1");
+ text.psz_string = (char *)_("5.1");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 5.1 channels" );
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 4,
- p_aout->output.output.i_rate, VLC_TRUE )
+ p_aout->output.output.i_rate, true )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_2F2R;
- text.psz_string = (char *)N_("2 Front 2 Rear");
+ text.psz_string = (char *)_("2 Front 2 Rear");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 4 channels" );
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 2,
- p_aout->output.output.i_rate, VLC_TRUE )
+ p_aout->output.output.i_rate, true )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_STEREO;
- text.psz_string = (char *)N_("Stereo");
+ text.psz_string = (char *)_("Stereo");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 2 channels" );
}
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 1,
- p_aout->output.output.i_rate, VLC_TRUE )
+ p_aout->output.output.i_rate, true )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_MONO;
- text.psz_string = (char *)N_("Mono");
+ text.psz_string = (char *)_("Mono");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 1 channel" );
}
{
if( OpenWaveOut( p_aout,
p_aout->output.p_sys->i_wave_device_id,
- VLC_FOURCC('s','p','d','i'),
+ VLC_CODEC_SPDIFL,
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
- p_aout->output.output.i_rate, VLC_TRUE )
+ p_aout->output.output.i_rate, true )
== VLC_SUCCESS )
{
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
val.i_int = AOUT_VAR_SPDIF;
- text.psz_string = (char *)N_("A/52 over S/PDIF");
+ text.psz_string = (char *)_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
- if( config_GetInt( p_aout, "spdif" ) )
+ if( var_InheritBool( p_aout, "spdif" ) )
var_Set( p_aout, "audio-device", val );
}
}
}
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
-
- val.b_bool = VLC_TRUE;
- var_Set( p_aout, "intf-change", val );
+ var_SetBool( p_aout, "intf-change", true );
}
/*****************************************************************************
****************************************************************************/
static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_format,
int i_channels, int i_nb_channels, int i_rate,
- vlc_bool_t b_probe )
+ bool b_probe )
{
MMRESULT result;
unsigned int i;
switch( i_format )
{
- case VLC_FOURCC('s','p','d','i'):
+ case VLC_CODEC_SPDIFL:
i_nb_channels = 2;
/* To prevent channel re-ordering */
waveformat.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
break;
- case VLC_FOURCC('f','l','3','2'):
+ case VLC_CODEC_FL32:
waveformat.Format.wBitsPerSample = sizeof(float) * 8;
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
break;
- case VLC_FOURCC('s','1','6','l'):
+ case VLC_CODEC_S16L:
waveformat.Format.wBitsPerSample = 16;
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
/*****************************************************************************
* OpenWaveOutPCM: open a PCM waveout sound device
****************************************************************************/
-static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i_format,
+static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id,
+ vlc_fourcc_t *i_format,
int i_channels, int i_nb_channels, int i_rate,
- vlc_bool_t b_probe )
+ bool b_probe )
{
- vlc_bool_t b_use_float32 = var_CreateGetBool( p_aout, "waveout-float32");
+ bool b_use_float32 = var_CreateGetBool( p_aout, "waveout-float32");
- if( !b_use_float32 || OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('f','l','3','2'),
+ if( !b_use_float32 || OpenWaveOut( p_aout, i_device_id, VLC_CODEC_FL32,
i_channels, i_nb_channels, i_rate, b_probe )
!= VLC_SUCCESS )
{
- if ( OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('s','1','6','l'),
+ if ( OpenWaveOut( p_aout, i_device_id, VLC_CODEC_S16L,
i_channels, i_nb_channels, i_rate, b_probe )
!= VLC_SUCCESS )
{
}
else
{
- *i_format = VLC_FOURCC('s','1','6','l');
+ *i_format = VLC_CODEC_S16L;
return VLC_SUCCESS;
}
}
else
{
- *i_format = VLC_FOURCC('f','l','3','2');
+ *i_format = VLC_CODEC_FL32;
return VLC_SUCCESS;
}
}
*****************************************************************************/
static int PlayWaveOut( aout_instance_t *p_aout, HWAVEOUT h_waveout,
WAVEHDR *p_waveheader, aout_buffer_t *p_buffer,
- vlc_bool_t b_spdif)
+ bool b_spdif)
{
MMRESULT result;
*/
if(b_spdif)
{
- p_aout->p_libvlc->pf_memcpy( p_aout->output.p_sys->p_silence_buffer,
- p_buffer->p_buffer,
- p_aout->output.p_sys->i_buffer_size );
+ vlc_memcpy( p_aout->output.p_sys->p_silence_buffer,
+ p_buffer->p_buffer,
+ p_aout->output.p_sys->i_buffer_size );
p_aout->output.p_sys->i_repeat_counter = 2;
}
} else {
p_aout->output.p_sys->i_repeat_counter--;
if(!p_aout->output.p_sys->i_repeat_counter)
{
- p_aout->p_libvlc->pf_memset( p_aout->output.p_sys->p_silence_buffer,
- 0x00,
- p_aout->output.p_sys->i_buffer_size
- );
+ vlc_memset( p_aout->output.p_sys->p_silence_buffer,
+ 0x00, p_aout->output.p_sys->i_buffer_size );
}
}
p_waveheader->lpData = p_aout->output.p_sys->p_silence_buffer;
DWORD _p_aout,
DWORD dwParam1, DWORD dwParam2 )
{
+ (void)h_waveout; (void)dwParam1; (void)dwParam2;
aout_instance_t *p_aout = (aout_instance_t *)_p_aout;
int i, i_queued_frames = 0;
if( uMsg != WOM_DONE ) return;
- if( p_aout->b_die ) return;
+ if( !vlc_object_alive (p_aout) ) return;
/* Find out the current latency */
for( i = 0; i < FRAMES_NUM; i++ )
* we are not authorized to use waveOutWrite() directly in the waveout
* callback.
*****************************************************************************/
-static void WaveOutThread( notification_thread_t *p_notif )
+static void* WaveOutThread( vlc_object_t *p_this )
{
+ notification_thread_t *p_notif = (notification_thread_t*)p_this;
aout_instance_t *p_aout = p_notif->p_aout;
aout_sys_t *p_sys = p_aout->output.p_sys;
aout_buffer_t *p_buffer = NULL;
WAVEHDR *p_waveheader = p_sys->waveheader;
int i, i_queued_frames;
- vlc_bool_t b_sleek;
+ bool b_sleek;
mtime_t next_date;
uint32_t i_buffer_length = 64;
+ int canc = vlc_savecancel ();
/* We don't want any resampling when using S/PDIF */
- b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i');
+ b_sleek = p_aout->output.output.i_format == VLC_CODEC_SPDIFL;
// wait for first call to "play()"
- while( !p_sys->start_date && !p_aout->b_die )
+ while( !p_sys->start_date && vlc_object_alive (p_aout) )
WaitForSingleObject( p_sys->event, INFINITE );
- if( p_aout->b_die )
- return;
+ if( !vlc_object_alive (p_aout) )
+ return NULL;
- msg_Dbg( p_aout, "will start to play in "I64Fd" us",
+ msg_Dbg( p_aout, "will start to play in %"PRId64" us",
(p_sys->start_date - AOUT_PTS_TOLERANCE/4)-mdate());
// than wait a short time... before grabbing first frames
p_aout->output.b_starving, msg);
next_date = mdate();
- while( !p_aout->b_die )
+ while( vlc_object_alive (p_aout) )
{
/* Cleanup and find out the current latency */
i_queued_frames = WaveOutClearDoneBuffers( p_sys );
- if( p_aout->b_die ) return;
+ if( !vlc_object_alive (p_aout) ) return NULL;
/* Try to fill in as many frame buffers as possible */
for( i = 0; i < FRAMES_NUM; i++ )
if( p_buffer )
{
- mtime_t buffer_length = (p_buffer->end_date
- - p_buffer->start_date);
+ mtime_t buffer_length = p_buffer->i_length;
next_date = next_date + buffer_length;
i_buffer_length = buffer_length/1000;
}
if( p_buffer && p_sys->b_chan_reorder )
{
aout_ChannelReorder( p_buffer->p_buffer,
- p_buffer->i_nb_bytes,
+ p_buffer->i_buffer,
p_sys->waveformat.Format.nChannels,
p_sys->pi_chan_table,
p_sys->waveformat.Format.wBitsPerSample );
}
}
- if( p_aout->b_die ) return;
+ if( !vlc_object_alive (p_aout) ) return NULL;
/*
deal with the case that the loop didn't fillup the buffer to the
}
#undef waveout_warn
-}
-
-static int VolumeInfos( aout_instance_t * p_aout, audio_volume_t * pi_soft )
-{
- *pi_soft = AOUT_VOLUME_MAX / 2;
- return 0;
+ vlc_restorecancel (canc);
+ return NULL;
}
static int VolumeGet( aout_instance_t * p_aout, audio_volume_t * pi_volume )
static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,
vlc_value_t newval, vlc_value_t oldval, void *data )
{
- int i;
+ VLC_UNUSED( newval ); VLC_UNUSED( oldval ); VLC_UNUSED( data );
module_config_t *p_item = config_FindConfig( p_this, psz_name );
if( !p_item ) return VLC_SUCCESS;
/* Clear-up the current list */
if( p_item->i_list )
{
+ int i;
+
/* Keep the first entry */
for( i = 1; i < p_item->i_list; i++ )
{
int wave_devices = waveOutGetNumDevs();
- p_item->ppsz_list =
- (char **)realloc( p_item->ppsz_list,
+ p_item->ppsz_list = xrealloc( p_item->ppsz_list,
(wave_devices+2) * sizeof(char *) );
- p_item->ppsz_list_text =
- (char **)realloc( p_item->ppsz_list_text,
+ p_item->ppsz_list_text = xrealloc( p_item->ppsz_list_text,
(wave_devices+2) * sizeof(char *) );
WAVEOUTCAPS caps;
if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))
== MMSYSERR_NOERROR)
{
- sprintf(sz_dev_name,psz_device_name_fmt,caps.szPname,
+ sprintf( sz_dev_name, psz_device_name_fmt, caps.szPname,
caps.wMid,
caps.wPid
);
- p_item->ppsz_list[j] = strdup( sz_dev_name );
+ p_item->ppsz_list[j] = FromLocaleDup( sz_dev_name );
p_item->ppsz_list_text[j] = FromLocaleDup( sz_dev_name );
p_item->i_list++;
j++;
p_item->ppsz_list_text[j] = NULL;
/* Signal change to the interface */
- p_item->b_dirty = VLC_TRUE;
+ p_item->b_dirty = true;
return VLC_SUCCESS;
}
/*
convert devicename to device ID for output
if device not found return WAVE_MAPPER, so let
- windows decide which prefered audio device
+ windows decide which preferred audio device
should be used.
*/
static uint32_t findDeviceID(char *psz_device_name)
if(waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))
== MMSYSERR_NOERROR)
{
- sprintf(sz_dev_name,psz_device_name_fmt,caps.szPname,
+ sprintf(sz_dev_name, psz_device_name_fmt, caps.szPname,
caps.wMid,
caps.wPid
);
- if(!stricmp(sz_dev_name,psz_device_name))
- return i;
+ char *psz_temp = FromLocaleDup(sz_dev_name);
+
+ if( !stricmp(psz_temp, psz_device_name) )
+ {
+ LocaleFree( psz_temp );
+ return i;
+ }
+ LocaleFree( psz_temp );
}
}