Silence more compile warnings, fix compilation on MacOS

This commit is contained in:
Thulinma 2022-10-26 16:13:27 +02:00
parent 0a13ec1119
commit 4181b52857
34 changed files with 61 additions and 73 deletions

View file

@ -40,7 +40,6 @@ void Bit::setMSB(char *pointer, unsigned int offsetBits, unsigned int dataBits,
pointer += (offsetBits + dataBits) >> 3; pointer += (offsetBits + dataBits) >> 3;
// The offset is now guaranteed less than a whole byte. // The offset is now guaranteed less than a whole byte.
offsetBits = (offsetBits + dataBits) & 0x07; offsetBits = (offsetBits + dataBits) & 0x07;
unsigned long long retVal = 0;
// Now we set the remaining bytes // Now we set the remaining bytes
while (dataBits){ while (dataBits){
// Calculate how many bits we're setting in this byte // Calculate how many bits we're setting in this byte
@ -49,7 +48,6 @@ void Bit::setMSB(char *pointer, unsigned int offsetBits, unsigned int dataBits,
// If that is too much, we use the remainder instead // If that is too much, we use the remainder instead
if (curBits > dataBits){curBits = dataBits;} if (curBits > dataBits){curBits = dataBits;}
// Set the current pointer position at the correct offset, increasing the pointer by one // Set the current pointer position at the correct offset, increasing the pointer by one
retVal |= ((int)(*(pointer++)) << offsetBits) >> (8 - curBits);
*pointer = (((*pointer) << offsetBits) >> offsetBits) | ((value & 0xFF) << (8 - offsetBits)); *pointer = (((*pointer) << offsetBits) >> offsetBits) | ((value & 0xFF) << (8 - offsetBits));
--pointer; --pointer;
// Finally, shift the current value by the amount of bits we're adding // Finally, shift the current value by the amount of bits we're adding

View file

@ -407,7 +407,7 @@ namespace Comms{
setConnector(protocol); setConnector(protocol);
setHost(ip); setHost(ip);
setStream(streamName); setStream(streamName);
VERYHIGH_MSG("Reloading connection. Claimed record %lu", index); VERYHIGH_MSG("Reloading connection. Claimed record %" PRIu64, index);
} }
} }

View file

@ -2836,8 +2836,8 @@ namespace DTSC{
trackJSON["codec"] = getCodec(*it); trackJSON["codec"] = getCodec(*it);
trackJSON["type"] = type; trackJSON["type"] = type;
trackJSON["idx"] = *it; trackJSON["idx"] = (uint64_t)*it;
trackJSON["trackid"] = getID(*it); trackJSON["trackid"] = (uint64_t)getID(*it);
trackJSON["init"] = getInit(*it); trackJSON["init"] = getInit(*it);
trackJSON["firstms"] = getFirstms(*it); trackJSON["firstms"] = getFirstms(*it);
trackJSON["lastms"] = getLastms(*it); trackJSON["lastms"] = getLastms(*it);
@ -3288,7 +3288,7 @@ namespace DTSC{
if (trackValid(srcTrk)){ if (trackValid(srcTrk)){
track["source"] = getTrackIdentifier(srcTrk); track["source"] = getTrackIdentifier(srcTrk);
}else{ }else{
track["source"] = "Invalid track " + JSON::Value(srcTrk).asString(); track["source"] = "Invalid track " + JSON::Value((uint64_t)srcTrk).asString();
} }
}else{ }else{
if (jitter < minKeep){jitter = minKeep;} if (jitter < minKeep){jitter = minKeep;}

View file

@ -114,7 +114,7 @@ namespace HLS{
uint64_t lastFragmentDur = getLastFragDur(M, userSelect, trackData, hlsMsnNr, fragments, keys); uint64_t lastFragmentDur = getLastFragDur(M, userSelect, trackData, hlsMsnNr, fragments, keys);
std::ldiv_t res = std::ldiv(lastFragmentDur, partDurationMaxMs); std::ldiv_t res = std::ldiv(lastFragmentDur, partDurationMaxMs);
DEBUG_MSG(5, "req MSN %" PRIu64 " fin MSN %zu, req Part %" PRIu64 " fin Part %zu", hlsMsnNr, DEBUG_MSG(5, "req MSN %" PRIu64 " fin MSN %zu, req Part %" PRIu64 " fin Part %ld", hlsMsnNr,
(fragments.getEndValid() - 2), hlsPartNr, res.quot); (fragments.getEndValid() - 2), hlsPartNr, res.quot);
// BPR Time limit = 3x Target Duration (per HLS spec) // BPR Time limit = 3x Target Duration (per HLS spec)
@ -300,13 +300,7 @@ namespace HLS{
/// Appends result with prependStr and timestamp calculated from current time in ms /// Appends result with prependStr and timestamp calculated from current time in ms
void addDateTimeTag(std::stringstream &result, const std::string &prependStr, void addDateTimeTag(std::stringstream &result, const std::string &prependStr,
const uint64_t unixMs){ const uint64_t unixMs){
time_t uSecs = unixMs / 1000; result << prependStr << Util::getUTCStringMillis(unixMs) << "\r\n";
struct tm *ptm = gmtime(&uSecs);
char dt_iso_8601[25];
snprintf(dt_iso_8601, 25, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ", ptm->tm_year + 1900,
ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec,
(int)(unixMs % 1000));
result << prependStr << dt_iso_8601 << "\r\n";
} }
/// Add segment tag to LLHLS playlist /// Add segment tag to LLHLS playlist

View file

@ -1273,7 +1273,7 @@ namespace RTP{
WARN_MSG("Ignoring invalid PPS packet! (%" PRIu32 "b)", len-4); WARN_MSG("Ignoring invalid PPS packet! (%" PRIu32 "b)", len-4);
return; return;
} }
HIGH_MSG("Updated PPS with ID %li from RTP data", PPS.picParameterSetId); HIGH_MSG("Updated PPS with ID %" PRIu64 " from RTP data", PPS.picParameterSetId);
ppsData[PPS.picParameterSetId].assign(buffer + 4, len - 4); ppsData[PPS.picParameterSetId].assign(buffer + 4, len - 4);
} }
} }

