summaryrefslogtreecommitdiff
path: root/libavcodec/dcadec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-29 04:39:52 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-29 04:39:52 +0100
commit5b3c68414749e87ef46a7ce19ce75be8c6f3d515 (patch)
tree063b686e0d40f1e36ed77986f0e85d3cb1b70ed1 /libavcodec/dcadec.c
parent3f41e57fa869036e42bf26dfaccf0c7b28d0bd19 (diff)
parent3c8507a845e68b2c0c7fb53ef4c6972db80acf21 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: dcadec: add disable_xch private option. Conflicts: libavcodec/dcadec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dcadec.c')
-rw-r--r--libavcodec/dcadec.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 8490c1e7e8..8af11a309e 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -32,6 +32,7 @@
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "avcodec.h"
#include "fft.h"
@@ -346,6 +347,7 @@ static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
}
typedef struct {
+ AVClass *class; ///< class for AVOptions
AVCodecContext *avctx;
/* Frame header */
int frame_type; ///< type of the current frame
@@ -443,6 +445,7 @@ typedef struct {
/* XCh extension information */
int xch_present; ///< XCh extension present and valid
int xch_base_channel; ///< index of first (only) channel containing XCH data
+ int xch_disable; ///< whether the XCh extension should be decoded or not
/* XXCH extension information */
int xxch_chset;
@@ -2321,12 +2324,12 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
avctx->channel_layout = dca_core_channel_layout[s->amode];
#if FF_API_REQUEST_CHANNELS
FF_DISABLE_DEPRECATION_WARNINGS
- if (s->xch_present && (!avctx->request_channels ||
- avctx->request_channels
- > num_core_channels + !!s->lfe)) {
+ if (s->xch_present && !s->xch_disable &&
+ (!avctx->request_channels ||
+ avctx->request_channels > num_core_channels + !!s->lfe)) {
FF_ENABLE_DEPRECATION_WARNINGS
#else
- if (s->xch_present) {
+ if (s->xch_present && !s->xch_disable) {
#endif
avctx->channel_layout |= AV_CH_BACK_CENTER;
if (s->lfe) {
@@ -2602,6 +2605,18 @@ static const AVProfile profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
+static const AVOption options[] = {
+ { "disable_xch", "disable decoding of the XCh extension", offsetof(DCAContext, xch_disable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_AUDIO_PARAM },
+ { NULL },
+};
+
+static const AVClass dca_decoder_class = {
+ .class_name = "DCA decoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVCodec ff_dca_decoder = {
.name = "dca",
.long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
@@ -2615,4 +2630,5 @@ AVCodec ff_dca_decoder = {
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles),
+ .priv_class = &dca_decoder_class,
};