aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/GmeDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-10-27 11:05:47 +0100
committerMax Kellermann <max@duempel.org>2015-10-27 11:05:47 +0100
commit94f850a5885c89e5255948f9274aaaa4197bc52b (patch)
tree5348c92cb0ed9a3dc409be922abac07eee4438de /src/decoder/plugins/GmeDecoderPlugin.cxx
parent3882c114505ea39e3707f27d91eb8ef363a8895b (diff)
parentdb9997a1068e00c5f78d4bb9834ce5a13e7b7a3b (diff)
downloadmpd-94f850a5885c89e5255948f9274aaaa4197bc52b.tar.gz
mpd-94f850a5885c89e5255948f9274aaaa4197bc52b.tar.xz
mpd-94f850a5885c89e5255948f9274aaaa4197bc52b.zip
Merge tag 'v0.19.11'
Diffstat (limited to 'src/decoder/plugins/GmeDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/GmeDecoderPlugin.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx
index 693237f2f..cdaa68dcf 100644
--- a/src/decoder/plugins/GmeDecoderPlugin.cxx
+++ b/src/decoder/plugins/GmeDecoderPlugin.cxx
@@ -157,8 +157,11 @@ gme_file_decode(Decoder &decoder, Path path_fs)
return;
}
- const SignedSongTime song_len = ti->length > 0
- ? SignedSongTime::FromMS(ti->length)
+ const int length = ti->play_length;
+ gme_free_info(ti);
+
+ const SignedSongTime song_len = length > 0
+ ? SignedSongTime::FromMS(length)
: SignedSongTime::Negative();
/* initialize the MPD decoder */
@@ -169,7 +172,6 @@ gme_file_decode(Decoder &decoder, Path path_fs)
SampleFormat::S16, GME_CHANNELS,
error)) {
LogError(error);
- gme_free_info(ti);
gme_delete(emu);
return;
}
@@ -180,8 +182,8 @@ gme_file_decode(Decoder &decoder, Path path_fs)
if (gme_err != nullptr)
LogWarning(gme_domain, gme_err);
- if (ti->length > 0)
- gme_set_fade(emu, ti->length);
+ if (length > 0)
+ gme_set_fade(emu, length);
/* play */
DecoderCommand cmd;
@@ -197,16 +199,17 @@ gme_file_decode(Decoder &decoder, Path path_fs)
if (cmd == DecoderCommand::SEEK) {
unsigned where = decoder_seek_time(decoder).ToMS();
gme_err = gme_seek(emu, where);
- if (gme_err != nullptr)
+ if (gme_err != nullptr) {
LogWarning(gme_domain, gme_err);
- decoder_command_finished(decoder);
+ decoder_seek_error(decoder);
+ } else
+ decoder_command_finished(decoder);
}
if (gme_track_ended(emu))
break;
} while (cmd != DecoderCommand::STOP);
- gme_free_info(ti);
gme_delete(emu);
}
@@ -214,9 +217,9 @@ static void
ScanGmeInfo(const gme_info_t &info, unsigned song_num, int track_count,
const struct tag_handler *handler, void *handler_ctx)
{
- if (info.length > 0)
+ if (info.play_length > 0)
tag_handler_invoke_duration(handler, handler_ctx,
- SongTime::FromMS(info.length));
+ SongTime::FromMS(info.play_length));
if (info.song != nullptr) {
if (track_count > 1) {