+ if( ioctl( p_sys->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
+ {
+ msg_Err( p_aout, "cannot reset OSS audio device" );
+ var_Destroy( p_aout, "audio-device" );
+ return;
+ }
+
+ /* Test for spdif. */
+ if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
+ {
+ i_format = AFMT_AC3;
+
+ if( ioctl( p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) >= 0
+ && i_format == AFMT_AC3 )
+ {
+ val.i_int = AOUT_VAR_SPDIF;
+ text.psz_string = N_("A/52 over S/PDIF");
+ var_Change( p_aout, "audio-device",
+ VLC_VAR_ADDCHOICE, &val, &text );
+ if( config_GetInt( p_aout, "spdif" ) )
+ var_Set( p_aout, "audio-device", val );
+ }
+ else if( config_GetInt( p_aout, "spdif" ) )
+ {
+ msg_Warn( p_aout, "S/PDIF not supported by card" );
+ }
+ }
+
+ var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart,
+ NULL );