You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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:
@@ -3216,7 +3216,8 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int aac_decode_frame_int(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;
|
AACContext *ac = avctx->priv_data;
|
||||||
ChannelElement *che = NULL, *che_prev = NULL;
|
ChannelElement *che = NULL, *che_prev = NULL;
|
||||||
|
@@ -296,7 +296,8 @@ static int ffat_set_extradata(AVCodecContext *avctx)
|
|||||||
return 0;
|
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;
|
ATDecodeContext *at = avctx->priv_data;
|
||||||
OSStatus status;
|
OSStatus status;
|
||||||
|
@@ -33,12 +33,12 @@
|
|||||||
|
|
||||||
struct BitpackedContext {
|
struct BitpackedContext {
|
||||||
int (*decode)(AVCodecContext *avctx, AVFrame *frame,
|
int (*decode)(AVCodecContext *avctx, AVFrame *frame,
|
||||||
AVPacket *pkt);
|
const AVPacket *pkt);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* For this format, it's a simple passthrough */
|
/* For this format, it's a simple passthrough */
|
||||||
static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame,
|
static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame,
|
||||||
AVPacket *avpkt)
|
const AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int bitpacked_decode_yuv422p10(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 frame_size = (uint64_t)avctx->width * (uint64_t)avctx->height * 20;
|
||||||
uint64_t packet_size = (uint64_t)avpkt->size * 8;
|
uint64_t packet_size = (uint64_t)avpkt->size * 8;
|
||||||
|
@@ -66,7 +66,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
typedef struct ThreadData {
|
typedef struct ThreadData {
|
||||||
AVFrame *frame;
|
AVFrame *frame;
|
||||||
AVPacket *avpkt;
|
const AVPacket *avpkt;
|
||||||
} ThreadData;
|
} ThreadData;
|
||||||
|
|
||||||
static int dsd_channel(AVCodecContext *avctx, void *tdata, int j, int threadnr)
|
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;
|
DSDContext *s = avctx->priv_data;
|
||||||
ThreadData *td = tdata;
|
ThreadData *td = tdata;
|
||||||
AVFrame *frame = td->frame;
|
AVFrame *frame = td->frame;
|
||||||
AVPacket *avpkt = td->avpkt;
|
const AVPacket *avpkt = td->avpkt;
|
||||||
int src_next, src_stride;
|
int src_next, src_stride;
|
||||||
float *dst = ((float **)frame->extended_data)[j];
|
float *dst = ((float **)frame->extended_data)[j];
|
||||||
|
|
||||||
|
@@ -179,7 +179,7 @@ static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size)
|
|||||||
return 0;
|
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,
|
GetBitContext *gb, int block_size,
|
||||||
int width, int height, int x_pos, int y_pos,
|
int width, int height, int x_pos, int y_pos,
|
||||||
int blk_idx)
|
int blk_idx)
|
||||||
|
@@ -117,7 +117,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
size_t base_size;
|
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;
|
} Box;
|
||||||
|
|
||||||
static void mov_text_cleanup(MovTextContext *m)
|
static void mov_text_cleanup(MovTextContext *m)
|
||||||
@@ -240,14 +240,14 @@ static int mov_text_tx3g(AVCodecContext *avctx, MovTextContext *m)
|
|||||||
return 0;
|
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->box_flags |= TWRP_BOX;
|
||||||
m->w.wrap_flag = bytestream_get_byte(&tsmb);
|
m->w.wrap_flag = bytestream_get_byte(&tsmb);
|
||||||
return 0;
|
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->box_flags |= HLIT_BOX;
|
||||||
m->h.hlit_start = bytestream_get_be16(&tsmb);
|
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;
|
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;
|
m->box_flags |= HCLR_BOX;
|
||||||
bytestream_get_buffer(&tsmb, m->c.hlit_color, 4);
|
bytestream_get_buffer(&tsmb, m->c.hlit_color, 4);
|
||||||
return 0;
|
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 i;
|
||||||
int style_entries = bytestream_get_be16(&tsmb);
|
int style_entries = bytestream_get_be16(&tsmb);
|
||||||
|
@@ -95,7 +95,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define WRITE_FRAME(D, PIXEL, suffix) \
|
#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 width, int height, int sign, int depth) \
|
||||||
{ \
|
{ \
|
||||||
int i, j; \
|
int i, j; \
|
||||||
@@ -151,9 +151,9 @@ static int pgx_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
p->key_frame = 1;
|
p->key_frame = 1;
|
||||||
avctx->bits_per_raw_sample = depth;
|
avctx->bits_per_raw_sample = depth;
|
||||||
if (bpp == 8)
|
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)
|
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;
|
*got_frame = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -525,7 +525,7 @@ static void postprocess_chroma(AVFrame *frame, int w, int h, int depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int decode_plane(AVCodecContext *avctx, int plane,
|
static int decode_plane(AVCodecContext *avctx, int plane,
|
||||||
AVPacket *avpkt, AVFrame *frame)
|
const AVPacket *avpkt, AVFrame *frame)
|
||||||
{
|
{
|
||||||
PixletContext *ctx = avctx->priv_data;
|
PixletContext *ctx = avctx->priv_data;
|
||||||
ptrdiff_t stride = frame->linesize[plane] / 2;
|
ptrdiff_t stride = frame->linesize[plane] / 2;
|
||||||
|
@@ -1179,7 +1179,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int decode_frame_common(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);
|
const AVCRC *crc_tab = av_crc_get_table(AV_CRC_32_IEEE_LE);
|
||||||
AVDictionary **metadatap = NULL;
|
AVDictionary **metadatap = NULL;
|
||||||
|
@@ -112,7 +112,7 @@ static int init_frames(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int decode_fint(AVCodecContext *avctx,
|
static int decode_fint(AVCodecContext *avctx,
|
||||||
AVPacket *avpkt, unsigned size)
|
const AVPacket *avpkt, unsigned size)
|
||||||
{
|
{
|
||||||
RASCContext *s = avctx->priv_data;
|
RASCContext *s = avctx->priv_data;
|
||||||
GetByteContext *gb = &s->gb;
|
GetByteContext *gb = &s->gb;
|
||||||
@@ -171,7 +171,7 @@ static int decode_fint(AVCodecContext *avctx,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int decode_zlib(AVCodecContext *avctx, AVPacket *avpkt,
|
static int decode_zlib(AVCodecContext *avctx, const AVPacket *avpkt,
|
||||||
unsigned size, unsigned uncompressed_size)
|
unsigned size, unsigned uncompressed_size)
|
||||||
{
|
{
|
||||||
RASCContext *s = avctx->priv_data;
|
RASCContext *s = avctx->priv_data;
|
||||||
@@ -205,7 +205,7 @@ static int decode_zlib(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int decode_move(AVCodecContext *avctx,
|
static int decode_move(AVCodecContext *avctx,
|
||||||
AVPacket *avpkt, unsigned size)
|
const AVPacket *avpkt, unsigned size)
|
||||||
{
|
{
|
||||||
RASCContext *s = avctx->priv_data;
|
RASCContext *s = avctx->priv_data;
|
||||||
GetByteContext *gb = &s->gb;
|
GetByteContext *gb = &s->gb;
|
||||||
@@ -329,7 +329,7 @@ static int decode_move(AVCodecContext *avctx,
|
|||||||
len--;
|
len--;
|
||||||
|
|
||||||
static int decode_dlta(AVCodecContext *avctx,
|
static int decode_dlta(AVCodecContext *avctx,
|
||||||
AVPacket *avpkt, unsigned size)
|
const AVPacket *avpkt, unsigned size)
|
||||||
{
|
{
|
||||||
RASCContext *s = avctx->priv_data;
|
RASCContext *s = avctx->priv_data;
|
||||||
GetByteContext *gb = &s->gb;
|
GetByteContext *gb = &s->gb;
|
||||||
@@ -471,7 +471,7 @@ static int decode_dlta(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int decode_kfrm(AVCodecContext *avctx,
|
static int decode_kfrm(AVCodecContext *avctx,
|
||||||
AVPacket *avpkt, unsigned size)
|
const AVPacket *avpkt, unsigned size)
|
||||||
{
|
{
|
||||||
RASCContext *s = avctx->priv_data;
|
RASCContext *s = avctx->priv_data;
|
||||||
GetByteContext *gb = &s->gb;
|
GetByteContext *gb = &s->gb;
|
||||||
@@ -534,7 +534,7 @@ static int decode_kfrm(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int decode_mous(AVCodecContext *avctx,
|
static int decode_mous(AVCodecContext *avctx,
|
||||||
AVPacket *avpkt, unsigned size)
|
const AVPacket *avpkt, unsigned size)
|
||||||
{
|
{
|
||||||
RASCContext *s = avctx->priv_data;
|
RASCContext *s = avctx->priv_data;
|
||||||
GetByteContext *gb = &s->gb;
|
GetByteContext *gb = &s->gb;
|
||||||
@@ -574,7 +574,7 @@ static int decode_mous(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int decode_mpos(AVCodecContext *avctx,
|
static int decode_mpos(AVCodecContext *avctx,
|
||||||
AVPacket *avpkt, unsigned size)
|
const AVPacket *avpkt, unsigned size)
|
||||||
{
|
{
|
||||||
RASCContext *s = avctx->priv_data;
|
RASCContext *s = avctx->priv_data;
|
||||||
GetByteContext *gb = &s->gb;
|
GetByteContext *gb = &s->gb;
|
||||||
|
@@ -964,7 +964,8 @@ static int dng_decode_jpeg(AVCodecContext *avctx, AVFrame *frame,
|
|||||||
return 0;
|
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;
|
TiffContext *s = avctx->priv_data;
|
||||||
int tile_idx;
|
int tile_idx;
|
||||||
|
@@ -2622,7 +2622,7 @@ static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata,
|
|||||||
|
|
||||||
static av_always_inline
|
static av_always_inline
|
||||||
int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
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;
|
VP8Context *s = avctx->priv_data;
|
||||||
int ret, i, referenced, num_jobs;
|
int ret, i, referenced, num_jobs;
|
||||||
|
Reference in New Issue
Block a user