summaryrefslogtreecommitdiff
path: root/libavcodec/libopusenc.c
diff options
context:
space:
mode:
authorMenno <mrdegier@gmail.com>2018-02-05 10:54:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-02-06 23:07:10 +0100
commit204c7caf0d77bdfd73196ffee00695222d0ff2cb (patch)
tree4448d99edb8c8d782cdae6e6b90846e073a74d7d /libavcodec/libopusenc.c
parent26d879c1cea176d4f0e0a47d4b641c86495aa0e8 (diff)
avcodec/libopus: support disabling phase inversion.
Signed-off-by: Menno <mrdegier@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/libopusenc.c')
-rw-r--r--libavcodec/libopusenc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index b449497d15..4ae81b0bb2 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -39,6 +39,9 @@ typedef struct LibopusEncOpts {
int packet_size;
int max_bandwidth;
int mapping_family;
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+ int apply_phase_inv;
+#endif
} LibopusEncOpts;
typedef struct LibopusEncContext {
@@ -154,6 +157,14 @@ static int libopus_configure_encoder(AVCodecContext *avctx, OpusMSEncoder *enc,
"Unable to set maximum bandwidth: %s\n", opus_strerror(ret));
}
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_PHASE_INVERSION_DISABLED(!opts->apply_phase_inv));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set phase inversion: %s\n",
+ opus_strerror(ret));
+#endif
return OPUS_OK;
}
@@ -530,6 +541,9 @@ static const AVOption libopus_options[] = {
{ "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "vbr" },
{ "constrained", "Use constrained VBR", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, "vbr" },
{ "mapping_family", "Channel Mapping Family", OFFSET(mapping_family), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, FLAGS, "mapping_family" },
+#ifdef OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST
+ { "apply_phase_inv", "Apply intensity stereo phase inversion", OFFSET(apply_phase_inv), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
+#endif
{ NULL },
};