diff options
author | Max Kellermann <max@duempel.org> | 2014-08-29 12:14:27 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-29 13:20:58 +0200 |
commit | 7c25d83f1cc4c7db2d2d3f4506525dd056b885e8 (patch) | |
tree | b710e3f3d0f4edf7de0dcf6d61c823d8da7c9027 /src/output | |
parent | 8ce30c6a69a64f37a866541f66e3f242fe901f49 (diff) |
Tag: use SignedSongTime for the song duration
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/plugins/RoarOutputPlugin.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
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<char *>("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<char *>("LENGTH"); + vals[cnt].value = timebuf; + ++cnt; + } for (const auto &item : tag) { if (cnt >= 32) |