On Tue, Nov 10, 2015 at 07:45:09PM +0100, Paul B Mahol wrote: > On 11/10/15, Ni Hui <shuizhuyuan...@126.com> wrote: > > this updated patch fix the return code of avcodec_decode_video2 for gif > > decoding > > > > ff_lzw_decode_tail() now returns the consumed bytes in lzw decompress > > and gif frame data buffer is skipped properly > > gifdec is the only user of ff_lzw_decode_tail() > > > > my usecase tested and the return code problem got disappered :) > > > > > > --- > > libavcodec/gifdec.c | 5 +++-- > > libavcodec/lzw.c | 3 ++- > > libavcodec/lzw.h | 2 +- > > 3 files changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c > > index 9f2e6eb..20ae903 100644 > > --- a/libavcodec/gifdec.c > > +++ b/libavcodec/gifdec.c > > @@ -130,7 +130,7 @@ static void gif_copy_img_rect(const uint32_t *src, > > uint32_t *dst, > > static int gif_read_image(GifState *s, AVFrame *frame) > > { > > int left, top, width, height, bits_per_pixel, code_size, flags, pw; > > - int is_interleaved, has_local_palette, y, pass, y1, linesize, pal_size; > > + int is_interleaved, has_local_palette, y, pass, y1, linesize, pal_size, > > lzwed_len; > > uint32_t *ptr, *pal, *px, *pr, *ptr1; > > int ret; > > uint8_t *idx; > > @@ -293,7 +293,8 @@ static int gif_read_image(GifState *s, AVFrame *frame) > > > > decode_tail: > > /* read the garbage data until end marker is found */ > > - ff_lzw_decode_tail(s->lzw); > > + lzwed_len = ff_lzw_decode_tail(s->lzw); > > + bytestream2_skipu(&s->gb, lzwed_len); > > > > /* Graphic Control Extension's scope is single frame. > > * Remove its influence. */ > > diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c > > index 6832c12..b0b9a34 100644 > > --- a/libavcodec/lzw.c > > +++ b/libavcodec/lzw.c > > @@ -93,7 +93,7 @@ static int lzw_get_code(struct LZWState * s) > > return c & s->curmask; > > } > > > > -void ff_lzw_decode_tail(LZWState *p) > > +int ff_lzw_decode_tail(LZWState *p) > > { > > struct LZWState *s = (struct LZWState *)p; > > > > @@ -104,6 +104,7 @@ void ff_lzw_decode_tail(LZWState *p) > > } > > }else > > bytestream2_skip(&s->gb, bytestream2_get_bytes_left(&s->gb)); > > + return bytestream2_tell(&s->gb); > > } > > > > av_cold void ff_lzw_decode_open(LZWState **p) > > diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h > > index 4653c1c..6af8a6b 100644 > > --- a/libavcodec/lzw.h > > +++ b/libavcodec/lzw.h > > @@ -47,7 +47,7 @@ void ff_lzw_decode_open(LZWState **p); > > void ff_lzw_decode_close(LZWState **p); > > int ff_lzw_decode_init(LZWState *s, int csize, const uint8_t *buf, int > > buf_size, int mode); > > int ff_lzw_decode(LZWState *s, uint8_t *buf, int len); > > -void ff_lzw_decode_tail(LZWState *lzw); > > +int ff_lzw_decode_tail(LZWState *lzw); > > > > /** LZW encode state */ > > struct LZWEncodeState; > > -- > > 2.4.1 > > > > > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > probably ok
applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel