comparison src/flacng/tools.c @ 1246:626f78ff2439

- Add FLAC 1.1.2 compatibility
author sun@fc5-buildsys
date Thu, 12 Jul 2007 19:30:31 +0200
parents b1128efde471
children 37598c8f4425
comparison
equal deleted inserted replaced
1243:4cf6ccace89c 1246:626f78ff2439
170 _LEAVE; 170 _LEAVE;
171 } 171 }
172 172
173 /* --- */ 173 /* --- */
174 174
175 gchar* StreamDecoderInitState(FLAC__StreamDecoderInitStatus state) {
176
177 _ENTER;
178
179 switch(state) {
180 case FLAC__STREAM_DECODER_INIT_STATUS_OK:
181 _LEAVE "FLAC__STREAM_DECODER_INIT_STATUS_OK";
182 break;
183
184 case FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER:
185 _LEAVE "FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER";
186 break;
187
188 case FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS:
189 _LEAVE "FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS";
190 break;
191
192 case FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR:
193 _LEAVE "FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR";
194 break;
195
196 case FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE:
197 _LEAVE "FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE";
198 break;
199
200 case FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED:
201 _LEAVE "FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED";
202 break;
203 }
204
205 _LEAVE "Unknown state";
206 }
207
208 /* --- */
209
210 gchar* StreamDecoderState(FLAC__StreamDecoderState state) {
211
212 _ENTER;
213
214 switch(state) {
215
216 case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
217 _LEAVE "FLAC__STREAM_DECODER_SEARCH_FOR_METADATA";
218 break;
219
220 case FLAC__STREAM_DECODER_READ_METADATA:
221 _LEAVE "FLAC__STREAM_DECODER_READ_METADATA";
222 break;
223
224 case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
225 _LEAVE "FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC";
226 break;
227
228 case FLAC__STREAM_DECODER_READ_FRAME:
229 _LEAVE "FLAC__STREAM_DECODER_READ_FRAME";
230 break;
231
232 case FLAC__STREAM_DECODER_END_OF_STREAM:
233 _LEAVE "FLAC__STREAM_DECODER_END_OF_STREAM";
234 break;
235
236 case FLAC__STREAM_DECODER_ABORTED:
237 _LEAVE "FLAC__STREAM_DECODER_ABORTED";
238 break;
239
240 case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
241 _LEAVE "FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR";
242 break;
243
244 case FLAC__STREAM_DECODER_UNINITIALIZED:
245 _LEAVE "FLAC__STREAM_DECODER_UNINITIALIZED";
246 break;
247
248 default:
249 break;
250
251 }
252
253 _LEAVE "";
254 }
255
256 /* --- */
257
258 gboolean read_metadata(gchar* filename, FLAC__StreamDecoder* decoder, callback_info* info) { 175 gboolean read_metadata(gchar* filename, FLAC__StreamDecoder* decoder, callback_info* info) {
259 176
260 FLAC__StreamDecoderState ret; 177 FLAC__StreamDecoderState ret;
261 178
262 _ENTER; 179 _ENTER;
298 /* 215 /*
299 * Try to decode the metadata 216 * Try to decode the metadata
300 */ 217 */
301 if (false == FLAC__stream_decoder_process_until_end_of_metadata(decoder)) { 218 if (false == FLAC__stream_decoder_process_until_end_of_metadata(decoder)) {
302 ret = FLAC__stream_decoder_get_state(decoder); 219 ret = FLAC__stream_decoder_get_state(decoder);
303 _DEBUG("Could not read the metadata: %s(%d)!", StreamDecoderState(ret), ret); 220 _DEBUG("Could not read the metadata: %s(%d)!",
221 FLAC__StreamDecoderStateString[ret], ret);
304 reset_info(info); 222 reset_info(info);
305 _LEAVE FALSE; 223 _LEAVE FALSE;
306 } 224 }
307 225
308 /* 226 /*