summaryrefslogtreecommitdiff
path: root/libavcodec/libopusenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-26 09:09:44 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-05 03:21:41 +0200
commit5828e8209f48f206c42b69e314a6988b50e98924 (patch)
treeb1ce7a4fdbafb8e2ec3706340736812dae042016 /libavcodec/libopusenc.c
parentcee40a945abc3568e270899eefb8bf6cf7e5ab3c (diff)
downloadffmpeg-5828e8209f48f206c42b69e314a6988b50e98924.tar.gz
avcodec: Constify frame->data pointers for encoders where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/libopusenc.c')
-rw-r--r--libavcodec/libopusenc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 48dd32fc38..b8ab184109 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -459,7 +459,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
const int bytes_per_sample = av_get_bytes_per_sample(avctx->sample_fmt);
const int channels = avctx->ch_layout.nb_channels;
const int sample_size = channels * bytes_per_sample;
- uint8_t *audio;
+ const uint8_t *audio;
int ret;
int discard_padding;
@@ -470,18 +470,18 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
if (opus->encoder_channel_map != NULL) {
audio = opus->samples;
libopus_copy_samples_with_channel_map(
- audio, frame->data[0], opus->encoder_channel_map,
+ opus->samples, frame->data[0], opus->encoder_channel_map,
channels, frame->nb_samples, bytes_per_sample);
} else if (frame->nb_samples < opus->opts.packet_size) {
audio = opus->samples;
- memcpy(audio, frame->data[0], frame->nb_samples * sample_size);
+ memcpy(opus->samples, frame->data[0], frame->nb_samples * sample_size);
} else
audio = frame->data[0];
} else {
if (!opus->afq.remaining_samples || (!opus->afq.frame_alloc && !opus->afq.frame_count))
return 0;
audio = opus->samples;
- memset(audio, 0, opus->opts.packet_size * sample_size);
+ memset(opus->samples, 0, opus->opts.packet_size * sample_size);
}
/* Maximum packet size taken from opusenc in opus-tools. 120ms packets
@@ -491,11 +491,11 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
return ret;
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT)
- ret = opus_multistream_encode_float(opus->enc, (float *)audio,
+ ret = opus_multistream_encode_float(opus->enc, (const float *)audio,
opus->opts.packet_size,
avpkt->data, avpkt->size);
else
- ret = opus_multistream_encode(opus->enc, (opus_int16 *)audio,
+ ret = opus_multistream_encode(opus->enc, (const opus_int16 *)audio,
opus->opts.packet_size,
avpkt->data, avpkt->size);