Index: cfg-common.h =================================================================== RCS file: /cvsroot/mplayer/main/cfg-common.h,v retrieving revision 1.138 diff -u -p -r1.138 cfg-common.h --- cfg-common.h 19 Jan 2005 18:05:03 -0000 1.138 +++ cfg-common.h 15 Feb 2005 09:19:24 -0000 @@ -139,6 +139,7 @@ #ifdef USE_LIBA52 {"a52drc", &a52_drc_level, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL}, + {"a52volume", &a52_volume, CONF_TYPE_FLOAT, CONF_RANGE, -200, 60, NULL}, #endif // ------------------------- codec/vfilter options -------------------- @@ -315,6 +316,7 @@ extern int network_ipv4_only_proxy; #endif extern float a52_drc_level; +extern float a52_volume; /* defined in libmpdemux: */ extern int hr_mp3_seek; Index: libmpcodecs/ad_liba52.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_liba52.c,v retrieving revision 1.14 diff -u -p -r1.14 ad_liba52.c --- libmpcodecs/ad_liba52.c 21 Sep 2004 20:34:46 -0000 1.14 +++ libmpcodecs/ad_liba52.c 15 Feb 2005 09:19:24 -0000 @@ -24,6 +24,9 @@ static uint32_t a52_flags=0; #define DRC_NO_COMPRESSION 1 #define DRC_CALLBACK 2 +#define clamp(a,min,max) (((a)>(max))?(max):(((a)<(min))?(min):(a))) + +float a52_volume = 0.0; float a52_drc_level = 1.0; static int a52_drc_action = DRC_NO_ACTION; @@ -122,7 +125,7 @@ static int preinit(sh_audio_t *sh) static int init(sh_audio_t *sh_audio) { uint32_t a52_accel=0; - sample_t level=1, bias=384; + sample_t level=pow(10.0,a52_volume/20.0), bias=384; int flags=0; /* Dolby AC3 audio:*/ if(gCpuCaps.hasSSE) a52_accel|=MM_ACCEL_X86_SSE; @@ -199,13 +202,16 @@ static int control(sh_audio_t *sh,int cm case ADCTRL_SKIP_FRAME: a52_fillbuff(sh); break; // skip AC3 frame return CONTROL_TRUE; + case ADCTRL_SET_VOLUME: + a52_volume = clamp(*(float*)arg, -200.0, 60.0); + return CONTROL_TRUE; } return CONTROL_UNKNOWN; } static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) { - sample_t level=1, bias=384; + sample_t level=pow(10.0,a52_volume/20.0), bias=384; int flags=a52_flags|A52_ADJUST_LEVEL; int i,len=-1; if(!sh_audio->a_in_buffer_len) Index: DOCS/man/en/mplayer.1 =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v retrieving revision 1.874 diff -u -p -r1.874 mplayer.1 --- DOCS/man/en/mplayer.1 13 Feb 2005 23:51:41 -0000 1.874 +++ DOCS/man/en/mplayer.1 15 Feb 2005 09:19:27 -0000 @@ -709,6 +709,14 @@ This option only shows an effect if the compression information. . .TP +.B \-a52volume +Adjusts the volume level for AC3 audio streams. + is a float value of the desired gain in dB ranging from -200dB to ++60dB. +The result is similar to using the volume filter, but it is slightly +faster and more accurate. +. +.TP .B \-aid (also see \-alang) Select audio channel (MPEG: 0\-31, AVI/\:OGM: 1\-99, ASF/\:RM: 0\-127, VOB(AC3): 128\-159, VOB(LPCM): 160\-191, MPEG-TS 17\-8190).