diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-27 22:53:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-27 23:15:19 +0200 |
commit | 29d147c94dd40a78ca3981f39365cc77dae9a0da (patch) | |
tree | d1f9dd7af406734c411a71db6a6973261c2a95e8 | |
parent | 444e9874a75c821ad4a1b487559ee8ca1c999712 (diff) | |
parent | 059a934806d61f7af9ab3fd9f74994b838ea5eba (diff) | |
download | ffmpeg-29d147c94dd40a78ca3981f39365cc77dae9a0da.tar.gz |
Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
lavc: Consistently prefix input buffer defines
Conflicts:
doc/examples/decoding_encoding.c
libavcodec/4xm.c
libavcodec/aac_adtstoasc_bsf.c
libavcodec/aacdec.c
libavcodec/aacenc.c
libavcodec/ac3dec.h
libavcodec/asvenc.c
libavcodec/avcodec.h
libavcodec/avpacket.c
libavcodec/dvdec.c
libavcodec/ffv1enc.c
libavcodec/g2meet.c
libavcodec/gif.c
libavcodec/h264.c
libavcodec/h264_mp4toannexb_bsf.c
libavcodec/huffyuvdec.c
libavcodec/huffyuvenc.c
libavcodec/jpeglsenc.c
libavcodec/libxvid.c
libavcodec/mdec.c
libavcodec/motionpixels.c
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.c
libavcodec/noise_bsf.c
libavcodec/nuv.c
libavcodec/nvenc.c
libavcodec/options.c
libavcodec/parser.c
libavcodec/pngenc.c
libavcodec/proresenc_kostya.c
libavcodec/qsvdec.c
libavcodec/svq1enc.c
libavcodec/tiffenc.c
libavcodec/truemotion2.c
libavcodec/utils.c
libavcodec/utvideoenc.c
libavcodec/vc1dec.c
libavcodec/wmalosslessdec.c
libavformat/adxdec.c
libavformat/aiffdec.c
libavformat/apc.c
libavformat/apetag.c
libavformat/avidec.c
libavformat/bink.c
libavformat/cafdec.c
libavformat/flvdec.c
libavformat/id3v2.c
libavformat/isom.c
libavformat/matroskadec.c
libavformat/mov.c
libavformat/mpc.c
libavformat/mpc8.c
libavformat/mpegts.c
libavformat/mvi.c
libavformat/mxfdec.c
libavformat/mxg.c
libavformat/nutdec.c
libavformat/oggdec.c
libavformat/oggparsecelt.c
libavformat/oggparseflac.c
libavformat/oggparseopus.c
libavformat/oggparsespeex.c
libavformat/omadec.c
libavformat/rawdec.c
libavformat/riffdec.c
libavformat/rl2.c
libavformat/rmdec.c
libavformat/rtpdec_latm.c
libavformat/rtpdec_mpeg4.c
libavformat/rtpdec_qdm2.c
libavformat/rtpdec_svq3.c
libavformat/sierravmd.c
libavformat/smacker.c
libavformat/smush.c
libavformat/spdifenc.c
libavformat/takdec.c
libavformat/tta.c
libavformat/utils.c
libavformat/vqf.c
libavformat/westwood_vqa.c
libavformat/xmv.c
libavformat/xwma.c
libavformat/yop.c
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
153 files changed, 296 insertions, 287 deletions
diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c index e1f4ae36ae..fb386eb184 100644 --- a/doc/examples/decoding_encoding.c +++ b/doc/examples/decoding_encoding.c @@ -245,7 +245,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; @@ -538,13 +538,13 @@ static void video_decode_example(const char *outfilename, const char *filename) int frame_count; FILE *f; AVFrame *frame; - uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; 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("Decode video file %s to %s\n", filename, outfilename); 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; @@ -643,7 +643,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) int ret; if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) { - ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (ost->st->codec->extradata) { memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); ost->st->codec->extradata_size = ost->enc_ctx->extradata_size; @@ -688,10 +688,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY); if(a == 0 && new_pkt.data != pkt->data && new_pkt.destruct) { - uint8_t *t = av_malloc(new_pkt.size + FF_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow + uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow if(t) { memcpy(t, new_pkt.data, new_pkt.size); - memset(t + new_pkt.size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE); new_pkt.data = t; new_pkt.buf = NULL; a = 1; @@ -2811,7 +2811,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/ffserver.c b/ffserver.c index c74cd157aa..5c8810af4d 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3510,7 +3510,7 @@ static void extract_mpeg4_header(AVFormatContext *infile) if (p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01 && p[3] == 0xb6) { size = p - pkt.data; - st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); st->codec->extradata_size = size; memcpy(st->codec->extradata, pkt.data, size); break; diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 9af4546bc0..a7a757a078 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -883,11 +883,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, } cfrm = &f->cfrm[i]; - if (data_size > UINT_MAX - cfrm->size - FF_INPUT_BUFFER_PADDING_SIZE) + if (data_size > UINT_MAX - cfrm->size - AV_INPUT_BUFFER_PADDING_SIZE) return AVERROR_INVALIDDATA; 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\n"); diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index 1587ac21ca..91aac0933f 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -235,7 +235,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 1f11d02499..9c117c6005 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -89,7 +89,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, } av_free(avctx->extradata); 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) { avctx->extradata_size = 0; return AVERROR(ENOMEM); diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c index cb93ba9482..0b868edcb2 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 2f1bb2a9cb..c0364033d6 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -322,14 +322,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/aacdec_template.c b/libavcodec/aacdec_template.c index dda8d51e2c..e29c803278 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -3098,7 +3098,7 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data, if (new_extradata && 0) { 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; diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index bace7cf6ec..ee1a835439 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -817,7 +817,7 @@ static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s) int ch; FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->buffer.samples, s->channels, 3 * 1024 * sizeof(s->buffer.samples[0]), alloc_fail); FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->cpe, s->chan_map[0], sizeof(ChannelElement), 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 678f08d2d7..5ab5627a46 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -166,7 +166,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, *phdr = &hdr; GetBitContext gbc; diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index 5259c60009..b3498fec96 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -235,7 +235,7 @@ typedef struct AC3DecodeContext { DECLARE_ALIGNED(32, INTFLOAT, window)[AC3_BLOCK_SIZE]; ///< window coefficients DECLARE_ALIGNED(32, INTFLOAT, tmp_output)[AC3_BLOCK_SIZE]; ///< temporary storage for output before windowing DECLARE_ALIGNED(32, SHORTFLOAT, 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 e671358331..9ceea09452 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -113,7 +113,7 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx) avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; avctx->bits_per_coded_sample = 4; 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 81ca9134d1..a87c373e25 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -531,7 +531,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 4b390b047a..d51df80331 100644 --- a/libavcodec/asvenc.c +++ b/libavcodec/asvenc.c @@ -265,7 +265,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } if ((ret = ff_alloc_packet2(avctx, pkt, a->mb_height * a->mb_width * MAX_MB_SIZE + - FF_MIN_BUFFER_SIZE, 0)) < 0) + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; init_put_bits(&a->pb, pkt->data, pkt->size); diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 89c877aecb..4bdb63f98b 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -886,7 +886,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 be340602c4..8163a992a1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -632,15 +632,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 32 +#define AV_INPUT_BUFFER_PADDING_SIZE 32 /** * @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 32 +/** + * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead + */ +#define FF_MIN_BUFFER_SIZE 16384 /** * @ingroup lavc_encoding @@ -1595,7 +1604,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 problems 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. @@ -4062,7 +4071,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 */ @@ -4399,7 +4408,7 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s * 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. * @@ -4439,7 +4448,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. * @@ -5447,7 +5456,7 @@ AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); /** * Same behaviour av_fast_malloc but the buffer has additional - * FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. * * In addition the whole buffer will initially and after resizes * be 0-initialized so that no uninitialized data will ever appear. diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 6ba9c0bc5e..10be9d53b8 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -68,14 +68,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; } @@ -105,20 +105,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) @@ -136,17 +136,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); @@ -174,9 +174,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); \ } \ @@ -185,7 +185,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) @@ -303,7 +303,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, @@ -311,7 +311,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_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + pkt->side_data[elems].data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!pkt->side_data[elems].data) return NULL; pkt->side_data[elems].size = size; @@ -366,7 +366,7 @@ int av_packet_merge_side_data(AVPacket *pkt){ AVBufferRef *buf; int i; uint8_t *p; - uint64_t size= pkt->size + 8LL + FF_INPUT_BUFFER_PADDING_SIZE; + uint64_t size= pkt->size + 8LL + AV_INPUT_BUFFER_PADDING_SIZE; AVPacket old= *pkt; for (i=0; i<old.side_data_elems; i++) { size += old.side_data[i].size + 5LL; @@ -383,7 +383,7 @@ FF_DISABLE_DEPRECATION_WARNINGS pkt->destruct = dummy_destruct_packet; FF_ENABLE_DEPRECATION_WARNINGS #endif - pkt->size = size - FF_INPUT_BUFFER_PADDING_SIZE; + pkt->size = size - AV_INPUT_BUFFER_PADDING_SIZE; bytestream_put_buffer(&p, old.data, old.size); for (i=old.side_data_elems-1; i>=0; i--) { bytestream_put_buffer(&p, old.side_data[i].data, old.side_data[i].size); @@ -392,7 +392,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } bytestream_put_be64(&p, FF_MERGE_MARKER); av_assert0(p-pkt->data == pkt->size); - memset(p, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(p, 0, AV_INPUT_BUFFER_PADDING_SIZE); av_free_packet(&old); pkt->side_data_elems = 0; pkt->side_data = NULL; @@ -425,7 +425,7 @@ int av_packet_split_side_data(AVPacket *pkt){ for (i=0; ; i++){ size= AV_RB32(p); av_assert0(size<=INT_MAX && p - pkt->data >= size); - pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + pkt->side_data[i].data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); pkt->side_data[i].size = size; pkt->side_data[i].type = p[4]&127; if (!pkt->side_data[i].data) diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c index 9643445c7e..281c2c1a87 100644 --- a/libavcodec/avuienc.c +++ b/libavcodec/avuienc.c @@ -30,7 +30,7 @@ static av_cold int avui_encode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Only 720x486 and 720x576 are supported.\n"); return AVERROR(EINVAL); } - if (!(avctx->extradata = av_mallocz(144 + FF_INPUT_BUFFER_PADDING_SIZE))) + if (!(avctx->extradata = av_mallocz(144 + AV_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); avctx->extradata_size = 144; memcpy(avctx->extradata, "\0\0\0\x18""APRGAPRG0001", 16); diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 82562b652c..5cc23311f5 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -302,10 +302,10 @@ 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); - memset(buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(buf + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); s->packet_buffer = buf; memcpy(s->packet_buffer, avpkt->data, avpkt->size); if ((ret = init_get_bits8(gb, s->packet_buffer, avpkt->size)) < 0) diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c index cd573c5d94..50d514b25d 100644 --- a/libavcodec/cdxl.c +++ b/libavcodec/cdxl.c @@ -272,7 +272,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 4f4f4fc8ce..673896d6cd 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1232,11 +1232,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/crystalhd.c b/libavcodec/crystalhd.c index a299a948e2..3cb32a8c59 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -422,7 +422,7 @@ static av_cold int init(AVCodecContext *avctx) int dummy_int; /* Back up the extradata so it can be restored at close time. */ - priv->orig_extradata = av_malloc(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + priv->orig_extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!priv->orig_extradata) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate copy of extradata\n"); diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index 9dafe706e2..337a99d2cb 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 a402eed148..7cf84899fc 100644 --- a/libavcodec/dss_sp.c +++ b/libavcodec/dss_sp.c @@ -66,7 +66,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 d40a52a829..08c422704d 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 0cece1fa26..679075e6a9 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -287,8 +287,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-s->avctx->lowres; int is_field_mode[5]; int vs_bit_buffer_damaged = 0; diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 70d65bea84..4e202f98a3 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -312,7 +312,7 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR(ENOMEM); s->bbdsp.bswap16_buf(s->bitstream_buf, (const uint16_t *)(buf + bytestream2_tell(&gb)), bytestream2_get_bytes_left(&gb) / 2); - memset((uint8_t*)s->bitstream_buf + bytestream2_get_bytes_left(&gb), 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset((uint8_t*)s->bitstream_buf + bytestream2_get_bytes_left(&gb), 0, AV_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&s->gb, s->bitstream_buf, 8*(bytestream2_get_bytes_left(&gb))); for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++) diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index e1322c0dc9..e24c320e32 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -550,7 +550,7 @@ static int write_extradata(FFV1Context *f) f->avctx->extradata_size = 10000 + 4 + (11 * 11 * 5 * 5 * 5 + 11 * 11 * 11) * 32; - f->avctx->extradata = av_malloc(f->avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + f->avctx->extradata = av_malloc(f->avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!f->avctx->extradata) return AVERROR(ENOMEM); ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size); @@ -1197,7 +1197,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t keystate = 128; uint8_t *buf_p; int i, ret; - int64_t maxsize = FF_MIN_BUFFER_SIZE + int64_t maxsize = AV_INPUT_BUFFER_MIN_SIZE + avctx->width*avctx->height*35LL*4; if(!pict) { @@ -1246,7 +1246,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } if (f->version > 3) - maxsize = FF_MIN_BUFFER_SIZE + avctx->width*avctx->height*3LL*4; + maxsize = AV_INPUT_BUFFER_MIN_SIZE + avctx->width*avctx->height*3LL*4; if ((ret = ff_alloc_packet2(avctx, pkt, maxsize, 0)) < 0) return ret; diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c index 9f048f91ef..c2c00f4916 100644 --- a/libavcodec/flashsv2enc.c +++ b/libavcodec/flashsv2enc.c @@ -854,7 +854,7 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int res; int keyframe = 0; - if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return res; /* First frame needs to be a keyframe */ diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index 857030361b..3e0573af93 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -193,7 +193,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; - if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + FF_INPUT_BUFFER_PADDING_SIZE)) + if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + AV_INPUT_BUFFER_PADDING_SIZE)) return AVERROR_INVALIDDATA; frame_size = bytestream2_get_le32(&g2); if (frame_size > buf_size) diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 3682d26d49..b1457b7f97 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); if((ret = init_get_bits8(&gb, c->buf, unesc_size)) < 0) return ret; @@ -1185,7 +1185,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 affaecb172..0d3db1f3cf 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -401,7 +401,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 @@ -432,7 +432,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 1b17377037..acdc0e1e0d 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -269,7 +269,7 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const uint32_t *palette = NULL; int ret; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; outbuf_ptr = pkt->data; end = pkt->data + pkt->size; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index abf1723e5a..8b575bee2e 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -324,7 +324,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 e919360f96..1693989977 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -57,7 +57,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; } @@ -178,7 +178,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, if (args && strstr(args, "private_spspps_buf")) ctx->private_spspps = 1; - ret = h264_extradata_to_annexb(ctx, avctx, FF_INPUT_BUFFER_PADDING_SIZE); + ret = h264_extradata_to_annexb(ctx, avctx, AV_INPUT_BUFFER_PADDING_SIZE); if (ret < 0) return ret; ctx->length_size = ret; diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index cc3aa8ee63..1f33b0cdfe 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -349,8 +349,8 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) int sh = s->ps.sps->pixel_shift; int left_pixels, right_pixels; - stride_dst = 2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE; - dst = lc->edge_emu_buffer + stride_dst + FF_INPUT_BUFFER_PADDING_SIZE; + stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE; + dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE; if (!top_edge) { int left = 1 - left_edge; diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c index 4263eae6ba..15890f73d7 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 66a6536515..63ed84a8de 100644 --- a/libavcodec/hevc_parse.c +++ b/libavcodec/hevc_parse.c @@ -91,7 +91,7 @@ int ff_hevc_extract_rbsp(HEVCContext *s, 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); @@ -137,7 +137,7 @@ int ff_hevc_extract_rbsp(HEVCContext *s, 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/hevcdsp.h b/libavcodec/hevcdsp.h index d2ea8672b1..9f1f6dd59f 100644 --- a/libavcodec/hevcdsp.h +++ b/libavcodec/hevcdsp.h @@ -61,7 +61,7 @@ typedef struct HEVCDSPContext { void (*sao_band_filter[5])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, int16_t *sao_offset_val, int sao_left_class, int width, int height); - /* implicit stride_src parameter has value of 2 * MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE */ + /* implicit stride_src parameter has value of 2 * MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE */ void (*sao_edge_filter[5])(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst, int16_t *sao_offset_val, int sao_eo_class, int width, int height); diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index cec28e4550..c547eec4f9 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -341,7 +341,7 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride pixel *src = (pixel *)_src; int a_stride, b_stride; int x, y; - ptrdiff_t stride_src = (2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); + ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); stride_dst /= sizeof(pixel); a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index a6ba96be32..a700abb941 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -41,7 +41,7 @@ #include "libavutil/pixdesc.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, @@ -49,7 +49,7 @@ static const unsigned char classic_shift_luma[classic_shift_luma_table_size + FF }; #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, diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 65d2520dc1..65b165aaa0 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -760,7 +760,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame * const p = pict; int i, j, size = 0, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; if (s->context) { diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 4f947bfbf0..9d1f9a77d1 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -240,7 +240,7 @@ static int extract_header(AVCodecContext *const avctx, avctx->pix_fmt = AV_PIX_FMT_RGB32; av_freep(&s->mask_buf); av_freep(&s->mask_palbuf); - s->mask_buf = av_malloc((s->planesize * 32) + FF_INPUT_BUFFER_PADDING_SIZE); + s->mask_buf = av_malloc((s->planesize * 32) + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->mask_buf) return AVERROR(ENOMEM); if (s->bpp > 16) { @@ -248,7 +248,7 @@ static int extract_header(AVCodecContext *const avctx, av_freep(&s->mask_buf); return AVERROR(ENOMEM); } - s->mask_palbuf = av_malloc((2 << s->bpp) * sizeof(uint32_t) + FF_INPUT_BUFFER_PADDING_SIZE); + s->mask_palbuf = av_malloc((2 << s->bpp) * sizeof(uint32_t) + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->mask_palbuf) { av_freep(&s->mask_buf); return AVERROR(ENOMEM); @@ -275,12 +275,12 @@ static int extract_header(AVCodecContext *const avctx, int ham_count; const uint8_t *const palette = avctx->extradata + AV_RB16(avctx->extradata); - s->ham_buf = av_malloc((s->planesize * 8) + FF_INPUT_BUFFER_PADDING_SIZE); + s->ham_buf = av_malloc((s->planesize * 8) + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->ham_buf) return AVERROR(ENOMEM); ham_count = 8 * (1 << s->ham); - s->ham_palbuf = av_malloc((ham_count << !!(s->masking == MASK_HAS_MASK)) * sizeof (uint32_t) + FF_INPUT_BUFFER_PADDING_SIZE); + s->ham_palbuf = av_malloc((ham_count << !!(s->masking == MASK_HAS_MASK)) * sizeof (uint32_t) + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->ham_palbuf) { av_freep(&s->ham_buf); return AVERROR(ENOMEM); @@ -366,7 +366,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 2910d308c6..14f9fa30a5 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -1021,7 +1021,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 d53f338a4f..3a69e98c04 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 97b89c1c1d..202f82d7e5 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -200,7 +200,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/j2kenc.c b/libavcodec/j2kenc.c index 001718d6da..046e3411fd 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -955,7 +955,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, Jpeg2000EncoderContext *s = avctx->priv_data; uint8_t *chunkstart, *jp2cstart, *jp2hstart; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; // init: diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c index 683728e374..87650170fa 100644 --- a/libavcodec/jpeg2000.c +++ b/libavcodec/jpeg2000.c @@ -215,13 +215,13 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, (comp->coord[1][1] - comp->coord[1][0]); if (codsty->transform == FF_DWT97) { - csize += FF_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->f_data); + csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->f_data); comp->i_data = NULL; comp->f_data = av_mallocz_array(csize, sizeof(*comp->f_data)); if (!comp->f_data) return AVERROR(ENOMEM); } else { - csize += FF_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->i_data); + csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->i_data); comp->f_data = NULL; comp->i_data = av_mallocz_array(csize, sizeof(*comp->i_data)); if (!comp->i_data) diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c index 4e8cd63f6b..1e1a22bed2 100644 --- a/libavcodec/jpeglsenc.c +++ b/libavcodec/jpeglsenc.c @@ -269,7 +269,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt, comps = 3; if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width *avctx->height * comps * 4 + - FF_MIN_BUFFER_SIZE, 0)) < 0) + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; buf2 = av_malloc(pkt->size); diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c index a6efba5e97..1b1e08bd99 100644 --- a/libavcodec/lclenc.c +++ b/libavcodec/lclenc.c @@ -131,7 +131,7 @@ static av_cold int encode_init(AVCodecContext *avctx) av_assert0(avctx->width && avctx->height); - avctx->extradata = av_mallocz(8 + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(8 + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); diff --git a/libavcodec/libaacplus.c b/libavcodec/libaacplus.c index 3bf24c7206..fe380871b1 100644 --- a/libavcodec/libaacplus.c +++ b/libavcodec/libaacplus.c @@ -81,7 +81,7 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx) if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &buffer, &decoder_specific_info_size) == 1) { - 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) { free(buffer); return AVERROR(ENOMEM); diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index 72fae62fa2..9422e88949 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -56,7 +56,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 3d8a354d90..98b3ba8183 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -138,7 +138,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 9e844ff513..5df0c90947 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 300e24540c..101dd53da3 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 072779bb44..48dbebcfc4 100644 --- a/libavcodec/libopusenc.c +++ b/libavcodec/libopusenc.c @@ -269,7 +269,7 @@ static av_cold int 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 53d76c3385..fbc17388a1 100644 --- a/libavcodec/libspeexenc.c +++ b/libavcodec/libspeexenc.c @@ -245,7 +245,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/libstagefright.cpp b/libavcodec/libstagefright.cpp index 9ea96f3862..f4b38e6070 100644 --- a/libavcodec/libstagefright.cpp +++ b/libavcodec/libstagefright.cpp @@ -272,7 +272,7 @@ static av_cold int Stagefright_init(AVCodecContext *avctx) s->orig_extradata_size = avctx->extradata_size; s->orig_extradata = (uint8_t*) av_mallocz(avctx->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!s->orig_extradata) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 7715d1ce83..7f21ad2e0d 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/libvorbisenc.c b/libavcodec/libvorbisenc.c index 00a5131b51..3ca5b55e8e 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -231,7 +231,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 f4f0548c51..a15ef1a95c 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 14a6adf5ba..a4d2c79c64 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 e6f0dbdd2a..8cbeef2b39 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -716,7 +716,7 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, xvid_enc_frame_t xvid_enc_frame = { 0 }; xvid_enc_stats_t xvid_enc_stats = { 0 }; - if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*(int64_t)mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*(int64_t)mb_height*MAX_MB_BYTES + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; /* Start setting up the frame */ diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 70574b6110..896814543f 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -217,7 +217,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_BGR0 diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c index 87829fae8f..d6d41e6bbb 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 7a0f02cc91..ad618e25c9 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1905,7 +1905,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 %"PTRDIFF_SPECIFIER" bytes\n", (buf_end - *buf_ptr) - (dst - s->buffer)); @@ -1950,7 +1950,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/movsub_bsf.c b/libavcodec/movsub_bsf.c index 4820b26388..8ee7a3a42d 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); @@ -46,7 +46,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/movtextenc.c b/libavcodec/movtextenc.c index 3219858894..6d42d5f351 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -189,7 +189,7 @@ static av_cold int mov_text_encode_init(AVCodecContext *avctx) MovTextContext *s = avctx->priv_data; avctx->extradata_size = sizeof text_sample_entry; - 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/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c index df455322df..95c0b5b769 100644 --- a/libavcodec/mp3_header_decompress_bsf.c +++ b/libavcodec/mp3_header_decompress_bsf.c @@ -71,8 +71,8 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext header |= (frame_size == buf_size + 4)<<16; //FIXME actually set a correct crc instead of 0 *poutbuf_size= frame_size; - *poutbuf= av_malloc(frame_size + FF_INPUT_BUFFER_PADDING_SIZE); - memcpy(*poutbuf + frame_size - buf_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + *poutbuf= av_malloc(frame_size + AV_INPUT_BUFFER_PADDING_SIZE); + memcpy(*poutbuf + frame_size - buf_size, buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE); if(avctx->channels==2){ uint8_t *p= *poutbuf + frame_size - buf_size; diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c b/libavcodec/mpeg4_unpack_bframes_bsf.c index e85ea08b08..df49d3f407 100644 --- a/libavcodec/mpeg4_unpack_bframes_bsf.c +++ b/libavcodec/mpeg4_unpack_bframes_bsf.c @@ -73,11 +73,11 @@ static void scan_buffer(const uint8_t *buf, int buf_size, /* allocate new buffer and copy size bytes from src */ static uint8_t *create_new_buffer(const uint8_t *src, int size) { - uint8_t *dst = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + uint8_t *dst = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (dst) { memcpy(dst, src, size); - memset(dst + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(dst + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } return dst; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 1271275f34..991c0fd36c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -573,7 +573,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); @@ -586,7 +586,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/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index eb1daf21a2..002843a60e 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1740,7 +1740,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, /* output? */ if (s->new_picture.f->data[0]) { int growing_buffer = context_count == 1 && !pkt->data && !s->data_partitioning; - int pkt_size = growing_buffer ? FFMAX(s->mb_width*s->mb_height*64+10000, avctx->internal->byte_buffer_size) - FF_INPUT_BUFFER_PADDING_SIZE + int pkt_size = growing_buffer ? FFMAX(s->mb_width*s->mb_height*64+10000, avctx->internal->byte_buffer_size) - AV_INPUT_BUFFER_PADDING_SIZE : s->mb_width*s->mb_height*(MAX_MB_BYTES+100)+10000; if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, 0)) < 0) diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index e4ff818300..74e52af6cd 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -477,7 +477,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); if ((ret = init_get_bits8(&gb, buf, buf_size)) < 0) diff --git a/libavcodec/msvideo1enc.c b/libavcodec/msvideo1enc.c index ac32cae1bc..b6ae92b2ac 100644 --- a/libavcodec/msvideo1enc.c +++ b/libavcodec/msvideo1enc.c @@ -76,7 +76,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int skips = 0; int quality = 24; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; dst= buf= pkt->data; diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index 4f609de7bf..556ad5c549 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -35,11 +35,11 @@ static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const ch if(amount <= 0) return AVERROR(EINVAL); - *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 6757b4d6be..f3270cb19d 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -124,7 +124,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, if (width != c->width || height != c->height) { // also reserve space for a possible additional header int buf_size = height * width * 3 / 2 - + FFMAX(AV_LZO_OUTPUT_PADDING, FF_INPUT_BUFFER_PADDING_SIZE) + + FFMAX(AV_LZO_OUTPUT_PADDING, AV_INPUT_BUFFER_PADDING_SIZE) + RTJPEG_HEADER_SIZE; if (buf_size > INT_MAX/8) return -1; @@ -208,15 +208,15 @@ retry: buf = &buf[12]; buf_size -= 12; if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) { - int outlen = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING); + int outlen = c->decomp_size - FFMAX(AV_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING); 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"); return AVERROR_INVALIDDATA; } buf = c->decomp_buf; - buf_size = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING) - outlen; - memset(c->decomp_buf + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + buf_size = c->decomp_size - FFMAX(AV_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING) - outlen; + memset(c->decomp_buf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } if (c->codec_frameheader) { int w, h, q; diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 6bd6b892bb..93fa9c689c 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1014,7 +1014,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) } avctx->extradata_size = outSize; - avctx->extradata = av_mallocz(outSize + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(outSize + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { res = AVERROR(ENOMEM); diff --git a/libavcodec/options.c b/libavcodec/options.c index 63a03ace4a..37f379245d 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -232,7 +232,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); dest->extradata_size = src->extradata_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); diff --git a/libavcodec/parser.c b/libavcodec/parser.c index c16546b1c9..f5bfa249d9 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -134,7 +134,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 = @@ -204,13 +204,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; } } @@ -252,10 +252,10 @@ 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) { - av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", *buf_size + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); + av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", *buf_size + pc->index + AV_INPUT_BUFFER_PADDING_SIZE); pc->index = 0; return AVERROR(ENOMEM); } @@ -272,17 +272,17 @@ 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) { - av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); + av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", next + pc->index + AV_INPUT_BUFFER_PADDING_SIZE); pc->overread_index = pc->index = 0; 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/pcx.c b/libavcodec/pcx.c index 0e89388f00..1d3ee8d96a 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -143,7 +143,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ptr = p->data[0]; stride = p->linesize[0]; - scanline = av_malloc(bytes_per_scanline + FF_INPUT_BUFFER_PADDING_SIZE); + scanline = av_malloc(bytes_per_scanline + AV_INPUT_BUFFER_PADDING_SIZE); if (!scanline) return AVERROR(ENOMEM); diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 6bd996d7c5..af8ca4e7a3 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -495,7 +495,7 @@ static int encode_png(AVCodecContext *avctx, AVPacket *pkt, enc_row_size = deflateBound(&s->zstream, (avctx->width * s->bits_per_pixel + 7) >> 3); max_packet_size = - FF_MIN_BUFFER_SIZE + // headers + AV_INPUT_BUFFER_MIN_SIZE + // headers avctx->height * ( enc_row_size + 12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // IDAT * ceil(enc_row_size / IOBUF_SIZE) @@ -553,7 +553,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, enc_row_size = deflateBound(&s->zstream, (avctx->width * s->bits_per_pixel + 7) >> 3); max_packet_size = - FF_MIN_BUFFER_SIZE + // headers + AV_INPUT_BUFFER_MIN_SIZE + // headers avctx->height * ( enc_row_size + (4 + 12) * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // fdAT * ceil(enc_row_size / IOBUF_SIZE) diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c index 2a9e3e1cba..a5eb81f5f6 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_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 41d83ca50a..138223ecf2 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -491,10 +491,10 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int header_size = 148; uint8_t *buf; int pic_size, ret; - int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + FF_MIN_BUFFER_SIZE; //FIXME choose tighter limit + int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + AV_INPUT_BUFFER_MIN_SIZE; //FIXME choose tighter limit - if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; buf = pkt->data; diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 06314432f5..3bc1d5d772 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -944,7 +944,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ctx->pic = pic; pkt_size = ctx->frame_size_upper_bound; - if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; orig_buf = pkt->data; diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index f2194887ad..c9dbe7ddb5 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -189,7 +189,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); @@ -197,7 +197,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 c7431e6b2c..d1f1b172c3 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 65a6676469..0f5be96eb7 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 = 8192; // 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); @@ -445,7 +445,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, buf_size = FFMIN(buf_size, s->max_framesize - s->bitstream_size); input_buf_size = buf_size; - if (s->bitstream_index + s->bitstream_size + buf_size + FF_INPUT_BUFFER_PADDING_SIZE > + if (s->bitstream_index + s->bitstream_size + buf_size + AV_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_size) { memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 8ecbb4651e..134c8c12d3 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -1555,7 +1555,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t rc_header_bak[sizeof(s->header_state)]; uint8_t rc_block_bak[sizeof(s->block_state)]; - if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + FF_MIN_BUFFER_SIZE, 0)) < 0) + if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; ff_init_range_encoder(c, pkt->data, pkt->size); diff --git a/libavcodec/startcode.c b/libavcodec/startcode.c index 940bbb7107..9efdffe8c6 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 5221651b77..ab9c221161 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -589,7 +589,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int i, ret; if ((ret = ff_alloc_packet2(avctx, pkt, s->y_block_width * s->y_block_height * - MAX_MB_BYTES*3 + FF_MIN_BUFFER_SIZE, 0)) < 0) + MAX_MB_BYTES*3 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; if (avctx->pix_fmt != AV_PIX_FMT_YUV410P) { diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 8dd31ebc7e..d5584a5636 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -453,7 +453,7 @@ static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride, int i, ret = 0; int line; 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, @@ -471,7 +471,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); if (s->bpp < 8 && s->avctx->pix_fmt == AV_PIX_FMT_PAL8) diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 7056cdc820..fbbea1a7e1 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -329,7 +329,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp * s->subsampling[0] * s->subsampling[1] + 7) >> 3; packet_size = avctx->height * bytes_per_row * 2 + - avctx->height * 4 + FF_MIN_BUFFER_SIZE; + avctx->height * 4 + AV_INPUT_BUFFER_MIN_SIZE; if ((ret = ff_alloc_packet2(avctx, pkt, packet_size, 0)) < 0) return ret; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d6de975f59..0b2e5f1da8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -126,25 +126,25 @@ static void *avformat_mutex; void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size) { uint8_t **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; } - if (!ff_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE, 1)) - memset(*p + min_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1)) + memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size) { uint8_t **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; } - if (!ff_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE, 1)) - memset(*p, 0, min_size + FF_INPUT_BUFFER_PADDING_SIZE); + if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1)) + memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE); } /* encoder management */ @@ -1783,9 +1783,9 @@ int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64 av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size); return AVERROR(EINVAL); } - if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { + if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %"PRId64" (max allowed is %d)\n", - size, INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE); + size, INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); return AVERROR(EINVAL); } @@ -1992,7 +1992,7 @@ FF_ENABLE_DEPRECATION_WARNINGS if (!ret) { if (needs_realloc && avpkt->data) { - ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); + ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } @@ -2118,7 +2118,7 @@ int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf AVPacket pkt; int ret, got_packet = 0; - if (buf_size < FF_MIN_BUFFER_SIZE) { + if (buf_size < AV_INPUT_BUFFER_MIN_SIZE) { av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n"); return -1; } @@ -2220,7 +2220,7 @@ FF_ENABLE_DEPRECATION_WARNINGS avpkt->pts = avpkt->dts = frame->pts; if (needs_realloc && avpkt->data) { - ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); + ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } @@ -2724,7 +2724,7 @@ static int recode_subtitle(AVCodecContext *avctx, inb = inpkt->data; inl = inpkt->size; - if (inl >= INT_MAX / UTF8_MAX_BYTES - FF_INPUT_BUFFER_PADDING_SIZE) { + if (inl >= INT_MAX / UTF8_MAX_BYTES - AV_INPUT_BUFFER_PADDING_SIZE) { av_log(avctx, AV_LOG_ERROR, "Subtitles packet is too big for recoding\n"); ret = AVERROR(ENOMEM); goto end; @@ -2813,7 +2813,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, * remaining bytes should have already been filled with zeros by the * original packet allocation anyway. */ memset(tmp.data + tmp.size, 0, - FFMIN(avpkt->size - tmp.size, FF_INPUT_BUFFER_PADDING_SIZE)); + FFMIN(avpkt->size - tmp.size, AV_INPUT_BUFFER_PADDING_SIZE)); } pkt_recoded = tmp; @@ -3869,7 +3869,7 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf) /* Note: the string is NUL terminated (so extradata can be read as a * string), but the ending character is not accounted in the size (in * binary formats you are likely not supposed to mux that character). When - * extradata is copied, it is also padded with FF_INPUT_BUFFER_PADDING_SIZE + * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE * zeros. */ avctx->extradata_size = buf->len; return 0; diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index ebce593041..760d9e5a7f 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -143,7 +143,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); @@ -385,7 +385,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 efba5381e9..b8e1cc33e5 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); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 6303fdfa3d..653ce9eb1b 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -486,7 +486,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); if (!buf2) return AVERROR(ENOMEM); @@ -657,7 +657,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 (!buf2) return AVERROR(ENOMEM); @@ -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(start + 4, size, @@ -711,7 +711,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, @@ -740,7 +740,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 bd51dba5f1..9bafe65e0e 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -299,7 +299,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 cc9d6f9f8a..4aad713fa8 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 381ec45f39..e814007ead 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -854,7 +854,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, *q++ = get_bits (&s->gb, 8); len --; } - memset(q, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(q, 0, AV_INPUT_BUFFER_PADDING_SIZE); s->last_superframe_len += 8*buf_size - 8; // s->reset_block_lengths = 1; //XXX is this needed ? @@ -893,7 +893,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 0ac5163e6e..e87291a01c 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -72,7 +72,7 @@ typedef struct WmallDecodeCtx { AVCodecContext *avctx; AVFrame *frame; LLAudDSPContext dsp; ///< accelerated DSP functions - 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 f864426c52..19dc335b32 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 3a509cb870..029dfdd8bf 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -203,7 +203,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/wmv2enc.c b/libavcodec/wmv2enc.c index ee2e51c306..8672d2277d 100644 --- a/libavcodec/wmv2enc.c +++ b/libavcodec/wmv2enc.c @@ -62,7 +62,7 @@ static av_cold int wmv2_encode_init(AVCodecContext *avctx) ff_wmv2_common_init(w); avctx->extradata_size = 4; - 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/wnv1.c b/libavcodec/wnv1.c index d5781991f1..9ff99b2f98 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -73,12 +73,12 @@ 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); } - memset(rbuf + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(rbuf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { av_free(rbuf); diff --git a/libavcodec/x86/hevc_sao.asm b/libavcodec/x86/hevc_sao.asm index 2461740bf3..c13a9a9aee 100644 --- a/libavcodec/x86/hevc_sao.asm +++ b/libavcodec/x86/hevc_sao.asm @@ -39,7 +39,7 @@ cextern pb_2 SECTION_TEXT %define MAX_PB_SIZE 64 -%define PADDING_SIZE 32 ; FF_INPUT_BUFFER_PADDING_SIZE +%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE ;****************************************************************************** ;SAO Band Filter diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 62249785cb..0c2eca02ee 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -975,7 +975,7 @@ dshow_add_device(AVFormatContext *avctx, codec->codec_id = AV_CODEC_ID_RAWVIDEO; if (bih->biCompression == BI_RGB || bih->biCompression == BI_BITFIELDS) { codec->bits_per_coded_sample = bih->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/vfwcap.c b/libavdevice/vfwcap.c index 10e6c69dcb..f536bc100f 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -396,7 +396,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 166575c9c2..f169f93665 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -231,7 +231,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 8fdad185f4..260e080962 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/anm.c b/libavformat/anm.c index f718797310..23200474bd 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/apetag.c b/libavformat/apetag.c index 26359205f8..2ee277f864 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -55,7 +55,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; } diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c index 6deff3b66b..84298aecfd 100644 --- a/libavformat/apngdec.c +++ b/libavformat/apngdec.c @@ -132,7 +132,7 @@ static int append_extradata(AVCodecContext *s, AVIOContext *pb, int len) return AVERROR_INVALIDDATA; new_size = previous_size + len; - new_extradata = av_realloc(s->extradata, new_size + FF_INPUT_BUFFER_PADDING_SIZE); + new_extradata = av_realloc(s->extradata, new_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!new_extradata) return AVERROR(ENOMEM); s->extradata = new_extradata; @@ -178,7 +178,7 @@ static int apng_read_header(AVFormatContext *s) return ret; /* extradata will contain every chunk up to the first fcTL (excluded) */ - st->codec->extradata = av_malloc(len + 12 + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = len + 12; diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 9c791649c8..a30b7d7212 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -517,7 +517,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) if (sizeX > 40) { st->codec->extradata_size = ffio_limit(pb, sizeX - 40); 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(pb, st->codec->extradata, st->codec->extradata_size); @@ -1394,12 +1394,12 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) } else { /* packet descrambling */ AVBufferRef *buf = av_buffer_alloc(asf_st->pkt.size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (buf) { uint8_t *newdata = buf->data; int offset = 0; memset(newdata + asf_st->pkt.size, 0, - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); while (offset < asf_st->pkt.size) { int off = offset / asf_st->ds_chunk_size; int row = off / asf_st->ds_span; diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c index ad601c89be..91c6e8612f 100644 --- a/libavformat/asfdec_o.c +++ b/libavformat/asfdec_o.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/avc.c b/libavformat/avc.c index 9d843e0ca4..f7b8f38a00 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -180,7 +180,7 @@ int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size) if (11 + sps_size + pps_size > *size) return AVERROR_INVALIDDATA; out_size = 8 + sps_size + pps_size; - out = av_mallocz(out_size + FF_INPUT_BUFFER_PADDING_SIZE); + out = av_mallocz(out_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!out) return AVERROR(ENOMEM); AV_WB32(&out[0], 0x00000001); diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 2f637225e9..42b75c0aee 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -823,7 +823,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 d3d9bbd15e..9b8fcce3eb 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -585,7 +585,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 ff850813e6..aceb3bfcb7 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1130,7 +1130,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) { @@ -1141,7 +1141,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/cafdec.c b/libavformat/cafdec.c index cc6ed0ce9f..bfbbb02627 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) { diff --git a/libavformat/dtsdec.c b/libavformat/dtsdec.c index da0fb61a60..ef283916e7 100644 --- a/libavformat/dtsdec.c +++ b/libavformat/dtsdec.c @@ -34,7 +34,7 @@ static int dts_probe(AVProbeData *p) int markers[4*16] = {0}; int sum, max, i; int64_t diff = 0; - uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 }; + uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 }; buf = p->buf + FFMIN(4096, p->buf_size); diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c index 669fd2e782..7bd98258e4 100644 --- a/libavformat/flac_picture.c +++ b/libavformat/flac_picture.c @@ -108,10 +108,10 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) ret = AVERROR_INVALIDDATA; goto fail; } - if (!(data = av_buffer_alloc(len + FF_INPUT_BUFFER_PADDING_SIZE))) { + if (!(data = av_buffer_alloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) { RETURN_ERROR(AVERROR(ENOMEM)); } - memset(data->data + len, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(data->data + len, 0, AV_INPUT_BUFFER_PADDING_SIZE); if (avio_read(pb, data->data, len) != len) { av_log(s, AV_LOG_ERROR, "Error reading attached picture data.\n"); if (s->error_recognition & AV_EF_EXPLODE) diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 4207fd2bf6..4c1f943581 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 345be1ea7d..36a179722f 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -654,7 +654,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 a9542ffd3d..47f18819a8 100644 --- a/libavformat/hevc.c +++ b/libavformat/hevc.c @@ -644,7 +644,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/hls.c b/libavformat/hls.c index 6d14d6bf98..05e08a953d 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -752,7 +752,7 @@ static int id3_has_changed_values(struct playlist *pls, AVDictionary *metadata, if (apic) { int size = pls->ctx->streams[1]->attached_pic.size; - if (size != apic->buf->size - FF_INPUT_BUFFER_PADDING_SIZE) + if (size != apic->buf->size - AV_INPUT_BUFFER_PADDING_SIZE) return 1; if (memcmp(apic->buf->data, pls->ctx->streams[1]->attached_pic.data, size) != 0) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 6eec60e896..addf937afd 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -605,10 +605,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 || !taglen || 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; @@ -1105,7 +1105,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/iff.c b/libavformat/iff.c index 7235bc1c9c..8ea3b38ac6 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -455,7 +455,7 @@ static int iff_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } st->codec->extradata_size = data_size + IFF_EXTRA_VIDEO_SIZE; - st->codec->extradata = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); if (avio_read(pb, st->codec->extradata + IFF_EXTRA_VIDEO_SIZE, data_size) < 0) @@ -682,7 +682,7 @@ static int iff_read_header(AVFormatContext *s) if (!st->codec->extradata) { st->codec->extradata_size = IFF_EXTRA_VIDEO_SIZE; - st->codec->extradata = av_malloc(IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_malloc(IFF_EXTRA_VIDEO_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); } diff --git a/libavformat/internal.h b/libavformat/internal.h index 1190dbdf60..77914d802c 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -449,7 +449,7 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, int size); /** - * Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end + * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end * which is always set to 0. * * @param size size of extradata @@ -458,7 +458,7 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, int ff_alloc_extradata(AVCodecContext *avctx, int size); /** - * Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end + * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end * which is always set to 0 and fill it from pb. * * @param size size of extradata diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 1ca0055877..63895d7efe 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -172,7 +172,7 @@ static int jacosub_read_header(AVFormatContext *s) jacosub->timeres = 30; - av_bprint_init(&header, 1024+FF_INPUT_BUFFER_PADDING_SIZE, 4096); + av_bprint_init(&header, 1024+AV_INPUT_BUFFER_PADDING_SIZE, 4096); while (!avio_feof(pb)) { int cmd_len; diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 64d31e0ee6..4d4f0c78c5 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 b546798118..1807caef9c 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1853,7 +1853,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); @@ -1866,13 +1866,13 @@ static int matroska_parse_tracks(AVFormatContext *s) extradata_size = 5; } else extradata_size = 2; - } else if (codec_id == AV_CODEC_ID_ALAC && track->codec_priv.size && track->codec_priv.size < INT_MAX - 12 - FF_INPUT_BUFFER_PADDING_SIZE) { + } else if (codec_id == AV_CODEC_ID_ALAC && track->codec_priv.size && track->codec_priv.size < INT_MAX - 12 - AV_INPUT_BUFFER_PADDING_SIZE) { /* Only ALAC's magic cookie is stored in Matroska's track headers. * Create the "atom size", "tag", and "tag version" fields the * 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); @@ -1882,7 +1882,7 @@ static int matroska_parse_tracks(AVFormatContext *s) track->codec_priv.size); } else if (codec_id == AV_CODEC_ID_TTA) { extradata_size = 30; - extradata = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!extradata) return AVERROR(ENOMEM); ffio_init_context(&b, extradata, extradata_size, 1, diff --git a/libavformat/mov.c b/libavformat/mov.c index 1624d4e10c..fdba34cf4a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1246,14 +1246,14 @@ static int mov_read_fiel(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_realloc_extradata(AVCodecContext *codec, MOVAtom atom) { int err = 0; - uint64_t size = (uint64_t)codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; + uint64_t size = (uint64_t)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(&codec->extradata, size)) < 0) { codec->extradata_size = 0; return err; } - codec->extradata_size = size - FF_INPUT_BUFFER_PADDING_SIZE; + codec->extradata_size = size - AV_INPUT_BUFFER_PADDING_SIZE; return 0; } @@ -1275,7 +1275,7 @@ static int64_t mov_read_atom_into_extradata(MOVContext *c, AVIOContext *pb, MOVA codec->extradata_size -= atom.size - err; result = err; } - memset(buf + 8 + err, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(buf + 8 + err, 0, AV_INPUT_BUFFER_PADDING_SIZE); return result; } @@ -1899,7 +1899,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); @@ -2336,7 +2336,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 8b7e582768..e03c4ec082 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -733,7 +733,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/mpc8.c b/libavformat/mpc8.c index 0cef65ff7d..bf597b88a5 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; ret = avio_read(s->pb, buf, size); if (ret != size) { @@ -162,7 +162,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) av_free(buf); return; } - memset(buf+size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(buf+size, 0, AV_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&gb, buf, size * 8); size = gb_get_v(&gb); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 6f4a47d577..3c1fcdd6fb 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -871,7 +871,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) @@ -903,8 +903,8 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl, int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; int dts_flag = -1, cts_flag = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; - uint8_t buf_padded[128 + FF_INPUT_BUFFER_PADDING_SIZE]; - int buf_padded_size = FFMIN(buf_size, sizeof(buf_padded) - FF_INPUT_BUFFER_PADDING_SIZE); + uint8_t buf_padded[128 + AV_INPUT_BUFFER_PADDING_SIZE]; + int buf_padded_size = FFMIN(buf_size, sizeof(buf_padded) - AV_INPUT_BUFFER_PADDING_SIZE); memcpy(buf_padded, buf, buf_padded_size); @@ -1036,7 +1036,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); @@ -1194,7 +1194,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; @@ -1793,7 +1793,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); @@ -2382,7 +2382,7 @@ static void finished_reading_packet(AVFormatContext *s, int raw_packet_size) static int handle_packets(MpegTSContext *ts, int64_t 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; int64_t packet_num; int ret = 0; @@ -2409,7 +2409,7 @@ static int handle_packets(MpegTSContext *ts, int64_t 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 (;;) { packet_num++; if (nb_packets != 0 && packet_num >= nb_packets || diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 34977b8197..3a34ebd5b5 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -111,7 +111,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) soi_pos = mxg->soi_ptr - mxg->buffer; buffer = av_fast_realloc(mxg->buffer, &mxg->buffer_size, current_pos + cache_size + - FF_INPUT_BUFFER_PADDING_SIZE); + AV_INPUT_BUFFER_PADDING_SIZE); if (!buffer) return AVERROR(ENOMEM); mxg->buffer = buffer; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 0a9f33717b..6edef13ff7 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -82,7 +82,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); if (os->buf) memcpy(os->buf, ost->streams[i].buf, os->bufpos); else @@ -263,7 +263,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) memset(os, 0, sizeof(*os)); 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; if (!os->buf) @@ -285,7 +285,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) 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) @@ -424,7 +424,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid) } 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); @@ -440,7 +440,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid) 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 (sid) *sid = idx; diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c index 54024e0a0a..ae8c3c850c 100644 --- a/libavformat/oggparseogm.c +++ b/libavformat/oggparseogm.c @@ -102,7 +102,7 @@ ogm_header(AVFormatContext *s, int idx) size -= 4; } if (size > 52) { - av_assert0(FF_INPUT_BUFFER_PADDING_SIZE <= 52); + av_assert0(AV_INPUT_BUFFER_PADDING_SIZE <= 52); size -= 52; ff_alloc_extradata(st->codec, size); bytestream2_get_buffer(&p, st->codec->extradata, st->codec->extradata_size); diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 91c70dfec9..e92d4c5170 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -127,11 +127,11 @@ 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; } - memset(st->codec->extradata + cds, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(st->codec->extradata + cds, 0, AV_INPUT_BUFFER_PADDING_SIZE); cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index dd44337437..59e7b75522 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -242,7 +242,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/rdt.c b/libavformat/rdt.c index bb56a8ba81..046d2732a4 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/redspark.c b/libavformat/redspark.c index 13a7b37d25..66c2dc5aae 100644 --- a/libavformat/redspark.c +++ b/libavformat/redspark.c @@ -67,7 +67,7 @@ static int redspark_read_header(AVFormatContext *s) return AVERROR(ENOMEM); codec = st->codec; - header = av_malloc(HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); + header = av_malloc(HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); if (!header) return AVERROR(ENOMEM); pbc = header; diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 832f15daa4..6b66b953eb 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -220,7 +220,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; } @@ -250,7 +250,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 2ac79dbf5e..b399be423e 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 51c2094882..815a72c2b2 100644 --- a/libavformat/rtpdec_hevc.c +++ b/libavformat/rtpdec_hevc.c @@ -152,7 +152,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; @@ -166,7 +166,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 7db92f60fa..aebba5741d 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); diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index ba701dc6cf..e11303fe01 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_xiph.c b/libavformat/rtpdec_xiph.c index eceb840580..9ea3b19386 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; if (ff_alloc_extradata(codec, extradata_alloc)) { av_log(codec, AV_LOG_ERROR, "Out of memory\n"); diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index cdcff24421..b4608a1c7c 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 3eb1a8ec2d..970ab4a8b4 100644 --- a/libavformat/takdec.c +++ b/libavformat/takdec.c @@ -82,10 +82,10 @@ static int tak_read_header(AVFormatContext *s) if (size <= 3) return AVERROR_INVALIDDATA; - buffer = av_malloc(size - 3 + FF_INPUT_BUFFER_PADDING_SIZE); + buffer = av_malloc(size - 3 + AV_INPUT_BUFFER_PADDING_SIZE); if (!buffer) return AVERROR(ENOMEM); - memset(buffer + size - 3, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(buffer + size - 3, 0, AV_INPUT_BUFFER_PADDING_SIZE); ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U); if (avio_read(pb, buffer, size - 3) != size - 3) { diff --git a/libavformat/utils.c b/libavformat/utils.c index 831d90a356..ccc2129126 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2922,14 +2922,14 @@ int ff_alloc_extradata(AVCodecContext *avctx, int size) { int ret; - if (size < 0 || size >= INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { + if (size < 0 || size >= INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { avctx->extradata = NULL; avctx->extradata_size = 0; return AVERROR(EINVAL); } - avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (avctx->extradata) { - memset(avctx->extradata + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(avctx->extradata + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); avctx->extradata_size = size; ret = 0; } else { |