diff options
author | anders <anders@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-31 11:06:19 +0000 |
---|---|---|
committer | anders <anders@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-31 11:06:19 +0000 |
commit | 437aa679375c2a9b0c5a55dcc2d169ab29a55178 (patch) | |
tree | 107130864237ff5cc64ed44c079400346cee6180 | |
parent | 95760a746db5aceb0274a140eafc83b3294bea5c (diff) | |
download | mpv-437aa679375c2a9b0c5a55dcc2d169ab29a55178.tar.bz2 mpv-437aa679375c2a9b0c5a55dcc2d169ab29a55178.tar.xz |
Adding commandline options for filters and fixing stupid bug in cfg
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7999 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | cfg-mplayer.h | 2 | ||||
-rw-r--r-- | libaf/af.c | 1 | ||||
-rw-r--r-- | libaf/af_channels.c | 5 | ||||
-rw-r--r-- | libaf/af_delay.c | 5 | ||||
-rw-r--r-- | libaf/af_format.c | 5 | ||||
-rw-r--r-- | libaf/af_resample.c | 21 |
6 files changed, 38 insertions, 1 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 8708947081..940c5fe651 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -121,7 +121,7 @@ extern float monitor_aspect; extern af_cfg_t af_cfg; // Audio filter configuration, defined in libmpcodecs/dec_audio.c struct config audio_filter_conf[]={ {"list", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, - {"force", &af_cfg.force, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL}, + {"force", &af_cfg.force, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; diff --git a/libaf/af.c b/libaf/af.c index a30e52bfed..ea11afb302 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -63,6 +63,7 @@ af_instance_t* af_create(af_stream_t* s, char* name) { char* cmdline = name; char* delim = "="; + // Allocate space for the new filter and reset all pointers af_instance_t* new=malloc(sizeof(af_instance_t)); if(!new){ diff --git a/libaf/af_channels.c b/libaf/af_channels.c index 3e9482deda..2fc9837e37 100644 --- a/libaf/af_channels.c +++ b/libaf/af_channels.c @@ -89,6 +89,11 @@ static int control(struct af_instance_s* af, int cmd, void* arg) af->mul.n = af->data->nch; af->mul.d = ((af_data_t*)arg)->nch; return AF_OK; + case AF_CONTROL_COMMAND_LINE:{ + int nch = 0; + sscanf((char*)arg,"%i",&nch); + return af->control(af,AF_CONTROL_CHANNELS,&nch); + } case AF_CONTROL_CHANNELS: // Reinit must be called after this function has been called diff --git a/libaf/af_delay.c b/libaf/af_delay.c index 6eb3965a36..08c33499a8 100644 --- a/libaf/af_delay.c +++ b/libaf/af_delay.c @@ -32,6 +32,11 @@ static int control(struct af_instance_s* af, int cmd, void* arg) return af->control(af,AF_CONTROL_DELAY_SET_LEN,&((af_delay_t*)af->setup)->tlen); } + case AF_CONTROL_COMMAND_LINE:{ + float d = 0; + sscanf((char*)arg,"%f",&d); + return af->control(af,AF_CONTROL_DELAY_SET_LEN,&d); + } case AF_CONTROL_DELAY_SET_LEN:{ af_delay_t* s = (af_delay_t*)af->setup; void* bt = s->buf; // Old buffer diff --git a/libaf/af_format.c b/libaf/af_format.c index c6047b25ab..d9ca5fd7e7 100644 --- a/libaf/af_format.c +++ b/libaf/af_format.c @@ -88,6 +88,11 @@ static int control(struct af_instance_s* af, int cmd, void* arg) af->mul.n = af->data->bps; af->mul.d = ((af_data_t*)arg)->bps; return AF_OK; + case AF_CONTROL_COMMAND_LINE:{ + af_data_t d; + sscanf((char*)arg,"%i:%i",&(d.format),&(d.bps)); + return af->control(af,AF_CONTROL_FORMAT,&d); + } case AF_CONTROL_FORMAT: // Reinit must be called after this function has been called diff --git a/libaf/af_resample.c b/libaf/af_resample.c index f27e845100..fb5e46c14a 100644 --- a/libaf/af_resample.c +++ b/libaf/af_resample.c @@ -69,6 +69,8 @@ typedef struct af_resample_s uint32_t i; // Number of new samples to put in x queue uint32_t dn; // Down sampling factor uint32_t up; // Up sampling factor + int sloppy; // Enable sloppy resampling to reduce memory usage + int fast; // Enable linear interpolation instead of filtering } af_resample_t; // Euclids algorithm for calculating Greatest Common Divisor GCD(a,b) @@ -222,6 +224,19 @@ static int control(struct af_instance_s* af, int cmd, void* arg) // Calculate up and down sampling factors d=gcd(af->data->rate,n->rate); + // If sloppy resampling is enabled limit the upsampling factor + if(s->sloppy && (af->data->rate/d > 5000)){ + int up=af->data->rate/2; + int dn=n->rate/2; + int m=2; + while(af->data->rate/(d*m) > 5000){ + d=gcd(up,dn); + up/=2; dn/=2; m*=2; + } + d*=m; + } + printf("\n%i %i %i\n",d,af->data->rate/d,n->rate/d); + // Check if the the design needs to be redone if(s->up != af->data->rate/d || s->dn != n->rate/d){ float* w; @@ -264,6 +279,12 @@ static int control(struct af_instance_s* af, int cmd, void* arg) af->mul.d = s->dn; return rv; } + case AF_CONTROL_COMMAND_LINE:{ + af_resample_t* s = (af_resample_t*)af->setup; + int rate=0; + sscanf((char*)arg,"%i:%i:%i",&rate,&(s->sloppy), &(s->fast)); + return af->control(af,AF_CONTROL_RESAMPLE,&rate); + } case AF_CONTROL_RESAMPLE: // Reinit must be called after this function has been called |