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/mp4_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/mp4_plugin.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 8b468168b..a46be0d52 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -107,6 +107,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) mpd_uint16 bitRate = 0; int seeking = 0; double seek_where = 0; + int initialized = 0; mp4cb = xmalloc(sizeof(mp4ff_callback_t)); mp4cb->read = mp4_inputStreamReadCallback; @@ -241,7 +242,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) break; } - if (dc.state != DECODE_STATE_DECODE) { + if (!initialized) { channels = frameInfo.channels; #ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE scale = frameInfo.samplerate; @@ -250,6 +251,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) audio_format.channels = frameInfo.channels; decoder_initialized(mpd_decoder, &audio_format, total_time); + initialized = 1; } if (channels * (unsigned long)(dur + offset) > frameInfo.samples) { @@ -282,7 +284,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) mp4ff_close(mp4fh); free(mp4cb); - if (dc.state != DECODE_STATE_DECODE) + if (!initialized) return -1; if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK && seeking) { |