From 695b4fd0bd6585d847131c07aa92248bcb941578 Mon Sep 17 00:00:00 2001
From: Thulinma <jaron@vietors.com>
Date: Fri, 9 Jun 2017 21:01:43 +0200
Subject: [PATCH] Fixes in regard to 64-bit time stamps

---
 src/output/output_dash_mp4.cpp        |  8 ++++----
 src/output/output_progressive_mp4.cpp | 12 ++++++------
 src/output/output_progressive_mp4.h   |  8 ++++----
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/output/output_dash_mp4.cpp b/src/output/output_dash_mp4.cpp
index 141adaf1..7b17a086 100644
--- a/src/output/output_dash_mp4.cpp
+++ b/src/output/output_dash_mp4.cpp
@@ -367,10 +367,10 @@ namespace Mist {
   /// Returns a string with the full XML DASH manifest MPD file.
   std::string OutDashMP4::buildManifest(){
     initialize();
-    int lastVidTime = 0;
-    int vidInitTrack = 0;
-    int lastAudTime = 0;
-    int audInitTrack = 0;
+    uint64_t lastVidTime = 0;
+    uint64_t vidInitTrack = 0;
+    uint64_t lastAudTime = 0;
+    uint64_t audInitTrack = 0;
     /// \TODO DASH pretends there is only one audio/video track, and then prints them all using the same timing information. This is obviously wrong if the tracks are not in sync.
     for (std::map<unsigned int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it ++){
       if ((it->second.codec == "H264" || it->second.codec == "HEVC") && it->second.lastms > lastVidTime){
diff --git a/src/output/output_progressive_mp4.cpp b/src/output/output_progressive_mp4.cpp
index 516c16f9..bc953fa1 100644
--- a/src/output/output_progressive_mp4.cpp
+++ b/src/output/output_progressive_mp4.cpp
@@ -525,9 +525,9 @@ namespace Mist {
     std::set <keyPart> trunOrder;
     //set with trackID, relative data offset, time and size
     for (std::map<long unsigned int, fragSet>::iterator it = currentPartSet.begin(); it != currentPartSet.end(); it++) {
-      long unsigned int timeStamp = it->second.firstTime;
+      uint64_t timeStamp = it->second.firstTime;
       DTSC::Track & thisTrack = myMeta.tracks[it->first];
-      for (long unsigned int i = it->second.firstPart; i <= it->second.lastPart; i++) {
+      for (uint32_t i = it->second.firstPart; i <= it->second.lastPart; i++) {
         keyPart temp;
         temp.trackID = it->first;
         temp.size = thisTrack.parts[i].getSize();
@@ -786,13 +786,13 @@ namespace Mist {
 ///\todo See if we can use something more elegant than a member variable...
   void OutProgressiveMP4::buildFragment() {
     DTSC::Key & currKey = myMeta.tracks[vidTrack].getKey(getKeyForTime(vidTrack, thisPacket.getTime()));
-    long long int startms = thisPacket.getTime();
+    uint64_t startms = thisPacket.getTime();
     if (!needsLookAhead){
       needsLookAhead = 1000;
       currentPartSet.clear();
       return;
     }
-    long long int endms = startms + needsLookAhead;
+    uint64_t endms = startms + needsLookAhead;
     bool missingSome = true;
 
     while (missingSome){
@@ -814,8 +814,8 @@ namespace Mist {
         }
         thisRange.lastPart = thisRange.firstPart;
         thisRange.lastTime = thisRange.firstTime;
-        unsigned int curMS = thisRange.firstTime;
-        unsigned int nextMS = thisRange.firstTime;
+        uint64_t curMS = thisRange.firstTime;
+        uint64_t nextMS = thisRange.firstTime;
         bool first = true;
         size_t maxParts = thisTrack.parts.size(); 
         for (size_t i = thisRange.firstPart; i < maxParts; i++) {
diff --git a/src/output/output_progressive_mp4.h b/src/output/output_progressive_mp4.h
index 997c5a48..c21a569a 100644
--- a/src/output/output_progressive_mp4.h
+++ b/src/output/output_progressive_mp4.h
@@ -30,10 +30,10 @@ namespace Mist {
   };
   
   struct fragSet{
-    long unsigned int firstPart;
-    long unsigned int lastPart;
-    long long unsigned int firstTime;
-    long long unsigned int lastTime;
+    uint32_t firstPart;
+    uint32_t lastPart;
+    uint64_t firstTime;
+    uint64_t lastTime;
   };
   class OutProgressiveMP4 : public HTTPOutput {
     public: