Use "const" qualifier for pointers that point to input data of

audio encoders.
This is purely for clarity/documentation purposes.

Originally committed as revision 24481 to svn://svn.ffmpeg.org/ffmpeg/trunk
oldabi
Reimar Döffinger 15 years ago
parent 6f2c523c85
commit edac49daf5
  1. 4
      libavcodec/ac3enc.c
  2. 6
      libavcodec/alacenc.c
  3. 8
      libavcodec/flacenc.c
  4. 2
      libavcodec/g726.c
  5. 4
      libavcodec/mpegaudioenc.c
  6. 2
      libavcodec/nellymoserenc.c
  7. 14
      libavcodec/pcm.c
  8. 2
      libavcodec/roqaudioenc.c
  9. 4
      libavcodec/vorbis_enc.c
  10. 4
      libavcodec/wmaenc.c

@ -1181,7 +1181,7 @@ static int AC3_encode_frame(AVCodecContext *avctx,
unsigned char *frame, int buf_size, void *data) unsigned char *frame, int buf_size, void *data)
{ {
AC3EncodeContext *s = avctx->priv_data; AC3EncodeContext *s = avctx->priv_data;
int16_t *samples = data; const int16_t *samples = data;
int i, j, k, v, ch; int i, j, k, v, ch;
int16_t input_samples[N]; int16_t input_samples[N];
int32_t mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; int32_t mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
@ -1197,7 +1197,7 @@ static int AC3_encode_frame(AVCodecContext *avctx,
int ich = s->channel_map[ch]; int ich = s->channel_map[ch];
/* fixed mdct to the six sub blocks & exponent computation */ /* fixed mdct to the six sub blocks & exponent computation */
for(i=0;i<NB_BLOCKS;i++) { for(i=0;i<NB_BLOCKS;i++) {
int16_t *sptr; const int16_t *sptr;
int sinc; int sinc;
/* compute input samples */ /* compute input samples */

@ -75,12 +75,12 @@ typedef struct AlacEncodeContext {
} AlacEncodeContext; } AlacEncodeContext;
static void init_sample_buffers(AlacEncodeContext *s, int16_t *input_samples) static void init_sample_buffers(AlacEncodeContext *s, const int16_t *input_samples)
{ {
int ch, i; int ch, i;
for(ch=0;ch<s->avctx->channels;ch++) { for(ch=0;ch<s->avctx->channels;ch++) {
int16_t *sptr = input_samples + ch; const int16_t *sptr = input_samples + ch;
for(i=0;i<s->avctx->frame_size;i++) { for(i=0;i<s->avctx->frame_size;i++) {
s->sample_buf[ch][i] = *sptr; s->sample_buf[ch][i] = *sptr;
sptr += s->avctx->channels; sptr += s->avctx->channels;
@ -482,7 +482,7 @@ verbatim:
if((s->compression_level == 0) || verbatim_flag) { if((s->compression_level == 0) || verbatim_flag) {
// Verbatim mode // Verbatim mode
int16_t *samples = data; const int16_t *samples = data;
write_frame_header(s, 1); write_frame_header(s, 1);
for(i=0; i<avctx->frame_size*avctx->channels; i++) { for(i=0; i<avctx->frame_size*avctx->channels; i++) {
put_sbits(pb, 16, *samples++); put_sbits(pb, 16, *samples++);

@ -446,7 +446,7 @@ static void init_frame(FlacEncodeContext *s)
/** /**
* Copy channel-interleaved input samples into separate subframes * Copy channel-interleaved input samples into separate subframes
*/ */
static void copy_samples(FlacEncodeContext *s, int16_t *samples) static void copy_samples(FlacEncodeContext *s, const int16_t *samples)
{ {
int i, j, ch; int i, j, ch;
FlacFrame *frame; FlacFrame *frame;
@ -1204,7 +1204,7 @@ static void output_frame_footer(FlacEncodeContext *s)
flush_put_bits(&s->pb); flush_put_bits(&s->pb);
} }
static void update_md5_sum(FlacEncodeContext *s, int16_t *samples) static void update_md5_sum(FlacEncodeContext *s, const int16_t *samples)
{ {
#if HAVE_BIGENDIAN #if HAVE_BIGENDIAN
int i; int i;
@ -1213,7 +1213,7 @@ static void update_md5_sum(FlacEncodeContext *s, int16_t *samples)
av_md5_update(s->md5ctx, (uint8_t *)&smp, 2); av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);
} }
#else #else
av_md5_update(s->md5ctx, (uint8_t *)samples, s->frame.blocksize*s->channels*2); av_md5_update(s->md5ctx, (const uint8_t *)samples, s->frame.blocksize*s->channels*2);
#endif #endif
} }
@ -1222,7 +1222,7 @@ static int flac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
{ {
int ch; int ch;
FlacEncodeContext *s; FlacEncodeContext *s;
int16_t *samples = data; const int16_t *samples = data;
int out_bytes; int out_bytes;
int reencoded=0; int reencoded=0;

@ -348,7 +348,7 @@ static int g726_encode_frame(AVCodecContext *avctx,
uint8_t *dst, int buf_size, void *data) uint8_t *dst, int buf_size, void *data)
{ {
G726Context *c = avctx->priv_data; G726Context *c = avctx->priv_data;
short *samples = data; const short *samples = data;
PutBitContext pb; PutBitContext pb;
init_put_bits(&pb, dst, 1024*1024); init_put_bits(&pb, dst, 1024*1024);

@ -306,7 +306,7 @@ static void idct32(int *out, int *tab)
#define WSHIFT (WFRAC_BITS + 15 - FRAC_BITS) #define WSHIFT (WFRAC_BITS + 15 - FRAC_BITS)
static void filter(MpegAudioContext *s, int ch, short *samples, int incr) static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
{ {
short *p, *q; short *p, *q;
int sum, offset, i, j; int sum, offset, i, j;
@ -752,7 +752,7 @@ static int MPA_encode_frame(AVCodecContext *avctx,
unsigned char *frame, int buf_size, void *data) unsigned char *frame, int buf_size, void *data)
{ {
MpegAudioContext *s = avctx->priv_data; MpegAudioContext *s = avctx->priv_data;
short *samples = data; const short *samples = data;
short smr[MPA_MAX_CHANNELS][SBLIMIT]; short smr[MPA_MAX_CHANNELS][SBLIMIT];
unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT]; unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT];
int padding, i; int padding, i;

@ -351,7 +351,7 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int
static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data) static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data)
{ {
NellyMoserEncodeContext *s = avctx->priv_data; NellyMoserEncodeContext *s = avctx->priv_data;
int16_t *samples = data; const int16_t *samples = data;
int i; int i;
if (s->last_frame) if (s->last_frame)

@ -81,14 +81,14 @@ static int pcm_encode_frame(AVCodecContext *avctx,
unsigned char *frame, int buf_size, void *data) unsigned char *frame, int buf_size, void *data)
{ {
int n, sample_size, v; int n, sample_size, v;
short *samples; const short *samples;
unsigned char *dst; unsigned char *dst;
uint8_t *srcu8; const uint8_t *srcu8;
int16_t *samples_int16_t; const int16_t *samples_int16_t;
int32_t *samples_int32_t; const int32_t *samples_int32_t;
int64_t *samples_int64_t; const int64_t *samples_int64_t;
uint16_t *samples_uint16_t; const uint16_t *samples_uint16_t;
uint32_t *samples_uint32_t; const uint32_t *samples_uint32_t;
sample_size = av_get_bits_per_sample(avctx->codec->id)/8; sample_size = av_get_bits_per_sample(avctx->codec->id)/8;
n = buf_size / sample_size; n = buf_size / sample_size;

@ -108,7 +108,7 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx,
unsigned char *frame, int buf_size, void *data) unsigned char *frame, int buf_size, void *data)
{ {
int i, samples, stereo, ch; int i, samples, stereo, ch;
short *in; const short *in;
unsigned char *out; unsigned char *out;
ROQDPCMContext *context = avctx->priv_data; ROQDPCMContext *context = avctx->priv_data;

@ -888,7 +888,7 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
} }
} }
static int apply_window_and_mdct(vorbis_enc_context *venc, signed short *audio, static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *audio,
int samples) int samples)
{ {
int i, j, channel; int i, j, channel;
@ -973,7 +973,7 @@ static int vorbis_encode_frame(AVCodecContext *avccontext,
int buf_size, void *data) int buf_size, void *data)
{ {
vorbis_enc_context *venc = avccontext->priv_data; vorbis_enc_context *venc = avccontext->priv_data;
signed short *audio = data; const signed short *audio = data;
int samples = data ? avccontext->frame_size : 0; int samples = data ? avccontext->frame_size : 0;
vorbis_enc_mode *mode; vorbis_enc_mode *mode;
vorbis_enc_mapping *mapping; vorbis_enc_mapping *mapping;

@ -74,7 +74,7 @@ static int encode_init(AVCodecContext * avctx){
} }
static void apply_window_and_mdct(AVCodecContext * avctx, signed short * audio, int len) { static void apply_window_and_mdct(AVCodecContext * avctx, const signed short * audio, int len) {
WMACodecContext *s = avctx->priv_data; WMACodecContext *s = avctx->priv_data;
int window_index= s->frame_len_bits - s->block_len_bits; int window_index= s->frame_len_bits - s->block_len_bits;
int i, j, channel; int i, j, channel;
@ -328,7 +328,7 @@ static int encode_frame(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
static int encode_superframe(AVCodecContext *avctx, static int encode_superframe(AVCodecContext *avctx,
unsigned char *buf, int buf_size, void *data){ unsigned char *buf, int buf_size, void *data){
WMACodecContext *s = avctx->priv_data; WMACodecContext *s = avctx->priv_data;
short *samples = data; const short *samples = data;
int i, total_gain; int i, total_gain;
s->block_len_bits= s->frame_len_bits; //required by non variable block len s->block_len_bits= s->frame_len_bits; //required by non variable block len

Loading…
Cancel
Save