aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-29 17:29:06 +0100
committerMax Kellermann <max@duempel.org>2008-10-29 17:29:06 +0100
commit528b7c3f5e7afc155058eeba631aa93ba9f42b0c (patch)
treee7874d0c9df831872431862f60150b9566e6a696
parent74c85811afe85d7cd3024156b204a5d68f94df86 (diff)
downloadmpd-528b7c3f5e7afc155058eeba631aa93ba9f42b0c.tar.gz
mpd-528b7c3f5e7afc155058eeba631aa93ba9f42b0c.tar.xz
mpd-528b7c3f5e7afc155058eeba631aa93ba9f42b0c.zip
decoder: automatically flush the output buffer after decoder exits
A decoder_flush() invocation was missing in the FLAC plugin, resulting in casual assertion failures due to a wrong assumption about the last chunk's audio format. It's much easier to remove that decoder_flush() function and make the decoder thread call ob_flush().
-rw-r--r--src/decoder/aac_plugin.c4
-rw-r--r--src/decoder/audiofile_plugin.c3
-rw-r--r--src/decoder/ffmpeg_plugin.c3
-rw-r--r--src/decoder/mod_plugin.c2
-rw-r--r--src/decoder/mp3_plugin.c2
-rw-r--r--src/decoder/mp4_plugin.c2
-rw-r--r--src/decoder/mpc_plugin.c2
-rw-r--r--src/decoder/oggvorbis_plugin.c3
-rw-r--r--src/decoder/wavpack_plugin.c2
-rw-r--r--src/decoder_api.c5
-rw-r--r--src/decoder_api.h2
-rw-r--r--src/decoder_thread.c3
12 files changed, 3 insertions, 30 deletions
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index 3e8468e9e..8ceed8b2b 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -419,8 +419,6 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
break;
}
- decoder_flush(mpd_decoder);
-
faacDecClose(decoder);
if (b.buffer)
free(b.buffer);
@@ -556,8 +554,6 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
break;
}
- decoder_flush(mpd_decoder);
-
faacDecClose(decoder);
if (b.buffer)
free(b.buffer);
diff --git a/src/decoder/audiofile_plugin.c b/src/decoder/audiofile_plugin.c
index 513b3815f..5e5eb2cb6 100644
--- a/src/decoder/audiofile_plugin.c
+++ b/src/decoder/audiofile_plugin.c
@@ -110,10 +110,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
bitRate, NULL);
} while (decoder_get_command(decoder) != DECODE_COMMAND_STOP);
- decoder_flush(decoder);
-
afCloseFile(af_fp);
-
return 0;
}
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 9cee6850a..e8947778b 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -314,10 +314,7 @@ static int ffmpeg_decode_internal(BasePtrs *base)
}
} while (decoder_get_command(decoder) != DECODE_COMMAND_STOP);
- decoder_flush(decoder);
-
DEBUG("decoder finish\n");
-
return 0;
}
diff --git a/src/decoder/mod_plugin.c b/src/decoder/mod_plugin.c
index 5916a24ab..bdf71ec37 100644
--- a/src/decoder/mod_plugin.c
+++ b/src/decoder/mod_plugin.c
@@ -210,8 +210,6 @@ static int mod_decode(struct decoder * decoder, char *path)
total_time, 0, NULL);
}
- decoder_flush(decoder);
-
mod_close(data);
MikMod_Exit();
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index 8c56319f8..452c2441c 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -1131,9 +1131,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
data.mute_frame == MUTEFRAME_SEEK)
decoder_command_finished(decoder);
- decoder_flush(decoder);
mp3_data_finish(&data);
-
return 0;
}
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c
index f2e83d2cd..f6848b508 100644
--- a/src/decoder/mp4_plugin.c
+++ b/src/decoder/mp4_plugin.c
@@ -298,8 +298,6 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK && seeking)
decoder_command_finished(mpd_decoder);
- decoder_flush(mpd_decoder);
-
return 0;
}
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index de955d712..f9c3f34d5 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -231,8 +231,6 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
replayGainInfo);
}
- decoder_flush(mpd_decoder);
-
freeReplayGainInfo(replayGainInfo);
return 0;
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index d6521d82c..2099d2c0f 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -326,9 +326,6 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
freeReplayGainInfo(replayGainInfo);
ov_clear(&vf);
-
- decoder_flush(decoder);
-
return 0;
}
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index 102e08ae0..73336e54d 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -206,8 +206,6 @@ static void wavpack_decode(struct decoder * decoder,
replayGainInfo);
}
} while (samplesgot == samplesreq);
-
- decoder_flush(decoder);
}
static char *wavpack_tag(WavpackContext *wpc, char *key)
diff --git a/src/decoder_api.c b/src/decoder_api.c
index f407a77d3..7888ebb95 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -206,8 +206,3 @@ decoder_data(struct decoder *decoder,
return DECODE_COMMAND_NONE;
}
-
-void decoder_flush(mpd_unused struct decoder *decoder)
-{
- ob_flush();
-}
diff --git a/src/decoder_api.h b/src/decoder_api.h
index 5b034c1e9..fbd259859 100644
--- a/src/decoder_api.h
+++ b/src/decoder_api.h
@@ -159,6 +159,4 @@ decoder_data(struct decoder *decoder,
void *data, size_t datalen, float data_time, uint16_t bitRate,
ReplayGainInfo * replayGainInfo);
-void decoder_flush(struct decoder *decoder);
-
#endif
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 68dbd4bb1..3bbe1f347 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -21,6 +21,7 @@
#include "decoder_control.h"
#include "decoder_internal.h"
#include "player_control.h"
+#include "outputBuffer.h"
#include "song.h"
#include "mapper.h"
#include "path.h"
@@ -147,6 +148,8 @@ static void decodeStart(void)
}
}
+ ob_flush();
+
if (ret < 0 || ret == DECODE_ERROR_UNKTYPE) {
if (ret != DECODE_ERROR_UNKTYPE)
dc.error = DECODE_ERROR_FILE;