comparison decoders/flac.c @ 387:fb519e6028e3

Changed all the Sound_SetError() calls to __Sound_SetError (or BAIL*_MACRO)
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 05 Jul 2002 23:11:51 +0000
parents cbb15ecf423a
children b12c4483815e
comparison
equal deleted inserted replaced
386:8c8ecd1008c9 387:fb519e6028e3
306 d_error_status_t status, 306 d_error_status_t status,
307 void *client_data) 307 void *client_data)
308 { 308 {
309 flac_t *f = (flac_t *) client_data; 309 flac_t *f = (flac_t *) client_data;
310 310
311 /* !!! FIXME: Is every error really fatal? I don't know... */ 311 __Sound_SetError(d_error_status_string[status]);
312 Sound_SetError(d_error_status_string[status]);
313 f->sample->flags |= SOUND_SAMPLEFLAG_ERROR; 312 f->sample->flags |= SOUND_SAMPLEFLAG_ERROR;
314 } /* error_callback */ 313 } /* error_callback */
315 314
316 315
317 #if SOUND_SUPPORTS_SEEKABLE_FLAC 316 #if SOUND_SUPPORTS_SEEKABLE_FLAC
447 BAIL_IF_MACRO(f == NULL, ERR_OUT_OF_MEMORY, 0); 446 BAIL_IF_MACRO(f == NULL, ERR_OUT_OF_MEMORY, 0);
448 447
449 decoder = d_new(); 448 decoder = d_new();
450 if (decoder == NULL) 449 if (decoder == NULL)
451 { 450 {
452 Sound_SetError(ERR_OUT_OF_MEMORY);
453 free(f); 451 free(f);
454 return(0); 452 BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
455 } /* if */ 453 } /* if */
456 454
457 d_set_read_callback(decoder, read_callback); 455 d_set_read_callback(decoder, read_callback);
458 d_set_write_callback(decoder, write_callback); 456 d_set_write_callback(decoder, write_callback);
459 d_set_metadata_callback(decoder, metadata_callback); 457 d_set_metadata_callback(decoder, metadata_callback);
513 d_process_metadata(decoder); 511 d_process_metadata(decoder);
514 512
515 /* Still not FLAC? Give up. */ 513 /* Still not FLAC? Give up. */
516 if (!f->is_flac) 514 if (!f->is_flac)
517 { 515 {
518 Sound_SetError("FLAC: No metadata found. Not a FLAC stream?");
519 free_flac(f); 516 free_flac(f);
520 return(0); 517 BAIL_MACRO("FLAC: No metadata found. Not a FLAC stream?", 0);
521 } /* if */ 518 } /* if */
522 } /* if */ 519 } /* if */
523 520
524 SNDDBG(("FLAC: Accepting data stream.\n")); 521 SNDDBG(("FLAC: Accepting data stream.\n"));
525 return(1); 522 return(1);
541 flac_t *f = (flac_t *) internal->decoder_private; 538 flac_t *f = (flac_t *) internal->decoder_private;
542 Uint32 len; 539 Uint32 len;
543 540
544 if (!d_process_one_frame(f->decoder)) 541 if (!d_process_one_frame(f->decoder))
545 { 542 {
546 Sound_SetError("FLAC: Couldn't decode frame.");
547 sample->flags |= SOUND_SAMPLEFLAG_ERROR; 543 sample->flags |= SOUND_SAMPLEFLAG_ERROR;
548 return(0); 544 BAIL_MACRO("FLAC: Couldn't decode frame.", 0);
549 } /* if */ 545 } /* if */
550 546
551 if (d_get_state(f->decoder) == D_END_OF_STREAM) 547 if (d_get_state(f->decoder) == D_END_OF_STREAM)
552 { 548 {
553 sample->flags |= SOUND_SAMPLEFLAG_EOF; 549 sample->flags |= SOUND_SAMPLEFLAG_EOF;