Mercurial > libavcodec.hg
comparison lclenc.c @ 9743:f36c5b72c4e3 libavcodec
Remove "#if CONFIG_ZLIB" checks from lclenc.c, the file is never compiled
if zlib is not available.
author | reimar |
---|---|
date | Sun, 31 May 2009 08:36:44 +0000 |
parents | 4cb7c65fc775 |
children | bcd71ae6ea74 |
comparison
equal
deleted
inserted
replaced
9742:0d6f887d91fb | 9743:f36c5b72c4e3 |
---|---|
43 | 43 |
44 #include "avcodec.h" | 44 #include "avcodec.h" |
45 #include "put_bits.h" | 45 #include "put_bits.h" |
46 #include "lcl.h" | 46 #include "lcl.h" |
47 | 47 |
48 #if CONFIG_ZLIB | |
49 #include <zlib.h> | 48 #include <zlib.h> |
50 #endif | |
51 | 49 |
52 /* | 50 /* |
53 * Decoder context | 51 * Decoder context |
54 */ | 52 */ |
55 typedef struct LclEncContext { | 53 typedef struct LclEncContext { |
68 unsigned int decomp_size; | 66 unsigned int decomp_size; |
69 // Maximum compressed data size | 67 // Maximum compressed data size |
70 unsigned int max_comp_size; | 68 unsigned int max_comp_size; |
71 // Compression buffer | 69 // Compression buffer |
72 unsigned char* comp_buf; | 70 unsigned char* comp_buf; |
73 #if CONFIG_ZLIB | |
74 z_stream zstream; | 71 z_stream zstream; |
75 #endif | |
76 } LclEncContext; | 72 } LclEncContext; |
77 | 73 |
78 /* | 74 /* |
79 * | 75 * |
80 * Encode a frame | 76 * Encode a frame |
84 LclEncContext *c = avctx->priv_data; | 80 LclEncContext *c = avctx->priv_data; |
85 AVFrame *pict = data; | 81 AVFrame *pict = data; |
86 AVFrame * const p = &c->pic; | 82 AVFrame * const p = &c->pic; |
87 int i; | 83 int i; |
88 int zret; // Zlib return code | 84 int zret; // Zlib return code |
89 | |
90 #if !CONFIG_ZLIB | |
91 av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled in.\n"); | |
92 return -1; | |
93 #else | |
94 | 85 |
95 init_put_bits(&c->pb, buf, buf_size); | 86 init_put_bits(&c->pb, buf, buf_size); |
96 | 87 |
97 *p = *pict; | 88 *p = *pict; |
98 p->pict_type= FF_I_TYPE; | 89 p->pict_type= FF_I_TYPE; |
129 for (i = 0; i < c->zstream.total_out; i++) | 120 for (i = 0; i < c->zstream.total_out; i++) |
130 put_bits(&c->pb, 8, c->comp_buf[i]); | 121 put_bits(&c->pb, 8, c->comp_buf[i]); |
131 flush_put_bits(&c->pb); | 122 flush_put_bits(&c->pb); |
132 | 123 |
133 return c->zstream.total_out; | 124 return c->zstream.total_out; |
134 #endif | |
135 } | 125 } |
136 | 126 |
137 /* | 127 /* |
138 * | 128 * |
139 * Init lcl encoder | 129 * Init lcl encoder |
141 */ | 131 */ |
142 static av_cold int encode_init(AVCodecContext *avctx) | 132 static av_cold int encode_init(AVCodecContext *avctx) |
143 { | 133 { |
144 LclEncContext *c = avctx->priv_data; | 134 LclEncContext *c = avctx->priv_data; |
145 int zret; // Zlib return code | 135 int zret; // Zlib return code |
146 | |
147 #if !CONFIG_ZLIB | |
148 av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n"); | |
149 return 1; | |
150 #else | |
151 | 136 |
152 c->avctx= avctx; | 137 c->avctx= avctx; |
153 | 138 |
154 assert(avctx->width && avctx->height); | 139 assert(avctx->width && avctx->height); |
155 | 140 |
197 av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n"); | 182 av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n"); |
198 return 1; | 183 return 1; |
199 } | 184 } |
200 | 185 |
201 return 0; | 186 return 0; |
202 #endif | |
203 } | 187 } |
204 | 188 |
205 /* | 189 /* |
206 * | 190 * |
207 * Uninit lcl encoder | 191 * Uninit lcl encoder |
211 { | 195 { |
212 LclEncContext *c = avctx->priv_data; | 196 LclEncContext *c = avctx->priv_data; |
213 | 197 |
214 av_freep(&avctx->extradata); | 198 av_freep(&avctx->extradata); |
215 av_freep(&c->comp_buf); | 199 av_freep(&c->comp_buf); |
216 #if CONFIG_ZLIB | |
217 deflateEnd(&(c->zstream)); | 200 deflateEnd(&(c->zstream)); |
218 #endif | |
219 | 201 |
220 return 0; | 202 return 0; |
221 } | 203 } |
222 | 204 |
223 AVCodec zlib_encoder = { | 205 AVCodec zlib_encoder = { |