comparison imgutils.c @ 13:97c3fe501477 libavcore

Deprecate avcodec_check_dimensions() in favor of the new function av_check_image_size() declared in libavcore/imgutils.h.
author stefano
date Fri, 06 Aug 2010 09:36:45 +0000
parents c37229a98056
children caf03c72a254
comparison
equal deleted inserted replaced
12:c37229a98056 13:97c3fe501477
93 total_size += size[i]; 93 total_size += size[i];
94 } 94 }
95 95
96 return total_size; 96 return total_size;
97 } 97 }
98
99 typedef struct ImgUtils {
100 const AVClass *class;
101 int log_offset;
102 void *log_ctx;
103 } ImgUtils;
104
105 static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) };
106
107 int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
108 {
109 ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx };
110
111 if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
112 return 0;
113
114 av_log(&imgutils, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
115 return AVERROR(EINVAL);
116 }