[FFmpeg-cvslog] avcodec: Introduce ff_get_buffer
Luca Barbato
git at videolan.org
Tue Aug 12 20:00:23 CEST 2014
ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Fri Aug 8 18:07:43 2014 +0200| [0ab76ddf313eeab70d06619ae0376fd7dd40761b] | committer: Luca Barbato
avcodec: Introduce ff_get_buffer
Validate the image size there as is done in the other release
branches.
Bug-Id: CVE-2011-3935
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ab76ddf313eeab70d06619ae0376fd7dd40761b
---
avplay.c | 2 +-
libavcodec/8svx.c | 3 ++-
libavcodec/aacdec.c | 2 +-
libavcodec/ac3dec.c | 2 +-
libavcodec/adpcm.c | 3 ++-
libavcodec/adxdec.c | 3 ++-
libavcodec/alac.c | 3 ++-
libavcodec/alsdec.c | 3 ++-
libavcodec/amrnbdec.c | 3 ++-
libavcodec/amrwbdec.c | 3 ++-
libavcodec/ansi.c | 3 ++-
libavcodec/apedec.c | 3 ++-
libavcodec/atrac1.c | 3 ++-
libavcodec/atrac3.c | 3 ++-
libavcodec/binkaudio.c | 3 ++-
libavcodec/bmv.c | 5 +++--
libavcodec/cdgraphics.c | 3 ++-
libavcodec/cook.c | 3 ++-
libavcodec/dca.c | 3 ++-
libavcodec/dfa.c | 3 ++-
libavcodec/dpcm.c | 3 ++-
libavcodec/dsicinav.c | 3 ++-
libavcodec/dxtory.c | 3 ++-
libavcodec/flacdec.c | 2 +-
libavcodec/g722dec.c | 3 ++-
libavcodec/g726.c | 2 +-
libavcodec/gsmdec.c | 3 ++-
libavcodec/iff.c | 5 +++--
libavcodec/imc.c | 3 ++-
libavcodec/indeo3.c | 3 ++-
libavcodec/internal.h | 3 +++
libavcodec/ivi_common.c | 3 ++-
libavcodec/kgv1dec.c | 3 ++-
libavcodec/libgsm.c | 2 +-
libavcodec/libopencore-amr.c | 4 ++--
libavcodec/libspeexdec.c | 2 +-
libavcodec/mace.c | 3 ++-
libavcodec/mlpdec.c | 3 ++-
libavcodec/mpc7.c | 3 ++-
libavcodec/mpc8.c | 3 ++-
libavcodec/mpegaudiodec.c | 5 +++--
libavcodec/mxpegdec.c | 4 ++--
libavcodec/nellymoserdec.c | 3 ++-
libavcodec/pcm-mpeg.c | 3 ++-
libavcodec/pcm.c | 2 +-
libavcodec/pthread.c | 6 +++---
libavcodec/qcelpdec.c | 2 +-
libavcodec/qdm2.c | 3 ++-
libavcodec/ra144dec.c | 3 ++-
libavcodec/ra288.c | 3 ++-
libavcodec/roqvideoenc.c | 4 ++--
libavcodec/s302m.c | 3 ++-
libavcodec/shorten.c | 3 ++-
libavcodec/sipr.c | 3 ++-
libavcodec/smacker.c | 3 ++-
libavcodec/svq1enc.c | 4 ++--
libavcodec/thread.h | 2 +-
libavcodec/truespeech.c | 3 ++-
libavcodec/tta.c | 3 ++-
libavcodec/twinvq.c | 3 ++-
libavcodec/utils.c | 19 ++++++++++++++++---
libavcodec/vmdav.c | 5 +++--
libavcodec/vorbisdec.c | 3 ++-
libavcodec/wavpack.c | 3 ++-
libavcodec/wmadec.c | 3 ++-
libavcodec/wmaprodec.c | 2 +-
libavcodec/wmavoice.c | 3 ++-
libavcodec/ws-snd1.c | 3 ++-
libavcodec/xan.c | 3 ++-
libavcodec/yop.c | 3 ++-
70 files changed, 149 insertions(+), 81 deletions(-)
diff --git a/avplay.c b/avplay.c
index 57fb864..be88116 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1584,7 +1584,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 4f11b8b..1057a72 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -29,6 +29,7 @@
*/
#include "avcodec.h"
+#include "internal.h"
/** decoder context */
typedef struct EightSvxContext {
@@ -141,7 +142,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
esc->frame.nb_samples = buf_size * (is_compr + 1);
- 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 83dd06b..9c44894 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -2246,7 +2246,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 039062b..a3c5819 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1411,7 +1411,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 5f7f140..fe4949d 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"
@@ -547,7 +548,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 3f7f5f4..de2d718 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 23b8951..c162e2f 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"
@@ -402,7 +403,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 7daa545..c49552d 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 a7d0b4e..d294fe9 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 b9ae9ec..893cd35 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 32c7ce4..3721bca 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) */
@@ -221,7 +222,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 745b14c..a9c3be4 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 9ead80d..128a66d 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 e31dd1d..5bfd038 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 d73ffcd..dc1028f 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 920e752..c0fe9b8 100644
--- a/libavcodec/bmv.c
+++ b/libavcodec/bmv.c
@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "bytestream.h"
enum BMVFlags{
@@ -265,7 +266,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_PAL8;
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;
}
@@ -330,7 +331,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 9ab00b4..f642287 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "bytestream.h"
/**
@@ -331,7 +332,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 7437852..df4fee5 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 4d71812..72b7bbf 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"
@@ -1902,7 +1903,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 0ae89a8..d9ff445 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 7f5dbfe..f4aaa95 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 {
@@ -213,7 +214,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = out / 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 1a33668..99eea8a 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"
@@ -362,7 +363,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 5f67fbd..f8ebb43 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 440a55d..f20dc3d 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 72bb0ef..9e0a287 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 85711f8..81aa7d0 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 97b6fe8..6fdf9fb 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 b931e40..4565724 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"
typedef struct {
@@ -260,7 +261,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_GRAY8) {
@@ -317,7 +318,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->bits_per_coded_sample <= 8 && avctx->pix_fmt != PIX_FMT_GRAY8) {
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index bee38b0..44bef9a 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 9e90fb1..c0957f0 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"
@@ -1095,7 +1096,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 441430e..66940a8 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -126,4 +126,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 84695a0..2539001 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"
@@ -940,7 +941,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 42bbcae..21f3080 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 1fa04cf..1098bce 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 ded9217..8265848 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 eba2f16..0ce09f4 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 d02b1dc..2d2f376 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 at 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 e74b202..6f6701f 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"
@@ -932,7 +933,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 b678afd..443c78b 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"
@@ -218,7 +219,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 f5eb4d6..5dadbef 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"
@@ -250,7 +251,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 e2216f3..ee67f12 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -26,6 +26,7 @@
#include "libavutil/audioconvert.h"
#include "avcodec.h"
+#include "internal.h"
#include "get_bits.h"
#include "mathops.h"
#include "mpegaudiodsp.h"
@@ -1604,7 +1605,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;
}
@@ -1910,7 +1911,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 6f0d045..fff5c7e 100644
--- a/libavcodec/mxpegdec.c
+++ b/libavcodec/mxpegdec.c
@@ -249,7 +249,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);
}
@@ -268,7 +268,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 69c1b86..1bc2b54 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"
@@ -179,7 +180,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 f010b97..0d0eba1 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"
/*
@@ -161,7 +162,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 cd44d77..23a03c4 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -302,7 +302,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 65c6e2f..345456c 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -573,7 +573,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 = p-ff_get_buffer(p->avctx, p->requested_frame);
p->state = STATE_SETTING_UP;
pthread_cond_signal(&p->progress_cond);
}
@@ -919,7 +919,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 &&
@@ -941,7 +941,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 a3af237..3d7420b 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 6b11b46..936c911 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"
@@ -2003,7 +2004,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 dd8838c..86c7eed 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 4cb2493..0d10545 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 2a62d55..58dd255 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -1031,8 +1031,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 34018ae..f18059d 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
@@ -94,7 +95,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 f96a003..2a127c5 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 818524c..b862e7d 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 e07fc37..bce23f4 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"
@@ -636,7 +637,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 ef136b9..82b828b 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 7f018fc..782c03c 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 5ef0a01..4b69b90 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 1743f7d..9ea7d03 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"
@@ -343,7 +344,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 c58a9bc..061ff76 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 7902e98..e657a2c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -552,7 +552,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 */
@@ -571,7 +571,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,
@@ -1815,7 +1815,7 @@ unsigned int avpriv_toupper4(unsigned int x)
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
{
f->owner = avctx;
- return avctx->get_buffer(avctx, f);
+ return ff_get_buffer(avctx, f);
}
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
@@ -1863,3 +1863,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 4659971..bdd9ca0 100644
--- a/libavcodec/vmdav.c
+++ b/libavcodec/vmdav.c
@@ -45,6 +45,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
#include "bytestream.h"
#define VMD_HEADER_SIZE 0x330
@@ -396,7 +397,7 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx,
return buf_size;
s->frame.reference = 1;
- 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;
}
@@ -569,7 +570,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 5a0a4a4..a22b541 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -27,6 +27,7 @@
#define BITSTREAM_READER_LE
#include "avcodec.h"
+#include "internal.h"
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
@@ -1668,7 +1669,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 31377e7..73986f8 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"
@@ -1207,7 +1208,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 c88a035..a0eb5c3 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -34,6 +34,7 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "wma.h"
#undef NDEBUG
@@ -842,7 +843,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 902c4e3..93bccb0 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1384,7 +1384,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 41a9ea3..444a727 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 15eb6f8..685c8ec 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 d0def65..fd7de1c 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"
@@ -560,7 +561,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 3c2d8b8..e1d9753 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 {
@@ -198,7 +199,7 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
- 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;
More information about the ffmpeg-cvslog
mailing list