avcodec: Constify some AVPackets

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2021-03-04 13:13:20 +01:00
parent 74b5564fb5
commit 74bffc00c5
12 changed files with 30 additions and 27 deletions

View File

@ -3216,7 +3216,8 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
}
static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
int *got_frame_ptr, GetBitContext *gb, AVPacket *avpkt)
int *got_frame_ptr, GetBitContext *gb,
const AVPacket *avpkt)
{
AACContext *ac = avctx->priv_data;
ChannelElement *che = NULL, *che_prev = NULL;

View File

@ -296,7 +296,8 @@ static int ffat_set_extradata(AVCodecContext *avctx)
return 0;
}
static av_cold int ffat_create_decoder(AVCodecContext *avctx, AVPacket *pkt)
static av_cold int ffat_create_decoder(AVCodecContext *avctx,
const AVPacket *pkt)
{
ATDecodeContext *at = avctx->priv_data;
OSStatus status;

View File

@ -33,12 +33,12 @@
struct BitpackedContext {
int (*decode)(AVCodecContext *avctx, AVFrame *frame,
AVPacket *pkt);
const AVPacket *pkt);
};
/* For this format, it's a simple passthrough */
static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame,
AVPacket *avpkt)
const AVPacket *avpkt)
{
int ret;
@ -56,7 +56,7 @@ static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame,
}
static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame,
AVPacket *avpkt)
const AVPacket *avpkt)
{
uint64_t frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20;
uint64_t packet_size = (uint64_t)avpkt->size * 8;

View File

@ -66,7 +66,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
typedef struct ThreadData {
AVFrame *frame;
AVPacket *avpkt;
const AVPacket *avpkt;
} ThreadData;
static int dsd_channel(AVCodecContext *avctx, void *tdata, int j, int threadnr)
@ -75,7 +75,7 @@ static int dsd_channel(AVCodecContext *avctx, void *tdata, int j, int threadnr)
DSDContext *s = avctx->priv_data;
ThreadData *td = tdata;
AVFrame *frame = td->frame;
AVPacket *avpkt = td->avpkt;
const AVPacket *avpkt = td->avpkt;
int src_next, src_stride;
float *dst = ((float **)frame->extended_data)[j];

View File

@ -179,7 +179,7 @@ static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size)
return 0;
}
static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
static int flashsv_decode_block(AVCodecContext *avctx, const AVPacket *avpkt,
GetBitContext *gb, int block_size,
int width, int height, int x_pos, int y_pos,
int blk_idx)

View File

