aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/MpcdecDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-29 22:43:36 +0200
committerMax Kellermann <max@duempel.org>2014-08-29 22:52:04 +0200
commit3158955198fbdc71319cd3418523d851e6d47106 (patch)
treeab3fff73fe7efa73ed95f9998eec5da66947b4e2 /src/decoder/plugins/MpcdecDecoderPlugin.cxx
parentd9d97bd17bf0d9469dcf00120d3d3fdab87299bc (diff)
downloadmpd-3158955198fbdc71319cd3418523d851e6d47106.tar.gz
mpd-3158955198fbdc71319cd3418523d851e6d47106.tar.xz
mpd-3158955198fbdc71319cd3418523d851e6d47106.zip
TagHandler: pass SongTime to duration()
Diffstat (limited to 'src/decoder/plugins/MpcdecDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/MpcdecDecoderPlugin.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/decoder/plugins/MpcdecDecoderPlugin.cxx b/src/decoder/plugins/MpcdecDecoderPlugin.cxx
index 08e060bee..befed0f3b 100644
--- a/src/decoder/plugins/MpcdecDecoderPlugin.cxx
+++ b/src/decoder/plugins/MpcdecDecoderPlugin.cxx
@@ -228,7 +228,7 @@ mpcdec_decode(Decoder &mpd_decoder, InputStream &is)
mpc_demux_exit(demux);
}
-static float
+static SignedSongTime
mpcdec_get_file_duration(InputStream &is)
{
mpc_decoder_data data(is, nullptr);
@@ -243,25 +243,24 @@ mpcdec_get_file_duration(InputStream &is)
mpc_demux *demux = mpc_demux_init(&reader);
if (demux == nullptr)
- return -1;
+ return SignedSongTime::Negative();
mpc_streaminfo info;
mpc_demux_get_info(demux, &info);
mpc_demux_exit(demux);
- return mpc_streaminfo_get_length(&info);
+ return SongTime::FromS(mpc_streaminfo_get_length(&info));
}
static bool
mpcdec_scan_stream(InputStream &is,
const struct tag_handler *handler, void *handler_ctx)
{
- float total_time = mpcdec_get_file_duration(is);
-
- if (total_time < 0)
+ const auto duration = mpcdec_get_file_duration(is);
+ if (duration.IsNegative())
return false;
- tag_handler_invoke_duration(handler, handler_ctx, total_time);
+ tag_handler_invoke_duration(handler, handler_ctx, SongTime(duration));
return true;
}