On 05/30/2011 03:15 PM, Anton Khirnov wrote:
> Deprecate corresponding AVCodecContext option.
>
> This is the first test of decoder private options.
good choice.
> ---
> libavcodec/ac3dec.c | 15 +++++++++++++++
> libavcodec/ac3dec.h | 2 ++
> libavcodec/avcodec.h | 5 ++++-
> libavcodec/options.c | 2 ++
> libavcodec/version.h | 3 +++
> 5 files changed, 26 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
> index 2966c33..04ffc36 100644
> --- a/libavcodec/ac3dec.c
> +++ b/libavcodec/ac3dec.c
> @@ -30,6 +30,7 @@
> #include <string.h>
>
> #include "libavutil/crc.h"
> +#include "libavutil/opt.h"
> #include "internal.h"
> #include "aac_ac3_parser.h"
> #include "ac3_parser.h"
> @@ -1440,6 +1441,18 @@ static av_cold int ac3_decode_end(AVCodecContext
> *avctx)
> return 0;
> }
>
> +static const AVOption options[] = {
> + { "drc_scale", "percentage of dynamic range compression to apply",
> offsetof(AC3DecodeContext, drc_scale), FF_OPT_TYPE_FLOAT, {.dbl = 1.0 }, 0.0,
> 1.0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM },
> + { NULL},
> +};
> +
> +static const AVClass ac3_decoder_class = {
> + .class_name = "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 +1465,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 +1481,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,
> };
How about a separate AVClass for the eac3 decoder with a correct
class_name? That or use "(E-)AC-3 decoder" as the class_name.
-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel