Commit de621e39 authored by Gildas Bazin's avatar Gildas Bazin

* src/libvlc.h, modules/audio_output: added a global --spdif config option
   to allow using the spdif output by default if available.
* modules/misc/dummy/*: on win32 added a quiet mode that doesn't display
   a dos command box.
* modules/control/rc/rc.c: on win32 enabled the echo mode and the
   backspace key.
* modules/codec/mpeg_audio.c: fixed a sync bug.
parent 5a13b475
......@@ -2,7 +2,7 @@
* alsa.c : alsa plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: alsa.c,v 1.23 2003/02/20 01:52:45 sigmunau Exp $
* $Id: alsa.c,v 1.24 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Henri Fallon <henri@videolan.org> - Original Author
* Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
......@@ -87,17 +87,10 @@ static void ALSAFill ( aout_instance_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define SPDIF_TEXT N_("Try to use S/PDIF output")
#define SPDIF_LONGTEXT N_( \
"Sometimes we attempt to use the S/PDIF output, even if nothing is " \
"connected to it. Un-checking this option disables this behaviour, " \
"and permanently selects analog PCM output." )
vlc_module_begin();
add_category_hint( N_("ALSA"), NULL, VLC_FALSE );
add_string( "alsadev", DEFAULT_ALSA_DEVICE, aout_FindAndRestart,
N_("ALSA device name"), NULL, VLC_FALSE );
add_bool( "spdif", 1, NULL, SPDIF_TEXT, SPDIF_LONGTEXT, VLC_FALSE );
set_description( _("ALSA audio module") );
set_capability( "audio output", 50 );
set_callbacks( Open, Close );
......@@ -115,20 +108,6 @@ static void Probe( aout_instance_t * p_aout,
var_Create ( p_aout, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
/* Test for S/PDIF device if needed */
if ( psz_iec_device )
{
/* Opening the device should be enough */
if ( config_GetInt( p_aout, "spdif" )
&& !snd_pcm_open( &p_sys->p_snd_pcm, psz_iec_device,
SND_PCM_STREAM_PLAYBACK, 0 ) )
{
val.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
snd_pcm_close( p_sys->p_snd_pcm );
}
}
/* Now test linear PCM capabilities */
if ( !snd_pcm_open( &p_sys->p_snd_pcm, psz_device,
SND_PCM_STREAM_PLAYBACK, 0 ) )
......@@ -205,6 +184,21 @@ static void Probe( aout_instance_t * p_aout,
snd_pcm_close( p_sys->p_snd_pcm );
}
/* Test for S/PDIF device if needed */
if ( psz_iec_device )
{
/* Opening the device should be enough */
if ( !snd_pcm_open( &p_sys->p_snd_pcm, psz_iec_device,
SND_PCM_STREAM_PLAYBACK, 0 ) )
{
val.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
snd_pcm_close( p_sys->p_snd_pcm );
if( config_GetInt( p_aout, "spdif" ) )
var_Set( p_aout, "audio-device", val );
}
}
/* Add final settings to the variable */
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
val.b_bool = VLC_TRUE;
......
......@@ -2,7 +2,7 @@
* directx.c: Windows DirectX audio output method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: directx.c,v 1.13 2003/02/19 22:08:39 gbazin Exp $
* $Id: directx.c,v 1.14 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -194,7 +194,7 @@ static void InterleaveS16 ( int16_t *, int16_t *, int *, int );
*****************************************************************************/
vlc_module_begin();
set_description( _("DirectX audio module") );
set_capability( "audio output", 50 );
set_capability( "audio output", 100 );
add_shortcut( "directx" );
set_callbacks( OpenAudio, CloseAudio );
vlc_module_end();
......@@ -365,22 +365,6 @@ static void Probe( aout_instance_t * p_aout )
var_Create( p_aout, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
/* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
{
if( CreateDSBuffer( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate,
AOUT_SPDIF_SIZE, VLC_TRUE )
== VLC_SUCCESS )
{
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
val.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
}
}
/* Test for 5.1 support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT |
......@@ -461,6 +445,24 @@ static void Probe( aout_instance_t * p_aout )
}
var_Set( p_aout, "audio-device", val );
/* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
{
if( CreateDSBuffer( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate,
AOUT_SPDIF_SIZE, VLC_TRUE )
== VLC_SUCCESS )
{
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
val.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
if( config_GetInt( p_aout, "spdif" ) )
var_Set( p_aout, "audio-device", val );
}
}
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
val.b_bool = VLC_TRUE;
......
......@@ -2,7 +2,7 @@
* oss.c : OSS /dev/dsp module for vlc
*****************************************************************************
* Copyright (C) 2000-2002 VideoLAN
* $Id: oss.c,v 1.52 2003/02/20 01:52:45 sigmunau Exp $
* $Id: oss.c,v 1.53 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -105,18 +105,11 @@ static mtime_t BufferDuration( aout_instance_t * p_aout );
"are completely filled (the sound gets heavily hashed). If you have one " \
"of these drivers, then you need to enable this option." )
#define SPDIF_TEXT N_("try to use S/PDIF output")
#define SPDIF_LONGTEXT N_( \
"Sometimes we attempt to use the S/PDIF output, even if nothing is " \
"connected to it. Un-checking this option disables this behaviour, " \
"and permanently selects analog PCM output." )
vlc_module_begin();
add_category_hint( N_("OSS"), NULL, VLC_FALSE );
add_file( "dspdev", "/dev/dsp", aout_FindAndRestart,
N_("OSS dsp device"), NULL, VLC_FALSE );
add_bool( "oss-buggy", 0, NULL, BUGGY_TEXT, BUGGY_LONGTEXT, VLC_TRUE );
add_bool( "spdif", 1, NULL, SPDIF_TEXT, SPDIF_LONGTEXT, VLC_FALSE );
set_description( _("Linux OSS /dev/dsp module") );
set_capability( "audio output", 100 );
add_shortcut( "oss" );
......@@ -134,40 +127,24 @@ static void Probe( aout_instance_t * p_aout )
var_Create( p_aout, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
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;
}
if ( config_GetInt( p_aout, "spdif" )
&& 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.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
}
}
/* Go to PCM mode. */
i_format = AFMT_S16_NE;
if( ioctl( p_sys->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 ||
ioctl( p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
{
return;
}
/* Test for multi-channel. */
#ifdef SNDCTL_DSP_GETCHANNELMASK
if ( aout_FormatNbChannels( &p_aout->output.output ) > 2 )
{
/* Check that the device supports this. */
int i_chanmask;
/* Reset all. */
i_format = AFMT_S16_NE;
if( ioctl( p_sys->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 ||
ioctl( p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
{
msg_Err( p_aout, "cannot reset OSS audio device" );
var_Destroy( p_aout, "audio-device" );
return;
}
if ( ioctl( p_sys->i_fd, SNDCTL_DSP_GETCHANNELMASK,
&i_chanmask ) == 0 )
{
......@@ -200,6 +177,16 @@ static void Probe( aout_instance_t * p_aout )
}
#endif
/* Reset all. */
i_format = AFMT_S16_NE;
if( ioctl( p_sys->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 ||
ioctl( p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
{
msg_Err( p_aout, "cannot reset OSS audio device" );
var_Destroy( p_aout, "audio-device" );
return;
}
/* Test for stereo. */
i_nb_channels = 2;
if( ioctl( p_sys->i_fd, SNDCTL_DSP_CHANNELS, &i_nb_channels ) >= 0
......@@ -232,6 +219,27 @@ static void Probe( aout_instance_t * p_aout )
}
}
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.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
if( config_GetInt( p_aout, "spdif" ) )
var_Set( p_aout, "audio-device", val );
}
}
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart,
NULL );
......
......@@ -2,7 +2,7 @@
* waveout.c : Windows waveOut plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: waveout.c,v 1.18 2003/02/19 22:08:39 gbazin Exp $
* $Id: waveout.c,v 1.19 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -128,7 +128,7 @@ static void InterleaveS16( int16_t *, int *, int );
*****************************************************************************/
vlc_module_begin();
set_description( _("Win32 waveOut extension module") );
set_capability( "audio output", 100 );
set_capability( "audio output", 50 );
set_callbacks( Open, Close );
vlc_module_end();
......@@ -315,21 +315,6 @@ static void Probe( aout_instance_t * p_aout )
var_Create( p_aout, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
/* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
{
if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
val.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
}
}
/* Test for 5.1 support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT |
......@@ -389,6 +374,23 @@ static void Probe( aout_instance_t * p_aout )
msg_Dbg( p_aout, "device supports 1 channel" );
}
/* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
{
if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
val.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
if( config_GetInt( p_aout, "spdif" ) )
var_Set( p_aout, "audio-device", val );
}
}
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
val.b_bool = VLC_TRUE;
......
......@@ -2,7 +2,7 @@
* mpeg_audio.c: parse MPEG audio sync info and packetize the stream
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: mpeg_audio.c,v 1.12 2003/02/18 18:49:11 fenrir Exp $
* $Id: mpeg_audio.c,v 1.13 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -164,7 +164,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
/* Look inside the sync buffer. */
for ( i = 1; i < MAD_BUFFER_GUARD - 1; i++ )
{
if ( (p_sync[i] == 0xff) && ((p_sync[i + 1] & 0xe0) != 0xe0) )
if ( (p_sync[i] == 0xff) && ((p_sync[i + 1] & 0xe0) == 0xe0) )
break;
}
if ( i < MAD_BUFFER_GUARD - 1 )
......
......@@ -2,7 +2,7 @@
* rc.c : remote control stdin/stdout plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: rc.c,v 1.27 2003/02/20 01:52:46 sigmunau Exp $
* $Id: rc.c,v 1.28 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
*
......@@ -250,14 +250,41 @@ static void Run( intf_thread_t *p_intf )
p_buffer[ i_size ] =
input_record.Event.KeyEvent.uChar.AsciiChar;
#endif
/* Echo out the command */
putc( p_buffer[ i_size ], stdout );
/* Handle special keys */
if( p_buffer[ i_size ] == '\r' || p_buffer[ i_size ] == '\n' )
{
putc( '\n', stdout );
break;
}
switch( p_buffer[ i_size ] )
{
case '\b':
if( i_size )
{
i_size -= 2;
putc( ' ', stdout );
putc( '\b', stdout );
}
break;
case '\r':
i_size --;
break;
}
i_size++;
#else
if( p_buffer[ i_size ] == '\r' || p_buffer[ i_size ] == '\n' )
{
break;
}
i_size++;
#endif
}
if( i_size == MAX_LINE_LENGTH
......
......@@ -2,7 +2,7 @@
* dummy.c : dummy plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: dummy.c,v 1.3 2003/02/20 01:52:46 sigmunau Exp $
* $Id: dummy.c,v 1.4 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -40,12 +40,25 @@
"format instead of trying to improve performances by using the most " \
"efficient one.")
#ifdef WIN32
#define QUIET_TEXT N_("don't open a dos command box interface")
#define QUIET_LONGTEXT N_( \
"By default the dummy interface plugin will start a dos command box. " \
"Enabling the quiet mode will not bring this command box but can also " \
"be pretty annoying when you want to stop vlc and no video window is " \
"opened." )
#endif
vlc_module_begin();
set_description( _("dummy functions module") );
add_shortcut( "vlc" );
add_submodule();
set_capability( "interface", 0 );
set_callbacks( E_(OpenIntf), NULL );
#ifdef WIN32
add_category_hint( N_("Interface"), NULL, VLC_FALSE );
add_bool( "dummy-quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, VLC_FALSE );
#endif
add_submodule();
set_capability( "access", 0 );
set_callbacks( E_(OpenAccess), NULL );
......
......@@ -2,7 +2,7 @@
* intf_dummy.c: dummy interface plugin
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: interface.c,v 1.2 2002/10/03 17:01:58 gbazin Exp $
* $Id: interface.c,v 1.3 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -42,7 +42,13 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*) p_this;
CONSOLE_INTRO_MSG;
#ifdef WIN32
vlc_bool_t b_quiet;
b_quiet = config_GetInt( p_intf, "dummy-quiet" );
if( !b_quiet )
CONSOLE_INTRO_MSG;
#endif
msg_Info( p_intf, _("Using the dummy interface plugin...") );
p_intf->pf_run = Run;
......
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.44 2003/02/20 01:52:46 sigmunau Exp $
* $Id: libvlc.h,v 1.45 2003/02/20 16:07:38 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -108,6 +108,11 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
"This option allows you to delay the audio output. This can be handy if " \
"you notice a lag between the video and the audio.")
#define SPDIF_TEXT N_("use the S/PDIF audio output when available")
#define SPDIF_LONGTEXT N_( \
"This option allows you to use the S/PDIF audio output by default when " \
"your hardware supports it as well as the audio stream being played.")
#define HEADPHONE_TEXT N_("headphone virtual spatialization effect")
#define HEADPHONE_LONGTEXT N_( \
"This effect gives you the feeling that you stands in a real room " \
......@@ -461,6 +466,7 @@ vlc_module_begin();
VOLUME_SAVE_TEXT, VOLUME_SAVE_LONGTEXT, VLC_TRUE );
add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT, AOUT_RATE_LONGTEXT, VLC_TRUE );
add_integer( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT, VLC_TRUE );
add_bool( "spdif", 0, NULL, SPDIF_TEXT, SPDIF_LONGTEXT, VLC_FALSE );
add_bool( "headphone", 0, NULL, HEADPHONE_TEXT, HEADPHONE_LONGTEXT, VLC_FALSE );
add_integer( "headphone-dim", 5, NULL, HEADPHONE_DIM_TEXT,
HEADPHONE_DIM_LONGTEXT, VLC_TRUE );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment