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/mp4_plugin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/inputPlugins/mp4_plugin.c') 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) { -- cgit v1.2.3