| 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 |
|
|---|
| 30 |
#ifdef HAVE_CONFIG_H |
|---|
| 31 |
# include "config.h" |
|---|
| 32 |
#endif |
|---|
| 33 |
|
|---|
| 34 |
#include <vlc_common.h> |
|---|
| 35 |
#include <vlc_plugin.h> |
|---|
| 36 |
|
|---|
| 37 |
#include <errno.h> |
|---|
| 38 |
#include <vlc_interface.h> |
|---|
| 39 |
|
|---|
| 40 |
#include <vlc_aout.h> |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
#define ALSA_PCM_NEW_HW_PARAMS_API |
|---|
| 45 |
#define ALSA_PCM_NEW_SW_PARAMS_API |
|---|
| 46 |
#include <alsa/asoundlib.h> |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
struct aout_sys_t |
|---|
| 57 |
{ |
|---|
| 58 |
snd_pcm_t * p_snd_pcm; |
|---|
| 59 |
unsigned int i_period_time; |
|---|
| 60 |
|
|---|
| 61 |
#ifdef ALSA_DEBUG |
|---|
| 62 |
snd_output_t * p_snd_stderr; |
|---|
| 63 |
#endif |
|---|
| 64 |
|
|---|
| 65 |
int b_playing; |
|---|
| 66 |
mtime_t start_date; |
|---|
| 67 |
|
|---|
| 68 |
vlc_mutex_t lock; |
|---|
| 69 |
vlc_cond_t wait ; |
|---|
| 70 |
|
|---|
| 71 |
snd_pcm_status_t *p_status; |
|---|
| 72 |
}; |
|---|
| 73 |
|
|---|
| 74 |
#define A52_FRAME_NB 1536 |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
#define ALSA_DEFAULT_PERIOD_SIZE 1024 |
|---|
| 81 |
#define ALSA_DEFAULT_BUFFER_SIZE ( ALSA_DEFAULT_PERIOD_SIZE << 8 ) |
|---|
| 82 |
#define ALSA_SPDIF_PERIOD_SIZE A52_FRAME_NB |
|---|
| 83 |
#define ALSA_SPDIF_BUFFER_SIZE ( ALSA_SPDIF_PERIOD_SIZE << 4 ) |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
#define DEFAULT_ALSA_DEVICE N_("default") |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
static int Open ( vlc_object_t * ); |
|---|
| 94 |
static void Close ( vlc_object_t * ); |
|---|
| 95 |
static void Play ( aout_instance_t * ); |
|---|
| 96 |
static void* ALSAThread ( vlc_object_t * ); |
|---|
| 97 |
static void ALSAFill ( aout_instance_t * ); |
|---|
| 98 |
static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name, |
|---|
| 99 |
vlc_value_t newval, vlc_value_t oldval, void *p_unused ); |
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
static const char *const ppsz_devices[] = { "default" }; |
|---|
| 105 |
static const char *const ppsz_devices_text[] = { N_("Default") }; |
|---|
| 106 |
vlc_module_begin(); |
|---|
| 107 |
set_shortname( "ALSA" ); |
|---|
| 108 |
set_description( N_("ALSA audio output") ); |
|---|
| 109 |
set_category( CAT_AUDIO ); |
|---|
| 110 |
set_subcategory( SUBCAT_AUDIO_AOUT ); |
|---|
| 111 |
add_string( "alsa-audio-device", DEFAULT_ALSA_DEVICE, aout_FindAndRestart, |
|---|
| 112 |
N_("ALSA Device Name"), NULL, false ); |
|---|
| 113 |
add_deprecated_alias( "alsadev" ); |
|---|
| 114 |
change_string_list( ppsz_devices, ppsz_devices_text, FindDevicesCallback ); |
|---|
| 115 |
change_action_add( FindDevicesCallback, N_("Refresh list") ); |
|---|
| 116 |
|
|---|
| 117 |
set_capability( "audio output", 150 ); |
|---|
| 118 |
set_callbacks( Open, Close ); |
|---|
| 119 |
vlc_module_end(); |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
static void Probe( aout_instance_t * p_aout, |
|---|
| 125 |
const char * psz_device, const char * psz_iec_device, |
|---|
| 126 |
int *pi_snd_pcm_format ) |
|---|
| 127 |
{ |
|---|
| 128 |
struct aout_sys_t * p_sys = p_aout->output.p_sys; |
|---|
| 129 |
vlc_value_t val, text; |
|---|
| 130 |
int i_ret; |
|---|
| 131 |
|
|---|
| 132 |
var_Create ( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); |
|---|
| 133 |
text.psz_string = _("Audio Device"); |
|---|
| 134 |
var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
if ( !(i_ret = snd_pcm_open( &p_sys->p_snd_pcm, psz_device, |
|---|
| 142 |
SND_PCM_STREAM_PLAYBACK, |
|---|
| 143 |
SND_PCM_NONBLOCK ) ) ) |
|---|
| 144 |
{ |
|---|
| 145 |
int i_channels; |
|---|
| 146 |
snd_pcm_hw_params_t * p_hw; |
|---|
| 147 |
snd_pcm_hw_params_alloca (&p_hw); |
|---|
| 148 |
|
|---|
| 149 |
if ( snd_pcm_hw_params_any( p_sys->p_snd_pcm, p_hw ) < 0 ) |
|---|
| 150 |
{ |
|---|
| 151 |
msg_Warn( p_aout, "unable to retrieve initial hardware parameters" |
|---|
| 152 |
", disabling linear PCM audio" ); |
|---|
| 153 |
snd_pcm_close( p_sys->p_snd_pcm ); |
|---|
| 154 |
var_Destroy( p_aout, "audio-device" ); |
|---|
| 155 |
return; |
|---|
| 156 |
} |
|---|
| 157 |
|
|---|
| 158 |
if ( snd_pcm_hw_params_set_format( p_sys->p_snd_pcm, p_hw, |
|---|
| 159 |
*pi_snd_pcm_format ) < 0 ) |
|---|
| 160 |
{ |
|---|
| 161 |
int i_snd_rc = -1; |
|---|
| 162 |
|
|---|
| 163 |
if( *pi_snd_pcm_format != SND_PCM_FORMAT_S16 ) |
|---|
| 164 |
{ |
|---|
| 165 |
*pi_snd_pcm_format = SND_PCM_FORMAT_S16; |
|---|
| 166 |
i_snd_rc = snd_pcm_hw_params_set_format( p_sys->p_snd_pcm, |
|---|
| 167 |
p_hw, *pi_snd_pcm_format ); |
|---|
| 168 |
} |
|---|
| 169 |
if ( i_snd_rc < 0 ) |
|---|
| 170 |
{ |
|---|
| 171 |
msg_Warn( p_aout, "unable to set stream sample size and " |
|---|
| 172 |
"word order, disabling linear PCM audio" ); |
|---|
| 173 |
snd_pcm_close( p_sys->p_snd_pcm ); |
|---|
| 174 |
var_Destroy( p_aout, "audio-device" ); |
|---|
| 175 |
return; |
|---|
| 176 |
} |
|---|
| 177 |
} |
|---|
| 178 |
|
|---|
| 179 |
i_channels = aout_FormatNbChannels( &p_aout->output.output ); |
|---|
| 180 |
|
|---|
| 181 |
while ( i_channels > 0 ) |
|---|
| 182 |
{ |
|---|
| 183 |
if ( !snd_pcm_hw_params_test_channels( p_sys->p_snd_pcm, p_hw, |
|---|
| 184 |
i_channels ) ) |
|---|
| 185 |
{ |
|---|
| 186 |
switch ( i_channels ) |
|---|
| 187 |
{ |
|---|
| 188 |
case 1: |
|---|
| 189 |
val.i_int = AOUT_VAR_MONO; |
|---|
| 190 |
text.psz_string = (char*)N_("Mono"); |
|---|
| 191 |
var_Change( p_aout, "audio-device", |
|---|
| 192 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 193 |
break; |
|---|
| 194 |
case 2: |
|---|
| 195 |
val.i_int = AOUT_VAR_STEREO; |
|---|
| 196 |
text.psz_string = (char*)N_("Stereo"); |
|---|
| 197 |
var_Change( p_aout, "audio-device", |
|---|
| 198 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 199 |
var_Set( p_aout, "audio-device", val ); |
|---|
| 200 |
break; |
|---|
| 201 |
case 4: |
|---|
| 202 |
val.i_int = AOUT_VAR_2F2R; |
|---|
| 203 |
text.psz_string = (char*)N_("2 Front 2 Rear"); |
|---|
| 204 |
var_Change( p_aout, "audio-device", |
|---|
| 205 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 206 |
break; |
|---|
| 207 |
case 6: |
|---|
| 208 |
val.i_int = AOUT_VAR_5_1; |
|---|
| 209 |
text.psz_string = (char*)"5.1"; |
|---|
| 210 |
var_Change( p_aout, "audio-device", |
|---|
| 211 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 212 |
break; |
|---|
| 213 |
} |
|---|
| 214 |
} |
|---|
| 215 |
|
|---|
| 216 |
--i_channels; |
|---|
| 217 |
} |
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
i_channels = aout_FormatNbChannels( &p_aout->output.output ); |
|---|
| 221 |
var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL ); |
|---|
| 222 |
if( val.i_int <= 0 && i_channels == 1 ) |
|---|
| 223 |
{ |
|---|
| 224 |
if ( !snd_pcm_hw_params_test_channels( p_sys->p_snd_pcm, p_hw, 2 )) |
|---|
| 225 |
{ |
|---|
| 226 |
val.i_int = AOUT_VAR_STEREO; |
|---|
| 227 |
text.psz_string = (char*)N_("Stereo"); |
|---|
| 228 |
var_Change( p_aout, "audio-device", |
|---|
| 229 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 230 |
var_Set( p_aout, "audio-device", val ); |
|---|
| 231 |
} |
|---|
| 232 |
} |
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 |
snd_pcm_close( p_sys->p_snd_pcm ); |
|---|
| 236 |
} |
|---|
| 237 |
else if ( i_ret == -EBUSY ) |
|---|
| 238 |
{ |
|---|
| 239 |
msg_Warn( p_aout, "audio device: %s is already in use", psz_device ); |
|---|
| 240 |
} |
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 |
if ( psz_iec_device ) |
|---|
| 244 |
{ |
|---|
| 245 |
|
|---|
| 246 |
if ( !(i_ret = snd_pcm_open( &p_sys->p_snd_pcm, psz_iec_device, |
|---|
| 247 |
SND_PCM_STREAM_PLAYBACK, |
|---|
| 248 |
SND_PCM_NONBLOCK ) ) ) |
|---|
| 249 |
{ |
|---|
| 250 |
val.i_int = AOUT_VAR_SPDIF; |
|---|
| 251 |
text.psz_string = (char*)N_("A/52 over S/PDIF"); |
|---|
| 252 |
var_Change( p_aout, "audio-device", |
|---|
| 253 |
VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 254 |
if( config_GetInt( p_aout, "spdif" ) ) |
|---|
| 255 |
var_Set( p_aout, "audio-device", val ); |
|---|
| 256 |
|
|---|
| 257 |
snd_pcm_close( p_sys->p_snd_pcm ); |
|---|
| 258 |
} |
|---|
| 259 |
else if ( i_ret == -EBUSY ) |
|---|
| 260 |
{ |
|---|
| 261 |
msg_Warn( p_aout, "audio device: %s is already in use", |
|---|
| 262 |
psz_iec_device ); |
|---|
| 263 |
} |
|---|
| 264 |
} |
|---|
| 265 |
|
|---|
| 266 |
var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL ); |
|---|
| 267 |
if( val.i_int <= 0 ) |
|---|
| 268 |
{ |
|---|
| 269 |
|
|---|
| 270 |
msg_Dbg( p_aout, "failed to find a useable alsa configuration" ); |
|---|
| 271 |
var_Destroy( p_aout, "audio-device" ); |
|---|
| 272 |
return; |
|---|
| 273 |
} |
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL ); |
|---|
| 277 |
val.b_bool = true; |
|---|
| 278 |
var_Set( p_aout, "intf-change", val ); |
|---|
| 279 |
} |
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
static int Open( vlc_object_t *p_this ) |
|---|
| 290 |
{ |
|---|
| 291 |
aout_instance_t * p_aout = (aout_instance_t *)p_this; |
|---|
| 292 |
struct aout_sys_t * p_sys; |
|---|
| 293 |
vlc_value_t val; |
|---|
| 294 |
|
|---|
| 295 |
char psz_default_iec_device[128]; |
|---|
| 296 |
S/PDIF device */ |
|---|
| 297 |
char * psz_device, * psz_iec_device; |
|---|
| 298 |
output */ |
|---|
| 299 |
|
|---|
| 300 |
int i_vlc_pcm_format; |
|---|
| 301 |
int i_snd_pcm_format; |
|---|
| 302 |
|
|---|
| 303 |
snd_pcm_uframes_t i_buffer_size = 0; |
|---|
| 304 |
snd_pcm_uframes_t i_period_size = 0; |
|---|
| 305 |
int i_channels = 0; |
|---|
| 306 |
|
|---|
| 307 |
snd_pcm_hw_params_t *p_hw; |
|---|
| 308 |
snd_pcm_sw_params_t *p_sw; |
|---|
| 309 |
|
|---|
| 310 |
int i_snd_rc = -1; |
|---|
| 311 |
unsigned int i_old_rate; |
|---|
| 312 |
bool b_retry = true; |
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 316 |
if( p_sys == NULL ) |
|---|
| 317 |
return VLC_ENOMEM; |
|---|
| 318 |
p_sys->b_playing = false; |
|---|
| 319 |
p_sys->start_date = 0; |
|---|
| 320 |
vlc_cond_init( &p_sys->wait ); |
|---|
| 321 |
vlc_mutex_init( &p_sys->lock ); |
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 |
if( (psz_device = config_GetPsz( p_aout, "alsa-audio-device" )) == NULL ) |
|---|
| 325 |
{ |
|---|
| 326 |
msg_Err( p_aout, "no audio device given (maybe \"default\" ?)" ); |
|---|
| 327 |
intf_UserFatal( p_aout, false, _("No Audio Device"), |
|---|
| 328 |
_("No audio device name was given. You might want to " \ |
|---|
| 329 |
"enter \"default\".") ); |
|---|
| 330 |
free( p_sys ); |
|---|
| 331 |
return VLC_EGENERIC; |
|---|
| 332 |
} |
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
if( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) |
|---|
| 338 |
&& !strcmp( psz_device, DEFAULT_ALSA_DEVICE ) ) |
|---|
| 339 |
{ |
|---|
| 340 |
snprintf( psz_default_iec_device, sizeof(psz_default_iec_device), |
|---|
| 341 |
"iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x", |
|---|
| 342 |
IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO, |
|---|
| 343 |
IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER, |
|---|
| 344 |
0, |
|---|
| 345 |
( p_aout->output.output.i_rate == 48000 ? |
|---|
| 346 |
IEC958_AES3_CON_FS_48000 : |
|---|
| 347 |
( p_aout->output.output.i_rate == 44100 ? |
|---|
| 348 |
IEC958_AES3_CON_FS_44100 : IEC958_AES3_CON_FS_32000 ) ) ); |
|---|
| 349 |
psz_iec_device = psz_default_iec_device; |
|---|
| 350 |
} |
|---|
| 351 |
else if( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) |
|---|
| 352 |
{ |
|---|
| 353 |
psz_iec_device = psz_device; |
|---|
| 354 |
} |
|---|
| 355 |
else |
|---|
| 356 |
{ |
|---|
| 357 |
psz_iec_device = NULL; |
|---|
| 358 |
} |
|---|
| 359 |
|
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
if( vlc_CPU() & CPU_CAPABILITY_FPU ) |
|---|
| 363 |
{ |
|---|
| 364 |
i_vlc_pcm_format = VLC_FOURCC('f','l','3','2'); |
|---|
| 365 |
i_snd_pcm_format = SND_PCM_FORMAT_FLOAT; |
|---|
| 366 |
} |
|---|
| 367 |
else |
|---|
| 368 |
{ |
|---|
| 369 |
i_vlc_pcm_format = AOUT_FMT_S16_NE; |
|---|
| 370 |
i_snd_pcm_format = SND_PCM_FORMAT_S16; |
|---|
| 371 |
} |
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 |
if ( var_Type( p_aout, "audio-device" ) == 0 ) |
|---|
| 376 |
{ |
|---|
| 377 |
Probe( p_aout, psz_device, psz_iec_device, &i_snd_pcm_format ); |
|---|
| 378 |
} |
|---|
| 379 |
|
|---|
| 380 |
if ( var_Get( p_aout, "audio-device", &val ) < 0 ) |
|---|
| 381 |
{ |
|---|
| 382 |
free( p_sys ); |
|---|
| 383 |
free( psz_device ); |
|---|
| 384 |
return VLC_EGENERIC; |
|---|
| 385 |
} |
|---|
| 386 |
|
|---|
| 387 |
p_aout->output.output.i_format = i_vlc_pcm_format; |
|---|
| 388 |
if ( val.i_int == AOUT_VAR_5_1 ) |
|---|
| 389 |
{ |
|---|
| 390 |
p_aout->output.output.i_physical_channels |
|---|
| 391 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER |
|---|
| 392 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT |
|---|
| 393 |
| AOUT_CHAN_LFE; |
|---|
| 394 |
free( psz_device ); |
|---|
| 395 |
psz_device = strdup( "surround51" ); |
|---|
| 396 |
} |
|---|
| 397 |
else if ( val.i_int == AOUT_VAR_2F2R ) |
|---|
| 398 |
{ |
|---|
| 399 |
p_aout->output.output.i_physical_channels |
|---|
| 400 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
|---|
| 401 |
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; |
|---|
| 402 |
free( psz_device ); |
|---|
| 403 |
psz_device = strdup( "surround40" ); |
|---|
| 404 |
} |
|---|
| 405 |
else if ( val.i_int == AOUT_VAR_STEREO ) |
|---|
| 406 |
{ |
|---|
| 407 |
p_aout->output.output.i_physical_channels |
|---|
| 408 |
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; |
|---|
| 409 |
} |
|---|
| 410 |
else if ( val.i_int == AOUT_VAR_MONO ) |
|---|
| 411 |
{ |
|---|
| 412 |
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER; |
|---|
| 413 |
} |
|---|
| 414 |
else if( val.i_int != AOUT_VAR_SPDIF ) |
|---|
| 415 |
{ |
|---|
| 416 |
|
|---|
| 417 |
msg_Err( p_aout, "internal: can't find audio-device (%i)", val.i_int ); |
|---|
| 418 |
free( p_sys ); |
|---|
| 419 |
free( psz_device ); |
|---|
| 420 |
return VLC_EGENERIC; |
|---|
| 421 |
} |
|---|
| 422 |
|
|---|
| 423 |
#ifdef ALSA_DEBUG |
|---|
| 424 |
snd_output_stdio_attach( &p_sys->p_snd_stderr, stderr, 0 ); |
|---|
| 425 |
#endif |
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
if ( val.i_int == AOUT_VAR_SPDIF ) |
|---|
| 429 |
{ |
|---|
| 430 |
if ( ( i_snd_rc = snd_pcm_open( &p_sys->p_snd_pcm, psz_iec_device, |
|---|
| 431 |
SND_PCM_STREAM_PLAYBACK, 0 ) ) < 0 ) |
|---|
| 432 |
{ |
|---|
| 433 |
msg_Err( p_aout, "cannot open ALSA device `%s' (%s)", |
|---|
| 434 |
psz_iec_device, snd_strerror( i_snd_rc ) ); |
|---|
| 435 |
intf_UserFatal( p_aout, false, _("Audio output failed"), |
|---|
| 436 |
_("VLC could not open the ALSA device \"%s\" (%s)."), |
|---|
| 437 |
psz_iec_device, snd_strerror( i_snd_rc ) ); |
|---|
| 438 |
free( p_sys ); |
|---|
| 439 |
free( psz_device ); |
|---|
| 440 |
return VLC_EGENERIC; |
|---|
| 441 |
} |
|---|
| 442 |
i_buffer_size = ALSA_SPDIF_BUFFER_SIZE; |
|---|
| 443 |
i_snd_pcm_format = SND_PCM_FORMAT_S16; |
|---|
| 444 |
i_channels = 2; |
|---|
| 445 |
|
|---|
| 446 |
i_vlc_pcm_format = VLC_FOURCC('s','p','d','i'); |
|---|
| 447 |
p_aout->output.i_nb_samples = i_period_size = ALSA_SPDIF_PERIOD_SIZE; |
|---|
| 448 |
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE; |
|---|
| 449 |
p_aout->output.output.i_frame_length = A52_FRAME_NB; |
|---|
| 450 |
|
|---|
| 451 |
aout_VolumeNoneInit( p_aout ); |
|---|
| 452 |
} |
|---|
| 453 |
else |
|---|
| 454 |
{ |
|---|
| 455 |
int i; |
|---|
| 456 |
|
|---|
| 457 |
msg_Dbg( p_aout, "opening ALSA device `%s'", psz_device ); |
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 |
for( i = 10; i >= 0; i-- ) |
|---|
| 465 |
{ |
|---|
| 466 |
if ( ( i_snd_rc = snd_pcm_open( &p_sys->p_snd_pcm, psz_device, |
|---|
| 467 |
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK ) ) == -EBUSY ) |
|---|
| 468 |
{ |
|---|
| 469 |
if( i ) msleep( 100000 ); |
|---|
| 470 |
else |
|---|
| 471 |
{ |
|---|
| 472 |
msg_Err( p_aout, "audio device: %s is already in use", |
|---|
| 473 |
psz_device ); |
|---|
| 474 |
intf_UserFatal( p_aout, false, _("Audio output failed"), |
|---|
| 475 |
_("The audio device \"%s\" is already in use."), |
|---|
| 476 |
psz_device ); |
|---|
| 477 |
} |
|---|
| 478 |
continue; |
|---|
| 479 |
} |
|---|
| 480 |
break; |
|---|
| 481 |
} |
|---|
| 482 |
if( i_snd_rc < 0 ) |
|---|
| 483 |
{ |
|---|
| 484 |
msg_Err( p_aout, "cannot open ALSA device `%s' (%s)", |
|---|
| 485 |
psz_device, snd_strerror( i_snd_rc ) ); |
|---|
| 486 |
intf_UserFatal( p_aout, false, _("Audio output failed"), |
|---|
| 487 |
_("VLC could not open the ALSA device \"%s\" (%s)."), |
|---|
| 488 |
psz_device, snd_strerror( i_snd_rc ) ); |
|---|
| 489 |
free( p_sys ); |
|---|
| 490 |
free( psz_device ); |
|---|
| 491 |
return VLC_EGENERIC; |
|---|
| 492 |
} |
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 |
snd_pcm_nonblock( p_sys->p_snd_pcm, 0 ); |
|---|
| 496 |
|
|---|
| 497 |
i_buffer_size = ALSA_DEFAULT_BUFFER_SIZE; |
|---|
| 498 |
i_channels = aout_FormatNbChannels( &p_aout->output.output ); |
|---|
| 499 |
|
|---|
| 500 |
p_aout->output.i_nb_samples = i_period_size = ALSA_DEFAULT_PERIOD_SIZE; |
|---|
| 501 |
|
|---|
| 502 |
aout_VolumeSoftInit( p_aout ); |
|---|
| 503 |
} |
|---|
| 504 |
|
|---|
| 505 |
|
|---|
| 506 |
free( psz_device ); |
|---|
| 507 |
|
|---|
| 508 |
p_aout->output.pf_play = Play; |
|---|
| 509 |
|
|---|
| 510 |
snd_pcm_hw_params_alloca(&p_hw); |
|---|
| 511 |
snd_pcm_sw_params_alloca(&p_sw); |
|---|
| 512 |
|
|---|
| 513 |
|
|---|
| 514 |
|
|---|
| 515 |
while ( b_retry ) |
|---|
| 516 |
{ |
|---|
| 517 |
b_retry = false; |
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 |
if ( ( i_snd_rc = snd_pcm_hw_params_any( p_sys->p_snd_pcm, p_hw ) ) < 0 ) |
|---|
| 521 |
{ |
|---|
| 522 |
msg_Err( p_aout, "unable to retrieve initial hardware parameters (%s)", |
|---|
| 523 |
snd_strerror( i_snd_rc ) ); |
|---|
| 524 |
goto error; |
|---|
| 525 |
} |
|---|
| 526 |
|
|---|
| 527 |
|
|---|
| 528 |
if ( ( i_snd_rc = snd_pcm_hw_params_set_format( p_sys->p_snd_pcm, p_hw, |
|---|
| 529 |
i_snd_pcm_format ) ) < 0 ) |
|---|
| 530 |
{ |
|---|
| 531 |
if( i_snd_pcm_format != SND_PCM_FORMAT_S16 ) |
|---|
| 532 |
{ |
|---|
| 533 |
i_snd_pcm_format = SND_PCM_FORMAT_S16; |
|---|
| 534 |
i_snd_rc = snd_pcm_hw_params_set_format( p_sys->p_snd_pcm, |
|---|
| 535 |
p_hw, i_snd_pcm_format ); |
|---|
| 536 |
} |
|---|
| 537 |
if ( i_snd_rc < 0 ) |
|---|
| 538 |
{ |
|---|
| 539 |
msg_Err( p_aout, "unable to set stream sample size and " |
|---|
| 540 |
"word order (%s)", snd_strerror( i_snd_rc ) ); |
|---|
| 541 |
goto error; |
|---|
| 542 |
} |
|---|
| 543 |
} |
|---|
| 544 |
if( i_vlc_pcm_format != VLC_FOURCC('s','p','d','i') ) |
|---|
| 545 |
switch( i_snd_pcm_format ) |
|---|
| 546 |
{ |
|---|
| 547 |
case SND_PCM_FORMAT_FLOAT: |
|---|
| 548 |
i_vlc_pcm_format = VLC_FOURCC('f','l','3','2'); |
|---|
| 549 |
break; |
|---|
| 550 |
case SND_PCM_FORMAT_S16: |
|---|
| 551 |
i_vlc_pcm_format = AOUT_FMT_S16_NE; |
|---|
| 552 |
break; |
|---|
| 553 |
} |
|---|
| 554 |
p_aout->output.output.i_format = i_vlc_pcm_format; |
|---|
| 555 |
|
|---|
| 556 |
if ( ( i_snd_rc = snd_pcm_hw_params_set_access( p_sys->p_snd_pcm, p_hw, |
|---|
| 557 |
SND_PCM_ACCESS_RW_INTERLEAVED ) ) < 0 ) |
|---|
| 558 |
{ |
|---|
| 559 |
msg_Err( p_aout, "unable to set interleaved stream format (%s)", |
|---|
| 560 |
snd_strerror( i_snd_rc ) ); |
|---|
| 561 |
goto error; |
|---|
| 562 |
} |
|---|
| 563 |
|
|---|
| 564 |
|
|---|
| 565 |
if ( ( i_snd_rc = snd_pcm_hw_params_set_channels( p_sys->p_snd_pcm, p_hw, |
|---|
| 566 |
i_channels ) ) < 0 ) |
|---|
| 567 |
{ |
|---|
| 568 |
msg_Err( p_aout, "unable to set number of output channels (%s)", |
|---|
| 569 |
snd_strerror( i_snd_rc ) ); |
|---|
| 570 |
goto error; |
|---|
| 571 |
} |
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 |
i_old_rate = p_aout->output.output.i_rate; |
|---|
| 575 |
#ifdef HAVE_ALSA_NEW_API |
|---|
| 576 |
i_snd_rc = snd_pcm_hw_params_set_rate_near( p_sys->p_snd_pcm, p_hw, |
|---|
| 577 |
&p_aout->output.output.i_rate, |
|---|
| 578 |
NULL ); |
|---|
| 579 |
#else |
|---|
| 580 |
i_snd_rc = snd_pcm_hw_params_set_rate_near( p_sys->p_snd_pcm, p_hw, |
|---|
| 581 |
p_aout->output.output.i_rate, |
|---|
| 582 |
NULL ); |
|---|
| 583 |
#endif |
|---|
| 584 |
if( i_snd_rc < 0 || p_aout->output.output.i_rate != i_old_rate ) |
|---|
| 585 |
{ |
|---|
| 586 |
msg_Warn( p_aout, "The rate %d Hz is not supported by your " \ |
|---|
| 587 |
"hardware. Using %d Hz instead.\n", i_old_rate, \ |
|---|
| 588 |
p_aout->output.output.i_rate ); |
|---|
| 589 |
} |
|---|
| 590 |
|
|---|
| 591 |
|
|---|
| 592 |
#ifdef HAVE_ALSA_NEW_API |
|---|
| 593 |
if ( ( i_snd_rc = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, |
|---|
| 594 |
p_hw, &i_period_size, NULL ) ) < 0 ) |
|---|
| 595 |
#else |
|---|
| 596 |
if ( ( i_snd_rc = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, |
|---|
| 597 |
p_hw, i_period_size, NULL ) ) < 0 ) |
|---|
| 598 |
#endif |
|---|
| 599 |
{ |
|---|
| 600 |
msg_Err( p_aout, "unable to set period size (%s)", |
|---|
| 601 |
snd_strerror( i_snd_rc ) ); |
|---|
| 602 |
goto error; |
|---|
| 603 |
} |
|---|
| 604 |
p_aout->output.i_nb_samples = i_period_size; |
|---|
| 605 |
|
|---|
| 606 |
|
|---|
| 607 |
#ifdef HAVE_ALSA_NEW_API |
|---|
| 608 |
if ( ( i_snd_rc = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, |
|---|
| 609 |
p_hw, &i_buffer_size ) ) < 0 ) |
|---|
| 610 |
#else |
|---|
| 611 |
if ( ( i_snd_rc = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, |
|---|
| 612 |
p_hw, i_buffer_size ) ) < 0 ) |
|---|
| 613 |
#endif |
|---|
| 614 |
{ |
|---|
| 615 |
msg_Err( p_aout, "unable to set buffer size (%s)", |
|---|
| 616 |
snd_strerror( i_snd_rc ) ); |
|---|
| 617 |
goto error; |
|---|
| 618 |
} |
|---|
| 619 |
|
|---|
| 620 |
|
|---|
| 621 |
if ( ( i_snd_rc = snd_pcm_hw_params( p_sys->p_snd_pcm, p_hw ) ) < 0 ) |
|---|
| 622 |
{ |
|---|
| 623 |
if ( b_retry == false && |
|---|
| 624 |
i_snd_pcm_format == SND_PCM_FORMAT_FLOAT) |
|---|
| 625 |
{ |
|---|
| 626 |
b_retry = true; |
|---|
| 627 |
i_snd_pcm_format = SND_PCM_FORMAT_S16; |
|---|
| 628 |
p_aout->output.output.i_format = AOUT_FMT_S16_NE; |
|---|
| 629 |
msg_Warn( p_aout, "unable to commit hardware configuration " |
|---|
| 630 |
"with fl32 samples. Retrying with s16l (%s)", snd_strerror( i_snd_rc ) ); |
|---|
| 631 |
} |
|---|
| 632 |
else |
|---|
| 633 |
{ |
|---|
| 634 |
msg_Err( p_aout, "unable to commit hardware configuration (%s)", |
|---|
| 635 |
snd_strerror( i_snd_rc ) ); |
|---|
| 636 |
goto error; |
|---|
| 637 |
} |
|---|
| 638 |
} |
|---|
| 639 |
} |
|---|
| 640 |
|
|---|
| 641 |
#ifdef HAVE_ALSA_NEW_API |
|---|
| 642 |
if( ( i_snd_rc = snd_pcm_hw_params_get_period_time( p_hw, |
|---|
| 643 |
&p_sys->i_period_time, NULL ) ) < 0 ) |
|---|
| 644 |
#else |
|---|
| 645 |
if( ( p_sys->i_period_time = |
|---|
| 646 |
(int)snd_pcm_hw_params_get_period_time( p_hw, NULL ) ) < 0 ) |
|---|
| 647 |
#endif |
|---|
| 648 |
{ |
|---|
| 649 |
msg_Err( p_aout, "unable to get period time (%s)", |
|---|
| 650 |
snd_strerror( i_snd_rc ) ); |
|---|
| 651 |
goto error; |
|---|
| 652 |
} |
|---|
| 653 |
|
|---|
| 654 |
|
|---|
| 655 |
snd_pcm_sw_params_current( p_sys->p_snd_pcm, p_sw ); |
|---|
| 656 |
|
|---|
| 657 |
i_snd_rc = snd_pcm_sw_params_set_sleep_min( p_sys->p_snd_pcm, p_sw, 0 ); |
|---|
| 658 |
|
|---|
| 659 |
i_snd_rc = snd_pcm_sw_params_set_avail_min( p_sys->p_snd_pcm, p_sw, |
|---|
| 660 |
p_aout->output.i_nb_samples ); |
|---|
| 661 |
|
|---|
| 662 |
i_snd_rc = snd_pcm_sw_params_set_start_threshold( p_sys->p_snd_pcm, p_sw, |
|---|
| 663 |
ALSA_DEFAULT_PERIOD_SIZE); |
|---|
| 664 |
if( i_snd_rc < 0 ) |
|---|
| 665 |
{ |
|---|
| 666 |
msg_Err( p_aout, "unable to set start threshold (%s)", |
|---|
| 667 |
snd_strerror( i_snd_rc ) ); |
|---|
| 668 |
goto error; |
|---|
| 669 |
} |
|---|
| 670 |
|
|---|
| 671 |
|
|---|
| 672 |
if ( snd_pcm_sw_params( p_sys->p_snd_pcm, p_sw ) < 0 ) |
|---|
| 673 |
{ |
|---|
| 674 |
msg_Err( p_aout, "unable to set software configuration" ); |
|---|
| 675 |
goto error; |
|---|
| 676 |
} |
|---|
| 677 |
|
|---|
| 678 |
#ifdef ALSA_DEBUG |
|---|
| 679 |
snd_output_printf( p_sys->p_snd_stderr, "\nALSA hardware setup:\n\n" ); |
|---|
| 680 |
snd_pcm_dump_hw_setup( p_sys->p_snd_pcm, p_sys->p_snd_stderr ); |
|---|
| 681 |
snd_output_printf( p_sys->p_snd_stderr, "\nALSA software setup:\n\n" ); |
|---|
| 682 |
snd_pcm_dump_sw_setup( p_sys->p_snd_pcm, p_sys->p_snd_stderr ); |
|---|
| 683 |
snd_output_printf( p_sys->p_snd_stderr, "\n" ); |
|---|
| 684 |
#endif |
|---|
| 685 |
|
|---|
| 686 |
|
|---|
| 687 |
if( vlc_thread_create( p_aout, "aout", ALSAThread, |
|---|
| 688 |
VLC_THREAD_PRIORITY_OUTPUT, false ) ) |
|---|
| 689 |
{ |
|---|
| 690 |
msg_Err( p_aout, "cannot create ALSA thread (%m)" ); |
|---|
| 691 |
goto error; |
|---|
| 692 |
} |
|---|
| 693 |
|
|---|
| 694 |
return 0; |
|---|
| 695 |
|
|---|
| 696 |
error: |
|---|
| 697 |
snd_pcm_close( p_sys->p_snd_pcm ); |
|---|
| 698 |
#ifdef ALSA_DEBUG |
|---|
| 699 |
snd_output_close( p_sys->p_snd_stderr ); |
|---|
| 700 |
#endif |
|---|
| 701 |
free( p_sys ); |
|---|
| 702 |
return VLC_EGENERIC; |
|---|
| 703 |
} |
|---|
| 704 |
|
|---|
| 705 |
|
|---|
| 706 |
|
|---|
| 707 |
|
|---|
| 708 |
static void Play( aout_instance_t *p_aout ) |
|---|
| 709 |
{ |
|---|
| 710 |
if( !p_aout->output.p_sys->b_playing ) |
|---|
| 711 |
{ |
|---|
| 712 |
p_aout->output.p_sys->b_playing = 1; |
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 |
p_aout->output.p_sys->start_date = |
|---|
| 716 |
aout_FifoFirstDate( p_aout, &p_aout->output.fifo ); |
|---|
| 717 |
|
|---|
| 718 |
|
|---|
| 719 |
vlc_mutex_lock( &p_aout->output.p_sys->lock ); |
|---|
| 720 |
vlc_cond_signal( &p_aout->output.p_sys->wait ); |
|---|
| 721 |
vlc_mutex_unlock( &p_aout->output.p_sys->lock ); |
|---|
| 722 |
} |
|---|
| 723 |
} |
|---|
| 724 |
|
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 |
|
|---|
| 728 |
static void Close( vlc_object_t *p_this ) |
|---|
| 729 |
{ |
|---|
| 730 |
aout_instance_t *p_aout = (aout_instance_t *)p_this; |
|---|
| 731 |
struct aout_sys_t * p_sys = p_aout->output.p_sys; |
|---|
| 732 |
int i_snd_rc; |
|---|
| 733 |
|
|---|
| 734 |
|
|---|
| 735 |
vlc_object_kill( p_aout ); |
|---|
| 736 |
|
|---|
| 737 |
|
|---|
| 738 |
vlc_mutex_lock( &p_aout->output.p_sys->lock ); |
|---|
| 739 |
vlc_cond_signal( &p_aout->output.p_sys->wait ); |
|---|
| 740 |
vlc_mutex_unlock( &p_aout->output.p_sys->lock ); |
|---|
| 741 |
|
|---|
| 742 |
|
|---|
| 743 |
vlc_thread_join( p_aout ); |
|---|
| 744 |
p_aout->b_die = false; |
|---|
| 745 |
|
|---|
| 746 |
i_snd_rc = snd_pcm_close( p_sys->p_snd_pcm ); |
|---|
| 747 |
|
|---|
| 748 |
if( i_snd_rc > 0 ) |
|---|
| 749 |
{ |
|---|
| 750 |
msg_Err( p_aout, "failed closing ALSA device (%s)", |
|---|
| 751 |
snd_strerror( i_snd_rc ) ); |
|---|
| 752 |
} |
|---|
| 753 |
|
|---|
| 754 |
#ifdef ALSA_DEBUG |
|---|
| 755 |
snd_output_close( p_sys->p_snd_stderr ); |
|---|
| 756 |
#endif |
|---|
| 757 |
|
|---|
| 758 |
free( p_sys ); |
|---|
| 759 |
} |
|---|
| 760 |
|
|---|
| 761 |
|
|---|
| 762 |
|
|---|
| 763 |
|
|---|
| 764 |
static void* ALSAThread( vlc_object_t* p_this ) |
|---|
| 765 |
{ |
|---|
| 766 |
aout_instance_t * p_aout = (aout_instance_t*)p_this; |
|---|
| 767 |
struct aout_sys_t * p_sys = p_aout->output.p_sys; |
|---|
| 768 |
int canc = vlc_savecancel (); |
|---|
| 769 |
p_sys->p_status = (snd_pcm_status_t *)malloc(snd_pcm_status_sizeof()); |
|---|
| 770 |
|
|---|
| 771 |
|
|---|
| 772 |
vlc_mutex_lock( &p_sys->lock ); |
|---|
| 773 |
while( !p_sys->start_date && vlc_object_alive (p_aout) ) |
|---|
| 774 |
vlc_cond_wait( &p_sys->wait, &p_sys->lock ); |
|---|
| 775 |
vlc_mutex_unlock( &p_sys->lock ); |
|---|
| 776 |
|
|---|
| 777 |
if( !vlc_object_alive (p_aout) ) |
|---|
| 778 |
goto cleanup; |
|---|
| 779 |
|
|---|
| 780 |
mwait( p_sys->start_date - AOUT_PTS_TOLERANCE / 4 ); |
|---|
| 781 |
|
|---|
| 782 |
while ( vlc_object_alive (p_aout) ) |
|---|
| 783 |
{ |
|---|
| 784 |
ALSAFill( p_aout ); |
|---|
| 785 |
} |
|---|
| 786 |
|
|---|
| 787 |
cleanup: |
|---|
| 788 |
snd_pcm_drop( p_sys->p_snd_pcm ); |
|---|
| 789 |
free( p_aout->output.p_sys->p_status ); |
|---|
| 790 |
vlc_restorecancel (canc); |
|---|
| 791 |
return NULL; |
|---|
| 792 |
} |
|---|
| 793 |
|
|---|
| 794 |
|
|---|
| 795 |
|
|---|
| 796 |
|
|---|
| 797 |
static void ALSAFill( aout_instance_t * p_aout ) |
|---|
| 798 |
{ |
|---|
| 799 |
struct aout_sys_t * p_sys = p_aout->output.p_sys; |
|---|
| 800 |
aout_buffer_t * p_buffer; |
|---|
| 801 |
snd_pcm_status_t * p_status = p_sys->p_status; |
|---|
| 802 |
int i_snd_rc; |
|---|
| 803 |
mtime_t next_date; |
|---|
| 804 |
|
|---|
| 805 |
|
|---|
| 806 |
|
|---|
| 807 |
|
|---|
| 808 |
i_snd_rc = snd_pcm_status( p_sys->p_snd_pcm, p_status ); |
|---|
| 809 |
if( i_snd_rc < 0 ) |
|---|
| 810 |
{ |
|---|
| 811 |
msg_Err( p_aout, "cannot get device status" ); |
|---|
| 812 |
goto error; |
|---|
| 813 |
} |
|---|
| 814 |
|
|---|
| 815 |
|
|---|
| 816 |
if( snd_pcm_status_get_state( p_status ) == SND_PCM_STATE_XRUN ) |
|---|
| 817 |
{ |
|---|
| 818 |
|
|---|
| 819 |
i_snd_rc = snd_pcm_prepare( p_sys->p_snd_pcm ); |
|---|
| 820 |
|
|---|
| 821 |
if( i_snd_rc ) |
|---|
| 822 |
{ |
|---|
| 823 |
msg_Err( p_aout, "cannot recover from buffer underrun" ); |
|---|
| 824 |
goto error; |
|---|
| 825 |
} |
|---|
| 826 |
|
|---|
| 827 |
msg_Dbg( p_aout, "recovered from buffer underrun" ); |
|---|
| 828 |
|
|---|
| 829 |
|
|---|
| 830 |
i_snd_rc = snd_pcm_status( p_sys->p_snd_pcm, p_status ); |
|---|
| 831 |
if( i_snd_rc < 0 ) |
|---|
| 832 |
{ |
|---|
| 833 |
msg_Err( p_aout, "cannot get device status after recovery" ); |
|---|
| 834 |
goto error; |
|---|
| 835 |
} |
|---|
| 836 |
|
|---|
| 837 |
|
|---|
| 838 |
next_date = mdate(); |
|---|
| 839 |
} |
|---|
| 840 |
else |
|---|
| 841 |
{ |
|---|
| 842 |
|
|---|
| 843 |
snd_pcm_sframes_t delay = snd_pcm_status_get_delay( p_status ); |
|---|
| 844 |
if( delay == 0 ) |
|---|
| 845 |
if( snd_pcm_delay( p_sys->p_snd_pcm, &delay ) < 0 ) |
|---|
| 846 |
delay = 0; |
|---|
| 847 |
int i_bytes = snd_pcm_frames_to_bytes( p_sys->p_snd_pcm, delay ); |
|---|
| 848 |
next_date = mdate() + ( (mtime_t)i_bytes * 1000000 |
|---|
| 849 |
/ p_aout->output.output.i_bytes_per_frame |
|---|
| 850 |
/ p_aout->output.output.i_rate |
|---|
| 851 |
* p_aout->output.output.i_frame_length ); |
|---|
| 852 |
|
|---|
| 853 |
#ifdef ALSA_DEBUG |
|---|
| 854 |
snd_pcm_state_t state = snd_pcm_status_get_state( p_status ); |
|---|
| 855 |
if( state != SND_PCM_STATE_RUNNING ) |
|---|
|
|---|