avcodec/dcadec: Treat the input packet's data as const

A decoder's input packet need not be writable, so we must not modify
the data.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
release/5.1
Andreas Rheinhardt 3 years ago
parent 1fc5d327e4
commit 88f9b1fc45
  1. 4
      libavcodec/dca_core.c
  2. 4
      libavcodec/dca_core.h
  3. 2
      libavcodec/dca_lbr.c
  4. 2
      libavcodec/dca_lbr.h
  5. 10
      libavcodec/dca_xll.c
  6. 2
      libavcodec/dca_xll.h
  7. 2
      libavcodec/dcadec.c

@ -1797,7 +1797,7 @@ static int parse_optional_info(DCACoreDecoder *s)
return 0;
}
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
int ff_dca_core_parse(DCACoreDecoder *s, const uint8_t *data, int size)
{
int ret;
@ -1830,7 +1830,7 @@ int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
return 0;
}
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
int ff_dca_core_parse_exss(DCACoreDecoder *s, const uint8_t *data, DCAExssAsset *asset)
{
AVCodecContext *avctx = s->avctx;
DCAContext *dca = avctx->priv_data;

@ -245,8 +245,8 @@ static inline void ff_dca_core_dequantize(int32_t *output, const int32_t *input,
}
}
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size);
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset);
int ff_dca_core_parse(DCACoreDecoder *s, const uint8_t *data, int size);
int ff_dca_core_parse_exss(DCACoreDecoder *s, const uint8_t *data, DCAExssAsset *asset);
int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth);
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame);
av_cold void ff_dca_core_flush(DCACoreDecoder *s);

@ -1156,7 +1156,7 @@ static int parse_decoder_init(DCALbrDecoder *s, GetByteContext *gb)
return 0;
}
int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset)
int ff_dca_lbr_parse(DCALbrDecoder *s, const uint8_t *data, DCAExssAsset *asset)
{
struct {
LBRChunk lfe;

@ -124,7 +124,7 @@ typedef struct DCALbrDecoder {
DCADSPContext *dcadsp;
} DCALbrDecoder;
int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset);
int ff_dca_lbr_parse(DCALbrDecoder *s, const uint8_t *data, DCAExssAsset *asset);
int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame);
av_cold void ff_dca_lbr_flush(DCALbrDecoder *s);
av_cold void ff_dca_lbr_init_tables(void);

@ -1040,7 +1040,7 @@ static int parse_band_data(DCAXllDecoder *s)
return 0;
}
static int parse_frame(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
static int parse_frame(DCAXllDecoder *s, const uint8_t *data, int size, DCAExssAsset *asset)
{
int ret;
@ -1067,7 +1067,7 @@ static void clear_pbr(DCAXllDecoder *s)
s->pbr_delay = 0;
}
static int copy_to_pbr(DCAXllDecoder *s, uint8_t *data, int size, int delay)
static int copy_to_pbr(DCAXllDecoder *s, const uint8_t *data, int size, int delay)
{
if (size > DCA_XLL_PBR_BUFFER_MAX)
return AVERROR(ENOSPC);
@ -1081,7 +1081,7 @@ static int copy_to_pbr(DCAXllDecoder *s, uint8_t *data, int size, int delay)
return 0;
}
static int parse_frame_no_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
static int parse_frame_no_pbr(DCAXllDecoder *s, const uint8_t *data, int size, DCAExssAsset *asset)
{
int ret = parse_frame(s, data, size, asset);
@ -1119,7 +1119,7 @@ static int parse_frame_no_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExss
return 0;
}
static int parse_frame_pbr(DCAXllDecoder *s, uint8_t *data, int size, DCAExssAsset *asset)
static int parse_frame_pbr(DCAXllDecoder *s, const uint8_t *data, int size, DCAExssAsset *asset)
{
int ret;
@ -1160,7 +1160,7 @@ fail:
return ret;
}
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset)
int ff_dca_xll_parse(DCAXllDecoder *s, const uint8_t *data, DCAExssAsset *asset)
{
int ret;

@ -139,7 +139,7 @@ typedef struct DCAXllDecoder {
int32_t *output_samples[DCA_SPEAKER_COUNT];
} DCAXllDecoder;
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset);
int ff_dca_xll_parse(DCAXllDecoder *s, const uint8_t *data, DCAExssAsset *asset);
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame);
av_cold void ff_dca_xll_flush(DCAXllDecoder *s);
av_cold void ff_dca_xll_close(DCAXllDecoder *s);

@ -151,7 +151,7 @@ static int dcadec_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame_ptr, AVPacket *avpkt)
{
DCAContext *s = avctx->priv_data;
uint8_t *input = avpkt->data;
const uint8_t *input = avpkt->data;
int input_size = avpkt->size;
int i, ret, prev_packet = s->packet;
uint32_t mrk;

Loading…
Cancel
Save