From dc4d774481e6d80e126cbde5e93f43641f6e345a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:07 +0200 Subject: use a local "initialized" flag instead of dc->state Since we want to hide mpd internals from the decoder plugins, the plugins should not check dc->state whether they have already called decoder_initialized(). Use a local variable to track that. --- src/inputPlugins/aac_plugin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/inputPlugins/aac_plugin.c') diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 178b4c608..168e0de92 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -298,6 +298,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) mpd_uint16 bitRate = 0; AacBuffer b; InputStream inStream; + int initialized = 0; if ((totalTime = getAacFloatTotalTime(path)) < 0) return -1; @@ -364,11 +365,12 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) sampleRate = frameInfo.samplerate; #endif - if (dc.state != DECODE_STATE_DECODE) { + if (!initialized) { audio_format.channels = frameInfo.channels; audio_format.sampleRate = sampleRate; decoder_initialized(mpd_decoder, &audio_format, totalTime); + initialized = 1; } advanceAacBuffer(&b, frameInfo.bytesconsumed); @@ -401,7 +403,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) if (b.buffer) free(b.buffer); - if (dc.state != DECODE_STATE_DECODE) + if (!initialized) return -1; if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { -- cgit v1.2.3