Mercurial > mplayer.hg
changeset 14818:663c1ea5f595
finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
author | alex |
---|---|
date | Fri, 25 Feb 2005 11:11:07 +0000 |
parents | 878745349274 |
children | 601e2c8a2922 |
files | libaf/af.c libaf/af.h libmpcodecs/dec_audio.c libmpcodecs/dec_audio.h mplayer.c |
diffstat | 5 files changed, 41 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/libaf/af.c Fri Feb 25 11:07:21 2005 +0000 +++ b/libaf/af.c Fri Feb 25 11:11:07 2005 +0000 @@ -265,8 +265,7 @@ return rv; } // Insert format filter - if(((af->prev?af->prev->data->format:s->input.format) != in.format) || - ((af->prev?af->prev->data->bps:s->input.bps) != in.bps)){ + if((af->prev?af->prev->data->format:s->input.format) != in.format){ // Create format filter if(NULL == (new = af_prepend(s,af,"format"))) return AF_ERROR; @@ -438,8 +437,7 @@ } // Check output format fix if not OK - if((s->last->data->format != s->output.format) || - (s->last->data->bps != s->output.bps)){ + if(s->last->data->format != s->output.format){ if(strcmp(s->last->info->name,"format")) af = af_append(s,s->last,"format"); else @@ -457,7 +455,6 @@ return -1; if((s->last->data->format != s->output.format) || - (s->last->data->bps != s->output.bps) || (s->last->data->nch != s->output.nch) || (s->last->data->rate != s->output.rate)) { // Something is stuffed audio out will not work @@ -698,3 +695,7 @@ } } +void af_fix_parameters(af_data_t *data) +{ + data->bps = af_fmt2bits(data->format)/8; +}
--- a/libaf/af.h Fri Feb 25 11:07:21 2005 +0000 +++ b/libaf/af.h Fri Feb 25 11:11:07 2005 +0000 @@ -214,6 +214,10 @@ /** Print a list of all available audio filters */ void af_help(void); +/* Fill the missing parameters in the af_data_t structure. + Used for stuffing bps with a value based on format. */ +void af_fix_paramaters(af_data_t *data); + /* Memory reallocation macro: if a local buffer is used (i.e. if the filter doesn't operate on the incoming buffer this macro must be called to ensure the buffer is big enough. */ @@ -269,5 +273,3 @@ #endif #endif /* __aop_h__ */ - -
--- a/libmpcodecs/dec_audio.c Fri Feb 25 11:07:21 2005 +0000 +++ b/libmpcodecs/dec_audio.c Fri Feb 25 11:11:07 2005 +0000 @@ -265,32 +265,29 @@ /* Init audio filters */ int preinit_audio_filters(sh_audio_t *sh_audio, - int in_samplerate, int in_channels, int in_format, int in_bps, - int* out_samplerate, int* out_channels, int* out_format, int out_bps){ - char strbuf[200]; + int in_samplerate, int in_channels, int in_format, + int* out_samplerate, int* out_channels, int* out_format){ af_stream_t* afs=malloc(sizeof(af_stream_t)); memset(afs,0,sizeof(af_stream_t)); // input format: same as codec's output format: afs->input.rate = in_samplerate; afs->input.nch = in_channels; -// afs->input.format = af_format_decode(in_format); afs->input.format = in_format; - afs->input.bps = in_bps; + af_fix_parameters(&(afs->input)); // output format: same as ao driver's input format (if missing, fallback to input) afs->output.rate = *out_samplerate ? *out_samplerate : afs->input.rate; afs->output.nch = *out_channels ? *out_channels : afs->input.nch; -// afs->output.format = *out_format ? af_format_decode(*out_format) : afs->input.format; afs->output.format = *out_format ? *out_format : afs->input.format; - afs->output.bps = out_bps ? out_bps : afs->input.bps; + af_fix_parameters(&(afs->output)); // filter config: memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); - mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Checking audio filter chain for %dHz/%dch/%dbit -> %dHz/%dch/%dbit...\n", - afs->input.rate,afs->input.nch,afs->input.bps*8, - afs->output.rate,afs->output.nch,afs->output.bps*8); + mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Checking audio filter chain for %dHz/%dch/%s -> %dHz/%dch/%s...\n", + afs->input.rate,afs->input.nch,af_fmt2str_short(afs->input.format), + afs->output.rate,afs->output.nch,af_fmt2str_short(afs->output.format)); // let's autoprobe it! if(0 != af_init(afs,0)){ @@ -300,12 +297,11 @@ *out_samplerate=afs->output.rate; *out_channels=afs->output.nch; -// *out_format=af_format_encode((void*)(&afs->output)); *out_format=afs->output.format; - - mp_msg(MSGT_DECAUDIO, MSGL_INFO, "AF_pre: af format: %d bps, %d ch, %d hz, %s\n", - afs->output.bps, afs->output.nch, afs->output.rate, - af_fmt2str(afs->output.format,strbuf,200)); + + mp_msg(MSGT_DECAUDIO, MSGL_INFO, "AF_pre: %dHz/%dch/%s\n", + afs->output.rate, afs->output.nch, + af_fmt2str_short(afs->output.format)); sh_audio->afilter=(void*)afs; return 1; @@ -313,8 +309,8 @@ /* Init audio filters */ int init_audio_filters(sh_audio_t *sh_audio, - int in_samplerate, int in_channels, int in_format, int in_bps, - int out_samplerate, int out_channels, int out_format, int out_bps, + int in_samplerate, int in_channels, int in_format, + int out_samplerate, int out_channels, int out_format, int out_minsize, int out_maxsize){ af_stream_t* afs=sh_audio->afilter; if(!afs){ @@ -325,23 +321,21 @@ // input format: same as codec's output format: afs->input.rate = in_samplerate; afs->input.nch = in_channels; -// afs->input.format = af_format_decode(in_format); afs->input.format = in_format; - afs->input.bps = in_bps; + af_fix_parameters(&(afs->input)); // output format: same as ao driver's input format (if missing, fallback to input) afs->output.rate = out_samplerate ? out_samplerate : afs->input.rate; afs->output.nch = out_channels ? out_channels : afs->input.nch; -// afs->output.format = af_format_decode(out_format ? out_format : afs->input.format); afs->output.format = out_format ? out_format : afs->input.format; - afs->output.bps = out_bps ? out_bps : afs->input.bps; + af_fix_parameters(&(afs->output)); // filter config: memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); - mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Building audio filter chain for %dHz/%dch/%dbit -> %dHz/%dch/%dbit...\n", - afs->input.rate,afs->input.nch,afs->input.bps*8, - afs->output.rate,afs->output.nch,afs->output.bps*8); + mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Building audio filter chain for %dHz/%dch/%s -> %dHz/%dch/%s...\n", + afs->input.rate,afs->input.nch,af_fmt2str_short(afs->input.format), + afs->output.rate,afs->output.nch,af_fmt2str_short(afs->output.format)); // let's autoprobe it! if(0 != af_init(afs,1)){ @@ -416,9 +410,8 @@ afd.len=declen; afd.rate=sh_audio->samplerate; afd.nch=sh_audio->channels; -// afd.format=af_format_decode(sh_audio->sample_format); afd.format=sh_audio->sample_format; - afd.bps=sh_audio->samplesize; + af_fix_parameters(&afd); //pafd=&afd; // printf("\nAF: %d --> ",declen); pafd=af_play(sh_audio->afilter,&afd); @@ -460,3 +453,7 @@ // default skip code: ds_fill_buffer(sh_audio->ds); // skip block } + +void adjust_volume() +{ +}
--- a/libmpcodecs/dec_audio.h Fri Feb 25 11:07:21 2005 +0000 +++ b/libmpcodecs/dec_audio.h Fri Feb 25 11:11:07 2005 +0000 @@ -11,9 +11,9 @@ extern void uninit_audio(sh_audio_t *sh_audio); extern int init_audio_filters(sh_audio_t *sh_audio, - int in_samplerate, int in_channels, int in_format, int in_bps, - int out_samplerate, int out_channels, int out_format, int out_bps, + int in_samplerate, int in_channels, int in_format, + int out_samplerate, int out_channels, int out_format, int out_minsize, int out_maxsize); extern int preinit_audio_filters(sh_audio_t *sh_audio, - int in_samplerate, int in_channels, int in_format, int in_bps, - int* out_samplerate, int* out_channels, int* out_format, int out_bps); + int in_samplerate, int in_channels, int in_format, + int* out_samplerate, int* out_channels, int* out_format);
--- a/mplayer.c Fri Feb 25 11:07:21 2005 +0000 +++ b/mplayer.c Fri Feb 25 11:11:07 2005 +0000 @@ -950,9 +950,8 @@ playback_speed = (float)new_srate / (float)sh_audio->samplerate; } result = init_audio_filters(sh_audio, new_srate, - sh_audio->channels, sh_audio->sample_format, sh_audio->samplesize, + sh_audio->channels, sh_audio->sample_format, ao_data->samplerate, ao_data->channels, ao_data->format, - af_fmt2bits(ao_data->format) / 8, /* ao_data.bps, */ ao_data->outburst * 4, ao_data->buffersize); mixer.afilter = sh_audio->afilter; #ifdef HAVE_NEW_GUI @@ -2119,16 +2118,10 @@ if(!preinit_audio_filters(sh_audio, // input: (int)(sh_audio->samplerate*playback_speed), - sh_audio->channels, sh_audio->sample_format, sh_audio->samplesize, + sh_audio->channels, sh_audio->sample_format, // output: - &ao_data.samplerate, &ao_data.channels, &ao_data.format, - af_fmt2bits(ao_data.format)/8)){ + &ao_data.samplerate, &ao_data.channels, &ao_data.format)){ mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError); - } else { - char buf[128]; - mp_msg(MSGT_CPLAYER,MSGL_INFO,"AF_pre: %dHz %dch %s\n", - ao_data.samplerate, ao_data.channels, - af_fmt2str(ao_data.format, buf, 128)); } #endif current_module="ao2_init"; @@ -2143,12 +2136,11 @@ sh_audio=d_audio->sh=NULL; // -> nosound } else { // SUCCESS: - char buf[128]; inited_flags|=INITED_AO; mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %dHz %dch %s (%d bps)\n", audio_out->info->short_name, ao_data.samplerate, ao_data.channels, - af_fmt2str(ao_data.format, buf, 128), + af_fmt2str_short(ao_data.format), af_fmt2bits(ao_data.format)/8 ); mp_msg(MSGT_CPLAYER,MSGL_V,"AO: Description: %s\nAO: Author: %s\n", audio_out->info->name, audio_out->info->author);