From 2cc59816a6e6304e643bc5c7ca055dd2567cba9e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Jan 2008 10:09:56 +0000 Subject: Simplify decode cleanup logic a bit DECODE_STATE_STOP is always set as dc->state, and dc->stop is always cleared. So handle it in decodeStart once rather than doing it in every plugin. While we're at it, fix a long-standing (but difficult to trigger) bug in mpc_decode where we failed to return if mpc_decoder_initialize() fails. git-svn-id: https://svn.musicpd.org/mpd/trunk@7122 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/inputPlugins/oggflac_plugin.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/inputPlugins/oggflac_plugin.c') diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 58eb0a5f7..50636274a 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -37,15 +37,13 @@ #include #include -static void oggflac_cleanup(InputStream * inStream, - FlacData * data, +static void oggflac_cleanup(FlacData * data, OggFLAC__SeekableStreamDecoder * decoder) { if (data->replayGainInfo) freeReplayGainInfo(data->replayGainInfo); if (decoder) OggFLAC__seekable_stream_decoder_delete(decoder); - closeInputStream(inStream); } static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(const @@ -330,7 +328,8 @@ static MpdTag *oggflac_TagDup(char *file) * data.tag will be set or unset, that's all we care about */ decoder = full_decoder_init_and_read_metadata(&data, 1); - oggflac_cleanup(&inStream, &data, decoder); + oggflac_cleanup(&data, decoder); + closeInputStream(&inStream); return data.tag; } @@ -388,11 +387,8 @@ static int oggflac_decode(OutputBuffer * cb, DecoderControl * dc, flushOutputBuffer(data.cb); } - dc->state = DECODE_STATE_STOP; - dc->stop = 0; - fail: - oggflac_cleanup(inStream, &data, decoder); + oggflac_cleanup(&data, decoder); return ret; } -- cgit v1.2.3