From 25da0d9a9f5e2832ed71e14d7fc874a83f111a06 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Tue, 4 Dec 2001 01:23:50 +0000 Subject: [PATCH] simplify decoder finishing --- src/flac/decode.c | 24 ++++++++---------------- src/plugin_winamp3/flacpcm.cpp | 3 +-- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/flac/decode.c b/src/flac/decode.c index 507105be..fff9c91e 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -213,8 +213,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool #ifdef FLAC__HAS_OGG if(stream_info.is_ogg) { if(stream_info.decoder.stream) { - if(FLAC__stream_decoder_get_state(stream_info.decoder.stream) != FLAC__STREAM_DECODER_UNINITIALIZED) - FLAC__stream_decoder_finish(stream_info.decoder.stream); + FLAC__stream_decoder_finish(stream_info.decoder.stream); md5_failure = false; print_stats(&stream_info); FLAC__stream_decoder_delete(stream_info.decoder.stream); @@ -224,8 +223,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool #endif { if(stream_info.decoder.file) { - if(FLAC__file_decoder_get_state(stream_info.decoder.file) != FLAC__FILE_DECODER_UNINITIALIZED) - md5_failure = !FLAC__file_decoder_finish(stream_info.decoder.file); + md5_failure = !FLAC__file_decoder_finish(stream_info.decoder.file); print_stats(&stream_info); FLAC__file_decoder_delete(stream_info.decoder.file); } @@ -252,8 +250,7 @@ wav_abort_: #ifdef FLAC__HAS_OGG if(stream_info.is_ogg) { if(stream_info.decoder.stream) { - if(FLAC__stream_decoder_get_state(stream_info.decoder.stream) != FLAC__STREAM_DECODER_UNINITIALIZED) - FLAC__stream_decoder_finish(stream_info.decoder.stream); + FLAC__stream_decoder_finish(stream_info.decoder.stream); FLAC__stream_decoder_delete(stream_info.decoder.stream); } } @@ -261,8 +258,7 @@ wav_abort_: #endif { if(stream_info.decoder.file) { - if(FLAC__file_decoder_get_state(stream_info.decoder.file) != FLAC__FILE_DECODER_UNINITIALIZED) - FLAC__file_decoder_finish(stream_info.decoder.file); + FLAC__file_decoder_finish(stream_info.decoder.file); FLAC__file_decoder_delete(stream_info.decoder.file); } } @@ -403,8 +399,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool #ifdef FLAC__HAS_OGG if(stream_info.is_ogg) { if(stream_info.decoder.stream) { - if(FLAC__stream_decoder_get_state(stream_info.decoder.stream) != FLAC__STREAM_DECODER_UNINITIALIZED) - FLAC__stream_decoder_finish(stream_info.decoder.stream); + FLAC__stream_decoder_finish(stream_info.decoder.stream); md5_failure = false; print_stats(&stream_info); FLAC__stream_decoder_delete(stream_info.decoder.stream); @@ -414,8 +409,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool #endif { if(stream_info.decoder.file) { - if(FLAC__file_decoder_get_state(stream_info.decoder.file) != FLAC__FILE_DECODER_UNINITIALIZED) - md5_failure = !FLAC__file_decoder_finish(stream_info.decoder.file); + md5_failure = !FLAC__file_decoder_finish(stream_info.decoder.file); print_stats(&stream_info); FLAC__file_decoder_delete(stream_info.decoder.file); } @@ -442,8 +436,7 @@ raw_abort_: #ifdef FLAC__HAS_OGG if(stream_info.is_ogg) { if(stream_info.decoder.stream) { - if(FLAC__stream_decoder_get_state(stream_info.decoder.stream) != FLAC__STREAM_DECODER_UNINITIALIZED) - FLAC__stream_decoder_finish(stream_info.decoder.stream); + FLAC__stream_decoder_finish(stream_info.decoder.stream); FLAC__stream_decoder_delete(stream_info.decoder.stream); } } @@ -451,8 +444,7 @@ raw_abort_: #endif { if(stream_info.decoder.file) { - if(FLAC__file_decoder_get_state(stream_info.decoder.file) != FLAC__FILE_DECODER_UNINITIALIZED) - FLAC__file_decoder_finish(stream_info.decoder.file); + FLAC__file_decoder_finish(stream_info.decoder.file); FLAC__file_decoder_delete(stream_info.decoder.file); } } diff --git a/src/plugin_winamp3/flacpcm.cpp b/src/plugin_winamp3/flacpcm.cpp index e1d7a37b..98e5eb15 100644 --- a/src/plugin_winamp3/flacpcm.cpp +++ b/src/plugin_winamp3/flacpcm.cpp @@ -204,8 +204,7 @@ int FlacPcm::corecb_onSeeked(int newpos) void FlacPcm::cleanup() { if(decoder) { - if(FLAC__seekable_stream_decoder_get_state(decoder) != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) - FLAC__seekable_stream_decoder_finish(decoder); + FLAC__seekable_stream_decoder_finish(decoder); FLAC__seekable_stream_decoder_delete(decoder); decoder = 0; }