diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:07 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:07 +0200 |
commit | dc4d774481e6d80e126cbde5e93f43641f6e345a (patch) | |
tree | ae793ae9bc9199af3f766bb05b1d890242ca738f /src/inputPlugins/oggvorbis_plugin.c | |
parent | 17e9cc84c5f94c94c71b2a808b57d4655ee21d12 (diff) | |
download | mpd-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/oggvorbis_plugin.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 340287cf5..f73b34842 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -228,6 +228,7 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) ReplayGainInfo *replayGainInfo = NULL; char **comments; const char *errorStr; + int initialized = 0; data.inStream = inStream; data.decoder = decoder; @@ -284,12 +285,13 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) vorbis_info *vi = ov_info(&vf, -1); audio_format.channels = vi->channels; audio_format.sampleRate = vi->rate; - if (dc.state == DECODE_STATE_START) { + if (!initialized) { float total_time = ov_time_total(&vf, -1); if (total_time < 0) total_time = 0; decoder_initialized(decoder, &audio_format, total_time); + initialized = 1; } comments = ov_comment(&vf, -1)->user_comments; putOggCommentsIntoOutputBuffer(inStream->metaName, |