From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 1/4] avformat/(mpeg|mpegts|mxf|sup)enc: Use const uint8_t* to access pkt data
Date: Mon, 4 Jul 2022 12:58:02 +0200
Message-ID: <DB6PR0101MB2214977FAAD46F339A77F2F58FBE9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)
The packets muxers receive are not guaranteed to be writable,
so they must not be modified. Ergo only access the packet's data
via a const uint8_t*.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/mpegenc.c | 2 +-
libavformat/mpegtsenc.c | 2 +-
libavformat/mxfenc.c | 4 ++--
libavformat/supenc.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 62692bfcd1..3ab4bd3f9b 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -1145,7 +1145,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
{
int stream_index = pkt->stream_index;
int size = pkt->size;
- uint8_t *buf = pkt->data;
+ const uint8_t *buf = pkt->data;
MpegMuxContext *s = ctx->priv_data;
AVStream *st = ctx->streams[stream_index];
StreamInfo *stream = st->priv_data;
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 18e8f7e45f..c964d58c8e 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1836,7 +1836,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st = s->streams[pkt->stream_index];
int size = pkt->size;
- uint8_t *buf = pkt->data;
+ const uint8_t *buf = pkt->data;
uint8_t *data = NULL;
MpegTSWrite *ts = s->priv_data;
MpegTSWriteStream *ts_st = st->priv_data;
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 7041659143..2d08dd6d40 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2806,8 +2806,8 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke
MXFContext *mxf = s->priv_data;
AVIOContext *pb = s->pb;
int frame_size = pkt->size / st->codecpar->block_align;
- uint8_t *samples = pkt->data;
- uint8_t *end = pkt->data + pkt->size;
+ const uint8_t *samples = pkt->data;
+ const uint8_t *const end = pkt->data + pkt->size;
int i;
klv_encode_ber4_length(pb, 4 + frame_size*4*8);
diff --git a/libavformat/supenc.c b/libavformat/supenc.c
index 1ca19fa161..c45d8a5321 100644
--- a/libavformat/supenc.c
+++ b/libavformat/supenc.c
@@ -27,7 +27,7 @@
static int sup_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- uint8_t *data = pkt->data;
+ const uint8_t *data = pkt->data;
size_t size = pkt->size;
uint32_t pts = 0, dts = 0;
--
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 reply other threads:[~2022-07-04 10:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 10:58 Andreas Rheinhardt [this message]
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 ` [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=DB6PR0101MB2214977FAAD46F339A77F2F58FBE9@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