aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-12 19:23:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-12 19:53:37 +0200
commitbb015b519e29a125b794bf1a5e18c422bcb4090c (patch)
tree26195c9564b7b46800b2606e659b70e54fd11a92 /libavcodec/utils.c
parentacf7c5b8ee63d4a3614dd93aa7bcc23d582c3ccd (diff)
parent0ab76ddf313eeab70d06619ae0376fd7dd40761b (diff)
downloadffmpeg-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>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c19
1 files changed, 16 insertions, 3 deletions
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);
+}