Commit be90199c authored by Max Kellermann's avatar Max Kellermann

decoder_api: removed decoder_clear()

Call ob_clear() in decoder_command_finished() instead of implementing that call in every decoder plugin.
parent d6c4441c
......@@ -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);
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
......
......@@ -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)) {
......
......@@ -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();
}
......@@ -161,6 +161,4 @@ decoder_data(struct decoder *decoder,
void decoder_flush(struct decoder *decoder);
void decoder_clear(struct decoder *decoder);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment