Commit 3c8507a8 authored by Tim Walker's avatar Tim Walker Committed by Anton Khirnov

dcadec: add disable_xch private option.

This supplements the deprecated request_channels-based control of XCh decoding.
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 220494ad
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h" #include "libavutil/samplefmt.h"
#include "avcodec.h" #include "avcodec.h"
#include "fft.h" #include "fft.h"
...@@ -283,6 +284,7 @@ static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, ...@@ -283,6 +284,7 @@ static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
} }
typedef struct { typedef struct {
AVClass *class; ///< class for AVOptions
AVCodecContext *avctx; AVCodecContext *avctx;
/* Frame header */ /* Frame header */
int frame_type; ///< type of the current frame int frame_type; ///< type of the current frame
...@@ -380,6 +382,7 @@ typedef struct { ...@@ -380,6 +382,7 @@ typedef struct {
/* XCh extension information */ /* XCh extension information */
int xch_present; ///< XCh extension present and valid int xch_present; ///< XCh extension present and valid
int xch_base_channel; ///< index of first (only) channel containing XCH data int xch_base_channel; ///< index of first (only) channel containing XCH data
int xch_disable; ///< whether the XCh extension should be decoded or not
/* ExSS header parser */ /* ExSS header parser */
int static_fields; ///< static fields present int static_fields; ///< static fields present
...@@ -1840,11 +1843,12 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, ...@@ -1840,11 +1843,12 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
#if FF_API_REQUEST_CHANNELS #if FF_API_REQUEST_CHANNELS
FF_DISABLE_DEPRECATION_WARNINGS FF_DISABLE_DEPRECATION_WARNINGS
if (s->xch_present && (!avctx->request_channels || if (s->xch_present && !s->xch_disable &&
avctx->request_channels > num_core_channels + !!s->lfe)) { (!avctx->request_channels ||
avctx->request_channels > num_core_channels + !!s->lfe)) {
FF_ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
#else #else
if (s->xch_present) { if (s->xch_present && !s->xch_disable) {
#endif #endif
avctx->channel_layout |= AV_CH_BACK_CENTER; avctx->channel_layout |= AV_CH_BACK_CENTER;
if (s->lfe) { if (s->lfe) {
...@@ -2039,6 +2043,18 @@ static const AVProfile profiles[] = { ...@@ -2039,6 +2043,18 @@ static const AVProfile profiles[] = {
{ FF_PROFILE_UNKNOWN }, { 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 = { AVCodec ff_dca_decoder = {
.name = "dca", .name = "dca",
.long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
...@@ -2052,4 +2068,5 @@ AVCodec ff_dca_decoder = { ...@@ -2052,4 +2068,5 @@ AVCodec ff_dca_decoder = {
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles), .profiles = NULL_IF_CONFIG_SMALL(profiles),
.priv_class = &dca_decoder_class,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment