diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-12 19:23:34 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-12 19:53:37 +0200 |
commit | bb015b519e29a125b794bf1a5e18c422bcb4090c (patch) | |
tree | 26195c9564b7b46800b2606e659b70e54fd11a92 | |
parent | acf7c5b8ee63d4a3614dd93aa7bcc23d582c3ccd (diff) | |
parent | 0ab76ddf313eeab70d06619ae0376fd7dd40761b (diff) | |
download | ffmpeg-bb015b519e29a125b794bf1a5e18c422bcb4090c.tar.gz |
Merge commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b' into release/0.10
* commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b':
avcodec: Introduce ff_get_buffer
Conflicts:
libavcodec/8svx.c
libavcodec/dpcm.c
libavcodec/utils.c
libavcodec/vmdav.c
libavcodec/yop.c
See: 668494acd8b20f974c7722895d4a6a14c1005f1e
Merged-by: Michael Niedermayer <michaelni@gmx.at>
70 files changed, 152 insertions, 82 deletions
@@ -1611,7 +1611,7 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic) if (pic->data[0] == NULL) { pic->buffer_hints |= FF_BUFFER_HINTS_READABLE; - return codec->get_buffer(codec, pic); + return input_get_buffer(codec, pic); } if ((codec->width != ref->video->w) || (codec->height != ref->video->h) || diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index e220ad13cc..a3ad6448d9 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -38,6 +38,7 @@ */ #include "avcodec.h" +#include "internal.h" /** decoder context */ typedef struct EightSvxContext { @@ -151,7 +152,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ esc->frame.nb_samples = (FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) +avctx->channels-1) / avctx->channels; - if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &esc->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 0986de12d6..f009942377 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2276,7 +2276,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, if (samples) { /* get output buffer */ ac->frame.nb_samples = samples; - if ((err = avctx->get_buffer(avctx, &ac->frame)) < 0) { + if ((err = ff_get_buffer(avctx, &ac->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return err; } diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 5e2c41a07b..386dc9302a 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1415,7 +1415,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ s->frame.nb_samples = s->num_blocks * 256; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 149fee1381..b90ad917a9 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "put_bits.h" #include "bytestream.h" @@ -556,7 +557,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ c->frame.nb_samples = nb_samples; - if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c index ec4b1041af..e5e4f13e5c 100644 --- a/libavcodec/adxdec.c +++ b/libavcodec/adxdec.c @@ -21,6 +21,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" #include "adx.h" #include "get_bits.h" @@ -140,7 +141,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ c->frame.nb_samples = num_blocks * BLOCK_SAMPLES; - if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/alac.c b/libavcodec/alac.c index f87313d202..3bfe2c0a91 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -47,6 +47,7 @@ #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "bytestream.h" #include "unary.h" @@ -417,7 +418,7 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } alac->frame.nb_samples = outputsamples; - if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &alac->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 3f2157f69b..2c674502c3 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -30,6 +30,7 @@ #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "unary.h" #include "mpeg4audio.h" @@ -1484,7 +1485,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, /* get output buffer */ ctx->frame.nb_samples = ctx->cur_frame_length; - if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index dc7f95ccbc..f2b0d3c1a7 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -44,6 +44,7 @@ #include <math.h> #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "libavutil/common.h" #include "celp_math.h" @@ -944,7 +945,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ p->avframe.nb_samples = AMR_BLOCK_SIZE; - if ((ret = avctx->get_buffer(avctx, &p->avframe)) < 0) { + if ((ret = ff_get_buffer(avctx, &p->avframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 663fd0f2e9..dd8f497e0d 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -27,6 +27,7 @@ #include "libavutil/lfg.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "lsp.h" #include "celp_math.h" @@ -1087,7 +1088,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ ctx->avframe.nb_samples = 4 * AMRWB_SFR_SIZE_16k; - if ((ret = avctx->get_buffer(avctx, &ctx->avframe)) < 0) { + if ((ret = ff_get_buffer(avctx, &ctx->avframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index ebcc288539..45d0380ab4 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -26,6 +26,7 @@ #include "libavutil/lfg.h" #include "avcodec.h" +#include "internal.h" #include "cga_data.h" #define ATTR_BOLD 0x01 /**< Bold/Bright-foreground (mode 1) */ @@ -222,7 +223,7 @@ static int execute_code(AVCodecContext * avctx, int c) if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); avcodec_set_dimensions(avctx, width, height); - ret = avctx->get_buffer(avctx, &s->frame); + ret = ff_get_buffer(avctx, &s->frame); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 89d023b723..779e4b7af6 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -22,6 +22,7 @@ #define BITSTREAM_READER_LE #include "avcodec.h" +#include "internal.h" #include "dsputil.h" #include "get_bits.h" #include "bytestream.h" @@ -887,7 +888,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = blockstodecode; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index c796235c80..a20c8e956f 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -33,6 +33,7 @@ #include <stdio.h> #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "fft.h" @@ -291,7 +292,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ q->frame.nb_samples = AT1_SU_SAMPLES; - if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 7777b04da2..ed80ee3f28 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -37,6 +37,7 @@ #include <stdio.h> #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "bytestream.h" @@ -852,7 +853,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ q->frame.nb_samples = SAMPLES_PER_FRAME; - if ((result = avctx->get_buffer(avctx, &q->frame)) < 0) { + if ((result = ff_get_buffer(avctx, &q->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return result; } diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 0c274b9e36..778b815f4b 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -29,6 +29,7 @@ */ #include "avcodec.h" +#include "internal.h" #define BITSTREAM_READER_LE #include "get_bits.h" #include "dsputil.h" @@ -340,7 +341,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = s->block_size / avctx->channels; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 951c25c71d..0104f4563a 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -20,6 +20,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "bytestream.h" #include "libavutil/avassert.h" @@ -274,7 +275,7 @@ static av_cold int decode_init(AVCodecContext *avctx) } c->pic.reference = 1; - if (avctx->get_buffer(avctx, &c->pic) < 0) { + if (ff_get_buffer(avctx, &c->pic) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -339,7 +340,7 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ c->frame.nb_samples = total_blocks * 32; - if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index 4d0e730ef5..1b5721533a 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -20,6 +20,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "bytestream.h" /** @@ -339,7 +340,7 @@ static int cdg_decode_frame(AVCodecContext *avctx, } cdg_init_frame(&new_frame); - ret = avctx->get_buffer(avctx, &new_frame); + ret = ff_get_buffer(avctx, &new_frame); if (ret) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; diff --git a/libavcodec/cook.c b/libavcodec/cook.c index b5a1ea460e..f6948a3e94 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -44,6 +44,7 @@ #include "libavutil/lfg.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "bytestream.h" @@ -991,7 +992,7 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ if (q->discarded_packets >= 2) { q->frame.nb_samples = q->samples_per_channel; - if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 314e04d8ae..434b889782 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -32,6 +32,7 @@ #include "libavutil/mathematics.h" #include "libavutil/audioconvert.h" #include "avcodec.h" +#include "internal.h" #include "dsputil.h" #include "fft.h" #include "get_bits.h" @@ -1895,7 +1896,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = 256 * (s->sample_blocks / 8); - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index cde4dc229b..9e0ed893d5 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -21,6 +21,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "bytestream.h" #include "libavutil/imgutils.h" @@ -325,7 +326,7 @@ static int dfa_decode_frame(AVCodecContext *avctx, if (s->pic.data[0]) avctx->release_buffer(avctx, &s->pic); - if ((ret = avctx->get_buffer(avctx, &s->pic))) { + if ((ret = ff_get_buffer(avctx, &s->pic))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index 4915223bc8..bba2a2b1cf 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -39,6 +39,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" #include "bytestream.h" typedef struct DPCMContext { @@ -216,7 +217,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = (out + s->channels - 1) / s->channels; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index fbac5df723..81cee7f5f6 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -25,6 +25,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "bytestream.h" #include "mathops.h" @@ -363,7 +364,7 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ cin->frame.nb_samples = avpkt->size - cin->initial_decode_frame; - if ((ret = avctx->get_buffer(avctx, &cin->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &cin->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c index 5f67fbdbef..f8ebb43b63 100644 --- a/libavcodec/dxtory.c +++ b/libavcodec/dxtory.c @@ -21,6 +21,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "libavutil/intreadwrite.h" static av_cold int decode_init(AVCodecContext *avctx) @@ -51,7 +52,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, } pic->reference = 0; - if ((ret = avctx->get_buffer(avctx, pic)) < 0) + if ((ret = ff_get_buffer(avctx, pic)) < 0) return ret; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 1a8a68b51c..dfe5cf5ab7 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -599,7 +599,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = s->blocksize; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c index 72bb0ef3c7..9e0a2870b2 100644 --- a/libavcodec/g722dec.c +++ b/libavcodec/g722dec.c @@ -35,6 +35,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "g722.h" #include "libavutil/opt.h" @@ -96,7 +97,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ c->frame.nb_samples = avpkt->size * 2; - if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 8c02a392cc..392a085c7c 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -448,7 +448,7 @@ static int g726_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ c->frame.nb_samples = out_samples; - if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c index eec515b41f..10cb6f0e21 100644 --- a/libavcodec/gsmdec.c +++ b/libavcodec/gsmdec.c @@ -25,6 +25,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "msgsmdec.h" @@ -72,7 +73,7 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = avctx->frame_size; - if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((res = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return res; } diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 5ea1a0dba3..de3fe6bba6 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -28,6 +28,7 @@ #include "libavutil/imgutils.h" #include "bytestream.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" // TODO: masking bits @@ -479,7 +480,7 @@ static int decode_frame_ilbm(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return res; } - } else if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) { + } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return res; } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt == PIX_FMT_PAL8) { @@ -579,7 +580,7 @@ static int decode_frame_byterun1(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return res; } - } else if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) { + } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return res; } else if (avctx->pix_fmt == PIX_FMT_PAL8) { diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 0c2b4b4a83..5179bc3621 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -36,6 +36,7 @@ #include <stdio.h> #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "fft.h" @@ -680,7 +681,7 @@ static int imc_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ q->frame.nb_samples = COEFFS; - if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 86a2dfbd2d..67859e57d2 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -32,6 +32,7 @@ #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" #include "dsputil.h" #include "bytestream.h" #include "get_bits.h" @@ -1097,7 +1098,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, avctx->release_buffer(avctx, &ctx->frame); ctx->frame.reference = 0; - if ((res = avctx->get_buffer(avctx, &ctx->frame)) < 0) { + if ((res = ff_get_buffer(avctx, &ctx->frame)) < 0) { av_log(ctx->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return res; } diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 72a89441c2..3e353be2b0 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -136,4 +136,7 @@ int avpriv_unlock_avformat(void); */ int ff_alloc_packet(AVPacket *avpkt, int size); + +int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame); + #endif /* AVCODEC_INTERNAL_H */ diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index bd590af2f9..fa6abdbfd6 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -28,6 +28,7 @@ #define BITSTREAM_READER_LE #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "ivi_common.h" #include "libavutil/common.h" @@ -942,7 +943,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size, ctx->frame.reference = 0; avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height); - if ((result = avctx->get_buffer(avctx, &ctx->frame)) < 0) { + if ((result = ff_get_buffer(avctx, &ctx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return result; } diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c index 264efa2a29..cd701ae75f 100644 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/imgutils.h" #include "avcodec.h" +#include "internal.h" typedef struct { AVCodecContext *avctx; @@ -70,7 +71,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac maxcnt = w * h; c->cur.reference = 3; - if ((res = avctx->get_buffer(avctx, &c->cur)) < 0) + if ((res = ff_get_buffer(avctx, &c->cur)) < 0) return res; out = (uint16_t *) c->cur.data[0]; if (c->prev.data[0]) { diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index 23950c0c21..cb85f02a18 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -188,7 +188,7 @@ static int libgsm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = avctx->frame_size; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 0de7130f19..1e567f4278 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -143,7 +143,7 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = 160; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -295,7 +295,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = 320; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c index fdc39532b7..ca3143c377 100644 --- a/libavcodec/libspeexdec.c +++ b/libavcodec/libspeexdec.c @@ -108,7 +108,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = s->frame_size; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/mace.c b/libavcodec/mace.c index fcd49d957f..2f510dda53 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -25,6 +25,7 @@ */ #include "avcodec.h" +#include "internal.h" /* * Adapted to libavcodec by Francois Revol <revol@free.fr> @@ -253,7 +254,7 @@ static int mace_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ ctx->frame.nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels; - if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 3d3e10bbf1..07db8d67d5 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -27,6 +27,7 @@ #include <stdint.h> #include "avcodec.h" +#include "internal.h" #include "dsputil.h" #include "libavutil/intreadwrite.h" #include "get_bits.h" @@ -982,7 +983,7 @@ static int output_data(MLPDecodeContext *m, unsigned int substr, /* get output buffer */ m->frame.nb_samples = s->blockpos; - if ((ret = avctx->get_buffer(avctx, &m->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &m->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 7a6d129610..38810cf191 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -27,6 +27,7 @@ #include "libavutil/lfg.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "mpegaudiodsp.h" @@ -217,7 +218,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ c->frame.nb_samples = buf[1] ? c->lastframelen : MPC_FRAME_SIZE; - if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 44ec30e73f..def79f4aab 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -27,6 +27,7 @@ #include "libavutil/lfg.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "mpegaudiodsp.h" @@ -253,7 +254,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ c->frame.nb_samples = MPC_FRAME_SIZE; - if ((res = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((res = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return res; } diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index fd195a1234..e4d29019ab 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -28,6 +28,7 @@ #include "libavutil/audioconvert.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "mathops.h" #include "mpegaudiodsp.h" @@ -1602,7 +1603,7 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT *samples, /* get output buffer */ if (!samples) { s->frame.nb_samples = s->avctx->frame_size; - if ((ret = s->avctx->get_buffer(s->avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(s->avctx, &s->frame)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -1908,7 +1909,7 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame->nb_samples = MPA_FRAME_SIZE; - if ((ret = avctx->get_buffer(avctx, s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c index 9f9212ce9b..636dd7076e 100644 --- a/libavcodec/mxpegdec.c +++ b/libavcodec/mxpegdec.c @@ -25,6 +25,7 @@ * MxPEG decoder */ +#include "internal.h" #include "mjpeg.h" #include "mjpegdec.h" @@ -250,7 +251,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx, /* use stored SOF data to allocate current picture */ if (jpg->picture_ptr->data[0]) avctx->release_buffer(avctx, jpg->picture_ptr); - if (avctx->get_buffer(avctx, jpg->picture_ptr) < 0) { + if (ff_get_buffer(avctx, jpg->picture_ptr) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return AVERROR(ENOMEM); } @@ -269,7 +270,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx, /* allocate dummy reference picture if needed */ if (!reference_ptr->data[0] && - avctx->get_buffer(avctx, reference_ptr) < 0) { + ff_get_buffer(avctx, reference_ptr) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 2a1ec5b4cd..74987e6b0f 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -36,6 +36,7 @@ #include "libavutil/random_seed.h" #include "libavutil/audioconvert.h" #include "avcodec.h" +#include "internal.h" #include "dsputil.h" #include "fft.h" #include "fmtconvert.h" @@ -184,7 +185,7 @@ static int decode_tag(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = NELLY_SAMPLES * blocks; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c index e7609f5b78..cf08373ce1 100644 --- a/libavcodec/pcm-mpeg.c +++ b/libavcodec/pcm-mpeg.c @@ -26,6 +26,7 @@ #include "libavutil/audioconvert.h" #include "avcodec.h" +#include "internal.h" #include "bytestream.h" /* @@ -163,7 +164,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = samples; - if ((retval = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((retval = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return retval; } diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index e658c9663f..35ccc9d8f4 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -304,7 +304,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = n * samples_per_block / avctx->channels; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 5214c21e3c..6884ebdd1c 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -589,7 +589,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); if (p->state == STATE_GET_BUFFER) { - p->result = p->avctx->get_buffer(p->avctx, p->requested_frame); + p->result = ff_get_buffer(p->avctx, p->requested_frame); p->state = STATE_SETTING_UP; pthread_cond_signal(&p->progress_cond); } @@ -946,7 +946,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) if (!(avctx->active_thread_type&FF_THREAD_FRAME)) { f->thread_opaque = NULL; - return avctx->get_buffer(avctx, f); + return ff_get_buffer(avctx, f); } if (p->state != STATE_SETTING_UP && @@ -969,7 +969,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) if (avctx->thread_safe_callbacks || avctx->get_buffer == avcodec_default_get_buffer) { - err = avctx->get_buffer(avctx, f); + err = ff_get_buffer(avctx, f); } else { p->requested_frame = f; p->state = STATE_GET_BUFFER; diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c index ac5c289c3d..33cee193f4 100644 --- a/libavcodec/qcelpdec.c +++ b/libavcodec/qcelpdec.c @@ -697,7 +697,7 @@ static int qcelp_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ q->avframe.nb_samples = 160; - if ((ret = avctx->get_buffer(avctx, &q->avframe)) < 0) { + if ((ret = ff_get_buffer(avctx, &q->avframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 63957a6965..e44dc8f470 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -37,6 +37,7 @@ #define BITSTREAM_READER_LE #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "rdft.h" @@ -2007,7 +2008,7 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = 16 * s->frame_size; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c index 428f788733..8b2bcacf59 100644 --- a/libavcodec/ra144dec.c +++ b/libavcodec/ra144dec.c @@ -24,6 +24,7 @@ #include "libavutil/intmath.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "ra144.h" @@ -77,7 +78,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ ractx->frame.nb_samples = NBLOCKS * BLOCKSIZE; - if ((ret = avctx->get_buffer(avctx, &ractx->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &ractx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index 26b576d804..43538f0186 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -20,6 +20,7 @@ */ #include "avcodec.h" +#include "internal.h" #define BITSTREAM_READER_LE #include "get_bits.h" #include "ra288.h" @@ -188,7 +189,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ ractx->frame.nb_samples = RA288_BLOCK_SIZE * RA288_BLOCKS_PER_FRAME; - if ((ret = avctx->get_buffer(avctx, &ractx->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &ractx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 88d6224eac..8ecb23c26b 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -59,6 +59,7 @@ #include "roqvideo.h" #include "bytestream.h" #include "elbg.h" +#include "internal.h" #include "mathops.h" #define CHROMA_BIAS 1 @@ -1031,8 +1032,8 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s if (enc->first_frame) { /* Alloc memory for the reconstruction data (we must know the stride for that) */ - if (avctx->get_buffer(avctx, enc->current_frame) || - avctx->get_buffer(avctx, enc->last_frame)) { + if (ff_get_buffer(avctx, enc->current_frame) || + ff_get_buffer(avctx, enc->last_frame)) { av_log(avctx, AV_LOG_ERROR, " RoQ: get_buffer() failed\n"); return -1; } diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c index 4a17fa102e..828d0ba207 100644 --- a/libavcodec/s302m.c +++ b/libavcodec/s302m.c @@ -22,6 +22,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" #define AES3_HEADER_LEN 4 @@ -104,7 +105,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ block_size = (avctx->bits_per_coded_sample + 4) / 4; s->frame.nb_samples = 2 * (buf_size / block_size) / avctx->channels; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 008a022a97..d1dc0dd94f 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -28,6 +28,7 @@ #include <limits.h> #include "avcodec.h" +#include "internal.h" #include "bytestream.h" #include "get_bits.h" #include "golomb.h" @@ -598,7 +599,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, if (s->cur_chan == s->channels) { /* get output buffer */ s->frame.nb_samples = s->blocksize; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index a0e4fd1972..ff7f07d477 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -27,6 +27,7 @@ #include "libavutil/mathematics.h" #include "avcodec.h" +#include "internal.h" #define BITSTREAM_READER_LE #include "get_bits.h" #include "dsputil.h" @@ -541,7 +542,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ ctx->frame.nb_samples = mode_par->frames_per_packet * subframe_size * mode_par->subframe_count; - if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 3b048e429b..12645b3849 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -32,6 +32,7 @@ #include <stdlib.h> #include "avcodec.h" +#include "internal.h" #include "libavutil/audioconvert.h" #include "mathops.h" @@ -637,7 +638,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1)); - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 2743b2f7d7..d478b5546b 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -512,8 +512,8 @@ static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, } if(!s->current_picture.data[0]){ - avctx->get_buffer(avctx, &s->current_picture); - avctx->get_buffer(avctx, &s->last_picture); + ff_get_buffer(avctx, &s->current_picture); + ff_get_buffer(avctx, &s->last_picture); s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16 * 2); } diff --git a/libavcodec/thread.h b/libavcodec/thread.h index 205e45035d..8dcbfc5d06 100644 --- a/libavcodec/thread.h +++ b/libavcodec/thread.h @@ -89,7 +89,7 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field); /** * Wrapper around get_buffer() for frame-multithreaded codecs. - * Call this function instead of avctx->get_buffer(f). + * Call this function instead of ff_get_buffer(f). * Cannot be called after the codec has called ff_thread_finish_setup(). * * @param avctx The current context. diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index 9bbbf5172e..fb96a3d3d1 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -21,6 +21,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" #include "dsputil.h" #include "get_bits.h" @@ -325,7 +326,7 @@ static int truespeech_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ c->frame.nb_samples = iterations * 240; - if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 455810774d..743344c3e2 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -31,6 +31,7 @@ //#define DEBUG #include <limits.h> #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "libavutil/crc.h" @@ -355,7 +356,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = framelen; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index e0b5747a30..abec32fb08 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -20,6 +20,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "fft.h" @@ -840,7 +841,7 @@ static int twin_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ if (tctx->discarded_packets >= 2) { tctx->frame.nb_samples = mtab->size; - if ((ret = avctx->get_buffer(avctx, &tctx->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &tctx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/utils.c b/libavcodec/utils.c index b3f485b170..6ecdfebbe2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -614,7 +614,7 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ if(pic->data[0] == NULL) { /* We will copy from buffer, so must be readable */ pic->buffer_hints |= FF_BUFFER_HINTS_READABLE; - return s->get_buffer(s, pic); + return ff_get_buffer(s, pic); } /* If internal buffer type return the same buffer */ @@ -630,7 +630,7 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ pic->data[i] = pic->base[i] = NULL; pic->opaque = NULL; /* Allocate new frame */ - if (s->get_buffer(s, pic)) + if (ff_get_buffer(s, pic)) return -1; /* Copy image data from old buffer to new buffer */ av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width, @@ -1982,7 +1982,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) ff_init_buffer_info(avctx, f); - return avctx->get_buffer(avctx, f); + return ff_get_buffer(avctx, f); } void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f) @@ -2036,3 +2036,16 @@ int avcodec_is_open(AVCodecContext *s) { return !!s->internal; } + +int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame) +{ + switch (avctx->codec_type) { + case AVMEDIA_TYPE_VIDEO: + if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) { + av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %dx%d\n", + avctx->width, avctx->height); + return AVERROR_INVALIDDATA; + } + } + return avctx->get_buffer(avctx, frame); +} diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index ad46b5c1f1..1e5f2caab8 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -45,10 +45,11 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" +#include "bytestream.h" #define VMD_HEADER_SIZE 0x330 #define PALETTE_COUNT 256 -#include "bytestream.h" /* * Video Decoder @@ -398,7 +399,7 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx, return buf_size; s->frame.reference = 3; - if (avctx->get_buffer(avctx, &s->frame)) { + if (ff_get_buffer(avctx, &s->frame)) { av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n"); return -1; } @@ -571,7 +572,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) / avctx->channels; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index b9b1753893..12c8cfac77 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -31,6 +31,7 @@ #define BITSTREAM_READER_LE #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "dsputil.h" #include "fft.h" @@ -1680,7 +1681,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data, /* get output buffer */ vc->frame.nb_samples = len; - if ((ret = avccontext->get_buffer(avccontext, &vc->frame)) < 0) { + if ((ret = ff_get_buffer(avccontext, &vc->frame)) < 0) { av_log(avccontext, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 867a3410ca..ae4946bc02 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -23,6 +23,7 @@ #include "libavutil/audioconvert.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "unary.h" @@ -1208,7 +1209,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = s->samples; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index 02f83f604b..a18ae887bd 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -34,6 +34,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "wma.h" #undef NDEBUG @@ -864,7 +865,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = nb_frames * s->frame_len; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index e04df49266..3a32dffacd 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1387,7 +1387,7 @@ static int decode_frame(WMAProDecodeCtx *s, int *got_frame_ptr) /* get output buffer */ s->frame.nb_samples = s->samples_per_frame; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); s->packet_loss = 1; return 0; diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 922c1a2ebd..f9de8945c9 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -29,6 +29,7 @@ #include <math.h> #include "avcodec.h" +#include "internal.h" #include "get_bits.h" #include "put_bits.h" #include "wmavoice_data.h" @@ -1814,7 +1815,7 @@ static int synth_superframe(AVCodecContext *ctx, int *got_frame_ptr) /* get output buffer */ s->frame.nb_samples = 480; - if ((res = ctx->get_buffer(ctx, &s->frame)) < 0) { + if ((res = ff_get_buffer(ctx, &s->frame)) < 0) { av_log(ctx, AV_LOG_ERROR, "get_buffer() failed\n"); return res; } diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c index 2cb8bb44a6..8694210f65 100644 --- a/libavcodec/ws-snd1.c +++ b/libavcodec/ws-snd1.c @@ -22,6 +22,7 @@ #include <stdint.h> #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" /** * @file @@ -89,7 +90,7 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ s->frame.nb_samples = out_size; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 7339e5b209..4e33a9e71a 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -34,6 +34,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" #include "bytestream.h" #define BITSTREAM_READER_LE #include "get_bits.h" @@ -566,7 +567,7 @@ static int xan_decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = avctx->get_buffer(avctx, &s->current_frame))) { + if ((ret = ff_get_buffer(avctx, &s->current_frame))) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } diff --git a/libavcodec/yop.c b/libavcodec/yop.c index fe52f53887..edcc3fb6bb 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -26,6 +26,7 @@ #include "libavutil/imgutils.h" #include "avcodec.h" +#include "internal.h" #include "get_bits.h" typedef struct YopDecContext { @@ -209,7 +210,7 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size, return AVERROR_INVALIDDATA; } - ret = avctx->get_buffer(avctx, &s->frame); + ret = ff_get_buffer(avctx, &s->frame); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; |