summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfg-mplayer.h6
-rwxr-xr-xconfigure7
-rw-r--r--dec_audio.c8
-rw-r--r--help_mp.h3
-rw-r--r--mp3lib/decod386.c34
-rw-r--r--mp3lib/mp3.h4
-rw-r--r--mp3lib/sr1.c13
7 files changed, 75 insertions, 0 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index c54ecdca73..31e6ff2bd1 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -18,6 +18,9 @@ extern char *sdl_driver;
extern int sdl_noxv;
extern int sdl_forcexv;
#endif
+#ifdef USE_FAKE_MONO
+extern int fakemono; // defined in dec_audio.c
+#endif
extern int vo_dbpp;
extern int osd_level;
@@ -76,6 +79,9 @@ struct config conf[]={
{"aid", &audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
{"vid", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
{"sid", &dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 32},
+#ifdef USE_FAKE_MONO
+ {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2},
+#endif
{"dumpfile", &stream_dump_name, CONF_TYPE_STRING, 0, 0, 0},
{"dumpaudio", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 1},
diff --git a/configure b/configure
index 7519b990e3..2cd2aa9338 100755
--- a/configure
+++ b/configure
@@ -1011,6 +1011,13 @@ cat > $CCONF << EOF
buffer problems, but it seems to be useful for every soundcard drivers) */
#define ALSA_TIMER
+/* Undefine this if you don't want to select mono audio (left or right)
+ with a stereo MPEG layer 2/3 audio stream. The command-line option
+ -stereo has three possible values (0 for stereo, 1 for left-only, 2 for
+ right-only), with 0 being the default.
+ */
+#define USE_FAKE_MONO
+
/* Undefine this if your soundcard driver has no working select().
If you have kernel Oops, player hangups, or just no audio, you should
try to recompile MPlayer with this option disabled! */
diff --git a/dec_audio.c b/dec_audio.c
index 79bbe69c9d..6927746f8e 100644
--- a/dec_audio.c
+++ b/dec_audio.c
@@ -6,6 +6,10 @@
extern int verbose; // defined in mplayer.c
+#ifdef USE_FAKE_MONO
+int fakemono=0;
+#endif
+
#include "stream.h"
#include "demuxer.h"
@@ -157,7 +161,11 @@ case 6: {
}
case 1: {
// MPEG Audio:
+#ifdef USE_FAKE_MONO
+ MP3_Init(fakemono);
+#else
MP3_Init();
+#endif
MP3_samplerate=MP3_channels=0;
// printf("[\n");
sh_audio->a_buffer_len=MP3_DecodeFrame(sh_audio->a_buffer,-1);
diff --git a/help_mp.h b/help_mp.h
index f0da2ff754..04b94683a7 100644
--- a/help_mp.h
+++ b/help_mp.h
@@ -25,6 +25,9 @@ static char* help_text=
#else
" -alsa enable timing code (works better with ALSA)\n"
#endif
+#ifdef USE_FAKE_MONO
+" -stereo select MPEG1 stereo output (0:stereo 1:left 2:right)\n"
+#endif
" -aid <id> select audio channel [MPG: 0-31 AVI: 1-99]\n"
" -vid <id> select video channel [MPG: 0-15 AVI: -- ]\n"
" -fps <value> force frame rate (if value is wrong in the header)\n"
diff --git a/mp3lib/decod386.c b/mp3lib/decod386.c
index f1a7e26b76..0dceb11a71 100644
--- a/mp3lib/decod386.c
+++ b/mp3lib/decod386.c
@@ -72,6 +72,40 @@ static int synth_1to1_mono2stereo(real *bandPtr,unsigned char *samples,int *pnt)
}
+#ifdef USE_FAKE_MONO
+static int synth_1to1_l(real *bandPtr,int channel,unsigned char *out,int *pnt)
+{
+ int i,ret;
+
+ ret = synth_1to1(bandPtr,channel,out,pnt);
+ out = out + *pnt - 128;
+
+ for(i=0;i<32;i++) {
+ ((short *)out)[1] = ((short *)out)[0];
+ out+=4;
+ }
+
+ return ret;
+}
+
+
+static int synth_1to1_r(real *bandPtr,int channel,unsigned char *out,int *pnt)
+{
+ int i,ret;
+
+ ret = synth_1to1(bandPtr,channel,out,pnt);
+ out = out + *pnt - 128;
+
+ for(i=0;i<32;i++) {
+ ((short *)out)[0] = ((short *)out)[1];
+ out+=4;
+ }
+
+ return ret;
+}
+#endif
+
+
static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
{
static real buffs[2][2][0x110];
diff --git a/mp3lib/mp3.h b/mp3lib/mp3.h
index c89833fff2..308c8187af 100644
--- a/mp3lib/mp3.h
+++ b/mp3lib/mp3.h
@@ -1,7 +1,11 @@
/* MP3 Player Library 2.0 (C) 1999 A'rpi/Astral&ESP-team */
/* decoder level: */
+#ifdef USE_FAKE_MONO
+extern void MP3_Init(int fakemono);
+#else
extern void MP3_Init();
+#endif
extern int MP3_Open(char *filename,int buffsize);
extern void MP3_SeekFrame(int num,int dir);
extern void MP3_SeekForward(int num);
diff --git a/mp3lib/sr1.c b/mp3lib/sr1.c
index 0829bc0c4a..f983763a04 100644
--- a/mp3lib/sr1.c
+++ b/mp3lib/sr1.c
@@ -348,7 +348,11 @@ retry1:
static int tables_done_flag=0;
// Init decoder tables. Call first, once!
+#ifdef USE_FAKE_MONO
+void MP3_Init(int fakemono){
+#else
void MP3_Init(){
+#endif
_CpuID=CpuDetect();
_i586=ipentium();
#ifdef HAVE_3DNOW
@@ -362,7 +366,16 @@ void MP3_Init(){
#endif
make_decode_tables(outscale);
+#ifdef USE_FAKE_MONO
+ if (fakemono == 1)
+ fr.synth=synth_1to1_l;
+ else if (fakemono == 2)
+ fr.synth=synth_1to1_r;
+ else
+ fr.synth=synth_1to1;
+#else
fr.synth=synth_1to1;
+#endif
fr.synth_mono=synth_1to1_mono2stereo;
fr.down_sample=0;
fr.down_sample_sblimit = SBLIMIT>>(fr.down_sample);