summaryrefslogtreecommitdiff
path: root/libavcodec/lcl.c
diff options
context:
space:
mode:
authorRoberto Togni <r_togni@tiscali.it>2004-09-23 22:20:17 +0000
committerRoberto Togni <r_togni@tiscali.it>2004-09-23 22:20:17 +0000
commit61cef2937927e44eed0f40f8e5db0a3ed520d914 (patch)
treeade70e1d7b35a517e036b85bca2618d1a6f4cec3 /libavcodec/lcl.c
parent715a97f0c04d90e9246247730f62193fd38d6f1c (diff)
Zlib encoder: fix image orientation (was flipped), 100l in deflate error
check, put right codec type in extradata Originally committed as revision 3500 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/lcl.c')
-rw-r--r--libavcodec/lcl.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavcodec/lcl.c b/libavcodec/lcl.c
index 46e835a31a..b536ac0be1 100644
--- a/libavcodec/lcl.c
+++ b/libavcodec/lcl.c
@@ -567,13 +567,20 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
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 @@ static int encode_init(AVCodecContext *avctx)
((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;