1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec: use the buffer_size_t typedef where required

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2021-03-06 13:29:37 -03:00
parent 42e68fe015
commit d8a18c8fc2
29 changed files with 41 additions and 36 deletions

View File

@ -122,7 +122,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
if (avctx->bits_per_coded_sample <= 8) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt,
AV_PKT_DATA_PALETTE,
&size);

View File

@ -3437,11 +3437,11 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
int buf_consumed;
int buf_offset;
int err;
int new_extradata_size;
buffer_size_t new_extradata_size;
const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
AV_PKT_DATA_NEW_EXTRADATA,
&new_extradata_size);
int jp_dualmono_size;
buffer_size_t jp_dualmono_size;
const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,
AV_PKT_DATA_JP_DUALMONO,
&jp_dualmono_size);

View File

@ -103,7 +103,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = buf + avpkt->size;
int num_blocks, ch, ret;
int new_extradata_size;
buffer_size_t new_extradata_size;
uint8_t *new_extradata;
new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,

View File

@ -484,7 +484,7 @@ static int ffat_decode(AVCodecContext *avctx, void *data,
if (avctx->codec_id == AV_CODEC_ID_AAC) {
if (!at->extradata_size) {
uint8_t *side_data;
int side_data_size;
buffer_size_t side_data_size;
side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);

View File

@ -593,7 +593,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
dst->side_data_elems = 0;
for (i = 0; i < src->side_data_elems; i++) {
enum AVPacketSideDataType type = src->side_data[i].type;
int size = src->side_data[i].size;
buffer_size_t size = src->side_data[i].size;
uint8_t *src_data = src->side_data[i].data;
uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
@ -800,7 +800,7 @@ void avpriv_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
{
uint8_t *side_data;
int side_data_size;
buffer_size_t side_data_size;
int i;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size);
@ -826,7 +826,7 @@ int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
{
AVProducerReferenceTime *prft;
uint8_t *side_data;
int side_data_size;
buffer_size_t side_data_size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
if (!side_data) {

View File

@ -24,7 +24,7 @@ static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt)
CBSBSFContext *ctx = bsf->priv_data;
CodedBitstreamFragment *frag = &ctx->fragment;
uint8_t *side_data;
int side_data_size;
buffer_size_t side_data_size;
int err;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,

View File

@ -477,7 +477,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
return ret;
if (s->palette_video) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
s->frame->palette_has_changed = 1;

View File

@ -66,7 +66,8 @@ typedef struct FramePool {
static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
{
int size, ret;
int ret;
buffer_size_t size;
const uint8_t *data;
uint32_t flags;
int64_t val;
@ -349,7 +350,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame,
got_frame = 0;
} else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
uint8_t *side;
int side_size;
buffer_size_t side_size;
uint32_t discard_padding = 0;
uint8_t skip_reason = 0;
uint8_t discard_reason = 0;
@ -1709,7 +1710,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags
static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
{
int size;
buffer_size_t size;
const uint8_t *side_metadata;
AVDictionary **frame_md = &frame->metadata;
@ -1755,7 +1756,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
frame->pkt_size = pkt->size;
for (i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
int size;
buffer_size_t size;
uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
if (packet_sd) {
AVFrameSideData *frame_sd = av_frame_new_side_data(frame,

View File

@ -461,7 +461,8 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data,
GetByteContext *gb = &gdv->gb;
PutByteContext *pb = &gdv->pb;
AVFrame *frame = data;
int ret, i, pal_size;
int ret, i;
buffer_size_t pal_size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
int compression;
unsigned flags;

View File

@ -371,7 +371,7 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf,
H264RawSEIDisplayOrientation *disp =
&ctx->display_orientation_payload;
uint8_t *data;
int size;
buffer_size_t size;
int write = 0;
data = av_packet_get_side_data(pkt, AV_PKT_DATA_DISPLAYMATRIX, &size);

View File

@ -975,7 +975,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
return send_next_delayed_frame(h, pict, got_frame, 0);
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
int side_size;
buffer_size_t side_size;
uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
ff_h264_decode_extradata(side, side_size,
&h->ps, &h->is_avc, &h->nal_length_size,

View File

@ -3303,7 +3303,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
AVPacket *avpkt)
{
int ret;
int new_extradata_size;
buffer_size_t new_extradata_size;
uint8_t *new_extradata;
HEVCContext *s = avctx->priv_data;

View File

@ -214,7 +214,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
IdcinContext *s = avctx->priv_data;
int pal_size;
buffer_size_t pal_size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
AVFrame *frame = data;
int ret;

View File

@ -49,7 +49,8 @@ static int imx_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
SimbiosisIMXContext *imx = avctx->priv_data;
int ret, x, y, pal_size;
int ret, x, y;
buffer_size_t pal_size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
AVFrame *frame = imx->frame;
GetByteContext gb;

View File

@ -1317,7 +1317,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
return ret;
if (!s->is_16bpp) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
frame->palette_has_changed = 1;

View File

@ -268,7 +268,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame,
int i, ret;
int header;
int blocksize;
int pal_size;
buffer_size_t pal_size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
bytestream2_init(&ctx->g, avpkt->data, avpkt->size);

View File

@ -221,7 +221,7 @@ static int vpx_decode(AVCodecContext *avctx,
struct vpx_image *img, *img_alpha;
int ret;
uint8_t *side_data = NULL;
int side_data_size;
buffer_size_t side_data_size;
ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
if (ret)

View File

@ -152,7 +152,7 @@ static int decode_frame(AVCodecContext *avctx,
}
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {

View File

@ -97,7 +97,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
return ret;
if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {

View File

@ -314,7 +314,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
return ret;
if (s->mode_8bit) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {

View File

@ -242,7 +242,7 @@ fail:
return ret;
}
static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, int size)
static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, buffer_size_t size)
{
NVDECFramePool *pool = opaque;
AVBufferRef *ret;
@ -283,7 +283,7 @@ static void nvdec_free_dummy(struct AVHWFramesContext *ctx)
av_buffer_pool_uninit(&ctx->pool);
}
static AVBufferRef *nvdec_alloc_dummy(int size)
static AVBufferRef *nvdec_alloc_dummy(buffer_size_t size)
{
return av_buffer_create(NULL, 0, NULL, NULL, 0);
}

View File

@ -274,7 +274,7 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame * const ref = a->ref;
uint8_t* outdata;
int delta, intra, ret;
int pal_size;
buffer_size_t pal_size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
if (avpkt->size < 0x86) {

View File

@ -540,7 +540,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
}
if(has_palette) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {

View File

@ -367,7 +367,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
}
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
int pal_size;
buffer_size_t pal_size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE,
&pal_size);
int ret;

View File

@ -346,7 +346,7 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
/* Palette handling */
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
int size;
buffer_size_t size;
const uint8_t *palette = av_packet_get_side_data(avpkt,
AV_PKT_DATA_PALETTE,
&size);

View File

@ -435,7 +435,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
SmcContext *s = avctx->priv_data;
int pal_size;
buffer_size_t pal_size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
int ret;
int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);

View File

@ -58,7 +58,8 @@ static int srt_decode_frame(AVCodecContext *avctx,
AVSubtitle *sub = data;
AVBPrint buffer;
int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
int size, ret;
int ret;
buffer_size_t size;
const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);
FFASSDecoderContext *s = avctx->priv_data;

View File

@ -72,7 +72,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int palette_has_changed = 0;
if (c->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
int size;
buffer_size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {

View File

@ -21,6 +21,7 @@
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/pixdesc.h"
@ -2234,7 +2235,7 @@ static void vaapi_encode_free_output_buffer(void *opaque,
}
static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque,
int size)
buffer_size_t size)
{
AVCodecContext *avctx = opaque;
VAAPIEncodeContext *ctx = avctx->priv_data;