From a38ef47cb3bfe3bbc919421aa73ae9c6660940f9 Mon Sep 17 00:00:00 2001 From: ods15 Date: Thu, 13 Oct 2005 20:54:21 +0000 Subject: cosmetics. does not change functionality, but makes code easier to read (removes redundant switch-case) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16757 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mencoder.c | 106 +++++++++++++++++++++++++------------------------------------ 1 file changed, 43 insertions(+), 63 deletions(-) (limited to 'mencoder.c') diff --git a/mencoder.c b/mencoder.c index ac5720a2a6..cdfa23b7b3 100644 --- a/mencoder.c +++ b/mencoder.c @@ -950,74 +950,54 @@ signal(SIGPIPE,exit_sighandler); // broken pipe timer_start=GetTimerMS(); } // if (!curfile) // if this was the first file. else { -if (!mux_a != !sh_audio) { - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoAudioFileMismatch); - mencoder_exit(1,NULL); -} -if (sh_audio) { - int out_format = 0, out_minsize = 0, out_maxsize = 0; - int do_init_filters = 1; - if((aencoder != NULL) && (mux_a->codec != ACODEC_COPY)) - { - out_format = aencoder->input_format; - out_minsize = aencoder->min_buffer_size; - out_maxsize = aencoder->max_buffer_size; + if (!mux_a != !sh_audio) { + mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoAudioFileMismatch); + mencoder_exit(1,NULL); } - switch(mux_a->codec){ - case ACODEC_COPY: - do_init_filters = 0; - if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, - mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec, - mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize); - if (sh_audio->wf) { - if ((mux_a->wf->wFormatTag != sh_audio->wf->wFormatTag) || - (mux_a->wf->nChannels != sh_audio->wf->nChannels) || - (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * playback_speed)) - { - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, - sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, sh_audio->wf->nSamplesPerSec * playback_speed, - sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); - mencoder_exit(1,NULL); - } + if (sh_audio && mux_a->codec == ACODEC_COPY) { + if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); + mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, + mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec, + mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize); + if (sh_audio->wf) { + if ((mux_a->wf->wFormatTag != sh_audio->wf->wFormatTag) || + (mux_a->wf->nChannels != sh_audio->wf->nChannels) || + (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * playback_speed)) + { + mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, + sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, sh_audio->wf->nSamplesPerSec * playback_speed, + sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); + mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); + mencoder_exit(1,NULL); } - else { - if ((mux_a->wf->wFormatTag != sh_audio->format) || - (mux_a->wf->nChannels != sh_audio->channels) || - (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * playback_speed)) - { - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, - sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, sh_audio->wf->nSamplesPerSec * playback_speed, - sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); - mencoder_exit(1,NULL); - } - + } else { + if ((mux_a->wf->wFormatTag != sh_audio->format) || + (mux_a->wf->nChannels != sh_audio->channels) || + (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * playback_speed)) + { + mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, + sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, sh_audio->wf->nSamplesPerSec * playback_speed, + sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); + mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); + mencoder_exit(1,NULL); } - break; - } - if (do_init_filters) { - int out_srate = mux_a->wf->nSamplesPerSec; - int out_channels = mux_a->wf->nChannels; - if(!init_audio_filters(sh_audio, - new_srate, - sh_audio->channels, - sh_audio->sample_format, - &out_srate, - &out_channels, - &out_format, - out_minsize, - out_maxsize)) - { - mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoMatchingFilter); - mencoder_exit(1, NULL); - } - mux_a->wf->nSamplesPerSec = out_srate; - mux_a->wf->nChannels = out_channels; + } + } else if (sh_audio) { + int out_srate = mux_a->wf->nSamplesPerSec; + int out_channels = mux_a->wf->nChannels; + int out_format = aencoder->input_format; + int out_minsize = aencoder->min_buffer_size; + int out_maxsize = aencoder->max_buffer_size; + if (!init_audio_filters(sh_audio, new_srate, sh_audio->channels, + sh_audio->sample_format, &out_srate, &out_channels, + &out_format, out_minsize, out_maxsize)) { + mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoMatchingFilter); + mencoder_exit(1, NULL); + } + mux_a->wf->nSamplesPerSec = out_srate; + mux_a->wf->nChannels = out_channels; } } -} parse_end_at(); -- cgit v1.2.3