avformat/(mpeg|mpegts|mxf|sup)enc: Use const uint8_t* to access pkt data

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*.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-07-04 11:24:44 +02:00
parent dba7376d59
commit 1fc5d327e4
4 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;