From 2c44be003cfe1670e71141250092b27af9768ef9 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 2 Aug 2016 21:58:03 +0200 Subject: [PATCH] Add method endTime() to outputs to get end of stream time in ms --- src/output/output.cpp | 14 ++++++++++++++ src/output/output.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/output/output.cpp b/src/output/output.cpp index d34f4283..afe4aded 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -466,6 +466,20 @@ namespace Mist { return buffer.begin()->time; } + ///Return the end time of the VoD asset, or 0 if unknown. + uint64_t Output::endTime(){ + if (myMeta.live){return 0;} + uint64_t end = 0; + for (std::set::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){ + if (myMeta.tracks.count(*it)){ + if (end < myMeta.tracks[*it].lastms){ + end = myMeta.tracks[*it].lastms; + } + } + } + return end; + } + /// Prepares all tracks from selectedTracks for seeking to the specified ms position. void Output::seek(unsigned long long pos){ sought = true; diff --git a/src/output/output.h b/src/output/output.h index d7ba6e2e..718856a7 100644 --- a/src/output/output.h +++ b/src/output/output.h @@ -47,6 +47,7 @@ namespace Mist { bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false); void stop(); uint64_t currentTime(); + uint64_t endTime(); void setBlocking(bool blocking); long unsigned int getMainSelectedTrack(); void updateMeta();