From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/decoders: Use const uint8_t* to access input packet data Date: Mon, 4 Jul 2022 13:02:42 +0200 Message-ID: <DB6PR0101MB2214CD829DD5F1DD9301C2D08FBE9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw) In-Reply-To: <DB6PR0101MB2214977FAAD46F339A77F2F58FBE9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> These packets need not be writable, so we must not modify them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/ansi.c | 2 +- libavcodec/cllc.c | 2 +- libavcodec/diracdec.c | 2 +- libavcodec/fic.c | 8 ++++---- libavcodec/hqx.c | 2 +- libavcodec/hqx.h | 2 +- libavcodec/libdavs2.c | 2 +- libavcodec/libjxldec.c | 2 +- libavcodec/libopenjpegdec.c | 2 +- libavcodec/msrle.c | 2 +- libavcodec/mwsc.c | 2 +- libavcodec/v410dec.c | 4 ++-- libavcodec/y41pdec.c | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index 909ebe7396..ff4437cc61 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -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; diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c index f7283ca4f8..4866c5b2d4 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -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; diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 9f3c930913..50d1d2e1d3 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -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; diff --git a/libavcodec/fic.c b/libavcodec/fic.c index e56a1a323c..491f63ea0c 100644 --- a/libavcodec/fic.c +++ b/libavcodec/fic.c @@ -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; diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c index c41fe61387..596b8a7ed3 100644 --- a/libavcodec/hqx.c +++ b/libavcodec/hqx.c @@ -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; diff --git a/libavcodec/hqx.h b/libavcodec/hqx.h index 3eddaafb29..155ec7f84f 100644 --- a/libavcodec/hqx.h +++ b/libavcodec/hqx.h @@ -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]; diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c index c2040775ae..918e48502c 100644 --- a/libavcodec/libdavs2.c +++ b/libavcodec/libdavs2.c @@ -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 */ diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index d516d3b0ac..829478bbde 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -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; diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 58715b43ee..58ac6c413a 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -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; diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 041d0c9493..f9d7141c03 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -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) diff --git a/libavcodec/mwsc.c b/libavcodec/mwsc.c index d89fbde4e2..499b220a07 100644 --- a/libavcodec/mwsc.c +++ b/libavcodec/mwsc.c @@ -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; diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c index f6d675c508..e67cb820ba 100644 --- a/libavcodec/v410dec.c +++ b/libavcodec/v410dec.c @@ -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); diff --git a/libavcodec/y41pdec.c b/libavcodec/y41pdec.c index ca81dda0e8..4b1e64aff9 100644 --- a/libavcodec/y41pdec.c +++ b/libavcodec/y41pdec.c @@ -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; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-07-04 11:03 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-04 10:58 [FFmpeg-devel] [PATCH 1/4] avformat/(mpeg|mpegts|mxf|sup)enc: Use const uint8_t* to access pkt data Andreas Rheinhardt 2022-07-04 11:02 ` [FFmpeg-devel] [PATCH 2/4] avcodec/dcadec: Treat the input packet's data as const Andreas Rheinhardt 2022-07-04 11:02 ` Andreas Rheinhardt [this message] 2022-07-04 11:02 ` [FFmpeg-devel] [PATCH 4/4] avcodec/mscc: Don't modify input packet Andreas Rheinhardt 2022-07-04 11:15 ` [FFmpeg-devel] [PATCH 1/4] avformat/(mpeg|mpegts|mxf|sup)enc: Use const uint8_t* to access pkt data Paul B Mahol
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=DB6PR0101MB2214CD829DD5F1DD9301C2D08FBE9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git