Browse Source

pngdec: av_log() zlib errors

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n1.0
Michael Niedermayer 13 years ago
parent
commit
0da0b5e0f8
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      libavcodec/pngdec.c

+ 7
- 1
libavcodec/pngdec.c View File

@@ -37,6 +37,7 @@

typedef struct PNGDecContext {
PNGDSPContext dsp;
AVCodecContext *avctx;

GetByteContext gb;
AVFrame picture1, picture2;
@@ -371,6 +372,7 @@ static int png_decode_idat(PNGDecContext *s, int length)
while (s->zstream.avail_in > 0) {
ret = inflate(&s->zstream, Z_PARTIAL_FLUSH);
if (ret != Z_OK && ret != Z_STREAM_END) {
av_log(s->avctx, AV_LOG_ERROR, "inflate returned %d\n", ret);
return -1;
}
if (s->zstream.avail_out == 0) {
@@ -420,8 +422,10 @@ static int decode_frame(AVCodecContext *avctx,
s->zstream.zfree = ff_png_zfree;
s->zstream.opaque = NULL;
ret = inflateInit(&s->zstream);
if (ret != Z_OK)
if (ret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "inflateInit returned %d\n", ret);
return -1;
}
for(;;) {
if (bytestream2_get_bytes_left(&s->gb) <= 0) {
av_log(avctx, AV_LOG_ERROR, "No bytes left\n");
@@ -723,6 +727,8 @@ static av_cold int png_dec_init(AVCodecContext *avctx)

ff_pngdsp_init(&s->dsp);

s->avctx = avctx;

return 0;
}



Loading…
Cancel
Save