aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/AudiofileDecoderPlugin.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/AudiofileDecoderPlugin.cxx
parentd9d97bd17bf0d9469dcf00120d3d3fdab87299bc (diff)
downloadmpd-3158955198fbdc71319cd3418523d851e6d47106.tar.gz
mpd-3158955198fbdc71319cd3418523d851e6d47106.tar.xz
mpd-3158955198fbdc71319cd3418523d851e6d47106.zip
TagHandler: pass SongTime to duration()
Diffstat (limited to '')
-rw-r--r--src/decoder/plugins/AudiofileDecoderPlugin.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
index 8d04f9596..0e34a20ff 100644
--- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx
+++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
@@ -244,19 +244,19 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
}
gcc_pure
-static int
+static SignedSongTime
audiofile_get_duration(InputStream &is)
{
if (!is.IsSeekable() || !is.KnownSize())
- return -1;
+ return SignedSongTime::Negative();
AudioFileInputStream afis{nullptr, is};
AFvirtualfile *vf = setup_virtual_fops(afis);
AFfilehandle fh = afOpenVirtualFile(vf, "r", nullptr);
if (fh == AF_NULL_FILEHANDLE)
- return -1;
+ return SignedSongTime::Negative();
- int duration = audiofile_get_duration(fh).RoundS();
+ const auto duration = audiofile_get_duration(fh);
afCloseFile(fh);
return duration;
}
@@ -265,11 +265,11 @@ static bool
audiofile_scan_stream(InputStream &is,
const struct tag_handler *handler, void *handler_ctx)
{
- int total_time = audiofile_get_duration(is);
- if (total_time < 0)
+ const auto duration = audiofile_get_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;
}