summaryrefslogtreecommitdiff
path: root/apps/codecs/libFLAC/stream_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libFLAC/stream_decoder.c')
-rw-r--r--apps/codecs/libFLAC/stream_decoder.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/apps/codecs/libFLAC/stream_decoder.c b/apps/codecs/libFLAC/stream_decoder.c
index ac398d0150..6f6b221527 100644
--- a/apps/codecs/libFLAC/stream_decoder.c
+++ b/apps/codecs/libFLAC/stream_decoder.c
@@ -184,6 +184,10 @@ FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = {
184 * Class constructor/destructor 184 * Class constructor/destructor
185 * 185 *
186 ***********************************************************************/ 186 ***********************************************************************/
187FLAC__StreamDecoder _sd;
188FLAC__StreamDecoderPrivate _sdprivate IDATA_ATTR;
189FLAC__StreamDecoderProtected _sdprotected IDATA_ATTR;
190
187FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) 191FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void)
188{ 192{
189 FLAC__StreamDecoder *decoder; 193 FLAC__StreamDecoder *decoder;
@@ -191,38 +195,41 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void)
191 195
192 FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ 196 FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
193 197
194 decoder = (FLAC__StreamDecoder*)calloc(1, sizeof(FLAC__StreamDecoder)); 198 decoder = &_sd;
199 /*decoder = (FLAC__StreamDecoder*)calloc(1, sizeof(FLAC__StreamDecoder));
195 if(decoder == 0) { 200 if(decoder == 0) {
196 return 0; 201 return 0;
197 } 202 }*/
198 203
199 decoder->protected_ = (FLAC__StreamDecoderProtected*)calloc(1, sizeof(FLAC__StreamDecoderProtected)); 204 decoder->protected_ = &_sdprotected;
205 /*decoder->protected_ = (FLAC__StreamDecoderProtected*)calloc(1, sizeof(FLAC__StreamDecoderProtected));
200 if(decoder->protected_ == 0) { 206 if(decoder->protected_ == 0) {
201 free(decoder); 207 free(decoder);
202 return 0; 208 return 0;
203 } 209 }*/
204 210
205 decoder->private_ = (FLAC__StreamDecoderPrivate*)calloc(1, sizeof(FLAC__StreamDecoderPrivate)); 211 decoder->private_ = &_sdprivate;
212 /*decoder->private_ = (FLAC__StreamDecoderPrivate*)calloc(1, sizeof(FLAC__StreamDecoderPrivate));
206 if(decoder->private_ == 0) { 213 if(decoder->private_ == 0) {
207 free(decoder->protected_); 214 free(decoder->protected_);
208 free(decoder); 215 free(decoder);
209 return 0; 216 return 0;
210 } 217 }*/
211 218
212 decoder->private_->input = FLAC__bitbuffer_new(); 219 decoder->private_->input = FLAC__bitbuffer_new();
213 if(decoder->private_->input == 0) { 220 if(decoder->private_->input == 0) {
214 free(decoder->private_); 221 /*free(decoder->private_);
215 free(decoder->protected_); 222 free(decoder->protected_);
216 free(decoder); 223 free(decoder);*/
217 return 0; 224 return 0;
218 } 225 }
219 226
220 decoder->private_->metadata_filter_ids_capacity = 16; 227 decoder->private_->metadata_filter_ids_capacity = 16;
221 if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) { 228 if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) {
222 FLAC__bitbuffer_delete(decoder->private_->input); 229 FLAC__bitbuffer_delete(decoder->private_->input);
223 free(decoder->private_); 230 /*free(decoder->private_);
224 free(decoder->protected_); 231 free(decoder->protected_);
225 free(decoder); 232 free(decoder);*/
226 return 0; 233 return 0;
227 } 234 }
228 235
@@ -264,9 +271,9 @@ FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)
264 for(i = 0; i < FLAC__MAX_CHANNELS; i++) 271 for(i = 0; i < FLAC__MAX_CHANNELS; i++)
265 FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&decoder->private_->partitioned_rice_contents[i]); 272 FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&decoder->private_->partitioned_rice_contents[i]);
266 273
267 free(decoder->private_); 274 /*free(decoder->private_);
268 free(decoder->protected_); 275 free(decoder->protected_);
269 free(decoder); 276 free(decoder);*/
270} 277}
271 278
272/*********************************************************************** 279/***********************************************************************