1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

applied 'fakemono' patch by Bryan Chan scorpio@acm.org

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@733 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-05-08 21:49:00 +00:00
parent 3040f42cd6
commit a158f5d747
7 changed files with 75 additions and 0 deletions

View File

@ -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},

7
configure vendored
View File

@ -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! */

View File

@ -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);

View File

@ -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"

View File

@ -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];

View File

@ -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);

View File

@ -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);