[FFmpeg-devel] [PATCH] avformat/avidec: assumes that extradata begins with palette when bpp <= 8.

Benoit Fouet benoit.fouet at free.fr
Tue Sep 16 14:17:36 CEST 2014


Some other information is stored in extradata, such that the BottomUp
field. But it seems that extradata always starts with the palette.
Fixes ticket #1304
---
 libavformat/avidec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 5b260e2..6292952 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -745,7 +745,7 @@ static int avi_read_header(AVFormatContext *s)
                         avio_r8(pb);
 
                     /* Extract palette from extradata if bpp <= 8.
-                     * This code assumes that extradata contains only palette.
+                     * This code assumes that extradata begins with palette.
                      * This is true for all paletted codecs implemented in
                      * FFmpeg. */
                     if (st->codec->extradata_size &&
@@ -754,8 +754,7 @@ static int avi_read_header(AVFormatContext *s)
                         const uint8_t *pal_src;
 
                         pal_size = FFMIN(pal_size, st->codec->extradata_size);
-                        pal_src  = st->codec->extradata +
-                                   st->codec->extradata_size - pal_size;
+                        pal_src  = st->codec->extradata;
                         for (i = 0; i < pal_size / 4; i++)
                             ast->pal[i] = 0xFFU<<24 | AV_RL32(pal_src+4*i);
                         ast->has_pal = 1;
-- 
2.1.0.127.g0c72b98



More information about the ffmpeg-devel mailing list