summaryrefslogtreecommitdiff
path: root/libavcodec/libopusenc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-08-23 12:40:50 +0000
committerAnton Khirnov <anton@khirnov.net>2014-10-13 19:09:01 +0000
commit2df0c32ea12ddfa72ba88309812bfb13b674130f (patch)
tree50677fbc787646c10931f8ba95e32883173f7bfb /libavcodec/libopusenc.c
parentc80a816142699dea9cf9fa66689a7838a487ed7e (diff)
lavc: use a separate field for exporting audio encoder padding
Currently, the amount of padding inserted at the beginning by some audio encoders, is exported through AVCodecContext.delay. However - the term 'delay' is heavily overloaded and can have multiple different meanings even in the case of audio encoding. - this field has entirely different meanings, depending on whether the codec context is used for encoding or decoding (and has yet another different meaning for video), preventing generic handling of the codec context. Therefore, add a new field -- AVCodecContext.initial_padding. It could conceivably be used for decoding as well at a later point.
Diffstat (limited to 'libavcodec/libopusenc.c')
-rw-r--r--libavcodec/libopusenc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 9af8bcda7e..ee9655beef 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -87,7 +87,7 @@ static void libopus_write_header(AVCodecContext *avctx, int stream_count,
bytestream_put_buffer(&p, "OpusHead", 8);
bytestream_put_byte(&p, 1); /* Version */
bytestream_put_byte(&p, channels);
- bytestream_put_le16(&p, avctx->delay); /* Lookahead samples at 48kHz */
+ bytestream_put_le16(&p, avctx->initial_padding); /* Lookahead samples at 48kHz */
bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */
bytestream_put_le16(&p, 0); /* Gain of 0dB is recommended. */
@@ -277,7 +277,7 @@ static int av_cold libopus_encode_init(AVCodecContext *avctx)
goto fail;
}
- ret = opus_multistream_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&avctx->delay));
+ ret = opus_multistream_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&avctx->initial_padding));
if (ret != OPUS_OK)
av_log(avctx, AV_LOG_WARNING,
"Unable to get number of lookahead samples: %s\n",