History

avcodec/libdcadec: add some useful options

foo86 committed 10 years ago

Commit de12aa51 parent 704b2781 file · +38 −0Browse files

Unified · Split

libavcodec/libdcadec.c+38−0
@@ -31,9 +31,12 @@ · 30 unmodified lines
3131 #include "internal.h"
3232
3333 typedef struct DCADecContext {
34+ const AVClass *class;
3435 struct dcadec_context *ctx;
3536 uint8_t *buffer;
3637 int buffer_size;
38+ int lfe_filter;
39+ int core_only;
3740 } DCADecContext;
3841
3942 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
240243 }
241244 }
242245
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+
243260 s->ctx = dcadec_context_create(flags);
244261 if (!s->ctx)
245262 return AVERROR(ENOMEM);
@@ -252,6 +269,26 @@ static av_cold int dcadec_init(AVCodecContext *avctx) · 6 unmodified lines
252269 return 0;
253270 }
254271
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+
255292 static const AVProfile profiles[] = {
256293 { FF_PROFILE_DTS, "DTS" },
257294 { FF_PROFILE_DTS_ES, "DTS-ES" },
@@ -275,5 +312,6 @@ AVCodec ff_libdcadec_decoder = { · 17 unmodified lines
275312 .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
276313 .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_S16P,
277314 AV_SAMPLE_FMT_NONE },
315+ .priv_class = &dcadec_class,
278316 .profiles = NULL_IF_CONFIG_SMALL(profiles),
279317 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t