summaryrefslogtreecommitdiffstats
path: root/libhb/audio_resample.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-08-01 23:05:00 +0000
committerjstebbins <[email protected]>2012-08-01 23:05:00 +0000
commitad257c9dac38fe3f7502b1058247b4458465c0a8 (patch)
treec142e7b68aa0406b64e77a7f844b0622172fc5c9 /libhb/audio_resample.c
parentdbec0d898d37f3b9a1fed8158543115fbdb3ce91 (diff)
libhb: Allow control of audio mix normalization
Since switching to libavresample for audio mixing, our output volume levels have been reduced because libavresample does mix level normalization by default. This change applies a patch to libav to allow us to disable this behavior and adds a new field to hb_audio_config_t to allow the hb frontends to control this feature. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4884 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/audio_resample.c')
-rw-r--r--libhb/audio_resample.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libhb/audio_resample.c b/libhb/audio_resample.c
index 3f67da87c..ea09b38a2 100644
--- a/libhb/audio_resample.c
+++ b/libhb/audio_resample.c
@@ -13,20 +13,23 @@
hb_audio_resample_t* hb_audio_resample_init(enum AVSampleFormat output_sample_fmt,
uint64_t output_channel_layout,
- enum AVMatrixEncoding matrix_encoding)
+ enum AVMatrixEncoding matrix_encoding,
+ int normalize_mix_level)
{
hb_audio_resample_t *resample = malloc(sizeof(hb_audio_resample_t));
if (resample == NULL)
return NULL;
- resample->out.sample_fmt = output_sample_fmt;
- resample->out.sample_size = av_get_bytes_per_sample(output_sample_fmt);
- resample->out.channel_layout = output_channel_layout;
- resample->out.channels =
+ resample->out.sample_fmt = output_sample_fmt;
+ resample->out.sample_size =
+ av_get_bytes_per_sample(output_sample_fmt);
+ resample->out.channel_layout = output_channel_layout;
+ resample->out.channels =
av_get_channel_layout_nb_channels(output_channel_layout);
- resample->out.matrix_encoding = matrix_encoding;
- resample->resample_needed = 0;
- resample->avresample = NULL;
+ resample->out.matrix_encoding = matrix_encoding;
+ resample->out.normalize_mix_level = normalize_mix_level;
+ resample->resample_needed = 0;
+ resample->avresample = NULL;
return resample;
}
@@ -72,6 +75,8 @@ int hb_audio_resample_update(hb_audio_resample_t *resample,
resample->out.channel_layout, 0);
av_opt_set_int(resample->avresample, "matrix_encoding",
resample->out.matrix_encoding, 0);
+ av_opt_set_int(resample->avresample, "normalize_mix_level",
+ resample->out.normalize_mix_level, 0);
}
else if (resample_changed)
{