diff options
Diffstat (limited to 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 4 |
3 files changed, 11 insertions, 5 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) { 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) { 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, |