music_flac.c
changeset 470 5cebd6c5be2d
parent 436 8ec227cabdd4
child 473 60b7e1c4f6b2
     1.1 --- a/music_flac.c	Sun Nov 08 15:06:43 2009 +0000
     1.2 +++ b/music_flac.c	Sun Nov 08 16:35:36 2009 +0000
     1.3 @@ -337,7 +337,7 @@
     1.4  		music->flac_data.data_len = 0;
     1.5  		music->flac_data.data_read = 0;
     1.6  
     1.7 -		if (Mix_InitFLAC () >= 0) {
     1.8 +		if (Mix_Init(MIX_INIT_FLAC)) {
     1.9  			init_stage++; // stage 1!
    1.10  
    1.11  			music->flac_decoder = flac.FLAC__stream_decoder_new ();
    1.12 @@ -357,8 +357,14 @@
    1.13  					if (flac.FLAC__stream_decoder_process_until_end_of_metadata
    1.14  											(music->flac_decoder)) {
    1.15  						was_error = 0;
    1.16 +					} else {
    1.17 +						SDL_SetError("FLAC__stream_decoder_process_until_end_of_metadata() failed");
    1.18  					}
    1.19 +				} else {
    1.20 +					SDL_SetError("FLAC__stream_decoder_init_stream() failed");
    1.21  				}
    1.22 +			} else {
    1.23 +				SDL_SetError("FLAC__stream_decoder_new() failed");
    1.24  			}
    1.25  		}
    1.26  
    1.27 @@ -369,16 +375,11 @@
    1.28  				case 2:
    1.29  					flac.FLAC__stream_decoder_delete( music->flac_decoder );
    1.30  				case 1:
    1.31 -					Mix_QuitFLAC();
    1.32  				case 0:
    1.33  					free(music);
    1.34  					SDL_RWclose(rw);
    1.35  					break;
    1.36  			}
    1.37 -
    1.38 -			SDL_SetError ("There was an error in stage [%d] of FLAC init.",
    1.39 -							init_stage);
    1.40 -
    1.41  			return NULL;
    1.42  		}
    1.43  	}
    1.44 @@ -559,8 +560,6 @@
    1.45  		}
    1.46  
    1.47  		free (music);
    1.48 -
    1.49 -		Mix_QuitFLAC ();
    1.50  	}
    1.51  }
    1.52