aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mpc_plugin.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-01-01 10:09:56 +0000
committerEric Wong <normalperson@yhbt.net>2008-01-01 10:09:56 +0000
commit2cc59816a6e6304e643bc5c7ca055dd2567cba9e (patch)
tree2686ddfc3b7e98feb8a47e6f64c3658c15b92f0b /src/inputPlugins/mpc_plugin.c
parent5e7367c580f3a7aca93f6523e6c9d37f81b1d48b (diff)
downloadmpd-2cc59816a6e6304e643bc5c7ca055dd2567cba9e.tar.gz
mpd-2cc59816a6e6304e643bc5c7ca055dd2567cba9e.tar.xz
mpd-2cc59816a6e6304e643bc5c7ca055dd2567cba9e.zip
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
Diffstat (limited to 'src/inputPlugins/mpc_plugin.c')
-rw-r--r--src/inputPlugins/mpc_plugin.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index 46de5b8ea..60fd6fde6 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -156,13 +156,9 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
mpc_streaminfo_init(&info);
if ((ret = mpc_streaminfo_read(&info, &reader)) != ERROR_CODE_OK) {
- closeInputStream(inStream);
if (!dc->stop) {
ERROR("Not a valid musepack stream\n");
return -1;
- } else {
- dc->state = DECODE_STATE_STOP;
- dc->stop = 0;
}
return 0;
}
@@ -170,13 +166,9 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
mpc_decoder_setup(&decoder, &reader);
if (!mpc_decoder_initialize(&decoder, &info)) {
- closeInputStream(inStream);
if (!dc->stop) {
ERROR("Not a valid musepack stream\n");
return -1;
- } else {
- dc->state = DECODE_STATE_STOP;
- dc->stop = 0;
}
return 0;
}
@@ -264,19 +256,10 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc,
replayGainInfo);
}
- closeInputStream(inStream);
-
flushOutputBuffer(cb);
freeReplayGainInfo(replayGainInfo);
- if (dc->stop) {
- dc->state = DECODE_STATE_STOP;
- dc->stop = 0;
- } else {
- dc->state = DECODE_STATE_STOP;
- }
-
return 0;
}