@ -117,7 +117,7 @@ typedef struct {
typedef struct {
uint32_t type;
size_t base_size;
int (*decode)(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt);
int (*decode)(const uint8_t *tsmb, MovTextContext *m, const AVPacket *avpkt);
} Box;
static void mov_text_cleanup(MovTextContext *m)
@ -240,14 +240,14 @@ static int mov_text_tx3g(AVCodecContext *avctx, MovTextContext *m)
return 0;
}
static int decode_twrp(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
static int decode_twrp(const uint8_t *tsmb, MovTextContext *m, const AVPacket *avpkt)
{
m->box_flags |= TWRP_BOX;
m->w.wrap_flag = bytestream_get_byte(&tsmb);
return 0;
}
static int decode_hlit(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
static int decode_hlit(const uint8_t *tsmb, MovTextContext *m, const AVPacket *avpkt)
{
m->box_flags |= HLIT_BOX;
m->h.hlit_start = bytestream_get_be16(&tsmb);
@ -255,14 +255,14 @@ static int decode_hlit(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
return 0;
}
static int decode_hclr(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
static int decode_hclr(const uint8_t *tsmb, MovTextContext *m, const AVPacket *avpkt)
{
m->box_flags |= HCLR_BOX;
bytestream_get_buffer(&tsmb, m->c.hlit_color, 4);
return 0;
}
static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
static int decode_styl(const uint8_t *tsmb, MovTextContext *m, const AVPacket *avpkt)
{
int i;
int style_entries = bytestream_get_be16(&tsmb);

View File

@ -95,7 +95,7 @@ error:
}
#define WRITE_FRAME(D, PIXEL, suffix) \
static inline void write_frame_ ##D(AVPacket *avpkt, AVFrame *frame, GetByteContext *g, \
static inline void write_frame_ ##D(AVFrame *frame, GetByteContext *g, \
int width, int height, int sign, int depth) \
{ \
int i, j; \
@ -151,9 +151,9 @@ static int pgx_decode_frame(AVCodecContext *avctx, void *data,
p->key_frame = 1;
avctx->bits_per_raw_sample = depth;
if (bpp == 8)
write_frame_8(avpkt, p, &g, width, height, sign, depth);
write_frame_8(p, &g, width, height, sign, depth);
else if (bpp == 16)
write_frame_16(avpkt, p, &g, width, height, sign, depth);
write_frame_16(p, &g, width, height, sign, depth);
*got_frame = 1;
return 0;
}

View File

@ -525,7 +525,7 @@ static void postprocess_chroma(AVFrame *frame, int w, int h, int depth)
}
static int decode_plane(AVCodecContext *avctx, int plane,
AVPacket *avpkt, AVFrame *frame)
const AVPacket *avpkt, AVFrame *frame)
{
PixletContext *ctx = avctx->priv_data;
ptrdiff_t stride = frame->linesize[plane] / 2;

View File

@ -1179,7 +1179,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
}
static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
AVFrame *p, AVPacket *avpkt)
AVFrame *p, const AVPacket *avpkt)
{
const AVCRC *crc_tab = av_crc_get_table(AV_CRC_32_IEEE_LE);
AVDictionary **metadatap = NULL;

View File

@ -112,7 +112,7 @@ static int init_frames(AVCodecContext *avctx)
}
static int decode_fint(AVCodecContext *avctx,
AVPacket *avpkt, unsigned size)
const AVPacket *avpkt, unsigned size)
{
RASCContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;
@ -171,7 +171,7 @@ static int decode_fint(AVCodecContext *avctx,
return 0;
}
static int decode_zlib(AVCodecContext *avctx, AVPacket *avpkt,
static int decode_zlib(AVCodecContext *avctx, const AVPacket *avpkt,
unsigned size, unsigned uncompressed_size)
{
RASCContext *s = avctx->priv_data;
@ -205,7 +205,7 @@ static int decode_zlib(AVCodecContext *avctx, AVPacket *avpkt,
}
static int decode_move(AVCodecContext *avctx,
AVPacket *avpkt, unsigned size)
const AVPacket *avpkt, unsigned size)
{
RASCContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;
@ -329,7 +329,7 @@ static int decode_move(AVCodecContext *avctx,
len--;
static int decode_dlta(AVCodecContext *avctx,
AVPacket *avpkt, unsigned size)
const AVPacket *avpkt, unsigned size)
{
RASCContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;
@ -471,7 +471,7 @@ static int decode_dlta(AVCodecContext *avctx,
}
static int decode_kfrm(AVCodecContext *avctx,
AVPacket *avpkt, unsigned size)
const AVPacket *avpkt, unsigned size)
{
RASCContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;
@ -534,7 +534,7 @@ static int decode_kfrm(AVCodecContext *avctx,
}
static int decode_mous(AVCodecContext *avctx,
AVPacket *avpkt, unsigned size)
const AVPacket *avpkt, unsigned size)
{
RASCContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;
@ -574,7 +574,7 @@ static int decode_mous(AVCodecContext *avctx,
}
static int decode_mpos(AVCodecContext *avctx,
AVPacket *avpkt, unsigned size)
const AVPacket *avpkt, unsigned size)
{
RASCContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;

View File

@ -964,7 +964,8 @@ static int dng_decode_jpeg(AVCodecContext *avctx, AVFrame *frame,
return 0;
}
static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame, AVPacket *avpkt)
static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame,
const AVPacket *avpkt)
{
TiffContext *s = avctx->priv_data;
int tile_idx;

View File

@ -2622,7 +2622,7 @@ static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata,
static av_always_inline
int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt, int is_vp7)
const AVPacket *avpkt, int is_vp7)
{
VP8Context *s = avctx->priv_data;
int ret, i, referenced, num_jobs;