Commit 2ce7beda authored by Stéphane Borel's avatar Stéphane Borel
Browse files

*New configuration option to choose audio output format at runtime.
It allows to select spdif pass-through decoder with --ac3_adec and to
remove the ugly b_ac3 in main.h

As a consequence --spdif doesn't work anymore: you should use --ac3_adec pass

*Fixed a typo in main.c

*Return the option name in error message for unknown option intead of the
argument.
parent df7f26ed
......@@ -104,15 +104,6 @@
/* Maximum number of audio output threads */
#define AOUT_MAX_THREADS 10
/* Default audio output format (AOUT_FMT_S16_NE = Native Endianess) */
#define AOUT_FORMAT_DEFAULT AOUT_FMT_S16_NE
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_S8 */
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_U8 */
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_S16_BE */
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_S16_LE */
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_U16_BE */
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_U16_LE */
/* Volume */
#define VOLUME_DEFAULT 256
#define VOLUME_STEP 128
......
......@@ -3,7 +3,7 @@
* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: main.h,v 1.30 2002/02/24 20:51:09 gbazin Exp $
* $Id: main.h,v 1.31 2002/03/12 18:37:46 stef Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -47,7 +47,6 @@ typedef struct main_s
/* Generic settings */
boolean_t b_audio; /* is audio output allowed ? */
boolean_t b_video; /* is video output allowed ? */
boolean_t b_ac3;
boolean_t b_stereo;
mtime_t i_desync; /* relative desync of the audio ouput */
......
......@@ -2,7 +2,7 @@
* ac3_adec.c: ac3 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ac3_adec.c,v 1.22 2002/02/24 22:06:50 sam Exp $
* $Id: ac3_adec.c,v 1.23 2002/03/12 18:37:46 stef Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -84,6 +84,8 @@ MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "software AC3 decoder" )
ADD_CAPABILITY( DECODER, 50 )
ADD_SHORTCUT( "ac3_adec" )
ADD_SHORTCUT( "ac3" )
MODULE_INIT_STOP
MODULE_ACTIVATE_START
......
......@@ -2,7 +2,7 @@
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.c,v 1.19 2002/03/11 07:23:09 gbazin Exp $
* $Id: ac3_spdif.c,v 1.20 2002/03/12 18:37:46 stef Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
......@@ -69,13 +69,14 @@ void _M( adec_getfunctions )( function_list_t * p_function_list )
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_CATEGORY_HINT( "Misc Options", NULL )
ADD_BOOL( "spdif", NULL, "enable AC3 pass-through mode", NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "SPDIF pass-through AC3 decoder" )
ADD_CAPABILITY( DECODER, 100 )
ADD_CAPABILITY( DECODER, 0 )
ADD_SHORTCUT( "ac3_spdif" )
ADD_SHORTCUT( "pass_through" )
ADD_SHORTCUT( "pass" )
MODULE_INIT_STOP
MODULE_ACTIVATE_START
......@@ -93,8 +94,7 @@ MODULE_DEACTIVATE_STOP
*****************************************************************************/
static int decoder_Probe( u8 *pi_type )
{
return( ( config_GetIntVariable( "spdif" )
&& *pi_type == AC3_AUDIO_ES ) ? 0 : -1 );
return( *pi_type == AC3_AUDIO_ES ) ? 0 : -1;
}
......@@ -249,7 +249,6 @@ static int InitThread( ac3_spdif_thread_t * p_spdif )
{
intf_ErrMsg( "spdif error: stream not valid");
aout_DestroyFifo( p_spdif->p_aout_fifo );
return( -1 );
}
......@@ -266,6 +265,10 @@ static int InitThread( ac3_spdif_thread_t * p_spdif )
//return -1;
}
/* The audio output need to be ready for an ac3 stream */
p_spdif->i_previous_format = config_GetIntVariable( "aout_format" );
config_PutIntVariable( "aout_format", 8 );
/* Creating the audio output fifo */
p_spdif->p_aout_fifo = aout_CreateFifo( AOUT_FIFO_SPDIF, 1,
p_spdif->ac3_info.i_sample_rate,
......@@ -302,6 +305,9 @@ static void EndThread( ac3_spdif_thread_t * p_spdif )
}
/* restore previous setting for output format */
config_PutIntVariable( "aout_format", p_spdif->i_previous_format );
/* Destroy descriptor */
free( p_spdif->p_ac3 );
free( p_spdif );
......
......@@ -2,7 +2,7 @@
* ac3_spdif.h: header for ac3 pass-through
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.h,v 1.1 2001/11/13 12:09:17 henri Exp $
* $Id: ac3_spdif.h,v 1.2 2002/03/12 18:37:46 stef Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
*
......@@ -63,6 +63,7 @@ typedef struct ac3_spdif_thread_s
/*
* Output properties
*/
int i_previous_format;
aout_fifo_t * p_aout_fifo; /* stores the decompressed audio frames */
} ac3_spdif_thread_t;
......
/* dvd_es.c: functions to find and select ES
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_es.c,v 1.3 2002/03/11 07:23:09 gbazin Exp $
* $Id: dvd_es.c,v 1.4 2002/03/12 18:37:46 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -252,9 +252,7 @@ void DVDLaunchDecoders( input_thread_t * p_input )
i_audio = 1;
}
if( config_GetIntVariable( "spdif" ) ||
( config_GetIntVariable( "input_audio" ) ==
REQUESTED_AC3 ) )
if( ( config_GetIntVariable( "input_audio" ) == REQUESTED_AC3 ) )
{
int i_ac3 = i_audio;
while( ( p_input->stream.pp_es[i_ac3]->i_type !=
......
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_dvdread.c,v 1.32 2002/03/11 07:23:09 gbazin Exp $
* $Id: input_dvdread.c,v 1.33 2002/03/12 18:37:46 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -1216,9 +1216,7 @@ static void DvdReadLauchDecoders( input_thread_t * p_input )
}
if( i_audio > 0/* && i_audio_nb > 0*/ )
{
if( config_GetIntVariable( "spdif" ) ||
( config_GetIntVariable( "input_audio" ) ==
REQUESTED_AC3 ) )
if( config_GetIntVariable( "input_audio" ) == REQUESTED_AC3 )
{
int i_ac3 = i_audio;
while( ( p_input->stream.pp_es[i_ac3]->i_type !=
......
......@@ -2,7 +2,7 @@
* audio_output.c : audio output thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio_output.c,v 1.82 2002/03/11 07:23:09 gbazin Exp $
* $Id: audio_output.c,v 1.83 2002/03/12 18:37:46 stef Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -86,7 +86,8 @@ aout_thread_t *aout_CreateThread( int *pi_status, int i_channels, int i_rate )
#if 0
int i_status; /* thread status */
#endif
char *psz_name;
char * psz_name;
int i_format;
/* Allocate descriptor */
p_aout = (aout_thread_t *) malloc( sizeof(aout_thread_t) );
......@@ -99,17 +100,16 @@ aout_thread_t *aout_CreateThread( int *pi_status, int i_channels, int i_rate )
p_aout->i_rate = config_GetIntVariable( "rate" );
p_aout->i_channels = config_GetIntVariable( "mono" ) ? 1 : 2;
/* Maybe we should pass this setting in argument */
p_aout->i_format = AOUT_FORMAT_DEFAULT;
/* special setting for ac3 pass-through mode */
/* FIXME is it necessary ? (cf ac3_adec.c) */
if( config_GetIntVariable( "spdif" ) && p_main->b_ac3 )
i_format = config_GetIntVariable( "aout_format" );
if( ( !i_format ) || ( i_format > 8 ) )
{
intf_WarnMsg( 4, "aout info: setting ac3 spdif" );
p_aout->i_format = AOUT_FMT_AC3;
p_aout->i_format = AOUT_FMT_S16_NE;
}
else
{
p_aout->i_format = 1 << ( i_format + 2 );
}
if( p_aout->i_rate == 0 )
{
intf_ErrMsg( "aout error: null sample rate" );
......
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_programs.c,v 1.73 2002/03/05 17:46:33 stef Exp $
* $Id: input_programs.c,v 1.74 2002/03/12 18:37:46 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -543,9 +543,6 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
case LPCM_AUDIO_ES:
if( p_main->b_audio )
{
/* This kludge should be removed */
p_main->b_ac3 = ( p_es->i_type == AC3_AUDIO_ES );
/* Release the lock, not to block the input thread during
* the creation of the thread. */
vlc_mutex_unlock( &p_input->stream.stream_lock );
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.162 2002/03/11 07:23:10 gbazin Exp $
* $Id: main.c,v 1.163 2002/03/12 18:37:46 stef Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -130,10 +130,25 @@
#define MONO_LONGTEXT "This will force a mono audio output"
#define VOLUME_TEXT "audio output volume"
#define VOLUME_LONGTEXT "You can set the default audio output volume here"
#define RATE_TEXT "audio output frequency"
#define RATE_LONGTEXT "You can force the audio output frequency here"
#define VOLUME_LONGTEXT "You can set the default audio output volume here," \
" in a range from 0 to 1024"
#define FORMAT_TEXT "audio output format"
#define FORMAT_LONGTEXT "You can force the audio output format here.\n" \
"0 -> 16 bits signed native endian (default)\n" \
"1 -> 8 bits unsigned\n" \
"2 -> 16 bits signed little endian\n" \
"3 -> 16 bits signed big endian\n" \
"4 -> 8 bits signed\n" \
"5 -> 16 bits unsigned little endian\n" \
"6 -> 16 bits unsigned big endian\n" \
"7 -> mpeg2 audio (unsupported)\n" \
"8 -> ac3 pass-through"
#define RATE_TEXT "audio output frequency (Hz)"
#define RATE_LONGTEXT "You can force the audio output frequency here.\n" \
"Common values are 48000, 44100, 32000, 22050," \
" 16000, 11025, 8000"
#define DESYNC_TEXT "Compensate desynchronization of audio (in ms)"
#define DESYNC_LONGTEXT "This option allows you to delay the audio output." \
......@@ -282,6 +297,8 @@ ADD_BOOL ( "mono", NULL, MONO_TEXT, MONO_LONGTEXT )
ADD_INTEGER ( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT )
ADD_INTEGER ( "rate", 44100, NULL, RATE_TEXT, RATE_LONGTEXT )
ADD_INTEGER ( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT )
ADD_INTEGER ( "aout_format", 0, NULL, FORMAT_TEXT,
FORMAT_LONGTEXT )
/* Video options */
ADD_CATEGORY_HINT( "Video", NULL )
......@@ -306,7 +323,7 @@ ADD_INTEGER ( "channel_port", 6010, NULL, CHAN_PORT_TEXT, CHAN_PORT_LONGTEXT )
ADD_STRING ( "iface", "eth0", NULL, IFACE_TEXT, IFACE_LONGTEXT )
ADD_INTEGER ( "input_audio", -1, NULL, INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT )
ADD_INTEGER ( "input channel", -1, NULL, INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT )
ADD_INTEGER ( "input_channel", -1, NULL, INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT )
ADD_INTEGER ( "input_subtitle", -1, NULL, INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT )
ADD_STRING ( "dvd_device", "/dev/dvd", NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT )
......@@ -943,7 +960,7 @@ static int GetConfigurationFromCmdLine( int *pi_argc, char *ppsz_argv[],
if( !b_ignore_errors )
{
intf_ErrMsg( "intf error: unknown option `%s'",
ppsz_argv[optind] );
ppsz_argv[optind-1] );
intf_Msg( "Try `%s --help' for more information.\n",
p_main->psz_arg0 );
......
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