diff options
Diffstat (limited to 'libhb/common.c')
-rw-r--r-- | libhb/common.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/libhb/common.c b/libhb/common.c index 62826a654..9f7a917de 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -4057,12 +4057,27 @@ int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg) /* Really shouldn't ignore the passed out track, but there is currently no * way to handle duplicates or out-of-order track numbers. */ audio->config.out.track = hb_list_count(job->list_audio) + 1; - audio->config.out.codec = audiocfg->out.codec; - if((audiocfg->out.codec & HB_ACODEC_PASS_FLAG) && - ((audiocfg->out.codec == HB_ACODEC_AUTO_PASS) || - (audiocfg->out.codec & audio->config.in.codec & HB_ACODEC_PASS_MASK))) + int codec = audiocfg->out.codec; + if(!(codec & HB_ACODEC_PASS_FLAG) || + ((codec & HB_ACODEC_PASS_FLAG) && + !(codec & audio->config.in.codec) && + hb_audio_encoder_is_enabled(codec & ~HB_ACODEC_PASS_FLAG))) + { + audio->config.out.codec = codec & ~HB_ACODEC_PASS_FLAG; + audio->config.out.samplerate = audiocfg->out.samplerate; + audio->config.out.bitrate = audiocfg->out.bitrate; + audio->config.out.compression_level = audiocfg->out.compression_level; + audio->config.out.quality = audiocfg->out.quality; + audio->config.out.dynamic_range_compression = audiocfg->out.dynamic_range_compression; + audio->config.out.mixdown = audiocfg->out.mixdown; + audio->config.out.gain = audiocfg->out.gain; + audio->config.out.normalize_mix_level = audiocfg->out.normalize_mix_level; + audio->config.out.dither_method = audiocfg->out.dither_method; + } + else { /* Pass-through, copy from input. */ + audio->config.out.codec = codec; audio->config.out.samplerate = audio->config.in.samplerate; audio->config.out.bitrate = audio->config.in.bitrate; audio->config.out.mixdown = HB_AMIXDOWN_NONE; @@ -4073,20 +4088,6 @@ int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg) audio->config.out.quality = HB_INVALID_AUDIO_QUALITY; audio->config.out.dither_method = hb_audio_dither_get_default(); } - else - { - /* Non pass-through, use what is given. */ - audio->config.out.codec &= ~HB_ACODEC_PASS_FLAG; - audio->config.out.samplerate = audiocfg->out.samplerate; - audio->config.out.bitrate = audiocfg->out.bitrate; - audio->config.out.compression_level = audiocfg->out.compression_level; - audio->config.out.quality = audiocfg->out.quality; - audio->config.out.dynamic_range_compression = audiocfg->out.dynamic_range_compression; - audio->config.out.mixdown = audiocfg->out.mixdown; - audio->config.out.gain = audiocfg->out.gain; - audio->config.out.normalize_mix_level = audiocfg->out.normalize_mix_level; - audio->config.out.dither_method = audiocfg->out.dither_method; - } if (audiocfg->out.name && *audiocfg->out.name) { audio->config.out.name = strdup(audiocfg->out.name); |