diff options
150 files changed, 273 insertions, 264 deletions
@@ -1732,7 +1732,7 @@ static int transcode_init(void) av_assert0(ist && !ost->filter); - extra_size = (uint64_t)dec_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE; + extra_size = (uint64_t)dec_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE; if (extra_size > INT_MAX) { return AVERROR(EINVAL); diff --git a/doc/examples/avcodec.c b/doc/examples/avcodec.c index 485911a67f..f801bed2d0 100644 --- a/doc/examples/avcodec.c +++ b/doc/examples/avcodec.c @@ -226,7 +226,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) AVCodecContext *c= NULL; int len; FILE *f, *outfile; - uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; AVPacket avpkt; AVFrame *decoded_frame = NULL; @@ -459,14 +459,14 @@ static void video_decode_example(const char *outfilename, const char *filename) int frame, got_picture, len; FILE *f; AVFrame *picture; - uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; char buf[1024]; AVPacket avpkt; av_init_packet(&avpkt); /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ - memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE); printf("Video decoding\n"); diff --git a/doc/examples/qsvdec.c b/doc/examples/qsvdec.c index 6dbb21031d..04e5b5f85d 100644 --- a/doc/examples/qsvdec.c +++ b/doc/examples/qsvdec.c @@ -405,7 +405,7 @@ int main(int argc, char **argv) decoder_ctx->codec_id = AV_CODEC_ID_H264; if (video_st->codec->extradata_size) { decoder_ctx->extradata = av_mallocz(video_st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!decoder_ctx->extradata) { ret = AVERROR(ENOMEM); goto finish; diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 4c0b4e3f98..b2d4db26b0 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -446,13 +446,13 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length) } av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, - bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE); + bitstream_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!f->bitstream_buffer) return AVERROR(ENOMEM); f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) (buf + extra), bitstream_size / 4); memset((uint8_t*)f->bitstream_buffer + bitstream_size, - 0, FF_INPUT_BUFFER_PADDING_SIZE); + 0, AV_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size); wordstream_offset = extra + bitstream_size; @@ -769,13 +769,13 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length) prestream_size = length + buf - prestream; av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, - prestream_size + FF_INPUT_BUFFER_PADDING_SIZE); + prestream_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!f->bitstream_buffer) return AVERROR(ENOMEM); f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) prestream, prestream_size / 4); memset((uint8_t*)f->bitstream_buffer + prestream_size, - 0, FF_INPUT_BUFFER_PADDING_SIZE); + 0, AV_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size); f->last_dc = 0 * 128 * 8 * 8; @@ -849,7 +849,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, cfrm = &f->cfrm[i]; cfrm->data = av_fast_realloc(cfrm->data, &cfrm->allocated_size, - cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE); + cfrm->size + data_size + AV_INPUT_BUFFER_PADDING_SIZE); // explicit check needed as memcpy below might not catch a NULL if (!cfrm->data) { av_log(f->avctx, AV_LOG_ERROR, "realloc failure"); diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index c5e50029c6..5d8d162348 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -209,7 +209,7 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx) } /* set up extradata */ - if (!(avctx->extradata = av_mallocz(8 * 4 + FF_INPUT_BUFFER_PADDING_SIZE))) { + if (!(avctx->extradata = av_mallocz(8 * 4 + AV_INPUT_BUFFER_PADDING_SIZE))) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate memory for extradata.\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c index bedaa4961b..d3cbeae9d0 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -88,7 +88,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, buf += get_bits_count(&gb)/8; } avctx->extradata_size = 2 + pce_size; - avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c index acb05d4de1..eae120a249 100644 --- a/libavcodec/aac_parser.c +++ b/libavcodec/aac_parser.c @@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, int size; union { uint64_t u64; - uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t u8[8 + AV_INPUT_BUFFER_PADDING_SIZE]; } tmp; tmp.u64 = av_be2ne64(state); diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 2528033f04..d7e0aa57f0 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2969,7 +2969,7 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data, if (new_extradata) { av_free(avctx->extradata); avctx->extradata = av_mallocz(new_extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); avctx->extradata_size = new_extradata_size; @@ -3089,14 +3089,14 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx, if (avctx->extradata_size < esize) { av_free(avctx->extradata); - avctx->extradata = av_malloc(esize + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_malloc(esize + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); } avctx->extradata_size = esize; memcpy(avctx->extradata, gb->buffer + (config_start_bit/8), esize); - memset(avctx->extradata+esize, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(avctx->extradata+esize, 0, AV_INPUT_BUFFER_PADDING_SIZE); } skip_bits_long(gb, bits_consumed); diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 815fb848e0..d2df65bb69 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -711,7 +711,7 @@ static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s) int ch; FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail); - FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail); + FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + AV_INPUT_BUFFER_PADDING_SIZE, alloc_fail); for(ch = 0; ch < s->channels; ch++) s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch; diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 69d88c1a76..970484810b 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -150,7 +150,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, int err; union { uint64_t u64; - uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t u8[8 + AV_INPUT_BUFFER_PADDING_SIZE]; } tmp = { av_be2ne64(state) }; AC3HeaderInfo hdr; GetBitContext gbc; diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index babd0a7d70..e4d443c9a8 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -217,7 +217,7 @@ typedef struct AC3DecodeContext { DECLARE_ALIGNED(32, float, window)[AC3_BLOCK_SIZE]; ///< window coefficients DECLARE_ALIGNED(32, float, tmp_output)[AC3_BLOCK_SIZE]; ///< temporary storage for output before windowing DECLARE_ALIGNED(32, float, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]; ///< output after imdct transform and windowing - DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread + DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread ///@} } AC3DecodeContext; diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 341dda475a..65e1f8e636 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -111,7 +111,7 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx) avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; avctx->block_align = BLKSIZE; - if (!(avctx->extradata = av_malloc(32 + FF_INPUT_BUFFER_PADDING_SIZE))) + if (!(avctx->extradata = av_malloc(32 + AV_INPUT_BUFFER_PADDING_SIZE))) goto error; avctx->extradata_size = 32; extradata = avctx->extradata; diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index e6e0475fb8..8a94f81bb4 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -519,7 +519,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx) avctx->channels, avctx->bits_per_raw_sample); - avctx->extradata = av_mallocz(ALAC_EXTRADATA_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(ALAC_EXTRADATA_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { ret = AVERROR(ENOMEM); goto error; diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c index a96521258e..ac7c317fa1 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -223,7 +223,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (!pkt->data && (ret = av_new_packet(pkt, a->mb_height * a->mb_width * MAX_MB_SIZE + - FF_MIN_BUFFER_SIZE)) < 0) { + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index c4201fb418..2e1fd3c133 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -879,7 +879,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) return AVERROR(EINVAL); q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 362a39752d..8e5a22883d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -535,15 +535,24 @@ typedef struct AVCodecDescriptor { * Note: If the first 23 bits of the additional bytes are not 0, then damaged * MPEG bitstreams could cause overread and segfault. */ -#define FF_INPUT_BUFFER_PADDING_SIZE 8 +#define AV_INPUT_BUFFER_PADDING_SIZE 8 /** * @ingroup lavc_encoding * minimum encoding buffer size * Used to avoid some checks during header writing. */ -#define FF_MIN_BUFFER_SIZE 16384 +#define AV_INPUT_BUFFER_MIN_SIZE 16384 +/** + * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 8 + +/** + * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead + */ +#define FF_MIN_BUFFER_SIZE 16384 /** * @ingroup lavc_encoding @@ -1362,7 +1371,7 @@ typedef struct AVCodecContext { * mjpeg: Huffman tables * rv10: additional flags * mpeg4: global headers (they can be in the bitstream or here) - * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger * than extradata_size to avoid prolems if it is read with the bitstream reader. * The bytewise contents of extradata must not depend on the architecture or CPU endianness. * - encoding: Set/allocated/freed by libavcodec. @@ -3627,7 +3636,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by); * function returns successfully, the data is owned by the underlying AVBuffer. * The caller may not access the data through other means. * @param size size of data in bytes, without the padding. I.e. the full buffer - * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE. * * @return 0 on success, a negative AVERROR on error */ @@ -3843,7 +3852,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, * returning samples. It is safe to flush even those decoders that are not * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. * - * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE * larger than the actual read bytes because some optimized bitstream * readers read 32 or 64 bits at once and could read over the end. * @@ -3883,7 +3892,7 @@ int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, * Some decoders may support multiple frames in a single AVPacket, such * decoders would then just decode the first frame. * - * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * @@ -4612,7 +4621,7 @@ AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); * Allocate a buffer with padding, reusing the given one if large enough. * * Same behaviour av_fast_malloc but the buffer has additional - * FF_INPUT_PADDING_SIZE at the end which will always memset to 0. + * AV_INPUT_PADDING_SIZE at the end which will always memset to 0. * */ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 557258d839..bad379f2e8 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -66,14 +66,14 @@ FF_ENABLE_DEPRECATION_WARNINGS static int packet_alloc(AVBufferRef **buf, int size) { int ret; - if ((unsigned)size >= (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) + if ((unsigned)size >= (unsigned)size + AV_INPUT_BUFFER_PADDING_SIZE) return AVERROR(EINVAL); - ret = av_buffer_realloc(buf, size + FF_INPUT_BUFFER_PADDING_SIZE); + ret = av_buffer_realloc(buf, size + AV_INPUT_BUFFER_PADDING_SIZE); if (ret < 0) return ret; - memset((*buf)->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset((*buf)->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); return 0; } @@ -103,20 +103,20 @@ void av_shrink_packet(AVPacket *pkt, int size) if (pkt->size <= size) return; pkt->size = size; - memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(pkt->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } int av_grow_packet(AVPacket *pkt, int grow_by) { int new_size; - av_assert0((unsigned)pkt->size <= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE); + av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); if (!pkt->size) return av_new_packet(pkt, grow_by); if ((unsigned)grow_by > - INT_MAX - (pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)) + INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE)) return -1; - new_size = pkt->size + grow_by + FF_INPUT_BUFFER_PADDING_SIZE; + new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE; if (pkt->buf) { int ret = av_buffer_realloc(&pkt->buf, new_size); if (ret < 0) @@ -134,17 +134,17 @@ FF_ENABLE_DEPRECATION_WARNINGS } pkt->data = pkt->buf->data; pkt->size += grow_by; - memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); return 0; } int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size) { - if (size >= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) + if (size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return AVERROR(EINVAL); - pkt->buf = av_buffer_create(data, size + FF_INPUT_BUFFER_PADDING_SIZE, + pkt->buf = av_buffer_create(data, size + AV_INPUT_BUFFER_PADDING_SIZE, av_buffer_default_free, NULL, 0); if (!pkt->buf) return AVERROR(ENOMEM); @@ -172,9 +172,9 @@ do { \ void *data; \ if (padding) { \ if ((unsigned)(size) > \ - (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \ + (unsigned)(size) + AV_INPUT_BUFFER_PADDING_SIZE) \ goto failed_alloc; \ - ALLOC(data, size + FF_INPUT_BUFFER_PADDING_SIZE); \ + ALLOC(data, size + AV_INPUT_BUFFER_PADDING_SIZE); \ } else { \ ALLOC(data, size); \ } \ @@ -183,7 +183,7 @@ do { \ memcpy(data, src, size); \ if (padding) \ memset((uint8_t *)data + size, 0, \ - FF_INPUT_BUFFER_PADDING_SIZE); \ + AV_INPUT_BUFFER_PADDING_SIZE); \ dst = data; \ } while (0) @@ -266,7 +266,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) return NULL; - if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) + if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return NULL; pkt->side_data = av_realloc(pkt->side_data, @@ -274,7 +274,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, if (!pkt->side_data) return NULL; - pkt->side_data[elems].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + pkt->side_data[elems].data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!pkt->side_data[elems].data) return NULL; pkt->side_data[elems].size = size; diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index c709ab03e7..71ad344bbf 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -302,7 +302,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } - buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); + buf = av_realloc(s->packet_buffer, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE); if (!buf) return AVERROR(ENOMEM); s->packet_buffer = buf; diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c index 0b4aa29ce4..99e96eb502 100644 --- a/libavcodec/cdxl.c +++ b/libavcodec/cdxl.c @@ -263,7 +263,7 @@ static int cdxl_decode_frame(AVCodecContext *avctx, void *data, if (encoding) { av_fast_padded_malloc(&c->new_video, &c->new_video_size, - h * w + FF_INPUT_BUFFER_PADDING_SIZE); + h * w + AV_INPUT_BUFFER_PADDING_SIZE); if (!c->new_video) return AVERROR(ENOMEM); if (c->bpp == 8) diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 2bc0abfce3..ddce57f6d3 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1213,11 +1213,11 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) /* Pad the databuffer with: DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(), - FF_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */ + AV_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */ q->decoded_bytes_buffer = av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) - + FF_INPUT_BUFFER_PADDING_SIZE); + + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index d827daac37..c33cc9acaa 100644 --- a/libavcodec/dca_parser.c +++ b/libavcodec/dca_parser.c @@ -113,7 +113,7 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, int *sample_rate, int *framesize) { GetBitContext gb; - uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 }; + uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 }; int ret, sample_blocks, sr_code; if (buf_size < 12) diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c index 16b738b7a9..20b05287a7 100644 --- a/libavcodec/dss_sp.c +++ b/libavcodec/dss_sp.c @@ -65,7 +65,7 @@ typedef struct DssSpContext { int pulse_dec_mode; DECLARE_ALIGNED(16, uint8_t, bits)[DSS_SP_FRAME_SIZE + - FF_INPUT_BUFFER_PADDING_SIZE]; + AV_INPUT_BUFFER_PADDING_SIZE]; } DssSpContext; /* diff --git a/libavcodec/dump_extradata_bsf.c b/libavcodec/dump_extradata_bsf.c index 62773e9e8d..3f54899794 100644 --- a/libavcodec/dump_extradata_bsf.c +++ b/libavcodec/dump_extradata_bsf.c @@ -36,12 +36,12 @@ static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){ int size= buf_size + avctx->extradata_size; *poutbuf_size= size; - *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf= av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!*poutbuf) return AVERROR(ENOMEM); memcpy(*poutbuf, avctx->extradata, avctx->extradata_size); - memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE); return 1; } } diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index daa8d19ebe..9ee9933cdc 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -167,8 +167,8 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) GetBitContext gb; BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1; LOCAL_ALIGNED_16(int16_t, sblock, [5 * DV_MAX_BPM], [64]); - LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ - LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [80 * 5 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ + LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + AV_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ + LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [80 * 5 + AV_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ const int log2_blocksize = 3; int is_field_mode[5]; diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 08e59de763..32b3711e16 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -940,7 +940,7 @@ static int ffv1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height * ((8 * 2 + 1 + 1) * 4) / 8 + - FF_MIN_BUFFER_SIZE)) < 0) { + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 21d7bb4da6..85f53e2bbe 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -294,10 +294,10 @@ static int jpg_decode_data(JPGContext *c, int width, int height, const int ridx = swapuv ? 2 : 0; if ((ret = av_reallocp(&c->buf, - src_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) + src_size + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) return ret; jpg_unescape(src, src_size, c->buf, &unesc_size); - memset(c->buf + unesc_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(c->buf + unesc_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&gb, c->buf, unesc_size * 8); width = FFALIGN(width, 16); @@ -1170,7 +1170,7 @@ static int g2m_init_buffers(G2MContext *c) c->synth_tile = av_mallocz(c->tile_stride * aligned_height); c->jpeg_tile = av_mallocz(c->tile_stride * aligned_height); c->kempf_buf = av_mallocz((c->tile_width + 1) * aligned_height + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); c->kempf_flags = av_mallocz(c->tile_width * aligned_height); if (!c->synth_tile || !c->jpeg_tile || !c->kempf_buf || !c->kempf_flags) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index ec4065370e..ea7e0c4509 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -367,7 +367,7 @@ static inline int check_marker(GetBitContext *s, const char *msg) /** * Initialize GetBitContext. - * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes + * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes * larger than the actual read bits because some optimized bitstream * readers read 32 or 64 bit at once and could read over the end * @param bit_size the size of the buffer in bits @@ -400,7 +400,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, /** * Initialize GetBitContext. - * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes + * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes * larger than the actual read bits because some optimized bitstream * readers read 32 or 64 bit at once and could read over the end * @param byte_size the size of the buffer in bytes diff --git a/libavcodec/gif.c b/libavcodec/gif.c index a8c7f37d7f..451e335991 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -153,7 +153,7 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *outbuf_ptr, *end; int ret; - if ((ret = ff_alloc_packet(pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet(pkt, avctx->width*avctx->height*7/5 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 6693d47b7d..eb4edb9f9e 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -275,7 +275,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, H264SliceContext *sl, } av_fast_malloc(&sl->rbsp_buffer, &sl->rbsp_buffer_size, - length + FF_INPUT_BUFFER_PADDING_SIZE); + length + AV_INPUT_BUFFER_PADDING_SIZE); dst = sl->rbsp_buffer; if (!dst) @@ -304,7 +304,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, H264SliceContext *sl, dst[di++] = src[si++]; nsc: - memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE); *dst_length = di; *consumed = si + 1; // +1 for the header diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index 3b212e5a55..eeb250f595 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -41,7 +41,7 @@ static int alloc_and_copy(uint8_t **poutbuf, int *poutbuf_size, *poutbuf_size += sps_pps_size + in_size + nal_header_size; if ((err = av_reallocp(poutbuf, - *poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { + *poutbuf_size + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { *poutbuf_size = 0; return err; } @@ -109,7 +109,7 @@ static int h264_extradata_to_annexb(AVCodecContext *avctx, const int padding) } if (out) - memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(out + total_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); if (!sps_seen) av_log(avctx, AV_LOG_WARNING, @@ -150,7 +150,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, /* retrieve sps and pps NAL units from extradata */ if (!ctx->extradata_parsed) { - ret = h264_extradata_to_annexb(avctx, FF_INPUT_BUFFER_PADDING_SIZE); + ret = h264_extradata_to_annexb(avctx, AV_INPUT_BUFFER_PADDING_SIZE); if (ret < 0) return ret; ctx->length_size = ret; diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c index 449c8a3287..dfecf5e99f 100644 --- a/libavcodec/hevc_mp4toannexb_bsf.c +++ b/libavcodec/hevc_mp4toannexb_bsf.c @@ -67,18 +67,18 @@ static int hevc_extradata_to_annexb(AVCodecContext *avctx) for (j = 0; j < cnt; j++) { int nalu_len = bytestream2_get_be16(&gb); - if (4 + FF_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) { + if (4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) { ret = AVERROR_INVALIDDATA; goto fail; } - ret = av_reallocp(&new_extradata, new_extradata_size + nalu_len + 4 + FF_INPUT_BUFFER_PADDING_SIZE); + ret = av_reallocp(&new_extradata, new_extradata_size + nalu_len + 4 + AV_INPUT_BUFFER_PADDING_SIZE); if (ret < 0) goto fail; AV_WB32(new_extradata + new_extradata_size, 1); // add the startcode bytestream2_get_buffer(&gb, new_extradata + new_extradata_size + 4, nalu_len); new_extradata_size += 4 + nalu_len; - memset(new_extradata + new_extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(new_extradata + new_extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } } diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c index 93c8175702..de00245809 100644 --- a/libavcodec/hevc_parse.c +++ b/libavcodec/hevc_parse.c @@ -89,7 +89,7 @@ int ff_hevc_extract_rbsp(const uint8_t *src, int length, } av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size, - length + FF_INPUT_BUFFER_PADDING_SIZE); + length + AV_INPUT_BUFFER_PADDING_SIZE); if (!nal->rbsp_buffer) return AVERROR(ENOMEM); @@ -119,7 +119,7 @@ int ff_hevc_extract_rbsp(const uint8_t *src, int length, dst[di++] = src[si++]; nsc: - memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE); nal->data = dst; nal->size = di; diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 3e73ed4d86..12eca26cff 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -35,14 +35,14 @@ #include "thread.h" #define classic_shift_luma_table_size 42 -static const unsigned char classic_shift_luma[classic_shift_luma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = { +static const unsigned char classic_shift_luma[classic_shift_luma_table_size + AV_INPUT_BUFFER_PADDING_SIZE] = { 34, 36, 35, 69, 135, 232, 9, 16, 10, 24, 11, 23, 12, 16, 13, 10, 14, 8, 15, 8, 16, 8, 17, 20, 16, 10, 207, 206, 205, 236, 11, 8, 10, 21, 9, 23, 8, 8, 199, 70, 69, 68, 0 }; #define classic_shift_chroma_table_size 59 -static const unsigned char classic_shift_chroma[classic_shift_chroma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = { +static const unsigned char classic_shift_chroma[classic_shift_chroma_table_size + AV_INPUT_BUFFER_PADDING_SIZE] = { 66, 36, 37, 38, 39, 40, 41, 75, 76, 77, 110, 239, 144, 81, 82, 83, 84, 85, 118, 183, 56, 57, 88, 89, 56, 89, 154, 57, 58, 57, 26, 141, 57, 56, 58, 57, 58, 57, 184, 119, 214, 245, 116, 83, 82, 49, 80, 79, @@ -511,11 +511,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, av_fast_malloc(&s->bitstream_buffer, &s->bitstream_buffer_size, - buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->bitstream_buffer) return AVERROR(ENOMEM); - memset(s->bitstream_buffer + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(s->bitstream_buffer + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); s->bdsp.bswap_buf((uint32_t *) s->bitstream_buffer, (const uint32_t *) buf, buf_size / 4); diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 68beb018fa..c18b38c4c1 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -453,7 +453,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int i, j, size = 0, ret; if (!pkt->data && - (ret = av_new_packet(pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE)) < 0) { + (ret = av_new_packet(pkt, width * height * 3 * 4 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error allocating output packet.\n"); return ret; } diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 6d9ac93971..0d56cd5837 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -172,7 +172,7 @@ static av_cold int decode_init(AVCodecContext *avctx) if ((err = av_image_check_size(avctx->width, avctx->height, 0, avctx))) return err; s->planesize = FFALIGN(avctx->width, 16) >> 3; // Align plane size in bits to word-boundary - s->planebuf = av_malloc(s->planesize + FF_INPUT_BUFFER_PADDING_SIZE); + s->planebuf = av_malloc(s->planesize + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->planebuf) return AVERROR(ENOMEM); diff --git a/libavcodec/imc.c b/libavcodec/imc.c index d2c96da166..498fdd578e 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -997,7 +997,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, IMCContext *q = avctx->priv_data; - LOCAL_ALIGNED_16(uint16_t, buf16, [(IMC_BLOCK_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) / 2]); + LOCAL_ALIGNED_16(uint16_t, buf16, [(IMC_BLOCK_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / 2]); if (buf_size < IMC_BLOCK_SIZE * avctx->channels) { av_log(avctx, AV_LOG_ERROR, "frame too small!\n"); diff --git a/libavcodec/imx_dump_header_bsf.c b/libavcodec/imx_dump_header_bsf.c index 5c647c4d68..a79039da33 100644 --- a/libavcodec/imx_dump_header_bsf.c +++ b/libavcodec/imx_dump_header_bsf.c @@ -42,7 +42,7 @@ static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx return 0; } - *poutbuf = av_malloc(buf_size + 20 + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf = av_malloc(buf_size + 20 + AV_INPUT_BUFFER_PADDING_SIZE); if (!*poutbuf) return AVERROR(ENOMEM); poutbufp = *poutbuf; diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 6edf587ce1..fc906322f8 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -157,7 +157,7 @@ int avpriv_unlock_avformat(void); * This value was chosen such that every bit of the buffer is * addressable by a 32-bit signed integer as used by get_bits. */ -#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE) +#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE) /** * Check AVPacket size and/or allocate data. diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c index 47c420fc50..7fb4bde238 100644 --- a/libavcodec/jpeglsenc.c +++ b/libavcodec/jpeglsenc.c @@ -268,7 +268,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt, comps = 3; if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height * comps * 4 + - FF_MIN_BUFFER_SIZE)) < 0) { + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index 9d983e8fbb..b88f80763b 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -54,7 +54,7 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data, } mrk = AV_RB32(input); if (mrk != DCA_SYNCWORD_CORE_BE && mrk != DCA_SYNCWORD_SUBSTREAM) { - s->buffer = av_fast_realloc(s->buffer, &s->buffer_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); + s->buffer = av_fast_realloc(s->buffer, &s->buffer_size, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->buffer) return AVERROR(ENOMEM); diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index 2d8564f89a..5cdbe27686 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -139,7 +139,7 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx) if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer, &decoder_specific_info_size)) { - avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_malloc(decoder_specific_info_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { ret = AVERROR(ENOMEM); goto error; diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index 2413c71f2c..2cea58f152 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -292,7 +292,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { avctx->extradata_size = info.confSize; avctx->extradata = av_mallocz(avctx->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { ret = AVERROR(ENOMEM); goto error; diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 9ac33e2ba1..fb153c4d58 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -143,7 +143,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) (*s->encoder)->EncodeParameterSets(s->encoder, &fbi); for (i = 0; i < fbi.sLayerInfo[0].iNalCount; i++) size += fbi.sLayerInfo[0].pNalLengthInByte[i]; - avctx->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { err = AVERROR(ENOMEM); goto fail; diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index ec4e513bc6..08f0f28ac8 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -262,7 +262,7 @@ static int av_cold libopus_encode_init(AVCodecContext *avctx) } header_size = 19 + (avctx->channels > 2 ? 2 + avctx->channels : 0); - avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_malloc(header_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate extradata.\n"); ret = AVERROR(ENOMEM); diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c index 86b1ac793c..88e5d2fea4 100644 --- a/libavcodec/libspeexenc.c +++ b/libavcodec/libspeexenc.c @@ -244,7 +244,7 @@ static av_cold int encode_init(AVCodecContext *avctx) header_data = speex_header_to_packet(&s->header, &header_size); /* allocate extradata */ - avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_malloc(header_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { speex_header_free(header_data); speex_encoder_destroy(s->enc_state); diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 25d7718314..876ef4c197 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -105,7 +105,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { avctx->extradata_size = 2; avctx->extradata = av_mallocz(avctx->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { ret = AVERROR(ENOMEM); goto error; diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c index 3f1e648e97..86c1ed6a75 100644 --- a/libavcodec/libvorbis.c +++ b/libavcodec/libvorbis.c @@ -206,7 +206,7 @@ static av_cold int libvorbis_encode_init(AVCodecContext *avctx) xiph_len(header_comm.bytes) + header_code.bytes; p = avctx->extradata = av_malloc(avctx->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!p) { ret = AVERROR(ENOMEM); goto error; diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 91bd83fcdc..11ffccf986 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -225,7 +225,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - avctx->extradata = av_malloc(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate HEVC header of size %d.\n", avctx->extradata_size); diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index c9cb34f6c0..f0f5dfdcd3 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -81,7 +81,7 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt, { XavsContext *x4 = ctx->priv_data; uint8_t *p; - int i, s, ret, size = x4->sei_size + FF_MIN_BUFFER_SIZE; + int i, s, ret, size = x4->sei_size + AV_INPUT_BUFFER_MIN_SIZE; if (!nnal) return 0; diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index 02f1af8475..750f891a38 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -688,7 +688,7 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, xvid_enc_stats_t xvid_enc_stats = { 0 }; if (!user_packet && - (ret = av_new_packet(pkt, mb_width * mb_height * MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) { + (ret = av_new_packet(pkt, mb_width * mb_height * MAX_MB_BYTES + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index d57d0331c8..4e02e3c906 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -211,7 +211,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const int height = avctx->height; const int mb_width = (width + s->hsample[0] - 1) / s->hsample[0]; const int mb_height = (height + s->vsample[0] - 1) / s->vsample[0]; - int max_pkt_size = FF_MIN_BUFFER_SIZE; + int max_pkt_size = AV_INPUT_BUFFER_MIN_SIZE; int ret, header_bits; if (avctx->pix_fmt == AV_PIX_FMT_BGR24) diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index ddb9ddbbc3..83b83d02ad 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -181,7 +181,7 @@ static int decode_frame(AVCodecContext *avctx, frame.f->pict_type = AV_PICTURE_TYPE_I; frame.f->key_frame = 1; - av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!a->bitstream_buffer) return AVERROR(ENOMEM); for (i = 0; i < buf_size; i += 2) { diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c index 1bcb9e7223..dfb8916dd9 100644 --- a/libavcodec/mjpega_dump_header_bsf.c +++ b/libavcodec/mjpega_dump_header_bsf.c @@ -44,7 +44,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av } *poutbuf_size = 0; - *poutbuf = av_malloc(buf_size + 44 + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf = av_malloc(buf_size + 44 + AV_INPUT_BUFFER_PADDING_SIZE); if (!*poutbuf) return AVERROR(ENOMEM); poutbufp = *poutbuf; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index da1c6d771e..d8fc9defa3 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1422,7 +1422,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s, *unescaped_buf_ptr = s->buffer; *unescaped_buf_size = dst - s->buffer; memset(s->buffer + *unescaped_buf_size, 0, - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n", (buf_end - *buf_ptr) - (dst - s->buffer)); @@ -1465,7 +1465,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s, *unescaped_buf_ptr = dst; *unescaped_buf_size = (bit_count + 7) >> 3; memset(s->buffer + *unescaped_buf_size, 0, - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); } else { *unescaped_buf_ptr = *buf_ptr; *unescaped_buf_size = buf_end - *buf_ptr; diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index e97a0cdeba..a18541b852 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -274,14 +274,14 @@ static int mp_decode_frame(AVCodecContext *avctx, } /* le32 bitstream msb first */ - av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!mp->bswapbuf) return AVERROR(ENOMEM); mp->bdsp.bswap_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf, buf_size / 4); if (buf_size & 3) memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3); - memset(mp->bswapbuf + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(mp->bswapbuf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&gb, mp->bswapbuf, buf_size * 8); memset(mp->changes_map, 0, avctx->width * avctx->height); diff --git a/libavcodec/movsub_bsf.c b/libavcodec/movsub_bsf.c index 7b4cd62548..0484303840 100644 --- a/libavcodec/movsub_bsf.c +++ b/libavcodec/movsub_bsf.c @@ -28,7 +28,7 @@ static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co const uint8_t *buf, int buf_size, int keyframe){ if (buf_size > 0xffff) return 0; *poutbuf_size = buf_size + 2; - *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf = av_malloc(*poutbuf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!*poutbuf) return AVERROR(ENOMEM); AV_WB16(*poutbuf, buf_size); @@ -47,7 +47,7 @@ static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co const uint8_t *buf, int buf_size, int keyframe){ if (buf_size < 2) return 0; *poutbuf_size = FFMIN(buf_size - 2, AV_RB16(buf)); - *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf = av_malloc(*poutbuf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!*poutbuf) return AVERROR(ENOMEM); memcpy(*poutbuf, buf + 2, *poutbuf_size); diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 146a332b72..b09aeb2b74 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2516,7 +2516,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size) av_fast_malloc(&s->bitstream_buffer, &s->allocated_bitstream_buffer_size, buf_size - current_pos + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->bitstream_buffer) return AVERROR(ENOMEM); memcpy(s->bitstream_buffer, buf + current_pos, diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 49528f2827..ae6fb7e9a5 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -544,7 +544,7 @@ do {\ if (s1->bitstream_buffer) { if (s1->bitstream_buffer_size + - FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) + AV_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) av_fast_malloc(&s->bitstream_buffer, &s->allocated_bitstream_buffer_size, s1->allocated_bitstream_buffer_size); @@ -552,7 +552,7 @@ do {\ memcpy(s->bitstream_buffer, s1->bitstream_buffer, s1->bitstream_buffer_size); memset(s->bitstream_buffer + s->bitstream_buffer_size, 0, - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); } // linesize dependend scratch buffer allocation diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 7a6ce2680e..4a4eaa0b88 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -476,7 +476,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r; int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask); - av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >= + av_assert0(AV_INPUT_BUFFER_PADDING_SIZE >= ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8); init_get_bits(&gb, buf, buf_size * 8); diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index 00ceeadfec..81840bd07b 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -32,10 +32,10 @@ static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const ch int amount= args ? atoi(args) : (*state % 10001+1); int i; - *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf= av_malloc(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!*poutbuf) return AVERROR(ENOMEM); - memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + memcpy(*poutbuf, buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE); for(i=0; i<buf_size; i++){ (*state) += (*poutbuf)[i] + 1; if(*state % amount == 0) diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index eb73c2ff82..c56003c3ad 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -128,7 +128,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, avctx->height = c->height = height; ptr = av_fast_realloc(c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2 + - FF_INPUT_BUFFER_PADDING_SIZE + + AV_INPUT_BUFFER_PADDING_SIZE + RTJPEG_HEADER_SIZE); if (!ptr) { av_log(avctx, AV_LOG_ERROR, @@ -202,7 +202,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf = &buf[12]; buf_size -= 12; if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) { - int outlen = c->decomp_size - FF_INPUT_BUFFER_PADDING_SIZE; + int outlen = c->decomp_size - AV_INPUT_BUFFER_PADDING_SIZE; int inlen = buf_size; if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen)) { av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n"); diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index bfb5856a7f..cd4e065733 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -747,7 +747,7 @@ static int nvenc_setup_extradata(AVCodecContext *avctx) NV_ENC_SEQUENCE_PARAM_PAYLOAD payload = { 0 }; int ret; - avctx->extradata = av_mallocz(EXTRADATA_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(EXTRADATA_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); diff --git a/libavcodec/options.c b/libavcodec/options.c index a433f25eb9..49c8aea030 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -203,7 +203,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) memset(((uint8_t *) dest->obj) + size, 0, pad); \ } alloc_and_copy_or_fail(extradata, src->extradata_size, - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0); alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0); alloc_and_copy_or_fail(rc_override, src->rc_override_count * sizeof(*src->rc_override), 0); diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 1b223f50ee..4671c13ae6 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -126,7 +126,7 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, int64_t pts, int64_t dts, int64_t pos) { int index, i; - uint8_t dummy_buf[FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t dummy_buf[AV_INPUT_BUFFER_PADDING_SIZE]; if (!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) { s->next_frame_offset = @@ -195,13 +195,13 @@ int av_parser_change(AVCodecParserContext *s, AVCodecContext *avctx, int size = buf_size + avctx->extradata_size; *poutbuf_size = size; - *poutbuf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!*poutbuf) return AVERROR(ENOMEM); memcpy(*poutbuf, avctx->extradata, avctx->extradata_size); memcpy(*poutbuf + avctx->extradata_size, buf, - buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + buf_size + AV_INPUT_BUFFER_PADDING_SIZE); return 1; } } @@ -243,7 +243,7 @@ int ff_combine_frame(ParseContext *pc, int next, if (next == END_NOT_FOUND) { void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, *buf_size + pc->index + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!new_buffer) return AVERROR(ENOMEM); @@ -260,14 +260,14 @@ int ff_combine_frame(ParseContext *pc, int next, if (pc->index) { void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!new_buffer) return AVERROR(ENOMEM); pc->buffer = new_buffer; - if (next > -FF_INPUT_BUFFER_PADDING_SIZE) + if (next > -AV_INPUT_BUFFER_PADDING_SIZE) memcpy(&pc->buffer[pc->index], *buf, - next + FF_INPUT_BUFFER_PADDING_SIZE); + next + AV_INPUT_BUFFER_PADDING_SIZE); pc->index = 0; *buf = pc->buffer; } diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 9f336a71d6..6ab4b7f54c 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -297,7 +297,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, enc_row_size = deflateBound(&s->zstream, row_size); max_packet_size = avctx->height * (enc_row_size + ((enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) * 12) - + FF_MIN_BUFFER_SIZE; + + AV_INPUT_BUFFER_MIN_SIZE; if (!pkt->data && (ret = av_new_packet(pkt, max_packet_size)) < 0) { av_log(avctx, AV_LOG_ERROR, "Could not allocate output packet of size %d.\n", diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c index 2e00c0a31e..175ca36267 100644 --- a/libavcodec/pnm_parser.c +++ b/libavcodec/pnm_parser.c @@ -55,7 +55,7 @@ retry: goto retry; } #if 0 - if (pc->index && pc->index * 2 + FF_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index) { + if (pc->index && pc->index * 2 + AV_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index) { memcpy(pc->buffer + pc->index, buf, pc->index); pc->index += pc->index; buf += pc->index; diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c index e38f7a070f..0564b12ae2 100644 --- a/libavcodec/proresenc.c +++ b/libavcodec/proresenc.c @@ -948,7 +948,7 @@ FF_ENABLE_DEPRECATION_WARNINGS pkt_size = ctx->frame_size_upper_bound; - if ((ret = ff_alloc_packet(pkt, pkt_size + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet(pkt, pkt_size + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 8c324f42c9..44693d23e1 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -341,7 +341,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, return AVERROR(ENOMEM); if (avctx->extradata) { - q->avctx_internal->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + q->avctx_internal->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->avctx_internal->extradata) return AVERROR(ENOMEM); diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index e454f73d1b..752777bf30 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -177,7 +177,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) } avctx->extradata = av_malloc(extradata.SPSBufSize + need_pps * extradata.PPSBufSize + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); @@ -185,7 +185,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) if (need_pps) memcpy(avctx->extradata + extradata.SPSBufSize, pps_buf, extradata.PPSBufSize); avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize; - memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); return 0; } diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 0efb7940e9..be608715ec 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -140,7 +140,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx) } vps_size = bytestream2_tell_p(&pbc); - new_extradata = av_mallocz(vps_size + avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + new_extradata = av_mallocz(vps_size + avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!new_extradata) return AVERROR(ENOMEM); memcpy(new_extradata, vps_buf, vps_size); diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index d3a82ca615..ce98a83dba 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -431,7 +431,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, void *tmp_ptr; s->max_framesize = 1024; // should hopefully be enough for the first header tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, - s->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE); + s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE); if (!tmp_ptr) { av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/startcode.c b/libavcodec/startcode.c index d34981e67d..5c1ec84c21 100644 --- a/libavcodec/startcode.c +++ b/libavcodec/startcode.c @@ -33,7 +33,7 @@ int ff_startcode_find_candidate_c(const uint8_t *buf, int size) int i = 0; #if HAVE_FAST_UNALIGNED /* we check i < size instead of i + 3 / 7 because it is - * simpler and there must be FF_INPUT_BUFFER_PADDING_SIZE + * simpler and there must be AV_INPUT_BUFFER_PADDING_SIZE * bytes at the end. */ #if HAVE_FAST_64BIT diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 338b2afc7f..a869c2478b 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -586,7 +586,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (!pkt->data && (ret = av_new_packet(pkt, s->y_block_width * s->y_block_height * - MAX_MB_BYTES * 3 + FF_MIN_BUFFER_SIZE)) < 0) { + MAX_MB_BYTES * 3 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index b70abcc385..97b9d6fb01 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -141,7 +141,7 @@ static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride, { int i, ret = 0; uint8_t *src2 = av_malloc((unsigned)size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!src2) { av_log(s->avctx, AV_LOG_ERROR, @@ -159,7 +159,7 @@ static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride, for (i = 0; i < size; i++) src2[i] = ff_reverse[src[i]]; } - memset(src2 + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(src2 + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts); av_free(src2); diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 1f5fa0b7d6..7c23ee2db8 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -309,7 +309,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, strips = (s->height - 1) / s->rps + 1; packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 + - avctx->height * 4 + FF_MIN_BUFFER_SIZE; + avctx->height * 4 + AV_INPUT_BUFFER_MIN_SIZE; if (!pkt->data && (ret = av_new_packet(pkt, packet_size)) < 0) { diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index d280e3220c..84e8e2a9b3 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -856,7 +856,7 @@ static int decode_frame(AVCodecContext *avctx, int i, t, ret; uint8_t *swbuf; - swbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + swbuf = av_malloc(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!swbuf) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 50311dee68..2f0997a1a4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -59,14 +59,14 @@ static void *avformat_mutex; void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size) { void **p = ptr; - if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { + if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { av_freep(p); *size = 0; return; } - av_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE); if (*size) - memset((uint8_t *)*p + min_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset((uint8_t *)*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } /* encoder management */ @@ -1324,7 +1324,7 @@ FF_ENABLE_DEPRECATION_WARNINGS int ff_alloc_packet(AVPacket *avpkt, int size) { - if (size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) + if (size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return AVERROR(EINVAL); if (avpkt->data) { diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 0ccd53a937..30ca4d2164 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -142,7 +142,7 @@ static int decode_plane(UtvideoContext *c, int plane_no, memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size); - memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(c->slice_bits + slice_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); c->bdsp.bswap_buf((uint32_t *) c->slice_bits, (uint32_t *) c->slice_bits, (slice_data_end - slice_data_start + 3) >> 2); @@ -388,7 +388,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } av_fast_malloc(&c->slice_bits, &c->slice_bits_size, - max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE); + max_slice_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!c->slice_bits) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index 6e9916cd9f..9af0f66a71 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -157,7 +157,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) avctx->extradata_size = 16; avctx->extradata = av_mallocz(avctx->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata.\n"); @@ -167,7 +167,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) for (i = 0; i < c->planes; i++) { c->slice_buffer[i] = av_malloc(c->slice_stride * (avctx->height + 2) + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!c->slice_buffer[i]) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 1.\n"); utvideo_encode_close(avctx); @@ -547,7 +547,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream2_init_writer(&pb, dst, pkt->size); av_fast_malloc(&c->slice_bits, &c->slice_bits_size, - width * height + FF_INPUT_BUFFER_PADDING_SIZE); + width * height + AV_INPUT_BUFFER_PADDING_SIZE); if (!c->slice_bits) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 2.\n"); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 67e1d7454f..8e8411289e 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -461,7 +461,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) return -1; } - buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + buf2 = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); start = find_next_marker(start, end); // in WVC1 extradata first byte is its size, but can be 0 in mkv next = start; for (; next < end; start = next) { @@ -612,7 +612,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, //for advanced profile we may need to parse and unescape data if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { int buf_size2 = 0; - buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + buf2 = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (IS_MARKER(AV_RB32(buf))) { /* frame starts with marker and needs to be parsed */ const uint8_t *start, *end, *next; @@ -635,7 +635,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, if (!tmp) goto err; slices = tmp; - slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, @@ -660,7 +660,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, if (!tmp) goto err; slices = tmp; - slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, @@ -686,7 +686,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, if (!tmp) goto err; slices = tmp; - slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index c8efec2d9c..599e36ccc5 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -446,7 +446,7 @@ static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S) const int max_bits = 1 + 23 + 8 + 1; const int left_bits = get_bits_left(&s->gb_extra_bits); - if (left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits) + if (left_bits + 8 * AV_INPUT_BUFFER_PADDING_SIZE < max_bits) return 0.0; } diff --git a/libavcodec/wma.h b/libavcodec/wma.h index 06386efd2f..c954d71e28 100644 --- a/libavcodec/wma.h +++ b/libavcodec/wma.h @@ -120,7 +120,7 @@ typedef struct WMACodecContext { /* output buffer for one frame and the last for IMDCT windowing */ DECLARE_ALIGNED(32, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2]; /* last frame info */ - uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; /* padding added */ + uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; /* padding added */ int last_bitoffset; int last_superframe_len; float noise_table[NOISE_TAB_SIZE]; diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index eb7dfd1a50..b79dd2a101 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -853,7 +853,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, } if (len > 0) *q++ = (get_bits) (&s->gb, len) << (8 - len); - memset(q, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(q, 0, AV_INPUT_BUFFER_PADDING_SIZE); /* XXX: bit_offset bits into last frame */ init_get_bits(&s->gb, s->last_superframe, diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index 6a53b390e7..e752bd02ea 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -69,7 +69,7 @@ typedef struct WmallDecodeCtx { /* generic decoder variables */ AVCodecContext *avctx; AVFrame *frame; - uint8_t frame_data[MAX_FRAMESIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< compressed frame data + uint8_t frame_data[MAX_FRAMESIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< compressed frame data PutBitContext pb; ///< context for filling the frame_data buffer /* frame size dependent frame information (set during initialization) */ diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index e69d973491..46710c54ae 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -173,7 +173,7 @@ typedef struct WMAProDecodeCtx { AVCodecContext* avctx; ///< codec context for av_log AVFloatDSPContext fdsp; uint8_t frame_data[MAX_FRAMESIZE + - FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data + AV_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data PutBitContext pb; ///< context for filling the frame_data buffer FFTContext mdct_ctx[WMAPRO_BLOCK_SIZES]; ///< MDCT context per block size DECLARE_ALIGNED(32, float, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT output buffer diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 8e9f038788..92261b9a77 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -205,7 +205,7 @@ typedef struct WMAVoiceContext { ///< to #wmavoice_decode_packet() (since ///< they're part of the previous superframe) - uint8_t sframe_cache[SFRAME_CACHE_MAXSIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t sframe_cache[SFRAME_CACHE_MAXSIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< cache for superframe data split over ///< multiple packets int sframe_cache_size; ///< set to >0 if we have data from an diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index 05dc9a534c..d0304c97ad 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -75,7 +75,7 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + rbuf = av_malloc(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!rbuf) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return AVERROR(ENOMEM); diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 5e2ba844ef..154f550b00 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -392,7 +392,7 @@ static int vfw_read_header(AVFormatContext *s) codec->codec_id = AV_CODEC_ID_RAWVIDEO; if(biCompression == BI_RGB) { codec->bits_per_coded_sample = biBitCount; - codec->extradata = av_malloc(9 + FF_INPUT_BUFFER_PADDING_SIZE); + codec->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE); if (codec->extradata) { codec->extradata_size = 9; memcpy(codec->extradata, "BottomUp", 9); diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index b539388429..356518ae5f 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -227,7 +227,7 @@ static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt) xcb_shm_get_image_reply_t *img; xcb_drawable_t drawable = c->screen->root; uint8_t *data; - int size = c->frame_size + FF_INPUT_BUFFER_PADDING_SIZE; + int size = c->frame_size + AV_INPUT_BUFFER_PADDING_SIZE; int id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777); xcb_generic_error_t *e = NULL; diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 6253ffb58e..2952a2172a 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -111,7 +111,7 @@ static int parse_vtrk(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_4XM; - st->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(4 + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 4; diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index 9d3ebe398b..bce0493b79 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -76,7 +76,7 @@ static int adx_read_header(AVFormatContext *s) c->header_size = avio_rb16(s->pb) + 4; avio_seek(s->pb, -4, SEEK_CUR); - avctx->extradata = av_mallocz(c->header_size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(c->header_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); if (avio_read(s->pb, avctx->extradata, c->header_size) < c->header_size) { diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index add843b267..04cca5d451 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -259,7 +259,7 @@ static int aiff_read_header(AVFormatContext *s) case MKTAG('w', 'a', 'v', 'e'): if ((uint64_t)size > (1<<30)) return -1; - st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = size; diff --git a/libavformat/anm.c b/libavformat/anm.c index 6b8e3066f3..69a13744f1 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -133,7 +133,7 @@ static int read_header(AVFormatContext *s) /* color cycling and palette data */ st->codec->extradata_size = 16*8 + 4*256; - st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { return AVERROR(ENOMEM); } diff --git a/libavformat/apc.c b/libavformat/apc.c index 0b6c5836c1..58fd9f8771 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -53,7 +53,7 @@ static int apc_read_header(AVFormatContext *s) st->codec->extradata_size = 2 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 4d65301697..5591555377 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key); return -1; } - if (size > INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { + if (size > INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { av_log(s, AV_LOG_ERROR, "APE tag size too large.\n"); return AVERROR_INVALIDDATA; } @@ -94,7 +94,7 @@ static int ape_tag_read_field(AVFormatContext *s) st->attached_pic.stream_index = st->index; st->attached_pic.flags |= AV_PKT_FLAG_KEY; } else { - st->codec->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); if (avio_read(pb, st->codec->extradata, size) != size) { diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 642ccb2ca3..9c746af075 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -674,12 +674,12 @@ static int parse_video_info(AVIOContext *pb, AVStream *st) int ret; st->codec->extradata_size = size - BMP_HEADER_SIZE; if (!(st->codec->extradata = av_malloc(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE))) { + AV_INPUT_BUFFER_PADDING_SIZE))) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); } memset(st->codec->extradata + st->codec->extradata_size , 0, - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if ((ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size)) < 0) return ret; diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 86397653bc..564318ee0c 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -625,7 +625,7 @@ static int avi_read_header(AVFormatContext *s) if (size > 10 * 4 && size < (1 << 30)) { st->codec->extradata_size = size - 10 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); @@ -696,7 +696,7 @@ static int avi_read_header(AVFormatContext *s) st->codec->extradata_size += 9; if ((ret = av_reallocp(&st->codec->extradata, st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return ret; } else diff --git a/libavformat/avio.h b/libavformat/avio.h index a1497d9d65..889fdcf1e7 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -396,7 +396,7 @@ int avio_open_dyn_buf(AVIOContext **s); /** * Return the written size and a pointer to the buffer. The buffer * must be freed with av_free(). - * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer. * * @param s IO context * @param pbuffer pointer to a byte buffer diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 6716772464..bb575ed8a3 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -983,7 +983,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { DynBuffer *d; int size; - static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0}; + static const char padbuf[AV_INPUT_BUFFER_PADDING_SIZE] = {0}; int padding = 0; if (!s) { @@ -994,7 +994,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) /* don't attempt to pad fixed-size packet buffers */ if (!s->max_packet_size) { avio_write(s, padbuf, sizeof(padbuf)); - padding = FF_INPUT_BUFFER_PADDING_SIZE; + padding = AV_INPUT_BUFFER_PADDING_SIZE; } avio_flush(s); diff --git a/libavformat/bink.c b/libavformat/bink.c index 3224790485..608de245d3 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -120,7 +120,7 @@ static int read_header(AVFormatContext *s) vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = AV_CODEC_ID_BINKVIDEO; - vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); + vst->codec->extradata = av_mallocz(4 + AV_INPUT_BUFFER_PADDING_SIZE); if (!vst->codec->extradata) return AVERROR(ENOMEM); vst->codec->extradata_size = 4; @@ -156,7 +156,7 @@ static int read_header(AVFormatContext *s) ast->codec->channels = 1; ast->codec->channel_layout = AV_CH_LAYOUT_MONO; } - ast->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); + ast->codec->extradata = av_mallocz(4 + AV_INPUT_BUFFER_PADDING_SIZE); if (!ast->codec->extradata) return AVERROR(ENOMEM); ast->codec->extradata_size = 4; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index a37ceaaebd..36c39678d1 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -101,7 +101,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; - if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) + if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return -1; if (st->codec->codec_id == AV_CODEC_ID_AAC) { @@ -131,7 +131,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) } avio_read(pb, preamble, ALAC_PREAMBLE); - st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(ALAC_HEADER + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); @@ -157,7 +157,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) } st->codec->extradata_size = ALAC_HEADER; } else { - st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); avio_read(pb, st->codec->extradata, size); diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 8abdd9d5b4..494bb095cc 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -58,7 +58,7 @@ static int flac_read_header(AVFormatContext *s) case FLAC_METADATA_TYPE_CUESHEET: case FLAC_METADATA_TYPE_PICTURE: case FLAC_METADATA_TYPE_VORBIS_COMMENT: - buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE); + buffer = av_mallocz(metadata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!buffer) { return AVERROR(ENOMEM); } diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 3b0370c950..2375eb1a1f 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -592,7 +592,7 @@ static int flv_read_close(AVFormatContext *s) static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size) { av_free(st->codec->extradata); - st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = size; @@ -605,7 +605,7 @@ static int flv_queue_extradata(FLVContext *flv, AVIOContext *pb, int stream, { av_free(flv->new_extradata[stream]); flv->new_extradata[stream] = av_mallocz(size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!flv->new_extradata[stream]) return AVERROR(ENOMEM); flv->new_extradata_size[stream] = size; diff --git a/libavformat/hevc.c b/libavformat/hevc.c index 26db3b101f..e59d6a8886 100644 --- a/libavformat/hevc.c +++ b/libavformat/hevc.c @@ -636,7 +636,7 @@ static uint8_t *nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, uint8_t *dst; uint32_t i, len; - dst = av_malloc(src_len + FF_INPUT_BUFFER_PADDING_SIZE); + dst = av_malloc(src_len + AV_INPUT_BUFFER_PADDING_SIZE); if (!dst) return NULL; diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 799eafee7c..d63d5a1171 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -495,10 +495,10 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen, goto fail; } - apic->buf = av_buffer_alloc(taglen + FF_INPUT_BUFFER_PADDING_SIZE); + apic->buf = av_buffer_alloc(taglen + AV_INPUT_BUFFER_PADDING_SIZE); if (!apic->buf || avio_read(pb, apic->buf->data, taglen) != taglen) goto fail; - memset(apic->buf->data + taglen, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(apic->buf->data + taglen, 0, AV_INPUT_BUFFER_PADDING_SIZE); new_extra->tag = "APIC"; new_extra->data = apic; @@ -772,7 +772,7 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta) av_init_packet(&st->attached_pic); st->attached_pic.buf = apic->buf; st->attached_pic.data = apic->buf->data; - st->attached_pic.size = apic->buf->size - FF_INPUT_BUFFER_PADDING_SIZE; + st->attached_pic.size = apic->buf->size - AV_INPUT_BUFFER_PADDING_SIZE; st->attached_pic.stream_index = st->index; st->attached_pic.flags |= AV_PKT_FLAG_KEY; diff --git a/libavformat/isom.c b/libavformat/isom.c index b4001772db..0582cfdac4 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -454,7 +454,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext if (!len || (uint64_t)len > (1<<30)) return -1; av_free(st->codec->extradata); - st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(len + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); avio_read(pb, st->codec->extradata, len); diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 8aebbf4de8..1b1c5428bf 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -196,7 +196,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; if (ret < size) { memset(pkt->data + JV_PREAMBLE_SIZE + ret, 0, - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); pkt->flags |= AV_PKT_FLAG_CORRUPT; } pkt->size = ret + JV_PREAMBLE_SIZE; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 0425d24dc4..3556b14537 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -747,7 +747,7 @@ static int ebml_read_ascii(AVIOContext *pb, int size, char **str) static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) { av_free(bin->data); - if (!(bin->data = av_mallocz(length + FF_INPUT_BUFFER_PADDING_SIZE))) + if (!(bin->data = av_mallocz(length + AV_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); bin->size = length; @@ -1205,7 +1205,7 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska, es = ec / 100; ec -= 100 * es; *ptr++ = '\0'; - len = 50 + end - ptr + FF_INPUT_BUFFER_PADDING_SIZE; + len = 50 + end - ptr + AV_INPUT_BUFFER_PADDING_SIZE; if (!(line = av_buffer_alloc(len))) return; snprintf(line->data, len, @@ -1644,7 +1644,7 @@ static int matroska_parse_tracks(AVFormatContext *s) } else if (codec_id == AV_CODEC_ID_AAC && !track->codec_priv.size) { int profile = matroska_aac_profile(track->codec_id); int sri = matroska_aac_sri(track->audio.samplerate); - extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); + extradata = av_mallocz(5 + AV_INPUT_BUFFER_PADDING_SIZE); if (!extradata) return AVERROR(ENOMEM); extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1); @@ -1663,7 +1663,7 @@ static int matroska_parse_tracks(AVFormatContext *s) * decoder expects manually. */ extradata_size = 12 + track->codec_priv.size; extradata = av_mallocz(extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!extradata) return AVERROR(ENOMEM); AV_WB32(extradata, extradata_size); @@ -1768,7 +1768,7 @@ static int matroska_parse_tracks(AVFormatContext *s) st->codec->extradata_size = extradata_size; } else if (track->codec_priv.data && track->codec_priv.size > 0) { st->codec->extradata = av_mallocz(track->codec_priv.size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = track->codec_priv.size; diff --git a/libavformat/mov.c b/libavformat/mov.c index b78a1c39e8..8bf1b90c97 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -963,7 +963,7 @@ static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) // currently SVQ3 decoder expect full STSD header - so let's fake it // this should be fixed and just SMI header should be passed av_free(st->codec->extradata); - st->codec->extradata = av_mallocz(atom.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(atom.size + 0x5a + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + atom.size; @@ -1127,7 +1127,7 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (c->fc->nb_streams < 1) // will happen with jp2 files return 0; st= c->fc->streams[c->fc->nb_streams-1]; - size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; + size= (uint64_t)st->codec->extradata_size + atom.size + 8 + AV_INPUT_BUFFER_PADDING_SIZE; if (size > INT_MAX || (uint64_t)atom.size > INT_MAX) return AVERROR_INVALIDDATA; if ((err = av_reallocp(&st->codec->extradata, size)) < 0) { @@ -1135,7 +1135,7 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom) return err; } buf = st->codec->extradata + st->codec->extradata_size; - st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; + st->codec->extradata_size= size - AV_INPUT_BUFFER_PADDING_SIZE; AV_WB32( buf , atom.size + 8); AV_WL32( buf + 4, atom.type); @@ -1161,7 +1161,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) { // pass all frma atom to codec, needed at least for QDMC and QDM2 av_free(st->codec->extradata); - st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(atom.size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; @@ -1203,7 +1203,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_read_default(c, pb, atom); } av_free(st->codec->extradata); - st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(atom.size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; @@ -1233,7 +1233,7 @@ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; av_free(st->codec->extradata); - st->codec->extradata = av_mallocz(atom.size - 7 + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(atom.size - 7 + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 7; @@ -1266,7 +1266,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR_INVALIDDATA; av_free(st->codec->extradata); - st->codec->extradata = av_mallocz(atom.size - 40 + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(atom.size - 40 + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 40; @@ -1629,7 +1629,7 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st) av_freep(&st->codec->extradata); st->codec->extradata_size = 0; - st->codec->extradata = av_mallocz(strlen(buf) + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(strlen(buf) + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = strlen(buf); @@ -1646,7 +1646,7 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, if (st->codec->codec_tag == MKTAG('t','m','c','d')) { st->codec->extradata_size = size; - st->codec->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); ret = ffio_read_size(pb, st->codec->extradata, size); @@ -2003,7 +2003,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) num_bytes = (entries*field_size+4)>>3; - buf = av_malloc(num_bytes+FF_INPUT_BUFFER_PADDING_SIZE); + buf = av_malloc(num_bytes+AV_INPUT_BUFFER_PADDING_SIZE); if (!buf) { av_freep(&sc->sample_sizes); return AVERROR(ENOMEM); diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d8255c8fa1..158dfa8b67 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -455,7 +455,7 @@ static int mov_write_dvc1_structs(MOVTrack *track, uint8_t *buf) "dvc1 atom. Set the delay_moov flag to fix this.\n"); } - unescaped = av_mallocz(track->vos_len + FF_INPUT_BUFFER_PADDING_SIZE); + unescaped = av_mallocz(track->vos_len + AV_INPUT_BUFFER_PADDING_SIZE); if (!unescaped) return AVERROR(ENOMEM); start = find_next_marker(track->vos_data, end); diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 1c8a295863..ed8d73f7b0 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -96,7 +96,7 @@ static int mpc_read_header(AVFormatContext *s) st->codec->bits_per_coded_sample = 16; st->codec->extradata_size = 16; - st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(st->codec->extradata_size+AV_INPUT_BUFFER_PADDING_SIZE); avio_read(s->pb, st->codec->extradata, 16); st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3]; avpriv_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate); diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 07f12d291c..3bc868e502 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -154,7 +154,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) av_log(s, AV_LOG_ERROR, "Bad seek table size\n"); return; } - if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE))) + if(!(buf = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE))) return; avio_read(s->pb, buf, size); init_get_bits(&gb, buf, size * 8); @@ -242,7 +242,7 @@ static int mpc8_read_header(AVFormatContext *s) st->codec->bits_per_coded_sample = 16; st->codec->extradata_size = 2; - st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); avio_read(pb, st->codec->extradata, st->codec->extradata_size); st->codec->channels = (st->codec->extradata[1] >> 4) + 1; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index f96d9f04a3..3a27343cf0 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -711,7 +711,7 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt) av_log(pes->stream, AV_LOG_WARNING, "PES packet size mismatch\n"); pes->flags |= AV_PKT_FLAG_CORRUPT; } - memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); // Separate out the AC3 substream from an HDMV combined TrueHD/AC3 PID if (pes->sub_st && pes->stream_type == 0x83 && pes->extended_stream_id == 0x76) @@ -864,7 +864,7 @@ static int mpegts_push_data(MpegTSFilter *filter, /* allocate pes buffer */ pes->buffer = av_buffer_alloc(pes->total_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!pes->buffer) return AVERROR(ENOMEM); @@ -971,7 +971,7 @@ skip: new_pes_packet(pes, ts->pkt); pes->total_size = MAX_PES_PAYLOAD; pes->buffer = av_buffer_alloc(pes->total_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!pes->buffer) return AVERROR(ENOMEM); ts->stop_parse = 1; @@ -1436,7 +1436,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type memcmp(st->codec->extradata, *pp, 4)) avpriv_request_sample(fc, "DVB sub with multiple IDs"); } else { - st->codec->extradata = av_malloc(4 + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_malloc(4 + AV_INPUT_BUFFER_PADDING_SIZE); if (st->codec->extradata) { st->codec->extradata_size = 4; memcpy(st->codec->extradata, *pp, 4); @@ -1482,7 +1482,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type ext_desc_tag == 0x80) { /* User defined (provisional Opus) */ if (!st->codec->extradata) { st->codec->extradata = av_mallocz(sizeof(opus_default_extradata) + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); @@ -1956,7 +1956,7 @@ static void finished_reading_packet(AVFormatContext *s, int raw_packet_size) static int handle_packets(MpegTSContext *ts, int nb_packets) { AVFormatContext *s = ts->stream; - uint8_t packet[TS_PACKET_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t packet[TS_PACKET_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; const uint8_t *data; int packet_num, ret = 0; @@ -1979,7 +1979,7 @@ static int handle_packets(MpegTSContext *ts, int nb_packets) ts->stop_parse = 0; packet_num = 0; - memset(packet + TS_PACKET_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(packet + TS_PACKET_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE); for (;;) { if (ts->stop_parse > 0) break; diff --git a/libavformat/mvi.c b/libavformat/mvi.c index 03a1f406cf..4abd1c670f 100644 --- a/libavformat/mvi.c +++ b/libavformat/mvi.c @@ -55,7 +55,7 @@ static int read_header(AVFormatContext *s) return AVERROR(ENOMEM); vst->codec->extradata_size = 2; - vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE); + vst->codec->extradata = av_mallocz(2 + AV_INPUT_BUFFER_PADDING_SIZE); version = avio_r8(pb); vst->codec->extradata[0] = avio_r8(pb); diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 25545dc603..8678dc161b 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -895,7 +895,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int if (IS_KLV_KEY(uid, mxf_sony_mpeg4_extradata)) { av_free(descriptor->extradata); descriptor->extradata_size = 0; - descriptor->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + descriptor->extradata = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!descriptor->extradata) return AVERROR(ENOMEM); descriptor->extradata_size = size; @@ -1653,7 +1653,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) } } if (descriptor->extradata) { - st->codec->extradata = av_mallocz(descriptor->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(descriptor->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (st->codec->extradata) { memcpy(st->codec->extradata, descriptor->extradata, descriptor->extradata_size); st->codec->extradata_size = descriptor->extradata_size; diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 1d1488c059..3cde2de1ff 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -110,7 +110,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) if (mxg->soi_ptr) soi_pos = mxg->soi_ptr - mxg->buffer; mxg->buffer = av_fast_realloc(mxg->buffer, &mxg->buffer_size, current_pos + cache_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!mxg->buffer) return AVERROR(ENOMEM); mxg->buffer_ptr = mxg->buffer + current_pos; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 47f6e318b3..bf1ab7b933 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -408,7 +408,7 @@ static int decode_stream_header(NUTContext *nut) GET_V(st->codec->extradata_size, tmp < (1 << 30)); if (st->codec->extradata_size) { st->codec->extradata = av_mallocz(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); avio_read(bc, st->codec->extradata, st->codec->extradata_size); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index f37c4af826..15526ffa01 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -74,7 +74,7 @@ static int ogg_save(AVFormatContext *s) for (i = 0; i < ogg->nstreams; i++) { struct ogg_stream *os = ogg->streams + i; - os->buf = av_mallocz(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); + os->buf = av_mallocz(os->bufsize + AV_INPUT_BUFFER_PADDING_SIZE); memcpy(os->buf, ost->streams[i].buf, os->bufpos); } @@ -172,7 +172,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) os = ogg->streams + idx; os->serial = serial; os->bufsize = DECODER_BUFFER_SIZE; - os->buf = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); + os->buf = av_malloc(os->bufsize + AV_INPUT_BUFFER_PADDING_SIZE); os->header = -1; os->start_granule = OGG_NOGRANULE_VALUE; @@ -191,7 +191,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) static int ogg_new_buf(struct ogg *ogg, int idx) { struct ogg_stream *os = ogg->streams + idx; - uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); + uint8_t *nb = av_malloc(os->bufsize + AV_INPUT_BUFFER_PADDING_SIZE); int size = os->bufpos - os->pstart; if (!nb) @@ -315,7 +315,7 @@ static int ogg_read_page(AVFormatContext *s, int *str) } if (os->bufsize - os->bufpos < size) { - uint8_t *nb = av_malloc((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE); + uint8_t *nb = av_malloc((os->bufsize *= 2) + AV_INPUT_BUFFER_PADDING_SIZE); if (!nb) return AVERROR(ENOMEM); memcpy(nb, os->buf, os->bufpos); @@ -331,7 +331,7 @@ static int ogg_read_page(AVFormatContext *s, int *str) os->granule = gp; os->flags = flags; - memset(os->buf + os->bufpos, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(os->buf + os->bufpos, 0, AV_INPUT_BUFFER_PADDING_SIZE); if (str) *str = idx; diff --git a/libavformat/oggparsecelt.c b/libavformat/oggparsecelt.c index 7084e768a3..ab8532090e 100644 --- a/libavformat/oggparsecelt.c +++ b/libavformat/oggparsecelt.c @@ -47,7 +47,7 @@ static int celt_header(AVFormatContext *s, int idx) uint8_t *extradata; extradata = av_malloc(2 * sizeof(uint32_t) + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); priv = av_malloc(sizeof(struct oggcelt_private)); if (!extradata || !priv) { av_free(extradata); diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c index 57bba68079..30a4840120 100644 --- a/libavformat/oggparseflac.c +++ b/libavformat/oggparseflac.c @@ -62,7 +62,7 @@ flac_header (AVFormatContext * s, int idx) st->need_parsing = AVSTREAM_PARSE_HEADERS; st->codec->extradata = - av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + av_malloc(FLAC_STREAMINFO_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE); st->codec->extradata_size = FLAC_STREAMINFO_SIZE; diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c index 5931ab543b..1851ff11ee 100644 --- a/libavformat/oggparseopus.c +++ b/libavformat/oggparseopus.c @@ -57,7 +57,7 @@ static int opus_header(AVFormatContext *avf, int idx) st->codec->channels = AV_RL8(packet + 9); priv->pre_skip = AV_RL16(packet + 10); - extradata = av_malloc(os->psize + FF_INPUT_BUFFER_PADDING_SIZE); + extradata = av_malloc(os->psize + AV_INPUT_BUFFER_PADDING_SIZE); if (!extradata) return AVERROR(ENOMEM); diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c index b2779e74c1..f7af79418f 100644 --- a/libavformat/oggparsespeex.c +++ b/libavformat/oggparsespeex.c @@ -74,7 +74,7 @@ static int speex_header(AVFormatContext *s, int idx) { st->codec->extradata_size = os->psize; st->codec->extradata = av_malloc(st->codec->extradata_size - + FF_INPUT_BUFFER_PADDING_SIZE); + + AV_INPUT_BUFFER_PADDING_SIZE); memcpy(st->codec->extradata, p, st->codec->extradata_size); avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index d78f02d67a..01d1518c2a 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -126,7 +126,7 @@ static int theora_header(AVFormatContext *s, int idx) } if ((err = av_reallocp(&st->codec->extradata, - cds + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { + cds + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return err; } diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index b2f9c8b03e..aac0f0e980 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -234,7 +234,7 @@ static int fixup_vorbis_headers(AVFormatContext *as, offset += priv->len[i]; av_freep(&priv->packet[i]); } - if ((err = av_reallocp(buf, offset + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) + if ((err = av_reallocp(buf, offset + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) return err; return offset; } diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 8dc35d17c2..28276d941d 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -357,7 +357,7 @@ static int oma_read_header(AVFormatContext *s) /* fake the ATRAC3 extradata * (wav format, makes stream copy to wav work) */ st->codec->extradata_size = 14; - edata = av_mallocz(14 + FF_INPUT_BUFFER_PADDING_SIZE); + edata = av_mallocz(14 + AV_INPUT_BUFFER_PADDING_SIZE); if (!edata) return AVERROR(ENOMEM); diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 65cb6bb00f..74ca272300 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -49,7 +49,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) } else if (ret < size) { /* initialize end of packet for partial reads to avoid reading * uninitialized data on allowed overreads */ - memset(pkt->data + ret, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(pkt->data + ret, 0, AV_INPUT_BUFFER_PADDING_SIZE); } pkt->size = ret; return ret; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 5478f88fc6..091bff2981 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -86,7 +86,7 @@ struct PayloadContext { RMStream **rmst; uint8_t *mlti_data; unsigned int mlti_data_size; - char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE]; + char buffer[RTP_MAX_PACKET_LENGTH + AV_INPUT_BUFFER_PADDING_SIZE]; int audio_pkt_cnt; /**< remaining audio packets in rmdec */ }; @@ -398,7 +398,7 @@ rdt_parse_b64buf (unsigned int *target_len, const char *p) len -= 2; /* skip embracing " at start/end */ } *target_len = len * 3 / 4; - target = av_mallocz(*target_len + FF_INPUT_BUFFER_PADDING_SIZE); + target = av_mallocz(*target_len + AV_INPUT_BUFFER_PADDING_SIZE); if (!target) return NULL; av_base64_decode(target, p, *target_len); diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c index 4d7b684e68..41b7a9c865 100644 --- a/libavformat/riffdec.c +++ b/libavformat/riffdec.c @@ -114,7 +114,7 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, if (cbSize > 0) { av_free(codec->extradata); codec->extradata = av_mallocz(codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return AVERROR(ENOMEM); avio_read(pb, codec->extradata, codec->extradata_size); diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 5d30bf8bd6..a6544c3a60 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -132,7 +132,7 @@ static av_cold int rl2_read_header(AVFormatContext *s) st->codec->extradata_size += back_size; st->codec->extradata = av_mallocz(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if(!st->codec->extradata) return AVERROR(ENOMEM); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index cab75fd338..d28a2a8d1e 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -86,7 +86,7 @@ static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned si { if (size >= 1<<24) return -1; - avctx->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); avctx->extradata_size = avio_read(pb, avctx->extradata, size); @@ -203,7 +203,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, if (version == 5) avio_r8(pb); codecdata_length = avio_rb32(pb); - if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ + if(codecdata_length + AV_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); return -1; } @@ -231,7 +231,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, if (version == 5) avio_r8(pb); codecdata_length = avio_rb32(pb); - if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ + if(codecdata_length + AV_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); return -1; } diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 1a690115e5..e8543ee06d 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -119,7 +119,7 @@ int ff_h264_parse_sprop_parameter_sets(AVFormatContext *s, uint8_t *dest = av_realloc(*data_ptr, packet_size + sizeof(start_sequence) + *size_ptr + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!dest) { av_log(s, AV_LOG_ERROR, "Unable to allocate memory for extradata!\n"); @@ -132,7 +132,7 @@ int ff_h264_parse_sprop_parameter_sets(AVFormatContext *s, memcpy(dest + *size_ptr + sizeof(start_sequence), decoded_packet, packet_size); memset(dest + *size_ptr + sizeof(start_sequence) + - packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + packet_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); *size_ptr += sizeof(start_sequence) + packet_size; } diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c index a4d9c54e0b..dee904397c 100644 --- a/libavformat/rtpdec_hevc.c +++ b/libavformat/rtpdec_hevc.c @@ -148,7 +148,7 @@ static av_cold int hevc_parse_sdp_line(AVFormatContext *ctx, int st_index, codec->extradata_size = hevc_data->vps_size + hevc_data->sps_size + hevc_data->pps_size + hevc_data->sei_size; codec->extradata = av_malloc(codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) { ret = AVERROR(ENOMEM); codec->extradata_size = 0; @@ -162,7 +162,7 @@ static av_cold int hevc_parse_sdp_line(AVFormatContext *ctx, int st_index, pos += hevc_data->pps_size; memcpy(codec->extradata + pos, hevc_data->sei, hevc_data->sei_size); pos += hevc_data->sei_size; - memset(codec->extradata + pos, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(codec->extradata + pos, 0, AV_INPUT_BUFFER_PADDING_SIZE); } av_freep(&hevc_data->vps); diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c index 5c54c202d0..d22cc1d215 100644 --- a/libavformat/rtpdec_latm.c +++ b/libavformat/rtpdec_latm.c @@ -97,7 +97,7 @@ static int parse_fmtp_config(AVStream *st, const char *value) int audio_mux_version, same_time_framing, num_programs, num_layers; /* Pad this buffer, too, to avoid out of bounds reads with get_bits below */ - config = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); + config = av_mallocz(len + AV_INPUT_BUFFER_PADDING_SIZE); if (!config) return AVERROR(ENOMEM); ff_hex_to_data(config, value); @@ -118,7 +118,7 @@ static int parse_fmtp_config(AVStream *st, const char *value) av_freep(&st->codec->extradata); st->codec->extradata_size = (get_bits_left(&gb) + 7)/8; st->codec->extradata = av_mallocz(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { ret = AVERROR(ENOMEM); goto end; diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c index c08242e792..a8c9943537 100644 --- a/libavformat/rtpdec_mpeg4.c +++ b/libavformat/rtpdec_mpeg4.c @@ -102,7 +102,7 @@ static int parse_fmtp_config(AVCodecContext *codec, const char *value) /* decode the hexa encoded parameter */ int len = ff_hex_to_data(NULL, value); av_free(codec->extradata); - codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); + codec->extradata = av_mallocz(len + AV_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return AVERROR(ENOMEM); codec->extradata_size = len; diff --git a/libavformat/rtpdec_qdm2.c b/libavformat/rtpdec_qdm2.c index 8eea571460..16dd48920e 100644 --- a/libavformat/rtpdec_qdm2.c +++ b/libavformat/rtpdec_qdm2.c @@ -104,7 +104,7 @@ static int qdm2_parse_config(PayloadContext *qdm, AVStream *st, return AVERROR_INVALIDDATA; av_freep(&st->codec->extradata); st->codec->extradata_size = 26 + item_len; - if (!(st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE))) { + if (!(st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE))) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); } diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 62aee89e50..002413dec2 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -174,14 +174,14 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, if (qt->pkt.size > 0 && qt->timestamp == *timestamp) { int err; if ((err = av_reallocp(&qt->pkt.data, qt->pkt.size + alen + - FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { qt->pkt.size = 0; return err; } } else { av_freep(&qt->pkt.data); av_init_packet(&qt->pkt); - qt->pkt.data = av_realloc(NULL, alen + FF_INPUT_BUFFER_PADDING_SIZE); + qt->pkt.data = av_realloc(NULL, alen + AV_INPUT_BUFFER_PADDING_SIZE); if (!qt->pkt.data) return AVERROR(ENOMEM); qt->pkt.size = 0; @@ -198,7 +198,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, qt->pkt.data = NULL; pkt->flags = keyframe ? AV_PKT_FLAG_KEY : 0; pkt->stream_index = st->index; - memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); return 0; } return AVERROR(EAGAIN); diff --git a/libavformat/rtpdec_svq3.c b/libavformat/rtpdec_svq3.c index 3104795165..004696fa54 100644 --- a/libavformat/rtpdec_svq3.c +++ b/libavformat/rtpdec_svq3.c @@ -62,7 +62,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv, st->codec->extradata_size = 0; if (len < 2 || !(st->codec->extradata = - av_malloc(len + 8 + FF_INPUT_BUFFER_PADDING_SIZE))) + av_malloc(len + 8 + AV_INPUT_BUFFER_PADDING_SIZE))) return AVERROR_INVALIDDATA; st->codec->extradata_size = len + 8; diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c index 66e619149b..5e17181ff3 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -262,8 +262,8 @@ parse_packed_headers(const uint8_t * packed_headers, /* allocate extra space: * -- length/255 +2 for xiphlacing * -- one for the '2' marker - * -- FF_INPUT_BUFFER_PADDING_SIZE required */ - extradata_alloc = length + length/255 + 3 + FF_INPUT_BUFFER_PADDING_SIZE; + * -- AV_INPUT_BUFFER_PADDING_SIZE required */ + extradata_alloc = length + length/255 + 3 + AV_INPUT_BUFFER_PADDING_SIZE; ptr = codec->extradata = av_malloc(extradata_alloc); if (!ptr) { diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 279633fe99..c6f9c035c5 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -120,7 +120,7 @@ static int vmd_read_header(AVFormatContext *s) vst->codec->height >>= 1; } vst->codec->extradata_size = VMD_HEADER_SIZE; - vst->codec->extradata = av_mallocz(VMD_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + vst->codec->extradata = av_mallocz(VMD_HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); memcpy(vst->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE); /* if sample rate is 0, assume no audio */ diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 2fa531bf64..b1d8e95f5c 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -213,7 +213,7 @@ static int smacker_read_header(AVFormatContext *s) /* load trees to extradata, they will be unpacked by decoder */ st->codec->extradata = av_mallocz(smk->treesize + 16 + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); st->codec->extradata_size = smk->treesize + 16; if(!st->codec->extradata){ av_log(s, AV_LOG_ERROR, diff --git a/libavformat/smush.c b/libavformat/smush.c index 1615b45417..94ecb5cb17 100644 --- a/libavformat/smush.c +++ b/libavformat/smush.c @@ -161,7 +161,7 @@ static int smush_read_header(AVFormatContext *ctx) av_free(vst->codec->extradata); vst->codec->extradata_size = 1024 + 2; vst->codec->extradata = av_malloc(vst->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!vst->codec->extradata) return AVERROR(ENOMEM); diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 432654affd..7162f0827b 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -525,7 +525,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) if (ctx->extra_bswap ^ (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)) { avio_write(s->pb, ctx->out_buf, ctx->out_bytes & ~1); } else { - av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + AV_INPUT_BUFFER_PADDING_SIZE); if (!ctx->buffer) return AVERROR(ENOMEM); ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); diff --git a/libavformat/takdec.c b/libavformat/takdec.c index 584cbccb50..902ba05097 100644 --- a/libavformat/takdec.c +++ b/libavformat/takdec.c @@ -71,7 +71,7 @@ static int tak_read_header(AVFormatContext *s) case TAK_METADATA_STREAMINFO: case TAK_METADATA_LAST_FRAME: case TAK_METADATA_ENCODER: - buffer = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + buffer = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!buffer) return AVERROR(ENOMEM); diff --git a/libavformat/tta.c b/libavformat/tta.c index bc86a777b3..f5304f31ed 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -113,12 +113,12 @@ static int tta_read_header(AVFormatContext *s) st->codec->bits_per_coded_sample = bps; st->codec->extradata_size = avio_tell(s->pb) - start_offset; - if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){ + if(st->codec->extradata_size+AV_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){ //this check is redundant as avio_read should fail av_log(s, AV_LOG_ERROR, "extradata_size too large\n"); return -1; } - st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(st->codec->extradata_size+AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); diff --git a/libavformat/utils.c b/libavformat/utils.c index fd393082e4..d72f5331be 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2241,7 +2241,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) { st->codec->extradata_size = i; st->codec->extradata = av_mallocz(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); memcpy(st->codec->extradata, pkt->data, @@ -3083,7 +3083,7 @@ int ff_generate_avci_extradata(AVStream *st) av_freep(&st->codec->extradata); st->codec->extradata_size = 0; - st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); diff --git a/libavformat/vqf.c b/libavformat/vqf.c index c04ffe74ee..49895c03a8 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -215,7 +215,7 @@ static int vqf_read_header(AVFormatContext *s) avpriv_set_pts_info(st, 64, size, st->codec->sample_rate); /* put first 12 bytes of COMM chunk in extradata */ - if (!(st->codec->extradata = av_malloc(12 + FF_INPUT_BUFFER_PADDING_SIZE))) + if (!(st->codec->extradata = av_malloc(12 + AV_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); st->codec->extradata_size = 12; memcpy(st->codec->extradata, comm_chunk, 12); diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c index 77da375e70..1f2359e83d 100644 --- a/libavformat/westwood_vqa.c +++ b/libavformat/westwood_vqa.c @@ -102,7 +102,7 @@ static int wsvqa_read_header(AVFormatContext *s) /* the VQA header needs to go to the decoder */ st->codec->extradata_size = VQA_HEADER_SIZE; - st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); header = (unsigned char *)st->codec->extradata; if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) != VQA_HEADER_SIZE) { @@ -224,7 +224,7 @@ static int wsvqa_read_packet(AVFormatContext *s, case SND2_TAG: st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_WS; st->codec->extradata_size = 2; - st->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(2 + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); AV_WL16(st->codec->extradata, wsvqa->version); diff --git a/libavformat/xmv.c b/libavformat/xmv.c index bcb17f8893..b8e3191607 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -393,7 +393,7 @@ static int xmv_process_packet_header(AVFormatContext *s) av_free(vst->codec->extradata); vst->codec->extradata = - av_malloc(4 + FF_INPUT_BUFFER_PADDING_SIZE); + av_malloc(4 + AV_INPUT_BUFFER_PADDING_SIZE); vst->codec->extradata_size = 4; } diff --git a/libavformat/xwma.c b/libavformat/xwma.c index cab4616070..b24cde857b 100644 --- a/libavformat/xwma.c +++ b/libavformat/xwma.c @@ -105,7 +105,7 @@ static int xwma_read_header(AVFormatContext *s) st->codec->extradata_size); } else { st->codec->extradata_size = 6; - st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(6 + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); diff --git a/libavformat/yop.c b/libavformat/yop.c index 08fcc19e3c..b809ad2b56 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -63,7 +63,7 @@ static int yop_read_header(AVFormatContext *s) // Extra data that will be passed to the decoder - video_stream->codec->extradata = av_mallocz(8 + FF_INPUT_BUFFER_PADDING_SIZE); + video_stream->codec->extradata = av_mallocz(8 + AV_INPUT_BUFFER_PADDING_SIZE); if (!video_stream->codec->extradata) return AVERROR(ENOMEM); |