# HG changeset patch # User rtognimp # Date 1095978017 0 # Node ID 902caf560c43cfaefa342acd8d7cceca1dd13e82 # Parent 2b1a5e1fd4496a7a94610be5ca08c1aea42e31eb Zlib encoder: fix image orientation (was flipped), 100l in deflate error check, put right codec type in extradata diff -r 2b1a5e1fd449 -r 902caf560c43 lcl.c --- a/lcl.c Thu Sep 23 12:20:41 2004 +0000 +++ b/lcl.c Thu Sep 23 22:20:17 2004 +0000 @@ -567,13 +567,20 @@ av_log(avctx, AV_LOG_ERROR, "Deflate reset error: %d\n", zret); return -1; } - c->zstream.next_in = p->data[0]; - c->zstream.avail_in = c->decomp_size; c->zstream.next_out = c->comp_buf; c->zstream.avail_out = c->max_comp_size; + for(i = avctx->height - 1; i >= 0; i--) { + c->zstream.next_in = p->data[0]+p->linesize[0]*i; + c->zstream.avail_in = avctx->width*3; + zret = deflate(&(c->zstream), Z_NO_FLUSH); + if (zret != Z_OK) { + av_log(avctx, AV_LOG_ERROR, "Deflate error: %d\n", zret); + return -1; + } + } zret = deflate(&(c->zstream), Z_FINISH); - if ((zret != Z_OK) && (zret != Z_STREAM_END)) { + if (zret != Z_STREAM_END) { av_log(avctx, AV_LOG_ERROR, "Deflate error: %d\n", zret); return -1; } @@ -785,7 +792,7 @@ ((uint8_t*)avctx->extradata)[4]= c->imgtype; ((uint8_t*)avctx->extradata)[5]= c->compression; ((uint8_t*)avctx->extradata)[6]= c->flags; - ((uint8_t*)avctx->extradata)[7]= 0; + ((uint8_t*)avctx->extradata)[7]= CODEC_ZLIB; c->avctx->extradata_size= 8; c->zstream.zalloc = Z_NULL;