From 285128eedf9efa9bd3cae1a5b79cb97bd05bb104 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 25 Jan 2013 12:15:13 +0000 Subject: lavc/gifdec: do not return nonzero *got_frame if frame is not passed Signed-off-by: Paul B Mahol --- libavcodec/gifdec.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libavcodec/gifdec.c') diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index bd4c22d1e5..90aaa46e85 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; } -- cgit v1.2.1