diff --git a/cfg-common.h b/cfg-common.h index 8071ec876a..abc186adf3 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -92,6 +92,7 @@ {"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL}, {"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL}, {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 1, 6, NULL}, + {"format", &audio_output_format, CONF_TYPE_INT, CONF_RANGE, 0, 0x00002000, NULL}, // ------------------------- codec/vfilter options -------------------- diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 2a5a778c3f..0c6d38772a 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -111,6 +111,14 @@ extern int nortc; /* from libvo/aspect.c */ extern float monitor_aspect; +#include "libaf/af.h" +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}, + {NULL, NULL, 0, 0, 0, 0, NULL} +}; + /* Options related to audio out plugins */ struct config ao_plugin_conf[]={ {"list", &ao_plugin_cfg.plugin_list, CONF_TYPE_STRING, 0, 0, 0, NULL}, @@ -167,6 +175,7 @@ static config_t mplayer_opts[]={ {"ao", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, {"aop", ao_plugin_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, + {"af", audio_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, {"dsp", "Use -ao oss:dsp_path!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, {"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"master", "Option -master has been removed, use -aop list=volume instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c index 51353ed0b2..25dd292c95 100644 --- a/libmpcodecs/dec_audio.c +++ b/libmpcodecs/dec_audio.c @@ -25,6 +25,7 @@ int fakemono=0; #endif /* used for ac3surround decoder - set using -channels option */ int audio_output_channels = 2; +af_cfg_t af_cfg; // Configuration for audio filters static ad_functions_t* mpadec; @@ -255,8 +256,7 @@ int init_audio_filters(sh_audio_t *sh_audio, afs->output.bps = out_bps ? out_bps : afs->input.bps; // filter config: - afs->cfg.force = 0; - afs->cfg.list = NULL; + 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, diff --git a/mencoder.c b/mencoder.c index d82e590bef..3f37e5a100 100644 --- a/mencoder.c +++ b/mencoder.c @@ -130,6 +130,7 @@ static float force_ofps=0; // set to 24 for inverse telecine static int skip_limit=-1; static int force_srate=0; +static int audio_output_format=0; char *vobsub_out=NULL; unsigned int vobsub_out_index=0; @@ -671,7 +672,7 @@ case ACODEC_COPY: } else { mux_a->wf = malloc(sizeof(WAVEFORMATEX)); mux_a->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; - mux_a->wf->wFormatTag = sh_audio->format; + mux_a->wf->wFormatTag = audio_output_format?audio_output_format:sh_audio->format; mux_a->wf->nChannels = sh_audio->channels; mux_a->wf->nSamplesPerSec = sh_audio->samplerate; mux_a->wf->nAvgBytesPerSec=sh_audio->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; diff --git a/mplayer.c b/mplayer.c index 88ebd1ea6d..c0bfa83d7c 100644 --- a/mplayer.c +++ b/mplayer.c @@ -212,6 +212,7 @@ static int softsleep=0; static float force_fps=0; static int force_srate=0; +static int audio_output_format=0; int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode static int play_n_frames=-1; static int play_n_frames_mf=-1; @@ -1240,7 +1241,8 @@ if(sh_audio){ (ao_plugin_cfg.plugin_list), // plugin flag force_srate?force_srate:sh_audio->samplerate*playback_speed, audio_output_channels?audio_output_channels: - sh_audio->channels,sh_audio->sample_format,0))){ + sh_audio->channels,audio_output_format?audio_output_format: + sh_audio->sample_format,0))){ // FAILED: mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO); sh_audio=d_audio->sh=NULL; // -> nosound