summaryrefslogtreecommitdiff
path: root/libavcodec/opusdec.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-12-04 06:36:42 +0000
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-12-04 07:28:45 +0000
commit1b8649c2ce95da0a12d90f6acf7171b4fc6580db (patch)
tree40eeb3616dea4963f080594b996cd906524f95ef /libavcodec/opusdec.c
parentfe05f93013c4a3616926fa9370be2d9c93a94659 (diff)
downloadffmpeg-1b8649c2ce95da0a12d90f6acf7171b4fc6580db.tar.gz
opus: add an option to toggle intensity stereo phase inversion
Due to a somewhat high volume of complains, phase inversion has been made optional with RFC8251. This allows for better bass frequency response when partially downmixing to play on systems with an LFE speaker. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/opusdec.c')
-rw-r--r--libavcodec/opusdec.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index 5a7ba9dbb4..03086dea99 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -687,7 +687,7 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
if (ret < 0)
goto fail;
- ret = ff_celt_init(avctx, &s->celt, s->output_channels);
+ ret = ff_celt_init(avctx, &s->celt, s->output_channels, c->apply_phase_inv);
if (ret < 0)
goto fail;
@@ -712,9 +712,24 @@ fail:
return ret;
}
+#define OFFSET(x) offsetof(OpusContext, x)
+#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+static const AVOption opus_options[] = {
+ { "apply_phase_inv", "Apply intensity stereo phase inversion", OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AD },
+ { NULL },
+};
+
+static const AVClass opus_class = {
+ .class_name = "Opus Decoder",
+ .item_name = av_default_item_name,
+ .option = opus_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVCodec ff_opus_decoder = {
.name = "opus",
.long_name = NULL_IF_CONFIG_SMALL("Opus"),
+ .priv_class = &opus_class,
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_OPUS,
.priv_data_size = sizeof(OpusContext),