[FFmpeg-cvslog] avcodec/qdrw: Fix the code which asks for version 1 samples

Michael Niedermayer git at videolan.org
Thu May 14 12:44:36 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu May 14 12:25:05 2015 +0200| [019daa07759727ac81f5871eb3ce582432ae483a] | committer: Michael Niedermayer

avcodec/qdrw: Fix the code which asks for version 1 samples

The new code only asks for version 1 if its actually version 1 and
prints the version bytes if its something else

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/qdrw.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index 3b17465..6c920aa 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -145,6 +145,7 @@ static int decode_frame(AVCodecContext *avctx,
     GetByteContext gbc;
     int colors;
     int w, h, ret;
+    int ver;
 
     bytestream2_init(&gbc, avpkt->data, avpkt->size);
     if (   bytestream2_get_bytes_left(&gbc) >= 552
@@ -153,6 +154,8 @@ static int decode_frame(AVCodecContext *avctx,
        )
         bytestream2_skip(&gbc, 512);
 
+    ver = check_header(gbc.buffer, bytestream2_get_bytes_left(&gbc));
+
     /* smallest PICT header */
     if (bytestream2_get_bytes_left(&gbc) < 40) {
         av_log(avctx, AV_LOG_ERROR, "Frame is too small %d\n",
@@ -170,12 +173,15 @@ static int decode_frame(AVCodecContext *avctx,
 
     /* version 1 is identified by 0x1101
      * it uses byte-aligned opcodes rather than word-aligned */
-    if (bytestream2_get_be32(&gbc) != 0x001102FF) {
+    if (ver == 1) {
         avpriv_request_sample(avctx, "QuickDraw version 1");
         return AVERROR_PATCHWELCOME;
+    } else if (ver != 2) {
+        avpriv_request_sample(avctx, "QuickDraw version unknown (%X)", bytestream2_get_be32(&gbc));
+        return AVERROR_PATCHWELCOME;
     }
 
-    bytestream2_skip(&gbc, 26);
+    bytestream2_skip(&gbc, 4+26);
 
     while (bytestream2_get_bytes_left(&gbc) >= 4) {
         int bppcnt, bpp;



More information about the ffmpeg-cvslog mailing list