From 7c25d83f1cc4c7db2d2d3f4506525dd056b885e8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2014 12:14:27 +0200 Subject: Tag: use SignedSongTime for the song duration --- src/output/plugins/RoarOutputPlugin.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/output/plugins') diff --git a/src/output/plugins/RoarOutputPlugin.cxx b/src/output/plugins/RoarOutputPlugin.cxx index ae6bdf1b1..04836cc46 100644 --- a/src/output/plugins/RoarOutputPlugin.cxx +++ b/src/output/plugins/RoarOutputPlugin.cxx @@ -363,16 +363,20 @@ RoarOutput::SendTag(const Tag &tag) const ScopeLock protect(mutex); - size_t cnt = 1; + size_t cnt = 0; struct roar_keyval vals[32]; char uuid_buf[32][64]; char timebuf[16]; - snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d", - tag.time / 3600, (tag.time % 3600) / 60, tag.time % 60); - - vals[0].key = const_cast("LENGTH"); - vals[0].value = timebuf; + if (!tag.duration.IsNegative()) { + const unsigned seconds = tag.duration.ToS(); + snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d", + seconds / 3600, (seconds % 3600) / 60, seconds % 60); + + vals[cnt].key = const_cast("LENGTH"); + vals[cnt].value = timebuf; + ++cnt; + } for (const auto &item : tag) { if (cnt >= 32) -- cgit v1.2.3