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
This commit is contained in:
parent
042c25f54b
commit
0ab76ddf31
2
avplay.c
2
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) ||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user