Fix compile warnings

Co-authored-by: Thulinma <jaron@vietors.com>
This commit is contained in:
Ivan Tivonenko 2022-01-13 10:11:35 +02:00 committed by Thulinma
parent 055fb18270
commit 0a13ec1119
14 changed files with 52 additions and 54 deletions

View file

@ -46,7 +46,7 @@ namespace Comms{
class Comms{ class Comms{
public: public:
Comms(); Comms();
~Comms(); virtual ~Comms();
operator bool() const; operator bool() const;
void reload(const std::string & prefix, size_t baseSize, bool _master = false, bool reIssue = false); void reload(const std::string & prefix, size_t baseSize, bool _master = false, bool reIssue = false);
virtual void addFields(); virtual void addFields();

View file

@ -743,7 +743,7 @@ std::string Util::getMyPath(){
#ifdef __APPLE__ #ifdef __APPLE__
memset(mypath, 0, 500); memset(mypath, 0, 500);
unsigned int refSize = 500; unsigned int refSize = 500;
int ret = _NSGetExecutablePath(mypath, &refSize); _NSGetExecutablePath(mypath, &refSize);
#else #else
int ret = readlink("/proc/self/exe", mypath, 500); int ret = readlink("/proc/self/exe", mypath, 500);
if (ret != -1){ if (ret != -1){

View file

@ -2124,7 +2124,7 @@ namespace DTSC{
uint64_t Meta::getBufferWindow() const{return stream.getInt(streamBufferWindowField);} uint64_t Meta::getBufferWindow() const{return stream.getInt(streamBufferWindowField);}
void Meta::setBootMsOffset(int64_t bootMsOffset){ void Meta::setBootMsOffset(int64_t bootMsOffset){
DONTEVEN_MSG("Setting streamBootMsOffsetField to '%ld'", bootMsOffset); DONTEVEN_MSG("Setting streamBootMsOffsetField to %" PRId64, bootMsOffset);
stream.setInt(streamBootMsOffsetField, bootMsOffset); stream.setInt(streamBootMsOffsetField, bootMsOffset);
} }
int64_t Meta::getBootMsOffset() const{return stream.getInt(streamBootMsOffsetField);} int64_t Meta::getBootMsOffset() const{return stream.getInt(streamBootMsOffsetField);}
@ -3190,7 +3190,7 @@ namespace DTSC{
if (pages.getInt(firsttime, i) > time){break;} if (pages.getInt(firsttime, i) > time){break;}
res = i; res = i;
} }
DONTEVEN_MSG("Page number for time %" PRIu64 " on track %" PRIu32 " can be found on page %zu", time, idx, pages.getInt("firstkey", res)); DONTEVEN_MSG("Page number for time %" PRIu64 " on track %" PRIu32 " can be found on page %" PRIu64, time, idx, pages.getInt("firstkey", res));
return pages.getInt("firstkey", res); return pages.getInt("firstkey", res);
} }

View file

@ -170,6 +170,7 @@ namespace RTP{
class toDTSC{ class toDTSC{
public: public:
toDTSC(); toDTSC();
virtual ~toDTSC(){}
void setProperties(const uint64_t track, const std::string &codec, const std::string &type, void setProperties(const uint64_t track, const std::string &codec, const std::string &type,
const std::string &init, const double multiplier); const std::string &init, const double multiplier);
void setProperties(const DTSC::Meta &M, size_t tid); void setProperties(const DTSC::Meta &M, size_t tid);

View file

@ -110,8 +110,17 @@ std::string Util::getUTCString(uint64_t epoch){
struct tm *ptm; struct tm *ptm;
ptm = gmtime(&rawtime); ptm = gmtime(&rawtime);
char result[20]; char result[20];
snprintf(result, 20, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d", ptm->tm_year + 1900, ptm->tm_mon + 1, snprintf(result, 20, "%.4u-%.2u-%.2uT%.2u:%.2u:%.2u", (ptm->tm_year + 1900)%10000, (ptm->tm_mon + 1)%100, ptm->tm_mday%100, ptm->tm_hour%100, ptm->tm_min%100, ptm->tm_sec%100);
ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); return std::string(result);
}
std::string Util::getUTCStringMillis(uint64_t epoch_millis){
if (!epoch_millis){epoch_millis = unixMS();}
time_t rawtime = epoch_millis/1000;
struct tm *ptm;
ptm = gmtime(&rawtime);
char result[25];
snprintf(result, 25, "%.4u-%.2u-%.2uT%.2u:%.2u:%.2u.%.3uZ", (ptm->tm_year + 1900)%10000, (ptm->tm_mon + 1)%100, ptm->tm_mday%100, ptm->tm_hour%100, ptm->tm_min%100, ptm->tm_sec%100, (unsigned int)(epoch_millis%1000));
return std::string(result); return std::string(result);
} }

View file

@ -17,5 +17,6 @@ namespace Util{
uint64_t getNTP(); uint64_t getNTP();
uint64_t epoch(); ///< Gets the amount of seconds since 01/01/1970. uint64_t epoch(); ///< Gets the amount of seconds since 01/01/1970.
std::string getUTCString(uint64_t epoch = 0); std::string getUTCString(uint64_t epoch = 0);
std::string getUTCStringMillis(uint64_t epoch_millis = 0);
std::string getDateString(uint64_t epoch = 0); std::string getDateString(uint64_t epoch = 0);
}// namespace Util }// namespace Util

View file

@ -151,13 +151,13 @@ HTTP::URL::URL(const std::string &url){
} }
/// Returns the port in numeric format /// Returns the port in numeric format
uint32_t HTTP::URL::getPort() const{ uint16_t HTTP::URL::getPort() const{
if (!port.size()){return getDefaultPort();} if (!port.size()){return getDefaultPort();}
return atoi(port.c_str()); return atoi(port.c_str());
} }
/// Returns the default port for the protocol in numeric format /// Returns the default port for the protocol in numeric format
uint32_t HTTP::URL::getDefaultPort() const{ uint16_t HTTP::URL::getDefaultPort() const{
if (protocol == "http"){return 80;} if (protocol == "http"){return 80;}
if (protocol == "https"){return 443;} if (protocol == "https"){return 443;}
if (protocol == "ws"){return 80;} if (protocol == "ws"){return 80;}

View file

@ -13,8 +13,8 @@ namespace HTTP{
class URL{ class URL{
public: public:
URL(const std::string &url = ""); URL(const std::string &url = "");
uint32_t getPort() const; uint16_t getPort() const;
uint32_t getDefaultPort() const; uint16_t getDefaultPort() const;
std::string getExt() const; std::string getExt() const;
std::string getUrl() const; std::string getUrl() const;
std::string getFilePath() const; std::string getFilePath() const;

View file

@ -293,12 +293,12 @@ void Controller::SharedMemStats(void *config){
if (cpustat){ if (cpustat){
char line[300]; char line[300];
while (cpustat.getline(line, 300)){ while (cpustat.getline(line, 300)){
static unsigned long long cl_total = 0, cl_idle = 0; static uint64_t cl_total = 0, cl_idle = 0;
unsigned long long c_user, c_nice, c_syst, c_idle, c_total; uint64_t c_user, c_nice, c_syst, c_idle, c_total;
if (sscanf(line, "cpu %Lu %Lu %Lu %Lu", &c_user, &c_nice, &c_syst, &c_idle) == 4){ if (sscanf(line, "cpu %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64, &c_user, &c_nice, &c_syst, &c_idle) == 4){
c_total = c_user + c_nice + c_syst + c_idle; c_total = c_user + c_nice + c_syst + c_idle;
if (c_total > cl_total){ if (c_total > cl_total){
cpu_use = (long long)(1000 - ((c_idle - cl_idle) * 1000) / (c_total - cl_total)); cpu_use = (uint64_t)(1000 - ((c_idle - cl_idle) * 1000) / (c_total - cl_total));
}else{ }else{
cpu_use = 0; cpu_use = 0;
} }

View file

@ -470,7 +470,7 @@ namespace Mist{
std::getline(input, filename); std::getline(input, filename);
// check for already added segments // check for already added segments
DONTEVEN_MSG("Current file has index #%zu, last index was #%zu", fileNo, lastFileIndex); DONTEVEN_MSG("Current file has index #%" PRIu64 ", last index was #%" PRIu64 "", fileNo, lastFileIndex);
if (fileNo >= lastFileIndex){ if (fileNo >= lastFileIndex){
cleanLine(filename); cleanLine(filename);
filename = root.link(filename).getUrl(); filename = root.link(filename).getUrl();
@ -807,7 +807,7 @@ namespace Mist{
// keyframe data exists, so always add 19 bytes keyframedata. // keyframe data exists, so always add 19 bytes keyframedata.
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0; uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11; size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11;
VERYHIGH_MSG("Adding packet (%zuB) at %zu with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx); VERYHIGH_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize); meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize);
tsStream.getEarliestPacket(headerPack); tsStream.getEarliestPacket(headerPack);
} }
@ -834,9 +834,9 @@ namespace Mist{
headerPack.getString("data", data, dataLen); headerPack.getString("data", data, dataLen);
// keyframe data exists, so always add 19 bytes keyframedata. // keyframe data exists, so always add 19 bytes keyframedata.
long long packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0; uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
long long packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11; size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11;
VERYHIGH_MSG("Adding packet (%zuB) at %zu with an offset of %llu on track %zu", dataLen, packetTime, packOffset, idx); VERYHIGH_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize); meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize);
tsStream.getEarliestPacket(headerPack); tsStream.getEarliestPacket(headerPack);
} }
@ -920,7 +920,7 @@ namespace Mist{
// Get the updated list of entries // Get the updated list of entries
std::deque<playListEntries> &curList = listEntries[currentPlaylist]; std::deque<playListEntries> &curList = listEntries[currentPlaylist];
if (curList.size() <= segmentIndex){ if (curList.size() <= segmentIndex){
FAIL_MSG("Tried to load segment with index '%lu', but the playlist only contains '%zu' entries!", segmentIndex, curList.size()); FAIL_MSG("Tried to load segment with index '%" PRIu64 "', but the playlist only contains '%zu' entries!", segmentIndex, curList.size());
return false; return false;
} }
if (!segDowner.loadSegment(curList.at(segmentIndex))){ if (!segDowner.loadSegment(curList.at(segmentIndex))){
@ -942,13 +942,13 @@ namespace Mist{
if (!hasOffset && curList.at(segmentIndex).mUTC){ if (!hasOffset && curList.at(segmentIndex).mUTC){
hasOffset = true; hasOffset = true;
DVRTimeOffsets[currentPlaylist] = (curList.at(segmentIndex).mUTC - zUTC) - packetTime; DVRTimeOffsets[currentPlaylist] = (curList.at(segmentIndex).mUTC - zUTC) - packetTime;
MEDIUM_MSG("Setting current live segment time offset to '%ld'", DVRTimeOffsets[currentPlaylist]); MEDIUM_MSG("Setting current live segment time offset to %" PRId64, DVRTimeOffsets[currentPlaylist]);
curList.at(segmentIndex).timeOffset = DVRTimeOffsets[currentPlaylist]; curList.at(segmentIndex).timeOffset = DVRTimeOffsets[currentPlaylist];
} }
if (hasOffset || DVRTimeOffsets.count(currentPlaylist)){ if (hasOffset || DVRTimeOffsets.count(currentPlaylist)){
hasOffset = true; hasOffset = true;
packetTime += DVRTimeOffsets[currentPlaylist]; packetTime += DVRTimeOffsets[currentPlaylist];
HIGH_MSG("Adjusting current packet timestamp '%ld' -> '%ld'", headerPack.getTime(), packetTime); HIGH_MSG("Adjusting current packet timestamp %" PRIu64 " -> %" PRIu64, headerPack.getTime(), packetTime);
} }
size_t idx = M.trackIDToIndex(packetId, getpid()); size_t idx = M.trackIDToIndex(packetId, getpid());
if (idx == INVALID_TRACK_ID || !M.getCodec(idx).size()){ if (idx == INVALID_TRACK_ID || !M.getCodec(idx).size()){
@ -959,7 +959,7 @@ namespace Mist{
headerPack.getString("data", data, dataLen); headerPack.getString("data", data, dataLen);
// keyframe data exists, so always add 19 bytes keyframedata. // keyframe data exists, so always add 19 bytes keyframedata.
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0; uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
VERYHIGH_MSG("Adding packet (%zuB) at %zu with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx); VERYHIGH_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
bufferLivePacket(packetTime, packOffset, idx, data, dataLen, segmentIndex + 1, headerPack.hasMember("keyframe")); bufferLivePacket(packetTime, packOffset, idx, data, dataLen, segmentIndex + 1, headerPack.hasMember("keyframe"));
tsStream.getEarliestPacket(headerPack); tsStream.getEarliestPacket(headerPack);
} }
@ -980,7 +980,7 @@ namespace Mist{
uint64_t packetTime = headerPack.getTime(); uint64_t packetTime = headerPack.getTime();
if (DVRTimeOffsets.count(currentPlaylist)){ if (DVRTimeOffsets.count(currentPlaylist)){
packetTime += DVRTimeOffsets[currentPlaylist]; packetTime += DVRTimeOffsets[currentPlaylist];
VERYHIGH_MSG("Adjusting current packet timestamp '%ld' -> '%ld'", headerPack.getTime(), packetTime); VERYHIGH_MSG("Adjusting current packet timestamp %" PRIu64 " -> %" PRIu64, headerPack.getTime(), packetTime);
} }
size_t idx = M.trackIDToIndex(packetId, getpid()); size_t idx = M.trackIDToIndex(packetId, getpid());
if (idx == INVALID_TRACK_ID || !M.getCodec(idx).size()){ if (idx == INVALID_TRACK_ID || !M.getCodec(idx).size()){
@ -991,7 +991,7 @@ namespace Mist{
headerPack.getString("data", data, dataLen); headerPack.getString("data", data, dataLen);
// keyframe data exists, so always add 19 bytes keyframedata. // keyframe data exists, so always add 19 bytes keyframedata.
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0; uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
VERYHIGH_MSG("Adding packet (%zuB) at %zu with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx); VERYHIGH_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
bufferLivePacket(packetTime, packOffset, idx, data, dataLen, segmentIndex + 1, headerPack.hasMember("keyframe")); bufferLivePacket(packetTime, packOffset, idx, data, dataLen, segmentIndex + 1, headerPack.hasMember("keyframe"));
tsStream.getEarliestPacket(headerPack); tsStream.getEarliestPacket(headerPack);
} }
@ -1010,9 +1010,9 @@ namespace Mist{
pListIt->second.reload(); pListIt->second.reload();
} }
HIGH_MSG("Current playlist has parsed %lu/%lu entries", listEntries[currentPlaylist].size(), parsedSegments[currentPlaylist]); HIGH_MSG("Current playlist has parsed %zu/%" PRIu64 " entries", listEntries[currentPlaylist].size(), parsedSegments[currentPlaylist]);
for(uint64_t entryIt = parsedSegments[currentPlaylist]; entryIt < listEntries[currentPlaylist].size(); entryIt++){ for(uint64_t entryIt = parsedSegments[currentPlaylist]; entryIt < listEntries[currentPlaylist].size(); entryIt++){
MEDIUM_MSG("Adding entry #%lu as live data", entryIt); MEDIUM_MSG("Adding entry #%" PRIu64 " as live data", entryIt);
if (parseSegmentAsLive(entryIt)){ if (parseSegmentAsLive(entryIt)){
parsedSegments[currentPlaylist]++; parsedSegments[currentPlaylist]++;
}else{ }else{
@ -1133,10 +1133,10 @@ namespace Mist{
DTSC::Keys keys(M.keys(idx)); DTSC::Keys keys(M.keys(idx));
for (size_t i = keys.getFirstValid(); i < keys.getEndValid(); i++){ for (size_t i = keys.getFirstValid(); i < keys.getEndValid(); i++){
if (keys.getTime(i) > seekTime){ if (keys.getTime(i) > seekTime){
VERYHIGH_MSG("Found elapsed key with a time of %lu ms at playlist index %zu while seeking", keys.getTime(i), keys.getBpos(i)-1); VERYHIGH_MSG("Found elapsed key with a time of %" PRIu64 " ms at playlist index %zu while seeking", keys.getTime(i), keys.getBpos(i)-1);
break; break;
} }
VERYHIGH_MSG("Found valid key with a time of %lu ms at playlist index %zu while seeking", keys.getTime(i), keys.getBpos(i)-1); VERYHIGH_MSG("Found valid key with a time of %" PRIu64 " ms at playlist index %zu while seeking", keys.getTime(i), keys.getBpos(i)-1);
plistEntry = keys.getBpos(i); plistEntry = keys.getBpos(i);
} }
@ -1165,7 +1165,7 @@ namespace Mist{
segDowner.loadSegment(entry); segDowner.loadSegment(entry);
// If we have an offset, load it // If we have an offset, load it
if (entry.timeOffset){ if (entry.timeOffset){
HIGH_MSG("Setting time offset of this TS segment to '%ld'", entry.timeOffset); HIGH_MSG("Setting time offset of this TS segment to %" PRId64, entry.timeOffset);
plsTimeOffset[currentPlaylist] = entry.timeOffset; plsTimeOffset[currentPlaylist] = entry.timeOffset;
} }
} }
@ -1186,7 +1186,7 @@ namespace Mist{
/// \param nUTC: Defaults to 0. If larger than 0, sync the timestamp based on this value and zUTC /// \param nUTC: Defaults to 0. If larger than 0, sync the timestamp based on this value and zUTC
/// \return the (modified) packetTime, used for meta.updates and buffering packets /// \return the (modified) packetTime, used for meta.updates and buffering packets
uint64_t inputHLS::getPacketTime(uint64_t packetTime, uint64_t tid, uint64_t currentPlaylist, uint64_t nUTC){ uint64_t inputHLS::getPacketTime(uint64_t packetTime, uint64_t tid, uint64_t currentPlaylist, uint64_t nUTC){
INSANE_MSG("Calculating adjusted packet time for track '%lu' on playlist '%lu' with current timestamp '%lu'. UTC timestamp is '%lu'", tid, currentPlaylist, packetTime, nUTC); INSANE_MSG("Calculating adjusted packet time for track %" PRIu64 " on playlist %" PRIu64 " with current timestamp %" PRIu64 ". UTC timestamp is %" PRIu64, tid, currentPlaylist, packetTime, nUTC);
uint64_t newTime = packetTime; uint64_t newTime = packetTime;
// UTC based timestamp offsets // UTC based timestamp offsets
@ -1206,7 +1206,7 @@ namespace Mist{
newTime = 0; newTime = 0;
FAIL_MSG("Time offset is too negative causing an integer overflow. Setting current packet time to 0."); FAIL_MSG("Time offset is too negative causing an integer overflow. Setting current packet time to 0.");
}else{ }else{
VERYHIGH_MSG("Adjusting timestamp %lu -> %lu (offset is %ld)", newTime, newTime + plsTimeOffset[currentPlaylist], plsTimeOffset[currentPlaylist]); VERYHIGH_MSG("Adjusting timestamp %" PRIu64 " -> %" PRIu64 " (offset is %" PRId64 ")", newTime, newTime + plsTimeOffset[currentPlaylist], plsTimeOffset[currentPlaylist]);
newTime += plsTimeOffset[currentPlaylist]; newTime += plsTimeOffset[currentPlaylist];
} }
} }
@ -1214,7 +1214,7 @@ namespace Mist{
}else{ }else{
// Apply offset if any was set // Apply offset if any was set
if (plsTimeOffset.count(currentPlaylist)){ if (plsTimeOffset.count(currentPlaylist)){
VERYHIGH_MSG("Adjusting timestamp %lu -> %lu (offset is %ld)", newTime, newTime + plsTimeOffset[currentPlaylist], plsTimeOffset[currentPlaylist]); VERYHIGH_MSG("Adjusting timestamp %" PRIu64 " -> %" PRIu64 " (offset is %" PRId64 ")", newTime, newTime + plsTimeOffset[currentPlaylist], plsTimeOffset[currentPlaylist]);
newTime += plsTimeOffset[currentPlaylist]; newTime += plsTimeOffset[currentPlaylist];
} }
if (plsLastTime.count(currentPlaylist)){ if (plsLastTime.count(currentPlaylist)){
@ -1302,7 +1302,7 @@ namespace Mist{
for (std::map<uint32_t, std::deque<playListEntries> >::iterator pListIt = listEntries.begin(); for (std::map<uint32_t, std::deque<playListEntries> >::iterator pListIt = listEntries.begin();
pListIt != listEntries.end(); pListIt++){ pListIt != listEntries.end(); pListIt++){
parsedSegments[pListIt->first] = pListIt->second.size(); parsedSegments[pListIt->first] = pListIt->second.size();
INFO_MSG("Playlist %u already contains %li VOD segments", pListIt->first, parsedSegments[pListIt->first]); INFO_MSG("Playlist %" PRIu32 " already contains %" PRIu64 " VOD segments", pListIt->first, parsedSegments[pListIt->first]);
} }
} }
@ -1512,7 +1512,7 @@ namespace Mist{
{ {
tthread::lock_guard<tthread::mutex> guard(entryMutex); tthread::lock_guard<tthread::mutex> guard(entryMutex);
std::deque<playListEntries> &curList = listEntries[currentPlaylist]; std::deque<playListEntries> &curList = listEntries[currentPlaylist];
INSANE_MSG("Current playlist contains %li entries. Current index is %li in playlist %li", curList.size(), currentIndex, currentPlaylist); INSANE_MSG("Current playlist contains %zu entries. Current index is %zu in playlist %" PRIu64, curList.size(), currentIndex, currentPlaylist);
if (!curList.size()){ if (!curList.size()){
INFO_MSG("Reached last entry in playlist %" PRIu64 "; waiting for more segments", currentPlaylist); INFO_MSG("Reached last entry in playlist %" PRIu64 "; waiting for more segments", currentPlaylist);
if (streamIsLive || isLiveDVR){Util::wait(500);} if (streamIsLive || isLiveDVR){Util::wait(500);}

View file

@ -23,7 +23,6 @@ namespace Mist{
std::string currentSource; std::string currentSource;
size_t playlistIndex; size_t playlistIndex;
size_t minIndex, maxIndex; size_t minIndex, maxIndex;
bool seenValidEntry;
uint32_t wallTime; uint32_t wallTime;
uint32_t reloadOn; uint32_t reloadOn;
}; };

View file

@ -437,7 +437,7 @@ namespace Mist{
if (tPages.getInt("avail", curPage) > FLIP_DATA_PAGE_SIZE || packTime - prevPageTime > FLIP_TARGET_DURATION){ if (tPages.getInt("avail", curPage) > FLIP_DATA_PAGE_SIZE || packTime - prevPageTime > FLIP_TARGET_DURATION){
// Create the book keeping data for the new page // Create the book keeping data for the new page
curPageNum[packTrack] = tPages.getInt("firstkey", curPage) + tPages.getInt("keycount", curPage); curPageNum[packTrack] = tPages.getInt("firstkey", curPage) + tPages.getInt("keycount", curPage);
DONTEVEN_MSG("Live page transition from %" PRIu32 ":%zu to %" PRIu32 ":%zu", packTrack, DONTEVEN_MSG("Live page transition from %" PRIu32 ":%" PRIu64 " to %" PRIu32 ":%zu", packTrack,
tPages.getInt("firstkey", curPage), packTrack, curPageNum[packTrack]); tPages.getInt("firstkey", curPage), packTrack, curPageNum[packTrack]);
if ((tPages.getEndPos() - tPages.getDeleted()) >= tPages.getRCount()){ if ((tPages.getEndPos() - tPages.getDeleted()) >= tPages.getRCount()){
@ -460,7 +460,7 @@ namespace Mist{
} }
} }
} }
DONTEVEN_MSG("Setting page %lu lastkeyTime to '%lu' and keycount to '%lu'", tPages.getInt("firstkey", curPage), packTime, tPages.getInt("keycount", curPage) + 1); DONTEVEN_MSG("Setting page %" PRIu64 " lastkeyTime to %" PRIu64 " and keycount to %" PRIu64, tPages.getInt("firstkey", curPage), packTime, tPages.getInt("keycount", curPage) + 1);
tPages.setInt("lastkeytime", packTime, curPage); tPages.setInt("lastkeytime", packTime, curPage);
tPages.setInt("keycount", tPages.getInt("keycount", curPage) + 1, curPage); tPages.setInt("keycount", tPages.getInt("keycount", curPage) + 1, curPage);
} }

View file

@ -229,11 +229,11 @@ namespace Mist{
if (firstTime > lastTime){ if (firstTime > lastTime){
firstTime = headerPack.getTime(); firstTime = headerPack.getTime();
} }
DONTEVEN_MSG("Found DTSC packet with timestamp '%zu'", lastTime); DONTEVEN_MSG("Found DTSC packet with timestamp %" PRIu64, lastTime);
} }
} }
fclose(inFile); fclose(inFile);
HIGH_MSG("Duration of TS file at location '%s' is %zu ms (%zu - %zu)", filepath.c_str(), (lastTime - firstTime), lastTime, firstTime); HIGH_MSG("Duration of TS file at location '%s' is " PRETTY_PRINT_MSTIME " (" PRETTY_PRINT_MSTIME " - " PRETTY_PRINT_MSTIME ")", filepath.c_str(), PRETTY_ARG_MSTIME(lastTime - firstTime), PRETTY_ARG_MSTIME(lastTime), PRETTY_ARG_MSTIME(firstTime));
return (lastTime - firstTime); return (lastTime - firstTime);
} }
@ -258,12 +258,7 @@ namespace Mist{
// Add current livestream timestamp // Add current livestream timestamp
if (M.getLive()){ if (M.getLive()){
uint64_t unixMs = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()) + firstTime; uint64_t unixMs = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()) + firstTime;
time_t uSecs = unixMs/1000; outPlsFile << "#EXT-X-PROGRAM-DATE-TIME:" << Util::getUTCStringMillis(unixMs) << std::endl;
struct tm *tVal = gmtime(&uSecs);
char UTCTime[25];
snprintf(UTCTime, 25, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%3zuZ", tVal->tm_year + 1900, tVal->tm_mon + 1, tVal->tm_mday, tVal->tm_hour, tVal->tm_min, tVal->tm_sec, unixMs%1000);
outPlsFile << "#EXT-X-PROGRAM-DATE-TIME:" << UTCTime << std::endl;
writeTimestamp = false; writeTimestamp = false;
} }
// Otherwise open it in append mode // Otherwise open it in append mode
@ -274,12 +269,7 @@ namespace Mist{
// Add current timestamp // Add current timestamp
if (M.getLive() && writeTimestamp){ if (M.getLive() && writeTimestamp){
uint64_t unixMs = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()) + firstTime; uint64_t unixMs = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()) + firstTime;
time_t uSecs = unixMs/1000; outPlsFile << "#EXT-X-PROGRAM-DATE-TIME:" << Util::getUTCStringMillis(unixMs) << std::endl;
struct tm *tVal = gmtime(&uSecs);
char UTCTime[25];
snprintf(UTCTime, 25, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%3zuZ", tVal->tm_year + 1900, tVal->tm_mon + 1, tVal->tm_mday, tVal->tm_hour, tVal->tm_min, tVal->tm_sec, unixMs%1000);
outPlsFile << "#EXT-X-PROGRAM-DATE-TIME:" << UTCTime << std::endl;
} }
INFO_MSG("Adding new segment of %.2f seconds to playlist '%s'", segmentDuration, playlistLocation.c_str()); INFO_MSG("Adding new segment of %.2f seconds to playlist '%s'", segmentDuration, playlistLocation.c_str());
// Append duration & TS filename to playlist file // Append duration & TS filename to playlist file

View file

@ -28,8 +28,6 @@ namespace Mist{
std::string prepend; std::string prepend;
// Defaults to True. When exporting to .m3u8 & TS, it will overwrite the existing playlist file and remove existing .TS files // Defaults to True. When exporting to .m3u8 & TS, it will overwrite the existing playlist file and remove existing .TS files
bool removeOldPlaylistFiles; bool removeOldPlaylistFiles;
// Amount of segments written to the playlist since the last 'EXT-X-PROGRAM-DATE-TIME' tag
uint32_t previousTimestamp;
}; };
}// namespace Mist }// namespace Mist