diff options
author | foo86 <foobaz86@gmail.com> | 2015-12-07 18:48:34 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-08 03:37:04 +0100 |
commit | de12aa51b6bfa563656b9b510c2c8a88e858dade (patch) | |
tree | e992ff70ffc6753a72416fd63adf93f90515acd9 /libavcodec/libdcadec.c | |
parent | 704b278361add7c819b4c3725938c4424328e268 (diff) | |
download | ffmpeg-de12aa51b6bfa563656b9b510c2c8a88e858dade.tar.gz |
avcodec/libdcadec: add some useful options
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/libdcadec.c')
-rw-r--r-- | libavcodec/libdcadec.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index e15d1b56cd..8e3bc616bd 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -31,9 +31,12 @@ #include "internal.h" typedef struct DCADecContext { + const AVClass *class; struct dcadec_context *ctx; uint8_t *buffer; int buffer_size; + int lfe_filter; + int core_only; } DCADecContext; static void my_log_cb(int level, const char *file, int line, @@ -240,6 +243,20 @@ static av_cold int dcadec_init(AVCodecContext *avctx) } } + if (s->core_only) + flags |= DCADEC_FLAG_CORE_ONLY; + + switch (s->lfe_filter) { +#if DCADEC_API_VERSION >= DCADEC_VERSION_CODE(0, 1, 0) + case 1: + flags |= DCADEC_FLAG_CORE_LFE_IIR; + break; +#endif + case 2: + flags |= DCADEC_FLAG_CORE_LFE_FIR; + break; + } + s->ctx = dcadec_context_create(flags); if (!s->ctx) return AVERROR(ENOMEM); @@ -252,6 +269,26 @@ static av_cold int dcadec_init(AVCodecContext *avctx) return 0; } +#define OFFSET(x) offsetof(DCADecContext, x) +#define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM + +static const AVOption dcadec_options[] = { + { "lfe_filter", "Lossy LFE channel interpolation filter", OFFSET(lfe_filter), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, PARAM, "lfe_filter" }, + { "default", "Library default", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, PARAM, "lfe_filter" }, + { "iir", "IIR filter", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, PARAM, "lfe_filter" }, + { "fir", "FIR filter", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, PARAM, "lfe_filter" }, + { "core_only", "Decode core only without extensions", OFFSET(core_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, PARAM }, + { NULL } +}; + +static const AVClass dcadec_class = { + .class_name = "libdcadec decoder", + .item_name = av_default_item_name, + .option = dcadec_options, + .version = LIBAVUTIL_VERSION_INT, + .category = AV_CLASS_CATEGORY_DECODER, +}; + static const AVProfile profiles[] = { { FF_PROFILE_DTS, "DTS" }, { FF_PROFILE_DTS_ES, "DTS-ES" }, @@ -275,5 +312,6 @@ AVCodec ff_libdcadec_decoder = { .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }, + .priv_class = &dcadec_class, .profiles = NULL_IF_CONFIG_SMALL(profiles), }; |