View file

@ -877,7 +877,7 @@ namespace SDP{
for (std::map<uint64_t, Track>::iterator it = tracks.begin(); it != tracks.end(); it++) { for (std::map<uint64_t, Track>::iterator it = tracks.begin(); it != tracks.end(); it++) {
trackID = myMeta->getID(it->first); trackID = myMeta->getID(it->first);
INFO_MSG("Removing track %zu:%s", it->first, myMeta->getTrackIdentifier(it->first).c_str()); INFO_MSG("Removing track %" PRIu64 ":%s", it->first, myMeta->getTrackIdentifier(it->first).c_str());
if (trackID == INVALID_TRACK_ID){ if (trackID == INVALID_TRACK_ID){
WARN_MSG("TrackID was invalid"); WARN_MSG("TrackID was invalid");
} }

View file

@ -1626,6 +1626,7 @@ void Socket::UDPConnection::checkRecvBuf(){
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf)); setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf); slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen); getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
#ifdef __linux__
#ifndef __CYGWIN__ #ifndef __CYGWIN__
if (recvbuf < 1024*1024){ if (recvbuf < 1024*1024){
recvbuf = 1024*1024; recvbuf = 1024*1024;
@ -1633,12 +1634,14 @@ void Socket::UDPConnection::checkRecvBuf(){
slen = sizeof(recvbuf); slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen); getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
} }
#endif
#endif #endif
if (recvbuf < 200*1024){ if (recvbuf < 200*1024){
recvbuf = 200*1024; recvbuf = 200*1024;
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf)); setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf); slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen); getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
#ifdef __linux__
#ifndef __CYGWIN__ #ifndef __CYGWIN__
if (recvbuf < 200*1024){ if (recvbuf < 200*1024){
recvbuf = 200*1024; recvbuf = 200*1024;
@ -1646,6 +1649,7 @@ void Socket::UDPConnection::checkRecvBuf(){
slen = sizeof(recvbuf); slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen); getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
} }
#endif
#endif #endif
} }
if (recvbuf < 200*1024){ if (recvbuf < 200*1024){

View file

@ -622,7 +622,7 @@ JSON::Value Util::getInputBySource(const std::string &filename, bool isProvider)
// Abort if not available // Abort if not available
if (!inputs){ if (!inputs){
FAIL_MSG("Capabilities not available, aborting! Is MistController running?"); FAIL_MSG("Capabilities not available, aborting! Is MistController running?");
return false; return JSON::Value();
} }
// check in curConf for <naam>-priority/source_match // check in curConf for <naam>-priority/source_match
@ -863,7 +863,7 @@ std::set<size_t> Util::pickTracks(const DTSC::Meta &M, const std::set<size_t> tr
//Literal track ID, does not check against trackList //Literal track ID, does not check against trackList
size_t idx = JSON::Value(trackVal).asInt(); size_t idx = JSON::Value(trackVal).asInt();
if (trackVal == JSON::Value(idx).asString()){ if (trackVal == JSON::Value((uint64_t)idx).asString()){
if (!M.trackValid(idx)){ if (!M.trackValid(idx)){
WARN_MSG("Track %zu does not exist in stream, cannot select", idx); WARN_MSG("Track %zu does not exist in stream, cannot select", idx);
return result; return result;

View file

@ -11,8 +11,6 @@
#if defined(__APPLE__) || defined(__MACH__) #if defined(__APPLE__) || defined(__MACH__)
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/mach.h> #include <mach/mach.h>
#define CLOCK_REALTIME CALENDAR_CLOCK
#define CLOCK_MONOTONIC SYSTEM_CLOCK
void clock_gettime(int ign, struct timespec *ts){ void clock_gettime(int ign, struct timespec *ts){
clock_serv_t cclock; clock_serv_t cclock;
mach_timespec_t mts; mach_timespec_t mts;

View file

@ -26,6 +26,7 @@ namespace Util{
virtual void dataCallback(const char *ptr, size_t size){ virtual void dataCallback(const char *ptr, size_t size){
INFO_MSG("default callback, size: %zu", size); INFO_MSG("default callback, size: %zu", size);
} }
virtual ~DataCallback(){};
}; };
extern Util::DataCallback defaultDataCallback; extern Util::DataCallback defaultDataCallback;

View file

@ -65,7 +65,6 @@ bool AnalyserOGG::parsePacket(){
} }
}else if (sn2Codec[oggPage.getBitstreamSerialNumber()] == "Opus"){ }else if (sn2Codec[oggPage.getBitstreamSerialNumber()] == "Opus"){
if (detail >= 2){std::cout << " Opus data" << std::endl;} if (detail >= 2){std::cout << " Opus data" << std::endl;}
int offset = 0;
for (unsigned int i = 0; i < oggPage.getAllSegments().size(); i++){ for (unsigned int i = 0; i < oggPage.getAllSegments().size(); i++){
int len = oggPage.getAllSegments()[i].size(); int len = oggPage.getAllSegments()[i].size();
const char *part = oggPage.getSegment(i); const char *part = oggPage.getSegment(i);
@ -101,7 +100,6 @@ bool AnalyserOGG::parsePacket(){
}else{ }else{
if (detail >= 4){std::cout << " " << Opus::Opus_prettyPacket(part, len) << std::endl;} if (detail >= 4){std::cout << " " << Opus::Opus_prettyPacket(part, len) << std::endl;}
} }
offset += len;
} }
} }
return true; return true;

View file

@ -1355,7 +1355,7 @@ void Controller::fillActive(JSON::Value &req, JSON::Value &rep){
}else if (j->asStringRef() == "tracks"){ }else if (j->asStringRef() == "tracks"){
if (!M || M.getStreamName() != it->first){M.reInit(it->first, false);} if (!M || M.getStreamName() != it->first){M.reInit(it->first, false);}
if (M){ if (M){
F = M.getValidTracks().size(); F = (uint64_t)M.getValidTracks().size();
} }
}else if (j->asStringRef() == "status"){ }else if (j->asStringRef() == "status"){
uint8_t ss = Util::getStreamStatus(it->first); uint8_t ss = Util::getStreamStatus(it->first);

View file

@ -1025,9 +1025,9 @@ namespace Mist{
void Input::finish(){ void Input::finish(){
if (!standAlone || config->getBool("realtime")){return;} if (!standAlone || config->getBool("realtime")){return;}
for (std::map<size_t, std::map<uint32_t, size_t> >::iterator it = pageCounter.begin(); for (std::map<size_t, std::map<uint32_t, uint64_t> >::iterator it = pageCounter.begin();
it != pageCounter.end(); it++){ it != pageCounter.end(); it++){
for (std::map<uint32_t, size_t>::iterator it2 = it->second.begin(); it2 != it->second.end(); it2++){ for (std::map<uint32_t, uint64_t>::iterator it2 = it->second.begin(); it2 != it->second.end(); it2++){
it2->second = 1; it2->second = 1;
} }
} }
@ -1059,9 +1059,9 @@ namespace Mist{
} }
} }
//Check pages we buffered but forgot about //Check pages we buffered but forgot about
for (std::map<size_t, std::map<uint32_t, size_t> >::iterator it = pageCounter.begin(); for (std::map<size_t, std::map<uint32_t, uint64_t> >::iterator it = pageCounter.begin();
it != pageCounter.end(); it++){ it != pageCounter.end(); it++){
for (std::map<uint32_t, size_t>::iterator it2 = it->second.begin(); it2 != it->second.end(); it2++){ for (std::map<uint32_t, uint64_t>::iterator it2 = it->second.begin(); it2 != it->second.end(); it2++){
if (!checkedPages.count(it->first) || !checkedPages[it->first].count(it2->first)){ if (!checkedPages.count(it->first) || !checkedPages[it->first].count(it2->first)){
INFO_MSG("Deleting forgotten page %zu:%" PRIu32, it->first, it2->first); INFO_MSG("Deleting forgotten page %zu:%" PRIu32, it->first, it2->first);
bufferRemove(it->first, it2->first); bufferRemove(it->first, it2->first);

View file

@ -163,7 +163,7 @@ namespace Mist{
inFile.readSome(aacData, bytesRead, frameSize - 6); inFile.readSome(aacData, bytesRead, frameSize - 6);
if (bytesRead < frameSize - 6){ if (bytesRead < frameSize - 6){
WARN_MSG("Not enough bytes left in buffer."); WARN_MSG("Not enough bytes left in buffer.");
WARN_MSG("Wanted %li bytes but read %li bytes...", frameSize - 6, bytesRead); WARN_MSG("Wanted %" PRIu64 " bytes but read %zu bytes...", frameSize - 6, bytesRead);
} }
for (int i = 0; i < (frameSize - 6); i++){ for (int i = 0; i < (frameSize - 6); i++){
aacFrame[i+6] = aacData[i]; aacFrame[i+6] = aacData[i];
@ -241,7 +241,7 @@ namespace Mist{
inFile.readSome(aacData, bytesRead, 6); inFile.readSome(aacData, bytesRead, 6);
if (bytesRead < 6){ if (bytesRead < 6){
WARN_MSG("Not enough bytes left in buffer to extract a new ADTS frame"); WARN_MSG("Not enough bytes left in buffer to extract a new ADTS frame");
WARN_MSG("Wanted %i bytes but read %li bytes...", 6, bytesRead); WARN_MSG("Wanted 6 bytes but read %zu bytes...", bytesRead);
WARN_MSG("Header contains bytes: %x %x %x %x %x %x", aacData[0] WARN_MSG("Header contains bytes: %x %x %x %x %x %x", aacData[0]
, aacData[1], aacData[2], aacData[3], aacData[4], aacData[5]); , aacData[1], aacData[2], aacData[3], aacData[4], aacData[5]);
return; return;
@ -252,7 +252,7 @@ namespace Mist{
if (aacData[0] == 0x41 && aacData[1] == 0x50 && aacData[2] == 0x45 && if (aacData[0] == 0x41 && aacData[1] == 0x50 && aacData[2] == 0x45 &&
aacData[3] == 0x54 && aacData[4] == 0x41 && aacData[5] == 0x47){ aacData[3] == 0x54 && aacData[4] == 0x41 && aacData[5] == 0x47){
inFile.readAll(aacData, bytesRead); inFile.readAll(aacData, bytesRead);
INFO_MSG("Throwing out %li bytes of metadata...", bytesRead); INFO_MSG("Throwing out %zu bytes of metadata...", bytesRead);
return; return;
} }
WARN_MSG("Invalid sync word at start of header"); WARN_MSG("Invalid sync word at start of header");
@ -270,7 +270,7 @@ namespace Mist{
inFile.readSome(aacData, bytesRead, frameSize - 6); inFile.readSome(aacData, bytesRead, frameSize - 6);
if (bytesRead < frameSize - 6){ if (bytesRead < frameSize - 6){
WARN_MSG("Not enough bytes left in buffer."); WARN_MSG("Not enough bytes left in buffer.");
WARN_MSG("Wanted %li bytes but read %li bytes...", frameSize - 6, bytesRead); WARN_MSG("Wanted %" PRIu64 " bytes but read %zu bytes...", frameSize - 6, bytesRead);
disregardAmount = frameSize - 6 - bytesRead; disregardAmount = frameSize - 6 - bytesRead;
} }
for (int i = 0; i < (frameSize - 6); i++){ for (int i = 0; i < (frameSize - 6); i++){
@ -282,10 +282,10 @@ namespace Mist{
if (!adtsPack){ if (!adtsPack){
WARN_MSG("Could not parse ADTS package!"); WARN_MSG("Could not parse ADTS package!");
WARN_MSG("Current frame info:"); WARN_MSG("Current frame info:");
WARN_MSG("Current frame pos: %li", filePos); WARN_MSG("Current frame pos: %zu", filePos);
WARN_MSG("Next frame pos: %li", nextFramePos); WARN_MSG("Next frame pos: %zu", nextFramePos);
WARN_MSG("Frame size expected: %li", frameSize); WARN_MSG("Frame size expected: %" PRIu64, frameSize);
WARN_MSG("Bytes read: %li", bytesRead); WARN_MSG("Bytes read: %zu", bytesRead);
WARN_MSG("ADTS getAACProfile: %li", adtsPack.getAACProfile()); WARN_MSG("ADTS getAACProfile: %li", adtsPack.getAACProfile());
WARN_MSG("ADTS getFrequencyIndex: %li", adtsPack.getFrequencyIndex()); WARN_MSG("ADTS getFrequencyIndex: %li", adtsPack.getFrequencyIndex());
WARN_MSG("ADTS getFrequency: %li", adtsPack.getFrequency()); WARN_MSG("ADTS getFrequency: %li", adtsPack.getFrequency());
@ -326,8 +326,8 @@ namespace Mist{
// We minus the filePos by one, since we init it 1 higher // We minus the filePos by one, since we init it 1 higher
inFile.seek(keys.getBpos(keyIdx)-1); inFile.seek(keys.getBpos(keyIdx)-1);
thisTime = keys.getTime(keyIdx); thisTime = keys.getTime(keyIdx);
DONTEVEN_MSG("inputAAC wants to seek to timestamp %li on track %li", seekTime, idx); DONTEVEN_MSG("inputAAC wants to seek to timestamp %" PRIu64 " on track %zu", seekTime, idx);
DONTEVEN_MSG("inputAAC seeked to timestamp %f with bytePos %li", thisTime, keys.getBpos(keyIdx)-1); DONTEVEN_MSG("inputAAC seeked to timestamp %" PRIu64 " with bytePos %zu", thisTime, keys.getBpos(keyIdx)-1);
} }
}// namespace Mist }// namespace Mist

View file

@ -401,7 +401,7 @@ namespace Mist{
if (longest_key > shrtest_key*2){ if (longest_key > shrtest_key*2){
JSON::Value prep; JSON::Value prep;
prep["cmd"] = "check_key_duration"; prep["cmd"] = "check_key_duration";
prep["id"] = thisPacket.getTrackId(); prep["id"] = (uint64_t)thisPacket.getTrackId();
prep["duration"] = longest_key; prep["duration"] = longest_key;
srcConn.SendNow("DTCM"); srcConn.SendNow("DTCM");
char sSize[4] ={0, 0, 0, 0}; char sSize[4] ={0, 0, 0, 0};

View file

@ -644,10 +644,8 @@ namespace Mist{
DTSC::Parts parts(M.parts(mainTrack)); DTSC::Parts parts(M.parts(mainTrack));
uint64_t seekPos = keys.getBpos(0); uint64_t seekPos = keys.getBpos(0);
// Replay the parts of the previous keyframe, so the timestaps match up // Replay the parts of the previous keyframe, so the timestaps match up
uint64_t partCount = 0;
for (size_t i = 0; i < keys.getEndValid(); i++){ for (size_t i = 0; i < keys.getEndValid(); i++){
if (keys.getTime(i) > seekTime){break;} if (keys.getTime(i) > seekTime){break;}
partCount += keys.getParts(i);
DONTEVEN_MSG("Seeking to %" PRIu64 ", found %" PRIu64 "...", seekTime, keys.getTime(i)); DONTEVEN_MSG("Seeking to %" PRIu64 ", found %" PRIu64 "...", seekTime, keys.getTime(i));
seekPos = keys.getBpos(i); seekPos = keys.getBpos(i);
} }

View file

@ -886,7 +886,7 @@ namespace Mist{
// Write packet ID mappings // Write packet ID mappings
JSON::Value thisMappingsR; JSON::Value thisMappingsR;
for (std::map<size_t, uint64_t>::iterator pidIt = pidMappingR.begin(); for (std::map<uint64_t, uint64_t>::iterator pidIt = pidMappingR.begin();
pidIt != pidMappingR.end(); pidIt++){ pidIt != pidMappingR.end(); pidIt++){
thisMappingsR[JSON::Value(pidIt->first).asString()] = pidIt->second; thisMappingsR[JSON::Value(pidIt->first).asString()] = pidIt->second;
} }

View file

@ -60,7 +60,6 @@ namespace Mist{
std::map<size_t, uint64_t> duration; std::map<size_t, uint64_t> duration;
uint64_t currOffset;
uint64_t lastBytePos = 0; uint64_t lastBytePos = 0;
uint64_t curBytePos = ftell(inFile); uint64_t curBytePos = ftell(inFile);
// parse fragments form here // parse fragments form here
@ -70,7 +69,6 @@ namespace Mist{
while (readMoofSkipMdat(tId, trunSamples) && !feof(inFile)){ while (readMoofSkipMdat(tId, trunSamples) && !feof(inFile)){
if (!duration.count(tId)){duration[tId] = 0;} if (!duration.count(tId)){duration[tId] = 0;}
currOffset = 8;
for (std::vector<MP4::trunSampleInformation>::iterator it = trunSamples.begin(); for (std::vector<MP4::trunSampleInformation>::iterator it = trunSamples.begin();
it != trunSamples.end(); it++){ it != trunSamples.end(); it++){
bool first = (it == trunSamples.begin()); bool first = (it == trunSamples.begin());
@ -86,7 +84,6 @@ namespace Mist{
meta.update(duration[tId] / 10000, offsetConv, tId, it->sampleSize, lastBytePos, first); meta.update(duration[tId] / 10000, offsetConv, tId, it->sampleSize, lastBytePos, first);
duration[tId] += it->sampleDuration; duration[tId] += it->sampleDuration;
currOffset += it->sampleSize;
} }
curBytePos = ftell(inFile); curBytePos = ftell(inFile);
} }

View file

@ -561,7 +561,7 @@ namespace Mist{
} }
static JSON::Value thisPack; static JSON::Value thisPack;
thisPack.null(); thisPack.null();
thisPack["trackid"] = curPart.trackID; thisPack["trackid"] = (uint64_t)curPart.trackID;
thisPack["bpos"] = curPart.bpos; //(long long)fileSource.tellg(); thisPack["bpos"] = curPart.bpos; //(long long)fileSource.tellg();
thisPack["data"] = std::string(readBuffer + (curPart.bpos-readPos) + 2, txtLen); thisPack["data"] = std::string(readBuffer + (curPart.bpos-readPos) + 2, txtLen);
thisPack["time"] = curPart.time; thisPack["time"] = curPart.time;

View file

@ -99,7 +99,7 @@ namespace Mist{
} }
reader.readAll(buffer, bytesRead); reader.readAll(buffer, bytesRead);
HIGH_MSG("Downloaded SDP file (%lu B)", bytesRead); HIGH_MSG("Downloaded SDP file (%zu B)", bytesRead);
// Save old buffer in order to identify changes // Save old buffer in order to identify changes
oldBuffer = strdup(buffer); oldBuffer = strdup(buffer);
@ -157,7 +157,7 @@ namespace Mist{
// Re-read SDP file // Re-read SDP file
reader.readAll(buffer, bytesRead); reader.readAll(buffer, bytesRead);
// Re-init SPD state iff contents have changed // Re-init SPD state iff contents have changed
INFO_MSG("Downloaded SDP file (%lu B)", bytesRead); INFO_MSG("Downloaded SDP file (%zu B)", bytesRead);
if (bytesRead != 0){ if (bytesRead != 0){
if (!compareStrings(oldBuffer, buffer)){ if (!compareStrings(oldBuffer, buffer)){
INFO_MSG("SDP contents have changed. Reparsing SDP file"); INFO_MSG("SDP contents have changed. Reparsing SDP file");
@ -302,7 +302,7 @@ namespace Mist{
pkt.getString("data", pktData, pktDataLen); pkt.getString("data", pktData, pktDataLen);
size_t idx = M.trackIDToIndex(pkt.getTrackId(), getpid()); size_t idx = M.trackIDToIndex(pkt.getTrackId(), getpid());
HIGH_MSG("Buffering new pkt for track %zu->%zu at offset %zu and time %zu", pkt.getTrackId(), idx, packetOffset, pkt.getTime()); HIGH_MSG("Buffering new pkt for track %zu->%zu at offset %" PRId64 " and time %" PRIu64, pkt.getTrackId(), idx, packetOffset, pkt.getTime());
if (idx == INVALID_TRACK_ID){ if (idx == INVALID_TRACK_ID){
INFO_MSG("Invalid index for track number %zu", pkt.getTrackId()); INFO_MSG("Invalid index for track number %zu", pkt.getTrackId());

View file

@ -1752,7 +1752,7 @@ namespace Mist{
JSON::Value & pData = pStat["push_status_update"]["status"]; JSON::Value & pData = pStat["push_status_update"]["status"];
pData["mediatime"] = currentTime(); pData["mediatime"] = currentTime();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
pData["tracks"].append(it->first); pData["tracks"].append((uint64_t)it->first);
} }
pData["bytes"] = statComm.getUp(); pData["bytes"] = statComm.getUp();
uint64_t pktCntNow = statComm.getPacketCount(); uint64_t pktCntNow = statComm.getPacketCount();

View file

@ -274,8 +274,8 @@ namespace Mist{
timingTid, timingTid,
requestTid, requestTid,
M.biggestFragment(timingTid) / 1000, M.biggestFragment(timingTid) / 1000,
atol(H.GetVar("iMsn").c_str()), (uint64_t)atol(H.GetVar("iMsn").c_str()),
M.getLive()? config->getInteger("listlimit") : 0, (uint64_t)(M.getLive() ? config->getInteger("listlimit") : 0),
urlPrefix, urlPrefix,
systemBoot, systemBoot,
bootMsOffset, bootMsOffset,

View file

@ -209,7 +209,7 @@ namespace Mist{
if (kDur > longest_key){longest_key = kDur;} if (kDur > longest_key){longest_key = kDur;}
} }
if (dur > longest_key*1.2){ if (dur > longest_key*1.2){
onFail("Key duration mismatch; disconnecting "+myConn.getHost()+" to recover ("+JSON::Value(longest_key).asString()+" -> "+JSON::Value(dur).asString()+")", true); onFail("Key duration mismatch; disconnecting "+myConn.getHost()+" to recover ("+JSON::Value(longest_key).asString()+" -> "+JSON::Value((uint64_t)dur).asString()+")", true);
return; return;
}else{ }else{
sendOk("Key duration matches upstream"); sendOk("Key duration matches upstream");

View file

@ -195,7 +195,7 @@ namespace Mist{
continue; continue;
} }
r["data"]["codecs"].append(codec); r["data"]["codecs"].append(codec);
r["data"]["tracks"].append(it->first); r["data"]["tracks"].append((uint64_t)it->first);
++it; ++it;
} }
webSock->sendFrame(r.toString()); webSock->sendFrame(r.toString());
@ -305,7 +305,7 @@ namespace Mist{
} }
} }
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
r["data"]["tracks"].append(it->first); r["data"]["tracks"].append((uint64_t)it->first);
} }
webSock->sendFrame(r.toString()); webSock->sendFrame(r.toString());
} }
@ -448,7 +448,7 @@ namespace Mist{
r["type"] = "info"; r["type"] = "info";
r["data"]["msg"] = "Sending header"; r["data"]["msg"] = "Sending header";
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
r["data"]["tracks"].append(it->first); r["data"]["tracks"].append((uint64_t)it->first);
} }
webSock->sendFrame(r.toString()); webSock->sendFrame(r.toString());

View file

@ -161,8 +161,8 @@ namespace Mist{
timingTid, timingTid,
requestTid, requestTid,
M.biggestFragment(timingTid) / 1000, M.biggestFragment(timingTid) / 1000,
atol(H.GetVar("iMsn").c_str()), (uint64_t)atol(H.GetVar("iMsn").c_str()),
M.getLive()? config->getInteger("listlimit") : 0, (uint64_t)(M.getLive() ? config->getInteger("listlimit") : 0),
urlPrefix, urlPrefix,
systemBoot, systemBoot,
bootMsOffset, bootMsOffset,

View file

@ -773,7 +773,7 @@ namespace Mist{
std::set<size_t> validTracks = M.getValidTracks(); std::set<size_t> validTracks = M.getValidTracks();
for (std::set<size_t>::iterator it = validTracks.begin(); it != validTracks.end(); it++){ for (std::set<size_t>::iterator it = validTracks.begin(); it != validTracks.end(); it++){
if (M.getType(*it) == "video"){ if (M.getType(*it) == "video"){
trackSources += " <video src='" + streamName + "?track=" + JSON::Value(*it).asString() + trackSources += " <video src='" + streamName + "?track=" + JSON::Value((uint64_t)*it).asString() +
"' height='" + JSON::Value(M.getHeight(*it)).asString() + "' height='" + JSON::Value(M.getHeight(*it)).asString() +
"' system-bitrate='" + JSON::Value(M.getBps(*it)).asString() + "' system-bitrate='" + JSON::Value(M.getBps(*it)).asString() +
"' width='" + JSON::Value(M.getWidth(*it)).asString() + "' />\n"; "' width='" + JSON::Value(M.getWidth(*it)).asString() + "' />\n";

View file

@ -46,7 +46,7 @@ namespace Mist{
thisPacket.getString("data", dPtr, dLen); thisPacket.getString("data", dPtr, dLen);
jPack["data"] = JSON::fromString(dPtr, dLen); jPack["data"] = JSON::fromString(dPtr, dLen);
jPack["time"] = thisPacket.getTime(); jPack["time"] = thisPacket.getTime();
jPack["track"] = thisIdx; jPack["track"] = (uint64_t)thisIdx;
}else{ }else{
jPack = thisPacket.toJSON(); jPack = thisPacket.toJSON();
} }

View file

@ -1403,7 +1403,7 @@ namespace Mist{
r["type"] = "info"; r["type"] = "info";
r["data"]["msg"] = "Sending header"; r["data"]["msg"] = "Sending header";
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
r["data"]["tracks"].append(it->first); r["data"]["tracks"].append((uint64_t)it->first);
} }
webSock->sendFrame(r.toString()); webSock->sendFrame(r.toString());
@ -1620,7 +1620,7 @@ namespace Mist{
continue; continue;
} }
r["data"]["codecs"].append(codec); r["data"]["codecs"].append(codec);
r["data"]["tracks"].append(it->first); r["data"]["tracks"].append((uint64_t)it->first);
++it; ++it;
} }
webSock->sendFrame(r.toString()); webSock->sendFrame(r.toString());
@ -1731,7 +1731,7 @@ namespace Mist{
} }
uint64_t jitter = 0; uint64_t jitter = 0;
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
r["data"]["tracks"].append(it->first); r["data"]["tracks"].append((uint64_t)it->first);
if (jitter < M.getMinKeepAway(it->first)){jitter = M.getMinKeepAway(it->first);} if (jitter < M.getMinKeepAway(it->first)){jitter = M.getMinKeepAway(it->first);}
} }
r["data"]["jitter"] = jitter; r["data"]["jitter"] = jitter;

View file

@ -46,7 +46,7 @@ namespace Mist{
pp[param]["name"] = name; pp[param]["name"] = name;
pp[param]["help"] = help; pp[param]["help"] = help;
pp[param]["type"] = "int"; pp[param]["type"] = "int";
pp[param]["default"] = def; pp[param]["default"] = (uint64_t)def;
} }
static void addStrOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, const std::string & def = ""){ static void addStrOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, const std::string & def = ""){

View file

@ -131,7 +131,7 @@ namespace Mist{
pp[param]["name"] = name; pp[param]["name"] = name;
pp[param]["help"] = help; pp[param]["help"] = help;
pp[param]["type"] = "int"; pp[param]["type"] = "int";
pp[param]["default"] = def; pp[param]["default"] = (uint64_t)def;
} }
static void addStrOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, const std::string & def = ""){ static void addStrOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, const std::string & def = ""){

View file

@ -552,7 +552,7 @@ namespace Mist{
commandResult["begin"] = startTime(); commandResult["begin"] = startTime();
commandResult["end"] = endTime(); commandResult["end"] = endTime();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
commandResult["tracks"].append(it->first); commandResult["tracks"].append((uint64_t)it->first);
} }
webSock->sendFrame(commandResult.toString()); webSock->sendFrame(commandResult.toString());
return; return;
@ -567,7 +567,7 @@ namespace Mist{
commandResult["begin"] = startTime(); commandResult["begin"] = startTime();
commandResult["end"] = endTime(); commandResult["end"] = endTime();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
commandResult["tracks"].append(it->first); commandResult["tracks"].append((uint64_t)it->first);
} }
webSock->sendFrame(commandResult.toString()); webSock->sendFrame(commandResult.toString());
return; return;
@ -710,7 +710,7 @@ namespace Mist{
commandResult["begin"] = startTime(); commandResult["begin"] = startTime();
commandResult["end"] = endTime(); commandResult["end"] = endTime();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
commandResult["tracks"].append(it->first); commandResult["tracks"].append((uint64_t)it->first);
} }
webSock->sendFrame(commandResult.toString()); webSock->sendFrame(commandResult.toString());
}else if (isPushing()){ }else if (isPushing()){

View file

@ -35,7 +35,7 @@ namespace Mist{
if (pData["sink_tracks"].size() != userSelect.size()){ if (pData["sink_tracks"].size() != userSelect.size()){
pData["sink_tracks"].null(); pData["sink_tracks"].null();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
pData["sink_tracks"].append(it->first); pData["sink_tracks"].append((uint64_t)it->first);
} }
} }
} }
@ -129,7 +129,7 @@ namespace Mist{
if (pData["source_tracks"].size() != userSelect.size()){ if (pData["source_tracks"].size() != userSelect.size()){
pData["source_tracks"].null(); pData["source_tracks"].null();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
pData["source_tracks"].append(it->first); pData["source_tracks"].append((uint64_t)it->first);
} }
} }
} }

View file

@ -131,7 +131,7 @@ namespace Mist{
if (pData["source_tracks"].size() != userSelect.size()){ if (pData["source_tracks"].size() != userSelect.size()){
pData["source_tracks"].null(); pData["source_tracks"].null();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
pData["source_tracks"].append(it->first); pData["source_tracks"].append((uint64_t)it->first);
} }
} }
} }
@ -193,7 +193,7 @@ namespace Mist{
if (pData["sink_tracks"].size() != userSelect.size()){ if (pData["sink_tracks"].size() != userSelect.size()){
pData["sink_tracks"].null(); pData["sink_tracks"].null();
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){ for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
pData["sink_tracks"].append(it->first); pData["sink_tracks"].append((uint64_t)it->first);
} }
} }
} }

View file

@ -74,7 +74,7 @@ int main(int argc, char **argv){
// Scoping to clear up metadata and track providers // Scoping to clear up metadata and track providers
{ {
char pageName[NAME_BUFFER_SIZE]; char pageName[NAME_BUFFER_SIZE];
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_META, Util::streamName); snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_META, argv[1]);
IPC::sharedPage streamPage(pageName, 0, false, false); IPC::sharedPage streamPage(pageName, 0, false, false);
if (streamPage.mapped){ if (streamPage.mapped){
streamPage.master = true; streamPage.master = true;
@ -99,7 +99,7 @@ int main(int argc, char **argv){
for (uint64_t j = pages.getDeleted(); j < pages.getEndPos(); j++){ for (uint64_t j = pages.getDeleted(); j < pages.getEndPos(); j++){
char thisPageName[NAME_BUFFER_SIZE]; char thisPageName[NAME_BUFFER_SIZE];
snprintf(thisPageName, NAME_BUFFER_SIZE, SHM_TRACK_DATA, snprintf(thisPageName, NAME_BUFFER_SIZE, SHM_TRACK_DATA,
Util::streamName, i, (uint32_t)pages.getInt("firstkey", j)); argv[1], i, (uint32_t)pages.getInt("firstkey", j));
IPC::sharedPage p(thisPageName, 0); IPC::sharedPage p(thisPageName, 0);
p.master = true; p.master = true;
} }