From 931187e117c299271df8c4caf1f8c656baf80a6b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 13 Aug 2011 00:55:11 +0200 Subject: [PATCH] ac3dec: export center & suroundmix levels Signed-off-by: Michael Niedermayer --- libavcodec/ac3dec.c | 11 +++++++++++ libavcodec/ac3dec.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 6e378bb59c..503db5e201 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1382,6 +1382,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, avctx->channels = s->out_channels; avctx->channel_layout = s->channel_layout; + s->loro_center_mix_level = gain_levels[ center_levels[s-> center_mix_level]]; + s->loro_surround_mix_level = gain_levels[surround_levels[s->surround_mix_level]]; + s->ltrt_center_mix_level = LEVEL_MINUS_3DB; + s->ltrt_surround_mix_level = LEVEL_MINUS_3DB; /* set downmixing coefficients if needed */ if(s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) && s->fbw_channels == s->out_channels)) { @@ -1443,6 +1447,13 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx) #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) static const AVOption options[] = { { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, {1.0}, 0.0, 1.0, PAR }, + +{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, 0, "dmix_mode"}, +{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, +{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, +{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, +{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, + { NULL}, }; diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index 8e84c18f11..aa346cb020 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -88,6 +88,12 @@ typedef struct { int eac3; ///< indicates if current frame is E-AC-3 ///@} + int preferred_stereo_downmix; + float ltrt_center_mix_level; + float ltrt_surround_mix_level; + float loro_center_mix_level; + float loro_surround_mix_level; + ///@name Frame syntax parameters int snr_offset_strategy; ///< SNR offset strategy (snroffststr) int block_switch_syntax; ///< block switch syntax enabled (blkswe)