Unified · Split
| @@ -31,9 +31,12 @@ · 30 unmodified lines | |||
| 31 | #include "internal.h" | 31 | #include "internal.h" |
| 32 | 32 | ||
| 33 | typedef struct DCADecContext { | 33 | typedef struct DCADecContext { |
| 34 | const AVClass *class; | ||
| 34 | struct dcadec_context *ctx; | 35 | struct dcadec_context *ctx; |
| 35 | uint8_t *buffer; | 36 | uint8_t *buffer; |
| 36 | int buffer_size; | 37 | int buffer_size; |
| 38 | int lfe_filter; | ||
| 39 | int core_only; | ||
| 37 | } DCADecContext; | 40 | } DCADecContext; |
| 38 | 41 | ||
| 39 | static void my_log_cb(int level, const char *file, int line, | 42 | static void my_log_cb(int level, const char *file, int line, |
| @@ -240,6 +243,20 @@ static av_cold int dcadec_init(AVCodecContext *avctx) · 200 unmodified lines | |||
| 240 | } | 243 | } |
| 241 | } | 244 | } |
| 242 | 245 | ||
| 246 | if (s->core_only) | ||
| 247 | flags |= DCADEC_FLAG_CORE_ONLY; | ||
| 248 | |||
| 249 | switch (s->lfe_filter) { | ||
| 250 | #if DCADEC_API_VERSION >= DCADEC_VERSION_CODE(0, 1, 0) | ||
| 251 | case 1: | ||
| 252 | flags |= DCADEC_FLAG_CORE_LFE_IIR; | ||
| 253 | break; | ||
| 254 | #endif | ||
| 255 | case 2: | ||
| 256 | flags |= DCADEC_FLAG_CORE_LFE_FIR; | ||
| 257 | break; | ||
| 258 | } | ||
| 259 | |||
| 243 | s->ctx = dcadec_context_create(flags); | 260 | s->ctx = dcadec_context_create(flags); |
| 244 | if (!s->ctx) | 261 | if (!s->ctx) |
| 245 | return AVERROR(ENOMEM); | 262 | return AVERROR(ENOMEM); |
| @@ -252,6 +269,26 @@ static av_cold int dcadec_init(AVCodecContext *avctx) · 6 unmodified lines | |||
| 252 | return 0; | 269 | return 0; |
| 253 | } | 270 | } |
| 254 | 271 | ||
| 272 | #define OFFSET(x) offsetof(DCADecContext, x) | ||
| 273 | #define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM | ||
| 274 | |||
| 275 | static const AVOption dcadec_options[] = { | ||
| 276 | { "lfe_filter", "Lossy LFE channel interpolation filter", OFFSET(lfe_filter), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, PARAM, "lfe_filter" }, | ||
| 277 | { "default", "Library default", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, PARAM, "lfe_filter" }, | ||
| 278 | { "iir", "IIR filter", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, PARAM, "lfe_filter" }, | ||
| 279 | { "fir", "FIR filter", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, PARAM, "lfe_filter" }, | ||
| 280 | { "core_only", "Decode core only without extensions", OFFSET(core_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, PARAM }, | ||
| 281 | { NULL } | ||
| 282 | }; | ||
| 283 | |||
| 284 | static const AVClass dcadec_class = { | ||
| 285 | .class_name = "libdcadec decoder", | ||
| 286 | .item_name = av_default_item_name, | ||
| 287 | .option = dcadec_options, | ||
| 288 | .version = LIBAVUTIL_VERSION_INT, | ||
| 289 | .category = AV_CLASS_CATEGORY_DECODER, | ||
| 290 | }; | ||
| 291 | |||
| 255 | static const AVProfile profiles[] = { | 292 | static const AVProfile profiles[] = { |
| 256 | { FF_PROFILE_DTS, "DTS" }, | 293 | { FF_PROFILE_DTS, "DTS" }, |
| 257 | { FF_PROFILE_DTS_ES, "DTS-ES" }, | 294 | { FF_PROFILE_DTS_ES, "DTS-ES" }, |
| @@ -275,5 +312,6 @@ AVCodec ff_libdcadec_decoder = { · 17 unmodified lines | |||
| 275 | .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, | 312 | .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, |
| 276 | .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_S16P, | 313 | .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_S16P, |
| 277 | AV_SAMPLE_FMT_NONE }, | 314 | AV_SAMPLE_FMT_NONE }, |
| 315 | .priv_class = &dcadec_class, | ||
| 278 | .profiles = NULL_IF_CONFIG_SMALL(profiles), | 316 | .profiles = NULL_IF_CONFIG_SMALL(profiles), |
| 279 | }; | 317 | }; |