Fix compile warnings
Co-authored-by: Thulinma <jaron@vietors.com>
This commit is contained in:
parent
055fb18270
commit
0a13ec1119
14 changed files with 52 additions and 54 deletions
|
@ -46,7 +46,7 @@ namespace Comms{
|
|||
class Comms{
|
||||
public:
|
||||
Comms();
|
||||
~Comms();
|
||||
virtual ~Comms();
|
||||
operator bool() const;
|
||||
void reload(const std::string & prefix, size_t baseSize, bool _master = false, bool reIssue = false);
|
||||
virtual void addFields();
|
||||
|
|
|
@ -743,7 +743,7 @@ std::string Util::getMyPath(){
|
|||
#ifdef __APPLE__
|
||||
memset(mypath, 0, 500);
|
||||
unsigned int refSize = 500;
|
||||
int ret = _NSGetExecutablePath(mypath, &refSize);
|
||||
_NSGetExecutablePath(mypath, &refSize);
|
||||
#else
|
||||
int ret = readlink("/proc/self/exe", mypath, 500);
|
||||
if (ret != -1){
|
||||
|
|
|
@ -2124,7 +2124,7 @@ namespace DTSC{
|
|||
uint64_t Meta::getBufferWindow() const{return stream.getInt(streamBufferWindowField);}
|
||||
|
||||
void Meta::setBootMsOffset(int64_t bootMsOffset){
|
||||
DONTEVEN_MSG("Setting streamBootMsOffsetField to '%ld'", bootMsOffset);
|
||||
DONTEVEN_MSG("Setting streamBootMsOffsetField to %" PRId64, bootMsOffset);
|
||||
stream.setInt(streamBootMsOffsetField, bootMsOffset);
|
||||
}
|
||||
int64_t Meta::getBootMsOffset() const{return stream.getInt(streamBootMsOffsetField);}
|
||||
|
@ -3190,7 +3190,7 @@ namespace DTSC{
|
|||
if (pages.getInt(firsttime, i) > time){break;}
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@ namespace RTP{
|
|||
class toDTSC{
|
||||
public:
|
||||
toDTSC();
|
||||
virtual ~toDTSC(){}
|
||||
void setProperties(const uint64_t track, const std::string &codec, const std::string &type,
|
||||
const std::string &init, const double multiplier);
|
||||
void setProperties(const DTSC::Meta &M, size_t tid);
|
||||
|
|
|
@ -110,8 +110,17 @@ std::string Util::getUTCString(uint64_t epoch){
|
|||
struct tm *ptm;
|
||||
ptm = gmtime(&rawtime);
|
||||
char result[20];
|
||||
snprintf(result, 20, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d", ptm->tm_year + 1900, ptm->tm_mon + 1,
|
||||
ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,5 +17,6 @@ namespace Util{
|
|||
uint64_t getNTP();
|
||||
uint64_t epoch(); ///< Gets the amount of seconds since 01/01/1970.
|
||||
std::string getUTCString(uint64_t epoch = 0);
|
||||
std::string getUTCStringMillis(uint64_t epoch_millis = 0);
|
||||
std::string getDateString(uint64_t epoch = 0);
|
||||
}// namespace Util
|
||||
|
|
|
@ -151,13 +151,13 @@ HTTP::URL::URL(const std::string &url){
|
|||
}
|
||||
|
||||
/// Returns the port in numeric format
|
||||
uint32_t HTTP::URL::getPort() const{
|
||||
uint16_t HTTP::URL::getPort() const{
|
||||
if (!port.size()){return getDefaultPort();}
|
||||
return atoi(port.c_str());
|
||||
}
|
||||
|
||||
/// 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 == "https"){return 443;}
|
||||
if (protocol == "ws"){return 80;}
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace HTTP{
|
|||
class URL{
|
||||
public:
|
||||
URL(const std::string &url = "");
|
||||
uint32_t getPort() const;
|
||||
uint32_t getDefaultPort() const;
|
||||
uint16_t getPort() const;
|
||||
uint16_t getDefaultPort() const;
|
||||
std::string getExt() const;
|
||||
std::string getUrl() const;
|
||||
std::string getFilePath() const;
|
||||
|
|
|
@ -293,12 +293,12 @@ void Controller::SharedMemStats(void *config){
|
|||
if (cpustat){
|
||||
char line[300];
|
||||
while (cpustat.getline(line, 300)){
|
||||
static unsigned long long cl_total = 0, cl_idle = 0;
|
||||
unsigned long long 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){
|
||||
static uint64_t cl_total = 0, cl_idle = 0;
|
||||
uint64_t c_user, c_nice, c_syst, c_idle, c_total;
|
||||
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;
|
||||
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{
|
||||
cpu_use = 0;
|
||||
}
|
||||
|
|
|
@ -470,7 +470,7 @@ namespace Mist{
|
|||
std::getline(input, filename);
|
||||
|
||||
// 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){
|
||||
cleanLine(filename);
|
||||
filename = root.link(filename).getUrl();
|
||||
|
@ -807,7 +807,7 @@ namespace Mist{
|
|||
// keyframe data exists, so always add 19 bytes keyframedata.
|
||||
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
|
||||
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);
|
||||
tsStream.getEarliestPacket(headerPack);
|
||||
}
|
||||
|
@ -834,9 +834,9 @@ namespace Mist{
|
|||
|
||||
headerPack.getString("data", data, dataLen);
|
||||
// keyframe data exists, so always add 19 bytes keyframedata.
|
||||
long long packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
|
||||
long long 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);
|
||||
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
|
||||
size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11;
|
||||
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);
|
||||
tsStream.getEarliestPacket(headerPack);
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ namespace Mist{
|
|||
// Get the updated list of entries
|
||||
std::deque<playListEntries> &curList = listEntries[currentPlaylist];
|
||||
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;
|
||||
}
|
||||
if (!segDowner.loadSegment(curList.at(segmentIndex))){
|
||||
|
@ -942,13 +942,13 @@ namespace Mist{
|
|||
if (!hasOffset && curList.at(segmentIndex).mUTC){
|
||||
hasOffset = true;
|
||||
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];
|
||||
}
|
||||
if (hasOffset || DVRTimeOffsets.count(currentPlaylist)){
|
||||
hasOffset = true;
|
||||
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());
|
||||
if (idx == INVALID_TRACK_ID || !M.getCodec(idx).size()){
|
||||
|
@ -959,7 +959,7 @@ namespace Mist{
|
|||
headerPack.getString("data", data, dataLen);
|
||||
// keyframe data exists, so always add 19 bytes keyframedata.
|
||||
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"));
|
||||
tsStream.getEarliestPacket(headerPack);
|
||||
}
|
||||
|
@ -980,7 +980,7 @@ namespace Mist{
|
|||
uint64_t packetTime = headerPack.getTime();
|
||||
if (DVRTimeOffsets.count(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());
|
||||
if (idx == INVALID_TRACK_ID || !M.getCodec(idx).size()){
|
||||
|
@ -991,7 +991,7 @@ namespace Mist{
|
|||
headerPack.getString("data", data, dataLen);
|
||||
// keyframe data exists, so always add 19 bytes keyframedata.
|
||||
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"));
|
||||
tsStream.getEarliestPacket(headerPack);
|
||||
}
|
||||
|
@ -1010,9 +1010,9 @@ namespace Mist{
|
|||
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++){
|
||||
MEDIUM_MSG("Adding entry #%lu as live data", entryIt);
|
||||
MEDIUM_MSG("Adding entry #%" PRIu64 " as live data", entryIt);
|
||||
if (parseSegmentAsLive(entryIt)){
|
||||
parsedSegments[currentPlaylist]++;
|
||||
}else{
|
||||
|
@ -1133,10 +1133,10 @@ namespace Mist{
|
|||
DTSC::Keys keys(M.keys(idx));
|
||||
for (size_t i = keys.getFirstValid(); i < keys.getEndValid(); i++){
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ namespace Mist{
|
|||
segDowner.loadSegment(entry);
|
||||
// If we have an offset, load it
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1186,7 +1186,7 @@ namespace Mist{
|
|||
/// \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
|
||||
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;
|
||||
|
||||
// UTC based timestamp offsets
|
||||
|
@ -1206,7 +1206,7 @@ namespace Mist{
|
|||
newTime = 0;
|
||||
FAIL_MSG("Time offset is too negative causing an integer overflow. Setting current packet time to 0.");
|
||||
}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];
|
||||
}
|
||||
}
|
||||
|
@ -1214,7 +1214,7 @@ namespace Mist{
|
|||
}else{
|
||||
// Apply offset if any was set
|
||||
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];
|
||||
}
|
||||
if (plsLastTime.count(currentPlaylist)){
|
||||
|
@ -1302,7 +1302,7 @@ namespace Mist{
|
|||
for (std::map<uint32_t, std::deque<playListEntries> >::iterator pListIt = listEntries.begin();
|
||||
pListIt != listEntries.end(); pListIt++){
|
||||
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);
|
||||
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()){
|
||||
INFO_MSG("Reached last entry in playlist %" PRIu64 "; waiting for more segments", currentPlaylist);
|
||||
if (streamIsLive || isLiveDVR){Util::wait(500);}
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace Mist{
|
|||
std::string currentSource;
|
||||
size_t playlistIndex;
|
||||
size_t minIndex, maxIndex;
|
||||
bool seenValidEntry;
|
||||
uint32_t wallTime;
|
||||
uint32_t reloadOn;
|
||||
};
|
||||
|
|
|
@ -437,7 +437,7 @@ namespace Mist{
|
|||
if (tPages.getInt("avail", curPage) > FLIP_DATA_PAGE_SIZE || packTime - prevPageTime > FLIP_TARGET_DURATION){
|
||||
// Create the book keeping data for the new page
|
||||
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]);
|
||||
|
||||
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("keycount", tPages.getInt("keycount", curPage) + 1, curPage);
|
||||
}
|
||||
|
|
|
@ -229,11 +229,11 @@ namespace Mist{
|
|||
if (firstTime > lastTime){
|
||||
firstTime = headerPack.getTime();
|
||||
}
|
||||
DONTEVEN_MSG("Found DTSC packet with timestamp '%zu'", lastTime);
|
||||
DONTEVEN_MSG("Found DTSC packet with timestamp %" PRIu64, lastTime);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -258,12 +258,7 @@ namespace Mist{
|
|||
// Add current livestream timestamp
|
||||
if (M.getLive()){
|
||||
uint64_t unixMs = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()) + firstTime;
|
||||
time_t uSecs = unixMs/1000;
|
||||
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;
|
||||
outPlsFile << "#EXT-X-PROGRAM-DATE-TIME:" << Util::getUTCStringMillis(unixMs) << std::endl;
|
||||
writeTimestamp = false;
|
||||
}
|
||||
// Otherwise open it in append mode
|
||||
|
@ -274,12 +269,7 @@ namespace Mist{
|
|||
// Add current timestamp
|
||||
if (M.getLive() && writeTimestamp){
|
||||
uint64_t unixMs = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()) + firstTime;
|
||||
time_t uSecs = unixMs/1000;
|
||||
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;
|
||||
outPlsFile << "#EXT-X-PROGRAM-DATE-TIME:" << Util::getUTCStringMillis(unixMs) << std::endl;
|
||||
}
|
||||
INFO_MSG("Adding new segment of %.2f seconds to playlist '%s'", segmentDuration, playlistLocation.c_str());
|
||||
// Append duration & TS filename to playlist file
|
||||
|
|
|
@ -28,8 +28,6 @@ namespace Mist{
|
|||
std::string prepend;
|
||||
// Defaults to True. When exporting to .m3u8 & TS, it will overwrite the existing playlist file and remove existing .TS files
|
||||
bool removeOldPlaylistFiles;
|
||||
// Amount of segments written to the playlist since the last 'EXT-X-PROGRAM-DATE-TIME' tag
|
||||
uint32_t previousTimestamp;
|
||||
};
|
||||
}// namespace Mist
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue