aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-29 17:28:47 +0100
committerMax Kellermann <max@duempel.org>2008-10-29 17:28:47 +0100
commitbe90199c5ace71eb3411294159fec6adcc0d4404 (patch)
treeaac2bed6180a800b9270427a1242ba356aed8ff3
parentd6c4441c785d5ae41feba865727fd7ecdfbad361 (diff)
downloadmpd-be90199c5ace71eb3411294159fec6adcc0d4404.tar.gz
mpd-be90199c5ace71eb3411294159fec6adcc0d4404.tar.xz
mpd-be90199c5ace71eb3411294159fec6adcc0d4404.zip
decoder_api: removed decoder_clear()
Call ob_clear() in decoder_command_finished() instead of implementing that call in every decoder plugin.
Diffstat (limited to '')
-rw-r--r--src/decoder/audiofile_plugin.c1
-rw-r--r--src/decoder/ffmpeg_plugin.c1
-rw-r--r--src/decoder/flac_plugin.c1
-rw-r--r--src/decoder/mp3_plugin.c6
-rw-r--r--src/decoder/mp4_plugin.c6
-rw-r--r--src/decoder/mpc_plugin.c1
-rw-r--r--src/decoder/oggvorbis_plugin.c1
-rw-r--r--src/decoder/wavpack_plugin.c2
-rw-r--r--src/decoder_api.c9
-rw-r--r--src/decoder_api.h2
10 files changed, 7 insertions, 23 deletions
diff --git a/src/decoder/audiofile_plugin.c b/src/decoder/audiofile_plugin.c
index 99846e853..513b3815f 100644
--- a/src/decoder/audiofile_plugin.c
+++ b/src/decoder/audiofile_plugin.c
@@ -92,7 +92,6 @@ static int audiofile_decode(struct decoder * decoder, char *path)
do {
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
- decoder_clear(decoder);
current = decoder_seek_where(decoder) *
audio_format.sample_rate;
afSeekFrame(af_fp, AF_DEFAULT_TRACK, current);
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 6de31d52a..9cee6850a 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -271,7 +271,6 @@ static int ffmpeg_decode_internal(BasePtrs *base)
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
DEBUG("seek\n");
- decoder_clear(decoder);
current = decoder_seek_where(decoder) * AV_TIME_BASE;
if (av_seek_frame(pFormatCtx, -1, current , 0) < 0) {
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 90313f8f6..dd933ce6b 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -349,7 +349,6 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
FLAC__uint64 sampleToSeek = decoder_seek_where(decoder) *
data.audio_format.sample_rate + 0.5;
if (flac_seek_absolute(flacDec, sampleToSeek)) {
- decoder_clear(decoder);
data.time = ((float)sampleToSeek) /
data.audio_format.sample_rate;
data.position = 0;
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index d001efbda..8c56319f8 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -1018,7 +1018,6 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
decoder_seek_where(decoder));
if (j < data->highest_frame) {
if (mp3_seek(data, data->frame_offsets[j])) {
- decoder_clear(decoder);
data->current_frame = j;
decoder_command_finished(decoder);
} else
@@ -1026,7 +1025,6 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
} else {
data->seek_where = decoder_seek_where(decoder);
data->mute_frame = MUTEFRAME_SEEK;
- decoder_clear(decoder);
decoder_command_finished(decoder);
}
}
@@ -1130,10 +1128,8 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
freeReplayGainInfo(replay_gain_info);
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK &&
- data.mute_frame == MUTEFRAME_SEEK) {
- decoder_clear(decoder);
+ data.mute_frame == MUTEFRAME_SEEK)
decoder_command_finished(decoder);
- }
decoder_flush(decoder);
mp3_data_finish(&data);
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c
index a9fa061d0..f2e83d2cd 100644
--- a/src/decoder/mp4_plugin.c
+++ b/src/decoder/mp4_plugin.c
@@ -224,7 +224,6 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
if (seeking && seekPositionFound) {
seekPositionFound = false;
- decoder_clear(mpd_decoder);
seeking = 0;
decoder_command_finished(mpd_decoder);
}
@@ -296,10 +295,9 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
if (!initialized)
return -1;
- if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK && seeking) {
- decoder_clear(mpd_decoder);
+ 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 12a11de6b..de955d712 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -168,7 +168,6 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
samplePos = decoder_seek_where(mpd_decoder) *
audio_format.sample_rate;
if (mpc_decoder_seek_sample(&decoder, samplePos)) {
- decoder_clear(mpd_decoder);
s16 = (int16_t *) chunk;
chunkpos = 0;
decoder_command_finished(mpd_decoder);
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index c177fc15e..d6521d82c 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -261,7 +261,6 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
double seek_where = decoder_seek_where(decoder);
if (0 == ov_time_seek_page(&vf, seek_where)) {
- decoder_clear(decoder);
chunkpos = 0;
decoder_command_finished(decoder);
} else
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index 86b01164e..102e08ae0 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -174,8 +174,6 @@ static void wavpack_decode(struct decoder * decoder,
if (canseek) {
int where;
- decoder_clear(decoder);
-
where = decoder_seek_where(decoder) *
audio_format.sample_rate;
if (WavpackSeekSample(wpc, where)) {
diff --git a/src/decoder_api.c b/src/decoder_api.c
index a82b6c162..6d38685f4 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -77,6 +77,10 @@ void decoder_command_finished(mpd_unused struct decoder * decoder)
assert(dc.command != DECODE_COMMAND_SEEK ||
dc.seekError || decoder->seeking);
+ if (dc.command == DECODE_COMMAND_SEEK)
+ /* delete frames from the old song position */
+ ob_clear();
+
dc.command = DECODE_COMMAND_NONE;
notify_signal(&pc.notify);
}
@@ -209,8 +213,3 @@ void decoder_flush(mpd_unused struct decoder *decoder)
{
ob_flush();
}
-
-void decoder_clear(mpd_unused struct decoder *decoder)
-{
- ob_clear();
-}
diff --git a/src/decoder_api.h b/src/decoder_api.h
index 8096d3cd8..5b034c1e9 100644
--- a/src/decoder_api.h
+++ b/src/decoder_api.h
@@ -161,6 +161,4 @@ decoder_data(struct decoder *decoder,
void decoder_flush(struct decoder *decoder);
-void decoder_clear(struct decoder *decoder);
-
#endif