From 9b83919f44eb1c87dc9431112944f0cccf6a599f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 20 May 2011 22:37:59 +0200 Subject: ac3dec: add a drc_scale private option Deprecate corresponding AVCodecContext option. This is the first test of decoder private options. --- libavcodec/ac3dec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libavcodec/ac3dec.c') diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 42b62ef701..663acc0ac9 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -30,6 +30,7 @@ #include #include "libavutil/crc.h" +#include "libavutil/opt.h" #include "internal.h" #include "aac_ac3_parser.h" #include "ac3_parser.h" @@ -1440,6 +1441,20 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx) return 0; } +#define OFFSET(x) offsetof(AC3DecodeContext, x) +#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 }, + { NULL}, +}; + +static const AVClass ac3_decoder_class = { + .class_name = "(E-)AC3 decoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + AVCodec ff_ac3_decoder = { .name = "ac3", .type = AVMEDIA_TYPE_AUDIO, @@ -1452,6 +1467,7 @@ AVCodec ff_ac3_decoder = { .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, + .priv_class = &ac3_decoder_class, }; #if CONFIG_EAC3_DECODER @@ -1467,5 +1483,6 @@ AVCodec ff_eac3_decoder = { .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, + .priv_class = &ac3_decoder_class, }; #endif -- cgit v1.2.3