Commit cf891bad authored by Christophe Massiot's avatar Christophe Massiot

* configure.in: Fixed detection of Qt-embedded.

* modules/codec/a52.c: Fixed detection of A/52 sound.
* modules/audio_filter/converter/a52tofloat32.c: Fixed a bug related to
  downmixing.
* ALL: Added hooks for audio volume management.
parent 4a53cbab
...@@ -1394,17 +1394,21 @@ then ...@@ -1394,17 +1394,21 @@ then
then then
test_LDFLAGS="-L${QTDIR}/lib" test_LDFLAGS="-L${QTDIR}/lib"
test_CFLAGS="-I$(QTDIR)/include" test_CFLAGS="-I$(QTDIR)/include"
PLUGINS="${PLUGINS} video_output/qte/qte"
else else
test_LDFLAGS="-L${with_qte}/lib" test_LDFLAGS="-L${with_qte}/lib"
test_CFLAGS="-I${with_qte}/include" test_CFLAGS="-I${with_qte}/include"
BUILTINS="${BUILTINS} video_output/qte/qte"
fi fi
CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}" CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
AC_CHECK_HEADERS(qt.h, [ AC_CHECK_HEADERS(qt.h, [
qte_CFLAGS="${qte_CFLAGS} ${test_CFLAGS} -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti" qte_CFLAGS="${qte_CFLAGS} ${test_CFLAGS} -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
qte_LDFLAGS="${qte_LDFLAGS} ${test_LDFLAGS} -lqpe -lqte" qte_LDFLAGS="${qte_LDFLAGS} ${test_LDFLAGS} -lqpe -lqte"
if test "x${with_qte}" = "x"
then
PLUGINS="${PLUGINS} video_output/qte/qte"
else
BUILTINS="${BUILTINS} video_output/qte/qte"
fi
]) ])
CPPFLAGS="${save_CPPFLAGS}" CPPFLAGS="${save_CPPFLAGS}"
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output * aout_internal.h : internal defines for audio output
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.16 2002/09/06 23:15:44 massiot Exp $ * $Id: aout_internal.h,v 1.17 2002/09/16 20:46:37 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -119,6 +119,11 @@ typedef struct aout_mixer_t ...@@ -119,6 +119,11 @@ typedef struct aout_mixer_t
struct aout_mixer_sys_t * p_sys; struct aout_mixer_sys_t * p_sys;
void (* pf_do_work)( struct aout_instance_t *, void (* pf_do_work)( struct aout_instance_t *,
struct aout_buffer_t * ); struct aout_buffer_t * );
/* Multiplier used to raise or lower the volume of the sound in
* software. Beware, this creates sound distortion and should be avoided
* as much as possible. This isn't available for non-float32 mixer. */
float f_multiplier;
} aout_mixer_t; } aout_mixer_t;
/***************************************************************************** /*****************************************************************************
...@@ -159,7 +164,14 @@ typedef struct aout_output_t ...@@ -159,7 +164,14 @@ typedef struct aout_output_t
struct module_t * p_module; struct module_t * p_module;
struct aout_sys_t * p_sys; struct aout_sys_t * p_sys;
void (* pf_play)( aout_instance_t * ); void (* pf_play)( aout_instance_t * );
int (* pf_volume_get )( aout_instance_t *, audio_volume_t * );
int (* pf_volume_set )( aout_instance_t *, audio_volume_t );
int (* pf_volume_infos )( aout_instance_t *, audio_volume_t *, audio_volume_t * );
int i_nb_samples; int i_nb_samples;
/* Current volume for the output - it's just a placeholder, the plug-in
* may or may not use it. */
audio_volume_t i_volume;
} aout_output_t; } aout_output_t;
/***************************************************************************** /*****************************************************************************
...@@ -219,6 +231,8 @@ void aout_FiltersPlay( aout_instance_t * p_aout, ...@@ -219,6 +231,8 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
int aout_MixerNew( aout_instance_t * p_aout ); int aout_MixerNew( aout_instance_t * p_aout );
void aout_MixerDelete( aout_instance_t * p_aout ); void aout_MixerDelete( aout_instance_t * p_aout );
void aout_MixerRun( aout_instance_t * p_aout ); void aout_MixerRun( aout_instance_t * p_aout );
int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier );
int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier );
int aout_OutputNew( aout_instance_t * p_aout, int aout_OutputNew( aout_instance_t * p_aout,
audio_sample_format_t * p_format ); audio_sample_format_t * p_format );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio_output.h : audio output interface * audio_output.h : audio output interface
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.62 2002/09/02 23:17:05 massiot Exp $ * $Id: audio_output.h,v 1.63 2002/09/16 20:46:37 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -165,6 +165,11 @@ struct audio_date_t ...@@ -165,6 +165,11 @@ struct audio_date_t
u32 i_remainder; u32 i_remainder;
}; };
/*****************************************************************************
* audio_volume_t : integer value for the audio volume
*****************************************************************************/
typedef unsigned int audio_volume_t;
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -186,3 +191,5 @@ VLC_EXPORT( mtime_t, aout_DateIncrement, ( audio_date_t *, u32 ) ); ...@@ -186,3 +191,5 @@ VLC_EXPORT( mtime_t, aout_DateIncrement, ( audio_date_t *, u32 ) );
VLC_EXPORT( aout_input_t *, __aout_InputNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) ); VLC_EXPORT( aout_input_t *, __aout_InputNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) );
VLC_EXPORT( void, aout_InputDelete, ( aout_instance_t *, aout_input_t * ) ); VLC_EXPORT( void, aout_InputDelete, ( aout_instance_t *, aout_input_t * ) );
/* From intf.c : */
/***************************************************************************** /*****************************************************************************
* config.h: limits and configuration * vlc_config.h: limits and configuration
* Defines all compilation-time configuration constants and size limits * Defines all compilation-time configuration constants and size limits
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999-2002 VideoLAN
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -124,10 +124,10 @@ ...@@ -124,10 +124,10 @@
#define AOUT_MAX_THREADS 10 #define AOUT_MAX_THREADS 10
/* Volume */ /* Volume */
#define VOLUME_DEFAULT 256 #define AOUT_VOLUME_DEFAULT 256
#define VOLUME_STEP 32 #define AOUT_VOLUME_STEP 32
#define VOLUME_MAX 1024 #define AOUT_VOLUME_MAX 1024
#define VOLUME_MIN 0 #define AOUT_VOLUME_MIN 0
/* Max number of pre-filters per input, and max number of post-filters */ /* Max number of pre-filters per input, and max number of post-filters */
#define AOUT_MAX_FILTERS 10 #define AOUT_MAX_FILTERS 10
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (http://liba52.sf.net/). * (http://liba52.sf.net/).
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: a52tofloat32.c,v 1.1 2002/09/02 23:17:05 massiot Exp $ * $Id: a52tofloat32.c,v 1.2 2002/09/16 20:46:37 massiot Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -190,7 +190,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -190,7 +190,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
a52_frame( p_sys->p_liba52, p_in_buf->p_buffer, a52_frame( p_sys->p_liba52, p_in_buf->p_buffer,
&i_flags, &i_sample_level, 0 ); &i_flags, &i_sample_level, 0 );
if ( i_flags != p_sys->i_flags ) if ( (i_flags & A52_CHANNEL_MASK) != (p_sys->i_flags & A52_CHANNEL_MASK) )
{ {
msg_Err( p_filter, msg_Err( p_filter,
"liba52 couldn't do the requested downmix 0x%x->0x%x", "liba52 couldn't do the requested downmix 0x%x->0x%x",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* float32.c : precise float32 audio mixer implementation * float32.c : precise float32 audio mixer implementation
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: float32.c,v 1.1 2002/08/28 22:25:38 massiot Exp $ * $Id: float32.c,v 1.2 2002/09/16 20:46:37 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -60,7 +60,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -60,7 +60,7 @@ static int Create( vlc_object_t *p_this )
return -1; return -1;
} }
if ( p_aout->i_nb_inputs == 1 ) if ( p_aout->i_nb_inputs == 1 && p_aout->mixer.f_multiplier == 1.0 )
{ {
/* Tell the trivial mixer to go for it. */ /* Tell the trivial mixer to go for it. */
return -1; return -1;
...@@ -75,13 +75,14 @@ static int Create( vlc_object_t *p_this ) ...@@ -75,13 +75,14 @@ static int Create( vlc_object_t *p_this )
* ScaleWords: prepare input words for averaging * ScaleWords: prepare input words for averaging
*****************************************************************************/ *****************************************************************************/
static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words, static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words,
int i_nb_inputs ) int i_nb_inputs, float f_multiplier )
{ {
int i; int i;
f_multiplier /= i_nb_inputs;
for ( i = i_nb_words; i--; ) for ( i = i_nb_words; i--; )
{ {
*p_out++ = *p_in++ / i_nb_inputs; *p_out++ = *p_in++ * f_multiplier;
} }
} }
...@@ -89,13 +90,14 @@ static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words, ...@@ -89,13 +90,14 @@ static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words,
* MeanWords: average input words * MeanWords: average input words
*****************************************************************************/ *****************************************************************************/
static void MeanWords( float * p_out, const float * p_in, size_t i_nb_words, static void MeanWords( float * p_out, const float * p_in, size_t i_nb_words,
int i_nb_inputs ) int i_nb_inputs, float f_multiplier )
{ {
int i; int i;
f_multiplier /= i_nb_inputs;
for ( i = i_nb_words; i--; ) for ( i = i_nb_words; i--; )
{ {
*p_out++ += *p_in++ / i_nb_inputs; *p_out++ += *p_in++ * f_multiplier;
} }
} }
...@@ -134,12 +136,12 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -134,12 +136,12 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
if ( !i_input ) if ( !i_input )
{ {
ScaleWords( p_out, p_in, i_available_words, ScaleWords( p_out, p_in, i_available_words,
i_nb_inputs ); i_nb_inputs, p_aout->mixer.f_multiplier );
} }
else else
{ {
MeanWords( p_out, p_in, i_available_words, MeanWords( p_out, p_in, i_available_words,
i_nb_inputs ); i_nb_inputs, p_aout->mixer.f_multiplier );
} }
} }
...@@ -162,11 +164,13 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -162,11 +164,13 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
{ {
if ( !i_input ) if ( !i_input )
{ {
ScaleWords( p_out, p_in, i_nb_words, i_nb_inputs ); ScaleWords( p_out, p_in, i_nb_words, i_nb_inputs,
p_aout->mixer.f_multiplier );
} }
else else
{ {
MeanWords( p_out, p_in, i_nb_words, i_nb_inputs ); MeanWords( p_out, p_in, i_nb_words, i_nb_inputs,
p_aout->mixer.f_multiplier );
} }
} }
p_input->p_first_byte_to_mix = (void *)(p_in p_input->p_first_byte_to_mix = (void *)(p_in
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* a52.c: A/52 basic parser * a52.c: A/52 basic parser
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2002 VideoLAN * Copyright (C) 2001-2002 VideoLAN
* $Id: a52.c,v 1.10 2002/09/06 23:15:44 massiot Exp $ * $Id: a52.c,v 1.11 2002/09/16 20:46:38 massiot Exp $
* *
* Authors: Stphane Borel <stef@via.ecp.fr> * Authors: Stphane Borel <stef@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -84,7 +84,7 @@ static int SyncInfo ( const byte_t *, int *, int *, int * ); ...@@ -84,7 +84,7 @@ static int SyncInfo ( const byte_t *, int *, int *, int * );
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
set_description( _("A/52 parser") ); set_description( _("A/52 parser") );
set_capability( "decoder", 0 ); set_capability( "decoder", 100 );
set_callbacks( OpenDecoder, NULL ); set_callbacks( OpenDecoder, NULL );
add_shortcut( "pass_through" ); add_shortcut( "pass_through" );
add_shortcut( "pass" ); add_shortcut( "pass" );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio_output.c : audio output instance miscellaneous functions * audio_output.c : audio output instance miscellaneous functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: audio_output.c,v 1.101 2002/09/02 23:17:06 massiot Exp $ * $Id: audio_output.c,v 1.102 2002/09/16 20:46:38 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -59,6 +59,7 @@ aout_instance_t * __aout_NewInstance( vlc_object_t * p_parent ) ...@@ -59,6 +59,7 @@ aout_instance_t * __aout_NewInstance( vlc_object_t * p_parent )
vlc_mutex_init( p_parent, &p_aout->mixer_lock ); vlc_mutex_init( p_parent, &p_aout->mixer_lock );
vlc_mutex_init( p_parent, &p_aout->output_fifo_lock ); vlc_mutex_init( p_parent, &p_aout->output_fifo_lock );
p_aout->i_nb_inputs = 0; p_aout->i_nb_inputs = 0;
p_aout->mixer.f_multiplier = 1.0;
vlc_object_attach( p_aout, p_parent->p_vlc ); vlc_object_attach( p_aout, p_parent->p_vlc );
......
/*****************************************************************************
* intf.c : audio output API towards the interface modules
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.c,v 1.1 2002/09/16 20:46:38 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include "audio_output.h"
#include "aout_internal.h"
/*
* Volume management
*
* The hardware volume cannot be set if the output module gets deleted, so
* we must take the mixer lock. The software volume cannot be set while the
* mixer is running, so we need the mixer lock (too).
*
* Here is a schematic of the i_volume range :
*
* |------------------+------------------------------------+--------------|
* 0 pi_low_soft pi_high_soft 1024
*
* Between pi_low_soft and pi_high_soft, the volume is done in hardware
* by the output module. Outside, the output module will change
* p_aout->mixer.i_multiplier (done in software). This scaling may result
* in cropping errors and should be avoided as much as possible.
*
* It is legal to have *pi_low_soft == *pi_high_soft, and do everything in
* software. In that case, it is recommended to use *pi_low_soft == 256,
* along with the utility functions provided in this file.
*
* It is also legal to have *pi_low_soft == 0 and *pi_high_soft == 1024, and
* completely avoid software scaling. However, some streams (esp. A/52)
* are encoded with a very low volume and users may complain.
*/
/*****************************************************************************
* aout_VolumeGet : get the volume of the output device
*****************************************************************************/
int aout_VolumeGet( aout_instance_t * p_aout, audio_volume_t * pi_volume )
{
int i_result;
vlc_mutex_lock( &p_aout->mixer_lock );
if ( p_aout->i_nb_inputs == 0 )
{
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
msg_Err( p_aout, "VolumeGet called without output module" );
return -1;
}
i_result = p_aout->output.pf_volume_get( p_aout, pi_volume );
vlc_mutex_lock( &p_aout->mixer_lock );
return i_result;
}
/*****************************************************************************
* aout_VolumeSet : set the volume of the output device
*****************************************************************************/
int aout_VolumeSet( aout_instance_t * p_aout, audio_volume_t i_volume )
{
int i_result;
vlc_mutex_lock( &p_aout->mixer_lock );
if ( p_aout->i_nb_inputs == 0 )
{
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
msg_Err( p_aout, "VolumeSet called without output module" );
return -1;
}
i_result = p_aout->output.pf_volume_set( p_aout, i_volume );
vlc_mutex_lock( &p_aout->mixer_lock );
return i_result;
}
/*****************************************************************************
* aout_VolumeInfos : get the boundaries pi_low_soft and pi_high_soft
*****************************************************************************/
int aout_VolumeInfos( aout_instance_t * p_aout, audio_volume_t * pi_low_soft,
audio_volume_t * pi_high_soft )
{
int i_result;
vlc_mutex_lock( &p_aout->mixer_lock );
if ( p_aout->i_nb_inputs == 0 )
{
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
msg_Err( p_aout, "VolumeInfos called without output module" );
return -1;
}
i_result = p_aout->output.pf_volume_infos( p_aout, pi_low_soft,
pi_high_soft );
vlc_mutex_lock( &p_aout->mixer_lock );
return i_result;
}
/*****************************************************************************
* aout_VolumeUp : raise the output volume
*****************************************************************************
* If pi_volume != NULL, *pi_volume will contain the volume at the end of the
* function.
*****************************************************************************/
int aout_VolumeUp( aout_instance_t * p_aout, int i_nb_steps,
audio_volume_t * pi_volume )
{
int i_result;
audio_volume_t i_volume;
vlc_mutex_lock( &p_aout->mixer_lock );
if ( p_aout->i_nb_inputs == 0 )
{
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
msg_Err( p_aout, "VolumeUp called without output module" );
return -1;
}
if ( p_aout->output.pf_volume_get( p_aout, &i_volume ) )
{
vlc_mutex_unlock( &p_aout->mixer_lock );
return -1;
}
i_volume += AOUT_VOLUME_STEP * i_nb_steps;
if ( i_volume > 1024 ) i_volume = 1024;
i_result = p_aout->output.pf_volume_set( p_aout, i_volume );
vlc_mutex_lock( &p_aout->mixer_lock );
if ( pi_volume != NULL ) *pi_volume = i_volume;
return i_result;
}
/*****************************************************************************
* aout_VolumeDown : lower the output volume
*****************************************************************************
* If pi_volume != NULL, *pi_volume will contain the volume at the end of the
* function.
*****************************************************************************/
int aout_VolumeDown( aout_instance_t * p_aout, int i_nb_steps,
audio_volume_t * pi_volume )
{
int i_result;
audio_volume_t i_volume;
vlc_mutex_lock( &p_aout->mixer_lock );
if ( p_aout->i_nb_inputs == 0 )
{
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
msg_Err( p_aout, "VolumeUp called without output module" );
return -1;
}
if ( p_aout->output.pf_volume_get( p_aout, &i_volume ) )
{
vlc_mutex_unlock( &p_aout->mixer_lock );
return -1;
}
if ( i_volume < AOUT_VOLUME_STEP * i_nb_steps )
i_volume = 0;
else
i_volume -= AOUT_VOLUME_STEP * i_nb_steps;
i_result = p_aout->output.pf_volume_set( p_aout, i_volume );
vlc_mutex_lock( &p_aout->mixer_lock );
if ( pi_volume != NULL ) *pi_volume = i_volume;
return i_result;
}
/*
* The next functions are not supposed to be called by the interface, but
* are placeholders for software-only scaling.
*/
/* Meant to be called by the output plug-in's Open(). */
void aout_VolumeSoftInit( aout_instance_t * p_aout )
{
p_aout->output.i_volume = AOUT_VOLUME_DEFAULT;
}
/* Placeholder for pf_volume_infos(). */
int aout_VolumeSoftInfos( aout_instance_t * p_aout,
audio_volume_t * pi_low_soft,
audio_volume_t * pi_high_soft )
{
*pi_low_soft = *pi_high_soft = AOUT_VOLUME_DEFAULT;
return 0;
}
/* Placeholder for pf_volume_get(). */
int aout_VolumeSoftGet( aout_instance_t * p_aout,
audio_volume_t * pi_volume )
{
*pi_volume = p_aout->output.i_volume;
return 0;
}
/* Placeholder for pf_volume_set(). */
int aout_VolumeSoftSet( aout_instance_t * p_aout,
audio_volume_t i_volume )
{
aout_MixerMultiplierSet( p_aout, (float)(i_volume / AOUT_VOLUME_DEFAULT) );
return 0;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mixer.c : audio output mixing operations * mixer.c : audio output mixing operations
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: mixer.c,v 1.11 2002/08/30 22:22:24 massiot Exp $ * $Id: mixer.c,v 1.12 2002/09/16 20:46:38 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -289,3 +289,52 @@ void aout_MixerRun( aout_instance_t * p_aout ) ...@@ -289,3 +289,52 @@ void aout_MixerRun( aout_instance_t * p_aout )
{ {
while( MixBuffer( p_aout ) != -1 ); while( MixBuffer( p_aout ) != -1 );
} }
/*****************************************************************************
* aout_MixerMultiplierSet: set p_aout->mixer.f_multiplier
*****************************************************************************
* Please note that we assume that you own the mixer lock when entering this
* function. This function returns -1 on error.
*****************************************************************************/
int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier )
{
float f_old = p_aout->mixer.f_multiplier;
if ( p_aout->mixer.mixer.i_format != AOUT_FMT_FLOAT32 )
{
msg_Warn( p_aout, "MixerMultiplierSet called for non-float32 mixer" );
return -1;
}
aout_MixerDelete( p_aout );
p_aout->mixer.f_multiplier = f_multiplier;
if ( aout_MixerNew( p_aout ) )
{
p_aout->mixer.f_multiplier = f_old;
aout_MixerNew( p_aout );
return -1;
}
return 0;
}
/*****************************************************************************
* aout_MixerMultiplierGet: get p_aout->mixer.f_multiplier
*****************************************************************************
* Please note that we assume that you own the mixer lock when entering this
* function. This function returns -1 on error.
*****************************************************************************/
int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier )
{
if ( p_aout->mixer.mixer.i_format != AOUT_FMT_FLOAT32 )
{
msg_Warn( p_aout, "MixerMultiplierGet called for non-float32 mixer" );
return -1;
}
*pf_multiplier = p_aout->mixer.f_multiplier;
return 0;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header * libvlc.h: main libvlc header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.14 2002/08/16 12:31:04 sam Exp $ * $Id: libvlc.h,v 1.15 2002/09/16 20:46:38 massiot Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -358,7 +358,7 @@ vlc_module_begin(); ...@@ -358,7 +358,7 @@ vlc_module_begin();
add_module_with_short( "aout", 'A', "audio output", NULL, NULL, add_module_with_short( "aout", 'A', "audio output", NULL, NULL,
AOUT_TEXT, AOUT_LONGTEXT ); AOUT_TEXT, AOUT_LONGTEXT );
add_bool( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT ); add_bool( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT );
add_integer( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT ); add_integer( "volume", -1, NULL, VOLUME_TEXT, VOLUME_LONGTEXT );
add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT, AOUT_RATE_LONGTEXT ); add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT, AOUT_RATE_LONGTEXT );
add_integer( "aout-channels", -1, NULL, add_integer( "aout-channels", -1, NULL,
AOUT_CHANNELS_TEXT, AOUT_CHANNELS_LONGTEXT ); AOUT_CHANNELS_TEXT, AOUT_CHANNELS_LONGTEXT );
......
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