aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mp3_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:13 +0200
committerEric Wong <normalperson@yhbt.net>2008-08-30 19:40:14 -0700
commitc9c9a7c7742afa59990cd1a3f1d52d2ab8c486d1 (patch)
tree5413e0fe825f595e339f0ff554eaf33c1ad1cc31 /src/inputPlugins/mp3_plugin.c
parentb40e8194e8e7ff816ca225ddedf5b546c8ecae96 (diff)
downloadmpd-c9c9a7c7742afa59990cd1a3f1d52d2ab8c486d1.tar.gz
mpd-c9c9a7c7742afa59990cd1a3f1d52d2ab8c486d1.tar.xz
mpd-c9c9a7c7742afa59990cd1a3f1d52d2ab8c486d1.zip
mp3: don't do a second flush in mp3_decode()
The previous patch made mp3Read() flush the output buffer in every iteration, which means we can eliminate the flush check after invoking mp3Read().
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/mp3_plugin.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index c9de49290..5e217c6ee 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -168,7 +168,6 @@ typedef struct _mp3DecodeData {
int foundXing;
int foundFirstFrame;
int decodedFirstFrame;
- int flush;
unsigned long bitRate;
InputStream *inStream;
struct audio_dither dither;
@@ -193,7 +192,6 @@ static void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream)
data->foundXing = 0;
data->foundFirstFrame = 0;
data->decodedFirstFrame = 0;
- data->flush = 1;
data->inStream = inStream;
data->layer = 0;
memset(&(data->dither), 0, sizeof(struct audio_dither));
@@ -419,7 +417,6 @@ static int decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag,
ERROR("unrecoverable frame level error "
"(%s).\n",
mad_stream_errorstr(&data->stream));
- data->flush = 0;
return DECODE_BREAK;
}
}
@@ -472,7 +469,6 @@ static int decodeNextFrame(mp3DecodeData * data)
ERROR("unrecoverable frame level error "
"(%s).\n",
mad_stream_errorstr(&data->stream));
- data->flush = 0;
return DECODE_BREAK;
}
}
@@ -979,10 +975,8 @@ static int mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
data->bitRate / 1000,
replayGainInfo ? *replayGainInfo : NULL);
- if (action == DC_ACTION_STOP) {
- data->flush = 0;
+ if (action == DC_ACTION_STOP)
return DECODE_BREAK;
- }
data->outputPtr = data->outputBuffer;
if (action == DC_ACTION_SEEK)
@@ -1082,11 +1076,6 @@ static int mp3_decode(InputStream * inStream)
metadata_pipe_send(tag, 0);
while (mp3Read(&data, &replayGainInfo) != DECODE_BREAK) ;
- /* send last little bit if not dc_intr() */
- if (!dc_intr() && data.outputPtr != data.outputBuffer && data.flush) {
- ob_send(data.outputBuffer, data.outputPtr - data.outputBuffer,
- data.elapsedTime, data.bitRate / 1000, replayGainInfo);
- }
if (replayGainInfo)
freeReplayGainInfo(replayGainInfo);