diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-08-06 09:36:45 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-08-06 09:36:45 +0000 |
commit | bf176f58b79e9bbbcc0eb243d39fda3f2419992c (patch) | |
tree | bc160c982bebab7a533b4deababe8e3c8648e54a /libavcore/imgutils.c | |
parent | 85fbad4555448c27e9b40b44663f5bd1dde452d2 (diff) | |
download | ffmpeg-streaming-bf176f58b79e9bbbcc0eb243d39fda3f2419992c.zip ffmpeg-streaming-bf176f58b79e9bbbcc0eb243d39fda3f2419992c.tar.gz |
Deprecate avcodec_check_dimensions() in favor of the new function
av_check_image_size() declared in libavcore/imgutils.h.
Originally committed as revision 24709 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcore/imgutils.c')
-rw-r--r-- | libavcore/imgutils.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavcore/imgutils.c b/libavcore/imgutils.c index 54c10d2..350caed 100644 --- a/libavcore/imgutils.c +++ b/libavcore/imgutils.c @@ -95,3 +95,22 @@ int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh return total_size; } + +typedef struct ImgUtils { + const AVClass *class; + int log_offset; + void *log_ctx; +} ImgUtils; + +static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) }; + +int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) +{ + ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; + + if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) + return 0; + + av_log(&imgutils, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h); + return AVERROR(EINVAL); +} |