mirror of
https://github.com/mpv-player/mpv
synced 2025-04-04 23:40:47 +00:00
Simplify init_audio_filters() arguments
Remove the following arguments as redundant: in_channels, in_format, out_minsize, out_maxsize. The first two always equal fields of the sh_audio_t struct given as the first argument to the function. The last two are unused after the allocation of sh_audio->a_out_buffer was changed to be done on demand. After the out_minsize and out_maxsize arguments are removed the function preinit_audio_filters() is identical to init_audio_filters(), so remove it and use the latter instead. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24922 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
2d44426648
commit
6338c068a2
@ -313,19 +313,8 @@ void uninit_audio(sh_audio_t *sh_audio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int preinit_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
|
|
||||||
int in_channels, int in_format, int *out_samplerate,
|
|
||||||
int *out_channels, int *out_format)
|
|
||||||
{
|
|
||||||
return init_audio_filters(sh_audio, in_samplerate, in_channels, in_format,
|
|
||||||
out_samplerate, out_channels, out_format, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
|
int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
|
||||||
int in_channels, int in_format, int *out_samplerate,
|
int *out_samplerate, int *out_channels, int *out_format)
|
||||||
int *out_channels, int *out_format,
|
|
||||||
int out_minsize, int out_maxsize)
|
|
||||||
{
|
{
|
||||||
af_stream_t *afs = sh_audio->afilter;
|
af_stream_t *afs = sh_audio->afilter;
|
||||||
if (!afs) {
|
if (!afs) {
|
||||||
@ -334,8 +323,8 @@ int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
|
|||||||
}
|
}
|
||||||
// input format: same as codec's output format:
|
// input format: same as codec's output format:
|
||||||
afs->input.rate = in_samplerate;
|
afs->input.rate = in_samplerate;
|
||||||
afs->input.nch = in_channels;
|
afs->input.nch = sh_audio->channels;
|
||||||
afs->input.format = in_format;
|
afs->input.format = sh_audio->sample_format;
|
||||||
af_fix_parameters(&(afs->input));
|
af_fix_parameters(&(afs->input));
|
||||||
|
|
||||||
// output format: same as ao driver's input format (if missing, fallback to input)
|
// output format: same as ao driver's input format (if missing, fallback to input)
|
||||||
|
@ -7,10 +7,5 @@ extern void resync_audio_stream(sh_audio_t *sh_audio);
|
|||||||
extern void skip_audio_frame(sh_audio_t *sh_audio);
|
extern void skip_audio_frame(sh_audio_t *sh_audio);
|
||||||
extern void uninit_audio(sh_audio_t *sh_audio);
|
extern void uninit_audio(sh_audio_t *sh_audio);
|
||||||
|
|
||||||
extern int init_audio_filters(sh_audio_t *sh_audio,
|
extern int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
|
||||||
int in_samplerate, int in_channels, int in_format,
|
int *out_samplerate, int *out_channels, int *out_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* out_samplerate, int* out_channels, int* out_format);
|
|
||||||
|
16
mencoder.c
16
mencoder.c
@ -914,10 +914,9 @@ mux_a->codec=out_audio_codec;
|
|||||||
ao_data.samplerate = force_srate;
|
ao_data.samplerate = force_srate;
|
||||||
ao_data.channels = 0;
|
ao_data.channels = 0;
|
||||||
ao_data.format = audio_output_format;
|
ao_data.format = audio_output_format;
|
||||||
if(!preinit_audio_filters(sh_audio,
|
if(!init_audio_filters(sh_audio,
|
||||||
// input:
|
// input:
|
||||||
new_srate,
|
new_srate,
|
||||||
sh_audio->channels, sh_audio->sample_format,
|
|
||||||
// output:
|
// output:
|
||||||
&ao_data.samplerate, &ao_data.channels, &ao_data.format)) {
|
&ao_data.samplerate, &ao_data.channels, &ao_data.format)) {
|
||||||
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
|
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
|
||||||
@ -932,9 +931,8 @@ if(mux_a->codec != ACODEC_COPY) {
|
|||||||
if(!aencoder)
|
if(!aencoder)
|
||||||
mencoder_exit(1, NULL);
|
mencoder_exit(1, NULL);
|
||||||
if(!init_audio_filters(sh_audio,
|
if(!init_audio_filters(sh_audio,
|
||||||
new_srate, sh_audio->channels, sh_audio->sample_format,
|
new_srate,
|
||||||
&aparams.sample_rate, &aparams.channels, &aencoder->input_format,
|
&aparams.sample_rate, &aparams.channels, &aencoder->input_format)) {
|
||||||
aencoder->min_buffer_size, aencoder->max_buffer_size)) {
|
|
||||||
mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoMatchingFilter);
|
mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoMatchingFilter);
|
||||||
mencoder_exit(1,NULL);
|
mencoder_exit(1,NULL);
|
||||||
}
|
}
|
||||||
@ -1031,11 +1029,9 @@ else {
|
|||||||
int out_srate = mux_a->wf->nSamplesPerSec;
|
int out_srate = mux_a->wf->nSamplesPerSec;
|
||||||
int out_channels = mux_a->wf->nChannels;
|
int out_channels = mux_a->wf->nChannels;
|
||||||
int out_format = aencoder->input_format;
|
int out_format = aencoder->input_format;
|
||||||
int out_minsize = aencoder->min_buffer_size;
|
if (!init_audio_filters(sh_audio, new_srate,
|
||||||
int out_maxsize = aencoder->max_buffer_size;
|
&out_srate, &out_channels,
|
||||||
if (!init_audio_filters(sh_audio, new_srate, sh_audio->channels,
|
&out_format)) {
|
||||||
sh_audio->sample_format, &out_srate, &out_channels,
|
|
||||||
&out_format, out_minsize, out_maxsize)) {
|
|
||||||
mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoMatchingFilter);
|
mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoMatchingFilter);
|
||||||
mencoder_exit(1, NULL);
|
mencoder_exit(1, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1213,9 +1213,7 @@ int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data)
|
|||||||
playback_speed = (float)new_srate / (float)sh_audio->samplerate;
|
playback_speed = (float)new_srate / (float)sh_audio->samplerate;
|
||||||
}
|
}
|
||||||
result = init_audio_filters(sh_audio, new_srate,
|
result = init_audio_filters(sh_audio, new_srate,
|
||||||
sh_audio->channels, sh_audio->sample_format,
|
&ao_data->samplerate, &ao_data->channels, &ao_data->format);
|
||||||
&ao_data->samplerate, &ao_data->channels, &ao_data->format,
|
|
||||||
ao_data->outburst * 4, ao_data->buffersize);
|
|
||||||
mpctx->mixer.afilter = sh_audio->afilter;
|
mpctx->mixer.afilter = sh_audio->afilter;
|
||||||
#ifdef HAVE_NEW_GUI
|
#ifdef HAVE_NEW_GUI
|
||||||
if (use_gui) guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter);
|
if (use_gui) guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter);
|
||||||
@ -1495,10 +1493,9 @@ if(mpctx->sh_audio){
|
|||||||
ao_data.format=audio_output_format;
|
ao_data.format=audio_output_format;
|
||||||
#if 1
|
#if 1
|
||||||
// first init to detect best values
|
// first init to detect best values
|
||||||
if(!preinit_audio_filters(mpctx->sh_audio,
|
if(!init_audio_filters(mpctx->sh_audio, // preliminary init
|
||||||
// input:
|
// input:
|
||||||
(int)(mpctx->sh_audio->samplerate*playback_speed),
|
(int)(mpctx->sh_audio->samplerate*playback_speed),
|
||||||
mpctx->sh_audio->channels, mpctx->sh_audio->sample_format,
|
|
||||||
// output:
|
// output:
|
||||||
&ao_data.samplerate, &ao_data.channels, &ao_data.format)){
|
&ao_data.samplerate, &ao_data.channels, &ao_data.format)){
|
||||||
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
|
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
|
||||||
|
Loading…
Reference in New Issue
Block a user