aboutsummaryrefslogtreecommitdiff
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)
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 3e8468e9..8ceed8b2 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 513b3815..5e5eb2cb 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 9cee6850..e8947778 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 5916a24a..bdf71ec3 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 8c56319f..452c2441 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 f2e83d2c..f6848b50 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 de955d71..f9c3f34d 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 d6521d82..2099d2c0 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 102e08ae..73336e54 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 f407a77d..7888ebb9 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 5b034c1e..fbd25985 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 68dbd4bb..3bbe1f34 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;