set_subcategory( SUBCAT_AUDIO_AOUT )
add_loadfile( "oss-audio-device", "/dev/dsp",
N_("OSS DSP device"), NULL, false )
- add_deprecated_alias( "dspdev" ) /* deprecated since 0.9.3 */
set_capability( "audio output", 100 )
add_shortcut( "oss" )
}
/* Test for spdif. */
- if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
+ if ( AOUT_FMT_SPDIF( &p_aout->format ) )
{
i_format = AFMT_AC3;
msg_Warn( p_aout, "S/PDIF not supported by card" );
}
}
-
- var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart,
- NULL );
}
/*****************************************************************************
p_aout->pf_flush = aout_PacketFlush;
if ( var_Type( p_aout, "audio-device" ) == 0 )
- {
Probe( p_aout );
- }
+ var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
if ( var_Get( p_aout, "audio-device", &val ) < 0 )
- {
/* Probe() has failed. */
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
- }
+ goto error;
if ( val.i_int == AOUT_VAR_SPDIF )
{
/* This should not happen ! */
msg_Err( p_aout, "internal: can't find audio-device (%"PRId64")",
val.i_int );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
var_TriggerCallback( p_aout, "intf-change" );
if( ioctl( p_sys->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
{
msg_Err( p_aout, "cannot reset OSS audio device" );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
/* Set the output format */
- if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
+ if ( AOUT_FMT_SPDIF( &p_aout->format ) )
{
int i_format = AFMT_AC3;
|| i_format != AFMT_AC3 )
{
msg_Err( p_aout, "cannot reset OSS audio device" );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
p_aout->format.i_format = VLC_CODEC_SPDIFL;
aout_PacketInit( p_aout, &p_sys->packet, A52_FRAME_NB );
aout_VolumeNoneInit( p_aout );
}
-
- if ( !AOUT_FMT_NON_LINEAR( &p_aout->format ) )
+ else
{
unsigned int i_format = AFMT_S16_NE;
unsigned int i_frame_size, i_fragments;
if( ioctl( p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
{
msg_Err( p_aout, "cannot set audio output format" );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
switch ( i_format )
default:
msg_Err( p_aout, "OSS fell back to an unknown format (%d)",
i_format );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
i_nb_channels = aout_FormatNbChannels( &p_aout->format );
{
msg_Err( p_aout, "cannot set number of audio channels (%s)",
aout_FormatPrintChannels( &p_aout->format) );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
/* Set the output rate */
{
msg_Err( p_aout, "cannot set audio output rate (%i)",
p_aout->format.i_rate );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
if( i_rate != p_aout->format.i_rate )
if( ioctl( p_sys->i_fd, SNDCTL_DSP_GETOSPACE, &audio_buf ) < 0 )
{
msg_Err( p_aout, "cannot get fragment size" );
- close( p_sys->i_fd );
- free( p_sys );
- return VLC_EGENERIC;
+ goto error;
}
/* Number of fragments actually allocated */
VLC_THREAD_PRIORITY_OUTPUT ) )
{
msg_Err( p_aout, "cannot create OSS thread (%m)" );
- close( p_sys->i_fd );
aout_PacketDestroy( p_aout );
- free( p_sys );
- return VLC_ENOMEM;
+ goto error;
}
return VLC_SUCCESS;
+
+ var_DelCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
+ close( p_sys->i_fd );
+ free( p_sys );
+ return VLC_EGENERIC;
}
/*****************************************************************************
vlc_cancel( p_sys->thread );
vlc_join( p_sys->thread, NULL );
p_aout->b_die = false;
+ var_DelCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
ioctl( p_sys->i_fd, SNDCTL_DSP_RESET, NULL );
close( p_sys->i_fd );
for( ;; )
{
canc = vlc_savecancel ();
- p_buffer = aout_PacketNext( p_aout );
+ p_buffer = aout_PacketNext( p_aout, next_date );
if ( p_buffer )
break;
vlc_restorecancel (canc);