# HG changeset patch # User arpi_esp # Date 989358540 0 # Node ID e14114170e0183b762e15b5c2b22003220546257 # Parent 7e4e014fb5a5614015c694284440ad0a5ad7b8de applied 'fakemono' patch by Bryan Chan scorpio@acm.org diff -r 7e4e014fb5a5 -r e14114170e01 cfg-mplayer.h --- a/cfg-mplayer.h Tue May 08 21:47:51 2001 +0000 +++ b/cfg-mplayer.h Tue May 08 21:49:00 2001 +0000 @@ -18,6 +18,9 @@ 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 @@ {"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 -r 7e4e014fb5a5 -r e14114170e01 configure --- a/configure Tue May 08 21:47:51 2001 +0000 +++ b/configure Tue May 08 21:49:00 2001 +0000 @@ -1011,6 +1011,13 @@ 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 -r 7e4e014fb5a5 -r e14114170e01 dec_audio.c --- a/dec_audio.c Tue May 08 21:47:51 2001 +0000 +++ b/dec_audio.c Tue May 08 21:49:00 2001 +0000 @@ -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 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 -r 7e4e014fb5a5 -r e14114170e01 help_mp.h --- a/help_mp.h Tue May 08 21:47:51 2001 +0000 +++ b/help_mp.h Tue May 08 21:49:00 2001 +0000 @@ -25,6 +25,9 @@ #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 select audio channel [MPG: 0-31 AVI: 1-99]\n" " -vid select video channel [MPG: 0-15 AVI: -- ]\n" " -fps force frame rate (if value is wrong in the header)\n" diff -r 7e4e014fb5a5 -r e14114170e01 mp3lib/decod386.c --- a/mp3lib/decod386.c Tue May 08 21:47:51 2001 +0000 +++ b/mp3lib/decod386.c Tue May 08 21:49:00 2001 +0000 @@ -72,6 +72,40 @@ } +#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 -r 7e4e014fb5a5 -r e14114170e01 mp3lib/mp3.h --- a/mp3lib/mp3.h Tue May 08 21:47:51 2001 +0000 +++ b/mp3lib/mp3.h Tue May 08 21:49:00 2001 +0000 @@ -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 -r 7e4e014fb5a5 -r e14114170e01 mp3lib/sr1.c --- a/mp3lib/sr1.c Tue May 08 21:47:51 2001 +0000 +++ b/mp3lib/sr1.c Tue May 08 21:49:00 2001 +0000 @@ -348,7 +348,11 @@ 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 @@ #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);