aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/aac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:07 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:07 +0200
commitdc4d774481e6d80e126cbde5e93f43641f6e345a (patch)
treeae793ae9bc9199af3f766bb05b1d890242ca738f /src/inputPlugins/aac_plugin.c
parent17e9cc84c5f94c94c71b2a808b57d4655ee21d12 (diff)
downloadmpd-dc4d774481e6d80e126cbde5e93f43641f6e345a.tar.gz
mpd-dc4d774481e6d80e126cbde5e93f43641f6e345a.tar.xz
mpd-dc4d774481e6d80e126cbde5e93f43641f6e345a.zip
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.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/aac_plugin.c6
1 files changed, 4 insertions, 2 deletions
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) {