From bd2684b6190e85ab79d1391834321f91be3f347d Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Fri, 11 Oct 2019 13:55:56 +0300
Subject: [PATCH] Display time in playback

---
 applications/player/src/main.cpp                | 2 ++
 components/codecs/include/ftl/codecs/reader.hpp | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/applications/player/src/main.cpp b/applications/player/src/main.cpp
index 4d3bccafc..896aac5ae 100644
--- a/applications/player/src/main.cpp
+++ b/applications/player/src/main.cpp
@@ -71,6 +71,8 @@ int main(int argc, char **argv) {
             }
 
             if (!frame.empty()) {
+                double time = (double)(spkt.timestamp - r.getStartTime()) / 1000.0;
+                cv::putText(frame, std::string("Time: ") + std::to_string(time) + std::string("s"), cv::Point(10,20), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(0,0,255));
                 cv::imshow("Player", frame);
             }
             int key = cv::waitKey(20);
diff --git a/components/codecs/include/ftl/codecs/reader.hpp b/components/codecs/include/ftl/codecs/reader.hpp
index effba8480..949f037dd 100644
--- a/components/codecs/include/ftl/codecs/reader.hpp
+++ b/components/codecs/include/ftl/codecs/reader.hpp
@@ -39,6 +39,8 @@ class Reader {
 	bool begin();
 	bool end();
 
+	inline int64_t getStartTime() const { return timestart_; };
+
 	private:
 	std::istream *stream_;
 	msgpack::unpacker buffer_;
-- 
GitLab