Mercurial > mplayer.hg
changeset 7998:d48a06d07afb
Adding commandline options for filters and fixing stupid bug in cfg
author | anders |
---|---|
date | Thu, 31 Oct 2002 11:06:19 +0000 |
parents | 253162f19e43 |
children | b523a14e12ae |
files | cfg-mplayer.h libaf/af.c libaf/af_channels.c libaf/af_delay.c libaf/af_format.c libaf/af_resample.c |
diffstat | 6 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/cfg-mplayer.h Thu Oct 31 11:01:40 2002 +0000 +++ b/cfg-mplayer.h Thu Oct 31 11:06:19 2002 +0000 @@ -121,7 +121,7 @@ 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} };
--- a/libaf/af.c Thu Oct 31 11:01:40 2002 +0000 +++ b/libaf/af.c Thu Oct 31 11:06:19 2002 +0000 @@ -63,6 +63,7 @@ { 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){
--- a/libaf/af_channels.c Thu Oct 31 11:01:40 2002 +0000 +++ b/libaf/af_channels.c Thu Oct 31 11:06:19 2002 +0000 @@ -89,6 +89,11 @@ 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
--- a/libaf/af_delay.c Thu Oct 31 11:01:40 2002 +0000 +++ b/libaf/af_delay.c Thu Oct 31 11:06:19 2002 +0000 @@ -32,6 +32,11 @@ 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
--- a/libaf/af_format.c Thu Oct 31 11:01:40 2002 +0000 +++ b/libaf/af_format.c Thu Oct 31 11:06:19 2002 +0000 @@ -88,6 +88,11 @@ 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
--- a/libaf/af_resample.c Thu Oct 31 11:01:40 2002 +0000 +++ b/libaf/af_resample.c Thu Oct 31 11:06:19 2002 +0000 @@ -69,6 +69,8 @@ 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 @@ // 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 @@ 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