Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/dcadec: Treat the input packet's data as const
Date: Mon,  4 Jul 2022 13:02:41 +0200
Message-ID: <DB6PR0101MB2214F84E0F407C76DE4020B38FBE9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <DB6PR0101MB2214977FAAD46F339A77F2F58FBE9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com>

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

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dca_core.c |  4 ++--
 libavcodec/dca_core.h |  4 ++--
 libavcodec/dca_lbr.c  |  2 +-
 libavcodec/dca_lbr.h  |  2 +-
 libavcodec/dca_xll.c  | 10 +++++-----
 libavcodec/dca_xll.h  |  2 +-
 libavcodec/dcadec.c   |  2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c
index 34b5b63159..2b19807ef4 100644
--- a/libavcodec/dca_core.c
+++ b/libavcodec/dca_core.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;
diff --git a/libavcodec/dca_core.h b/libavcodec/dca_core.h
index cb8e38a94b..a01d642e77 100644
--- a/libavcodec/dca_core.h
+++ b/libavcodec/dca_core.h
@@ -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);
diff --git a/libavcodec/dca_lbr.c b/libavcodec/dca_lbr.c
index 06c10b96f5..2b8594cd75 100644
--- a/libavcodec/dca_lbr.c
+++ b/libavcodec/dca_lbr.c
@@ -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;
diff --git a/libavcodec/dca_lbr.h b/libavcodec/dca_lbr.h
index db7a676c31..9e1abec0b4 100644
--- a/libavcodec/dca_lbr.h
+++ b/libavcodec/dca_lbr.h
@@ -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);
diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
index aaccb7a43d..17626b3614 100644
--- a/libavcodec/dca_xll.c
+++ b/libavcodec/dca_xll.c
@@ -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;
 
diff --git a/libavcodec/dca_xll.h b/libavcodec/dca_xll.h
index d223133019..d7c1a13ec8 100644
--- a/libavcodec/dca_xll.h
+++ b/libavcodec/dca_xll.h
@@ -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);
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 38ea8733e4..498e0c86f3 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -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;
-- 
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".

  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 ` Andreas Rheinhardt [this message]
2022-07-04 11:02 ` [FFmpeg-devel] [PATCH 3/4] avcodec/decoders: Use const uint8_t* to access input packet data Andreas Rheinhardt
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=DB6PR0101MB2214F84E0F407C76DE4020B38FBE9@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