[FFmpeg-cvslog] imgutils: do not use av_pix_fmt_descriptors directly

Paul B Mahol git at videolan.org
Fri Oct 12 17:42:17 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Oct 12 15:39:02 2012 +0000| [77e6b085a3386d87e1111697d846f21db423ca09] | committer: Paul B Mahol

imgutils: do not use av_pix_fmt_descriptors directly

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77e6b085a3386d87e1111697d846f21db423ca09
---

 libavutil/imgutils.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 7c7ae5c..57ee07d 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -309,11 +309,15 @@ int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],
 
 int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
 {
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
     uint8_t *data[4];
     int linesize[4];
+
+    if (!desc)
+        return AVERROR(EINVAL);
     if (av_image_check_size(width, height, 0, NULL) < 0)
         return AVERROR(EINVAL);
-    if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PSEUDOPAL)
+    if (desc->flags & PIX_FMT_PSEUDOPAL)
         // do not include palette for these pseudo-paletted formats
         return width * height;
     return av_image_fill_arrays(data, linesize, NULL, pix_fmt, width, height, align);



More information about the ffmpeg-cvslog mailing list