avcodec/decoders: Use const uint8_t* to access input packet data
These packets need not be writable, so we must not modify them. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
88f9b1fc45
commit
930e560da3
@ -358,7 +358,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
AnsiContext *s = avctx->priv_data;
|
||||
uint8_t *buf = avpkt->data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
const uint8_t *buf_end = buf+buf_size;
|
||||
int ret, i, count;
|
||||
|
@ -359,7 +359,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic,
|
||||
int *got_picture_ptr, AVPacket *avpkt)
|
||||
{
|
||||
CLLCContext *ctx = avctx->priv_data;
|
||||
uint8_t *src = avpkt->data;
|
||||
const uint8_t *src = avpkt->data;
|
||||
uint32_t info_tag, info_offset;
|
||||
int data_size;
|
||||
GetBitContext gb;
|
||||
|
@ -2264,7 +2264,7 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_frame, AVPacket *pkt)
|
||||
{
|
||||
DiracContext *s = avctx->priv_data;
|
||||
uint8_t *buf = pkt->data;
|
||||
const uint8_t *buf = pkt->data;
|
||||
int buf_size = pkt->size;
|
||||
int i, buf_idx = 0;
|
||||
int ret;
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
typedef struct FICThreadContext {
|
||||
DECLARE_ALIGNED(16, int16_t, block)[64];
|
||||
uint8_t *src;
|
||||
const uint8_t *src;
|
||||
int slice_h;
|
||||
int src_size;
|
||||
int y_off;
|
||||
@ -174,7 +174,7 @@ static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
|
||||
FICContext *ctx = avctx->priv_data;
|
||||
FICThreadContext *tctx = tdata;
|
||||
GetBitContext gb;
|
||||
uint8_t *src = tctx->src;
|
||||
const uint8_t *src = tctx->src;
|
||||
int slice_h = tctx->slice_h;
|
||||
int src_size = tctx->src_size;
|
||||
int y_off = tctx->y_off;
|
||||
@ -271,14 +271,14 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
FICContext *ctx = avctx->priv_data;
|
||||
uint8_t *src = avpkt->data;
|
||||
const uint8_t *src = avpkt->data;
|
||||
int ret;
|
||||
int slice, nslices;
|
||||
int msize;
|
||||
int tsize;
|
||||
int cur_x, cur_y;
|
||||
int skip_cursor = ctx->skip_cursor;
|
||||
uint8_t *sdata;
|
||||
const uint8_t *sdata;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, ctx->frame, 0)) < 0)
|
||||
return ret;
|
||||
|
@ -404,7 +404,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
int *got_picture_ptr, AVPacket *avpkt)
|
||||
{
|
||||
HQXContext *ctx = avctx->priv_data;
|
||||
uint8_t *src = avpkt->data;
|
||||
const uint8_t *src = avpkt->data;
|
||||
uint32_t info_tag;
|
||||
int data_start;
|
||||
int i, ret;
|
||||
|
@ -70,7 +70,7 @@ typedef struct HQXContext {
|
||||
int format, dcb, width, height;
|
||||
int interlaced;
|
||||
|
||||
uint8_t *src;
|
||||
const uint8_t *src;
|
||||
unsigned int data_size;
|
||||
uint32_t slice_off[17];
|
||||
|
||||
|
@ -190,7 +190,7 @@ static int davs2_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
{
|
||||
DAVS2Context *cad = avctx->priv_data;
|
||||
int buf_size = avpkt->size;
|
||||
uint8_t *buf_ptr = avpkt->data;
|
||||
const uint8_t *buf_ptr = avpkt->data;
|
||||
int ret = DAVS2_DEFAULT;
|
||||
|
||||
/* end of stream, output what is still in the buffers */
|
||||
|
@ -321,7 +321,7 @@ static int libjxl_color_encoding_event(AVCodecContext *avctx, AVFrame *frame)
|
||||
static int libjxl_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
LibJxlDecodeContext *ctx = avctx->priv_data;
|
||||
uint8_t *buf = avpkt->data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
size_t remaining = avpkt->size;
|
||||
JxlDecoderStatus jret;
|
||||
int ret;
|
||||
|
@ -321,7 +321,7 @@ static av_cold int libopenjpeg_decode_init(AVCodecContext *avctx)
|
||||
static int libopenjpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
uint8_t *buf = avpkt->data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
LibOpenJPEGContext *ctx = avctx->priv_data;
|
||||
const AVPixFmtDescriptor *desc;
|
||||
|
@ -108,7 +108,7 @@ static int msrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
|
||||
int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
|
||||
uint8_t *ptr = s->frame->data[0];
|
||||
uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
|
||||
const uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
|
||||
int i, j;
|
||||
|
||||
if (linesize < 0)
|
||||
|
@ -92,7 +92,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
{
|
||||
MWSCContext *s = avctx->priv_data;
|
||||
z_stream *const zstream = &s->zstream.zstream;
|
||||
uint8_t *buf = avpkt->data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
GetByteContext gb;
|
||||
GetByteContext gbp;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
typedef struct ThreadData {
|
||||
AVFrame *frame;
|
||||
uint8_t *buf;
|
||||
const uint8_t *buf;
|
||||
int stride;
|
||||
} ThreadData;
|
||||
|
||||
@ -89,7 +89,7 @@ static int v410_decode_frame(AVCodecContext *avctx, AVFrame *pic,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
ThreadData td;
|
||||
uint8_t *src = avpkt->data;
|
||||
const uint8_t *src = avpkt->data;
|
||||
int ret;
|
||||
int thread_count = av_clip(avctx->thread_count, 1, avctx->height/4);
|
||||
|
||||
|
@ -39,7 +39,7 @@ static av_cold int y41p_decode_init(AVCodecContext *avctx)
|
||||
static int y41p_decode_frame(AVCodecContext *avctx, AVFrame *pic,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
uint8_t *src = avpkt->data;
|
||||
const uint8_t *src = avpkt->data;
|
||||
uint8_t *y, *u, *v;
|
||||
int i, j, ret;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user