[FFmpeg-cvslog] lavc/gifdec: do not return nonzero *got_frame if frame is not passed

Paul B Mahol git at videolan.org
Fri Jan 25 13:59:25 CET 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Jan 25 12:15:13 2013 +0000| [285128eedf9efa9bd3cae1a5b79cb97bd05bb104] | committer: Paul B Mahol

lavc/gifdec: do not return nonzero *got_frame if frame is not passed

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

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

 libavcodec/gifdec.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index bd4c22d..90aaa46 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -409,10 +409,8 @@ static int gif_read_header1(GifState *s)
     return 0;
 }
 
-static int gif_parse_next_image(GifState *s, int *got_picture)
+static int gif_parse_next_image(GifState *s)
 {
-
-    *got_picture = 1;
     while (bytestream2_get_bytes_left(&s->gb)) {
         int code = bytestream2_get_byte(&s->gb);
         int ret;
@@ -428,8 +426,7 @@ static int gif_parse_next_image(GifState *s, int *got_picture)
             break;
         case GIF_TRAILER:
             /* end of image */
-            *got_picture = 0;
-            return 0;
+            return AVERROR_EOF;
         default:
             /* erroneous block label */
             return AVERROR_INVALIDDATA;
@@ -507,11 +504,12 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A
         s->picture.key_frame = 0;
     }
 
-    ret = gif_parse_next_image(s, got_frame);
+    ret = gif_parse_next_image(s);
     if (ret < 0)
         return ret;
-    else if (*got_frame)
-        *picture = s->picture;
+
+    *picture = s->picture;
+    *got_frame = 1;
 
     return avpkt->size;
 }



More information about the ffmpeg-cvslog mailing list