diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-22 11:39:00 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-22 11:46:08 +0100 |
commit | 7a88b7a9ad7ab5c9bd4b71db6790c59aa1155582 (patch) | |
tree | 7b1af6617cd611919d387f58c0e44a4a7dd198ab | |
parent | 564ae836fb7bf73cddf39a0cc47108b5f067c126 (diff) | |
parent | 1f3e56b6dcc163a705704e98569d4850a31d651c (diff) | |
download | ffmpeg-7a88b7a9ad7ab5c9bd4b71db6790c59aa1155582.tar.gz |
Merge commit '1f3e56b6dcc163a705704e98569d4850a31d651c'
* commit '1f3e56b6dcc163a705704e98569d4850a31d651c':
gifdec: convert to bytestream2
Conflicts:
libavcodec/gifdec.c
libavcodec/lzw.c
libavcodec/lzw.h
See: 3fd60d804996031ceaba9cad0b38652b92551eb0
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/gifdec.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index a6b6be0470..c7b9ac8726 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -64,7 +64,6 @@ typedef struct GifState { int stored_bg_color; GetByteContext gb; - /* LZW compatible decoder */ LZWState *lzw; /* aux buffers */ @@ -140,11 +139,11 @@ static int gif_read_image(GifState *s, AVFrame *frame) if (bytestream2_get_bytes_left(&s->gb) < 9) return AVERROR_INVALIDDATA; - left = bytestream2_get_le16u(&s->gb); - top = bytestream2_get_le16u(&s->gb); - width = bytestream2_get_le16u(&s->gb); + left = bytestream2_get_le16u(&s->gb); + top = bytestream2_get_le16u(&s->gb); + width = bytestream2_get_le16u(&s->gb); height = bytestream2_get_le16u(&s->gb); - flags = bytestream2_get_byteu(&s->gb); + flags = bytestream2_get_byteu(&s->gb); is_interleaved = flags & 0x40; has_local_palette = flags & 0x80; bits_per_pixel = (flags & 0x07) + 1; @@ -302,7 +301,7 @@ static int gif_read_extension(GifState *s) return AVERROR_INVALIDDATA; ext_code = bytestream2_get_byteu(&s->gb); - ext_len = bytestream2_get_byteu(&s->gb); + ext_len = bytestream2_get_byteu(&s->gb); av_dlog(s->avctx, "ext_code=0x%x len=%d\n", ext_code, ext_len); @@ -316,7 +315,7 @@ static int gif_read_extension(GifState *s) if (bytestream2_get_bytes_left(&s->gb) < 5) return AVERROR_INVALIDDATA; - gce_flags = bytestream2_get_byteu(&s->gb); + gce_flags = bytestream2_get_byteu(&s->gb); bytestream2_skipu(&s->gb, 2); // delay during which the frame is shown gce_transparent_index = bytestream2_get_byteu(&s->gb); if (gce_flags & 0x01) @@ -370,7 +369,7 @@ static int gif_read_header1(GifState *s) /* read screen header */ s->transparent_color_index = -1; - s->screen_width = bytestream2_get_le16u(&s->gb); + s->screen_width = bytestream2_get_le16u(&s->gb); s->screen_height = bytestream2_get_le16u(&s->gb); v = bytestream2_get_byteu(&s->gb); @@ -404,7 +403,7 @@ static int gif_read_header1(GifState *s) static int gif_parse_next_image(GifState *s, AVFrame *frame) { - while (bytestream2_get_bytes_left(&s->gb)) { + while (bytestream2_get_bytes_left(&s->gb) > 0) { int code = bytestream2_get_byte(&s->gb); int ret; @@ -502,7 +501,7 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A return ret; *got_frame = 1; - return avpkt->size; + return bytestream2_tell(&s->gb); } static av_cold int gif_decode_close(AVCodecContext *avctx) |