From b0b4a5d10dc28b8d3bba7f886444702d30104c64 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 3 Sep 2015 20:15:10 +0200 Subject: [PATCH] Added Track::finalize call to finish (live) tracks and record their complete duration, by Oswald de Bruin. --- lib/dtsc.h | 1 + lib/dtscmeta.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/dtsc.h b/lib/dtsc.h index 4326c588..7f617a22 100644 --- a/lib/dtsc.h +++ b/lib/dtsc.h @@ -275,6 +275,7 @@ namespace DTSC { unsigned int timeToFragnum(unsigned int timestamp); void reset(); void toPrettyString(std::ostream & str, int indent = 0, int verbosity = 0); + void finalize(); std::string getIdentifier(); std::string getWritableIdentifier(); diff --git a/lib/dtscmeta.cpp b/lib/dtscmeta.cpp index e1f62386..45c3815a 100644 --- a/lib/dtscmeta.cpp +++ b/lib/dtscmeta.cpp @@ -1114,6 +1114,10 @@ namespace DTSC { fragments.rbegin()->setSize(fragments.rbegin()->getSize() + packDataSize); } + void Track::finalize(){ + keys.rbegin()->setLength(lastms - keys.rbegin()->getTime() + parts.rbegin()->getDuration()); + } + ///\brief Returns a key given its number, or an empty key if the number is out of bounds Key & Track::getKey(unsigned int keyNum) { static Key empty;