Unified · Split
| @@ -122,7 +122,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, · 121 unmodified lines | ||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (avctx->bits_per_coded_sample <= 8) { |
| 125 | − int size; | |
| 125 | + buffer_size_t size; | |
| 126 | 126 | const uint8_t *pal = av_packet_get_side_data(avpkt, |
| 127 | 127 | AV_PKT_DATA_PALETTE, |
| 128 | 128 | &size); |
| @@ -3437,11 +3437,11 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data, · 3436 unmodified lines | ||
| 3437 | 3437 | int buf_consumed; |
| 3438 | 3438 | int buf_offset; |
| 3439 | 3439 | int err; |
| 3440 | − int new_extradata_size; | |
| 3440 | + buffer_size_t new_extradata_size; | |
| 3441 | 3441 | const uint8_t *new_extradata = av_packet_get_side_data(avpkt, |
| 3442 | 3442 | AV_PKT_DATA_NEW_EXTRADATA, |
| 3443 | 3443 | &new_extradata_size); |
| 3444 | − int jp_dualmono_size; | |
| 3444 | + buffer_size_t jp_dualmono_size; | |
| 3445 | 3445 | const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt, |
| 3446 | 3446 | AV_PKT_DATA_JP_DUALMONO, |
| 3447 | 3447 | &jp_dualmono_size); |
| @@ -103,7 +103,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data, · 102 unmodified lines | ||
| 103 | 103 | const uint8_t *buf = avpkt->data; |
| 104 | 104 | const uint8_t *buf_end = buf + avpkt->size; |
| 105 | 105 | int num_blocks, ch, ret; |
| 106 | − int new_extradata_size; | |
| 106 | + buffer_size_t new_extradata_size; | |
| 107 | 107 | uint8_t *new_extradata; |
| 108 | 108 | |
| 109 | 109 | new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, |
| @@ -484,7 +484,7 @@ static int ffat_decode(AVCodecContext *avctx, void *data, · 483 unmodified lines | ||
| 484 | 484 | if (avctx->codec_id == AV_CODEC_ID_AAC) { |
| 485 | 485 | if (!at->extradata_size) { |
| 486 | 486 | uint8_t *side_data; |
| 487 | − int side_data_size; | |
| 487 | + buffer_size_t side_data_size; | |
| 488 | 488 | |
| 489 | 489 | side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, |
| 490 | 490 | &side_data_size); |
| @@ -593,7 +593,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 592 unmodified lines | ||
| 593 | 593 | dst->side_data_elems = 0; |
| 594 | 594 | for (i = 0; i < src->side_data_elems; i++) { |
| 595 | 595 | enum AVPacketSideDataType type = src->side_data[i].type; |
| 596 | − int size = src->side_data[i].size; | |
| 596 | + buffer_size_t size = src->side_data[i].size; | |
| 597 | 597 | uint8_t *src_data = src->side_data[i].data; |
| 598 | 598 | uint8_t *dst_data = av_packet_new_side_data(dst, type, size); |
| 599 | 599 | |
| @@ -800,7 +800,7 @@ void avpriv_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) · 200 unmodified lines | ||
| 800 | 800 | int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type) |
| 801 | 801 | { |
| 802 | 802 | uint8_t *side_data; |
| 803 | − int side_data_size; | |
| 803 | + buffer_size_t side_data_size; | |
| 804 | 804 | int i; |
| 805 | 805 | |
| 806 | 806 | 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) · 19 unmodified lines | ||
| 826 | 826 | { |
| 827 | 827 | AVProducerReferenceTime *prft; |
| 828 | 828 | uint8_t *side_data; |
| 829 | − int side_data_size; | |
| 829 | + buffer_size_t side_data_size; | |
| 830 | 830 | |
| 831 | 831 | side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size); |
| 832 | 832 | if (!side_data) { |
| @@ -24,7 +24,7 @@ static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt) · 23 unmodified lines | ||
| 24 | 24 | CBSBSFContext *ctx = bsf->priv_data; |
| 25 | 25 | CodedBitstreamFragment *frag = &ctx->fragment; |
| 26 | 26 | uint8_t *side_data; |
| 27 | − int side_data_size; | |
| 27 | + buffer_size_t side_data_size; | |
| 28 | 28 | int err; |
| 29 | 29 | |
| 30 | 30 | side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, |
| @@ -477,7 +477,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx, · 476 unmodified lines | ||
| 477 | 477 | return ret; |
| 478 | 478 | |
| 479 | 479 | if (s->palette_video) { |
| 480 | − int size; | |
| 480 | + buffer_size_t size; | |
| 481 | 481 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); |
| 482 | 482 | if (pal && size == AVPALETTE_SIZE) { |
| 483 | 483 | s->frame->palette_has_changed = 1; |
| @@ -66,7 +66,8 @@ typedef struct FramePool { · 65 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt) |
| 68 | 68 | { |
| 69 | − int size, ret; | |
| 69 | + int ret; | |
| 70 | + buffer_size_t size; | |
| 70 | 71 | const uint8_t *data; |
| 71 | 72 | uint32_t flags; |
| 72 | 73 | int64_t val; |
| @@ -349,7 +350,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, · 276 unmodified lines | ||
| 349 | 350 | got_frame = 0; |
| 350 | 351 | } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) { |
| 351 | 352 | uint8_t *side; |
| 352 | − int side_size; | |
| 353 | + buffer_size_t side_size; | |
| 353 | 354 | uint32_t discard_padding = 0; |
| 354 | 355 | uint8_t skip_reason = 0; |
| 355 | 356 | uint8_t discard_reason = 0; |
| @@ -1709,7 +1710,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags · 1353 unmodified lines | ||
| 1709 | 1710 | |
| 1710 | 1711 | static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame) |
| 1711 | 1712 | { |
| 1712 | − int size; | |
| 1713 | + buffer_size_t size; | |
| 1713 | 1714 | const uint8_t *side_metadata; |
| 1714 | 1715 | |
| 1715 | 1716 | AVDictionary **frame_md = &frame->metadata; |
| @@ -1755,7 +1756,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 39 unmodified lines | ||
| 1755 | 1756 | frame->pkt_size = pkt->size; |
| 1756 | 1757 | |
| 1757 | 1758 | for (i = 0; i < FF_ARRAY_ELEMS(sd); i++) { |
| 1758 | − int size; | |
| 1759 | + buffer_size_t size; | |
| 1759 | 1760 | uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size); |
| 1760 | 1761 | if (packet_sd) { |
| 1761 | 1762 | AVFrameSideData *frame_sd = av_frame_new_side_data(frame, |
| @@ -461,7 +461,8 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data, · 460 unmodified lines | ||
| 461 | 461 | GetByteContext *gb = &gdv->gb; |
| 462 | 462 | PutByteContext *pb = &gdv->pb; |
| 463 | 463 | AVFrame *frame = data; |
| 464 | − int ret, i, pal_size; | |
| 464 | + int ret, i; | |
| 465 | + buffer_size_t pal_size; | |
| 465 | 466 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); |
| 466 | 467 | int compression; |
| 467 | 468 | unsigned flags; |
| @@ -371,7 +371,7 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf, · 370 unmodified lines | ||
| 371 | 371 | H264RawSEIDisplayOrientation *disp = |
| 372 | 372 | &ctx->display_orientation_payload; |
| 373 | 373 | uint8_t *data; |
| 374 | − int size; | |
| 374 | + buffer_size_t size; | |
| 375 | 375 | int write = 0; |
| 376 | 376 | |
| 377 | 377 | data = av_packet_get_side_data(pkt, AV_PKT_DATA_DISPLAYMATRIX, &size); |
| @@ -975,7 +975,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, · 974 unmodified lines | ||
| 975 | 975 | return send_next_delayed_frame(h, pict, got_frame, 0); |
| 976 | 976 | |
| 977 | 977 | if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) { |
| 978 | − int side_size; | |
| 978 | + buffer_size_t side_size; | |
| 979 | 979 | uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); |
| 980 | 980 | ff_h264_decode_extradata(side, side_size, |
| 981 | 981 | &h->ps, &h->is_avc, &h->nal_length_size, |
| @@ -3303,7 +3303,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output, · 3302 unmodified lines | ||
| 3303 | 3303 | AVPacket *avpkt) |
| 3304 | 3304 | { |
| 3305 | 3305 | int ret; |
| 3306 | − int new_extradata_size; | |
| 3306 | + buffer_size_t new_extradata_size; | |
| 3307 | 3307 | uint8_t *new_extradata; |
| 3308 | 3308 | HEVCContext *s = avctx->priv_data; |
| 3309 | 3309 | |
| @@ -214,7 +214,7 @@ static int idcin_decode_frame(AVCodecContext *avctx, · 213 unmodified lines | ||
| 214 | 214 | const uint8_t *buf = avpkt->data; |
| 215 | 215 | int buf_size = avpkt->size; |
| 216 | 216 | IdcinContext *s = avctx->priv_data; |
| 217 | − int pal_size; | |
| 217 | + buffer_size_t pal_size; | |
| 218 | 218 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); |
| 219 | 219 | AVFrame *frame = data; |
| 220 | 220 | int ret; |
| @@ -49,7 +49,8 @@ static int imx_decode_frame(AVCodecContext *avctx, void *data, · 48 unmodified lines | ||
| 49 | 49 | int *got_frame, AVPacket *avpkt) |
| 50 | 50 | { |
| 51 | 51 | SimbiosisIMXContext *imx = avctx->priv_data; |
| 52 | − int ret, x, y, pal_size; | |
| 52 | + int ret, x, y; | |
| 53 | + buffer_size_t pal_size; | |
| 53 | 54 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); |
| 54 | 55 | AVFrame *frame = imx->frame; |
| 55 | 56 | GetByteContext gb; |
| @@ -1317,7 +1317,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, · 1316 unmodified lines | ||
| 1317 | 1317 | return ret; |
| 1318 | 1318 | |
| 1319 | 1319 | if (!s->is_16bpp) { |
| 1320 | − int size; | |
| 1320 | + buffer_size_t size; | |
| 1321 | 1321 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); |
| 1322 | 1322 | if (pal && size == AVPALETTE_SIZE) { |
| 1323 | 1323 | frame->palette_has_changed = 1; |
| @@ -268,7 +268,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame, · 267 unmodified lines | ||
| 268 | 268 | int i, ret; |
| 269 | 269 | int header; |
| 270 | 270 | int blocksize; |
| 271 | − int pal_size; | |
| 271 | + buffer_size_t pal_size; | |
| 272 | 272 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); |
| 273 | 273 | |
| 274 | 274 | bytestream2_init(&ctx->g, avpkt->data, avpkt->size); |
| @@ -221,7 +221,7 @@ static int vpx_decode(AVCodecContext *avctx, · 220 unmodified lines | ||
| 221 | 221 | struct vpx_image *img, *img_alpha; |
| 222 | 222 | int ret; |
| 223 | 223 | uint8_t *side_data = NULL; |
| 224 | − int side_data_size; | |
| 224 | + buffer_size_t side_data_size; | |
| 225 | 225 | |
| 226 | 226 | ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size); |
| 227 | 227 | if (ret) |
| @@ -152,7 +152,7 @@ static int decode_frame(AVCodecContext *avctx, · 151 unmodified lines | ||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { |
| 155 | − int size; | |
| 155 | + buffer_size_t size; | |
| 156 | 156 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); |
| 157 | 157 | |
| 158 | 158 | if (pal && size == AVPALETTE_SIZE) { |
| @@ -97,7 +97,7 @@ static int msrle_decode_frame(AVCodecContext *avctx, · 96 unmodified lines | ||
| 97 | 97 | return ret; |
| 98 | 98 | |
| 99 | 99 | if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { |
| 100 | − int size; | |
| 100 | + buffer_size_t size; | |
| 101 | 101 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); |
| 102 | 102 | |
| 103 | 103 | if (pal && size == AVPALETTE_SIZE) { |
| @@ -314,7 +314,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, · 313 unmodified lines | ||
| 314 | 314 | return ret; |
| 315 | 315 | |
| 316 | 316 | if (s->mode_8bit) { |
| 317 | − int size; | |
| 317 | + buffer_size_t size; | |
| 318 | 318 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); |
| 319 | 319 | |
| 320 | 320 | if (pal && size == AVPALETTE_SIZE) { |
| @@ -242,7 +242,7 @@ fail: · 241 unmodified lines | ||
| 242 | 242 | return ret; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | −static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, int size) | |
| 245 | +static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, buffer_size_t size) | |
| 246 | 246 | { |
| 247 | 247 | NVDECFramePool *pool = opaque; |
| 248 | 248 | AVBufferRef *ret; |
| @@ -283,7 +283,7 @@ static void nvdec_free_dummy(struct AVHWFramesContext *ctx) · 34 unmodified lines | ||
| 283 | 283 | av_buffer_pool_uninit(&ctx->pool); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | −static AVBufferRef *nvdec_alloc_dummy(int size) | |
| 286 | +static AVBufferRef *nvdec_alloc_dummy(buffer_size_t size) | |
| 287 | 287 | { |
| 288 | 288 | return av_buffer_create(NULL, 0, NULL, NULL, 0); |
| 289 | 289 | } |
| @@ -274,7 +274,7 @@ static int decode_frame(AVCodecContext *avctx, · 273 unmodified lines | ||
| 274 | 274 | AVFrame * const ref = a->ref; |
| 275 | 275 | uint8_t* outdata; |
| 276 | 276 | int delta, intra, ret; |
| 277 | − int pal_size; | |
| 277 | + buffer_size_t pal_size; | |
| 278 | 278 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); |
| 279 | 279 | |
| 280 | 280 | if (avpkt->size < 0x86) { |
| @@ -540,7 +540,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx, · 539 unmodified lines | ||
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | if(has_palette) { |
| 543 | − int size; | |
| 543 | + buffer_size_t size; | |
| 544 | 544 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); |
| 545 | 545 | |
| 546 | 546 | if (pal && size == AVPALETTE_SIZE) { |
| @@ -367,7 +367,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, · 366 unmodified lines | ||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { |
| 370 | − int pal_size; | |
| 370 | + buffer_size_t pal_size; | |
| 371 | 371 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, |
| 372 | 372 | &pal_size); |
| 373 | 373 | int ret; |
| @@ -346,7 +346,7 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data, · 345 unmodified lines | ||
| 346 | 346 | |
| 347 | 347 | /* Palette handling */ |
| 348 | 348 | if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { |
| 349 | − int size; | |
| 349 | + buffer_size_t size; | |
| 350 | 350 | const uint8_t *palette = av_packet_get_side_data(avpkt, |
| 351 | 351 | AV_PKT_DATA_PALETTE, |
| 352 | 352 | &size); |
| @@ -435,7 +435,7 @@ static int smc_decode_frame(AVCodecContext *avctx, · 434 unmodified lines | ||
| 435 | 435 | const uint8_t *buf = avpkt->data; |
| 436 | 436 | int buf_size = avpkt->size; |
| 437 | 437 | SmcContext *s = avctx->priv_data; |
| 438 | − int pal_size; | |
| 438 | + buffer_size_t pal_size; | |
| 439 | 439 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); |
| 440 | 440 | int ret; |
| 441 | 441 | int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4); |
| @@ -58,7 +58,8 @@ static int srt_decode_frame(AVCodecContext *avctx, · 57 unmodified lines | ||
| 58 | 58 | AVSubtitle *sub = data; |
| 59 | 59 | AVBPrint buffer; |
| 60 | 60 | int x1 = -1, y1 = -1, x2 = -1, y2 = -1; |
| 61 | − int size, ret; | |
| 61 | + int ret; | |
| 62 | + buffer_size_t size; | |
| 62 | 63 | const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size); |
| 63 | 64 | FFASSDecoderContext *s = avctx->priv_data; |
| 64 | 65 | |
| @@ -72,7 +72,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, · 71 unmodified lines | ||
| 72 | 72 | int palette_has_changed = 0; |
| 73 | 73 | |
| 74 | 74 | if (c->avctx->pix_fmt == AV_PIX_FMT_PAL8) { |
| 75 | − int size; | |
| 75 | + buffer_size_t size; | |
| 76 | 76 | const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); |
| 77 | 77 | |
| 78 | 78 | if (pal && size == AVPALETTE_SIZE) { |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | #include "libavutil/avassert.h" |
| 23 | 23 | #include "libavutil/common.h" |
| 24 | +#include "libavutil/internal.h" | |
| 24 | 25 | #include "libavutil/log.h" |
| 25 | 26 | #include "libavutil/pixdesc.h" |
| 26 | 27 | |
| @@ -2234,7 +2235,7 @@ static void vaapi_encode_free_output_buffer(void *opaque, · 2207 unmodified lines | ||
| 2234 | 2235 | } |
| 2235 | 2236 | |
| 2236 | 2237 | static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque, |
| 2237 | − int size) | |
| 2238 | + buffer_size_t size) | |
| 2238 | 2239 | { |
| 2239 | 2240 | AVCodecContext *avctx = opaque; |
| 2240 | 2241 | VAAPIEncodeContext *ctx = avctx->priv_data; |