diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-10 23:40:44 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-11 00:24:10 +0300 |
commit | 2f07830e69bd14eaba348eb739b9503e7eb7cd4b (patch) | |
tree | bdcc84d7378de55e4b944cd35cb9eafb283ca203 /libavcodec/utils.c | |
parent | f542b152aa2086b30d1089162d79f5c136905c0c (diff) |
avcodec: Add max_pixels options
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 89a12c68a2..44ecc09c96 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -209,7 +209,7 @@ void avcodec_set_dimensions(AVCodecContext *s, int width, int height) int ff_set_dimensions(AVCodecContext *s, int width, int height) { - int ret = av_image_check_size(width, height, 0, s); + int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s); if (ret < 0) width = height = 0; @@ -904,7 +904,7 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) int ret; if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { - if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0 || avctx->pix_fmt<0) { + if ((ret = av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) < 0 || avctx->pix_fmt<0) { av_log(avctx, AV_LOG_ERROR, "video_get_buffer: image parameters invalid\n"); return AVERROR(EINVAL); } @@ -1338,8 +1338,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) - && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 - || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { + && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0 + || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n"); ff_set_dimensions(avctx, 0, 0); } @@ -1982,7 +1982,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, return 0; } - if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) + if (av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) return AVERROR(EINVAL); if (frame && frame->format == AV_PIX_FMT_NONE) @@ -2233,7 +2233,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi } *got_picture_ptr = 0; - if ((avctx->coded_width || avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx)) + if ((avctx->coded_width || avctx->coded_height) && av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) return AVERROR(EINVAL); avctx->internal->pkt = avpkt; |