c->zstream.next_in = p->data[0]; c->zstream.avail_in = c->decomp_size;
static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){    LclContext *c = avctx->priv_data;    AVFrame *pict = data;    AVFrame * const p = &c->pic;    int i;    int zret; // Zlib return code#ifndef CONFIG_ZLIB    av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled in.\n");    return -1;#else    init_put_bits(&c->pb, buf, buf_size);        *p = *pict;    p->pict_type= FF_I_TYPE;    p->key_frame= 1;        if(avctx->pix_fmt != PIX_FMT_BGR24){        av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");        return -1;    }    zret = deflateReset(&(c->zstream));    if (zret != Z_OK) {        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;    zret = deflate(&(c->zstream), Z_FINISH);    if ((zret != Z_OK) && (zret != Z_STREAM_END)) {        av_log(avctx, AV_LOG_ERROR, "Deflate error: %d\n", zret);        return -1;    }    for (i = 0; i < c->zstream.total_out; i++)        put_bits(&c->pb, 8, c->comp_buf[i]);    flush_put_bits(&c->pb);    return c->zstream.total_out;#endif}