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

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

View file

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

View file

@ -1025,9 +1025,9 @@ namespace Mist{
void Input::finish(){
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++){
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;
}
}
@ -1059,9 +1059,9 @@ namespace Mist{
}
}
//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++){
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)){
INFO_MSG("Deleting forgotten page %zu:%" PRIu32, it->first, it2->first);
bufferRemove(it->first, it2->first);

View file

@ -163,7 +163,7 @@ namespace Mist{
inFile.readSome(aacData, bytesRead, frameSize - 6);
if (bytesRead < frameSize - 6){
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++){
aacFrame[i+6] = aacData[i];
@ -241,7 +241,7 @@ namespace Mist{
inFile.readSome(aacData, bytesRead, 6);
if (bytesRead < 6){
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]
, aacData[1], aacData[2], aacData[3], aacData[4], aacData[5]);
return;
@ -252,7 +252,7 @@ namespace Mist{
if (aacData[0] == 0x41 && aacData[1] == 0x50 && aacData[2] == 0x45 &&
aacData[3] == 0x54 && aacData[4] == 0x41 && aacData[5] == 0x47){
inFile.readAll(aacData, bytesRead);
INFO_MSG("Throwing out %li bytes of metadata...", bytesRead);
INFO_MSG("Throwing out %zu bytes of metadata...", bytesRead);
return;
}
WARN_MSG("Invalid sync word at start of header");
@ -270,7 +270,7 @@ namespace Mist{
inFile.readSome(aacData, bytesRead, frameSize - 6);
if (bytesRead < frameSize - 6){
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;
}
for (int i = 0; i < (frameSize - 6); i++){
@ -282,10 +282,10 @@ namespace Mist{
if (!adtsPack){
WARN_MSG("Could not parse ADTS package!");
WARN_MSG("Current frame info:");
WARN_MSG("Current frame pos: %li", filePos);
WARN_MSG("Next frame pos: %li", nextFramePos);
WARN_MSG("Frame size expected: %li", frameSize);
WARN_MSG("Bytes read: %li", bytesRead);
WARN_MSG("Current frame pos: %zu", filePos);
WARN_MSG("Next frame pos: %zu", nextFramePos);
WARN_MSG("Frame size expected: %" PRIu64, frameSize);
WARN_MSG("Bytes read: %zu", bytesRead);
WARN_MSG("ADTS getAACProfile: %li", adtsPack.getAACProfile());
WARN_MSG("ADTS getFrequencyIndex: %li", adtsPack.getFrequencyIndex());
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
inFile.seek(keys.getBpos(keyIdx)-1);
thisTime = keys.getTime(keyIdx);
DONTEVEN_MSG("inputAAC wants to seek to timestamp %li on track %li", seekTime, idx);
DONTEVEN_MSG("inputAAC seeked to timestamp %f with bytePos %li", thisTime, keys.getBpos(keyIdx)-1);
DONTEVEN_MSG("inputAAC wants to seek to timestamp %" PRIu64 " on track %zu", seekTime, idx);
DONTEVEN_MSG("inputAAC seeked to timestamp %" PRIu64 " with bytePos %zu", thisTime, keys.getBpos(keyIdx)-1);
}
}// namespace Mist

View file

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

View file

@ -644,10 +644,8 @@ namespace Mist{
DTSC::Parts parts(M.parts(mainTrack));
uint64_t seekPos = keys.getBpos(0);
// 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++){
if (keys.getTime(i) > seekTime){break;}
partCount += keys.getParts(i);
DONTEVEN_MSG("Seeking to %" PRIu64 ", found %" PRIu64 "...", seekTime, keys.getTime(i));
seekPos = keys.getBpos(i);
}

View file

@ -886,7 +886,7 @@ namespace Mist{
// Write packet ID mappings
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++){
thisMappingsR[JSON::Value(pidIt->first).asString()] = pidIt->second;
}

View file

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

View file

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

View file

@ -99,7 +99,7 @@ namespace Mist{
}
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
oldBuffer = strdup(buffer);
@ -157,7 +157,7 @@ namespace Mist{
// Re-read SDP file
reader.readAll(buffer, bytesRead);
// 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 (!compareStrings(oldBuffer, buffer)){
INFO_MSG("SDP contents have changed. Reparsing SDP file");
@ -302,7 +302,7 @@ namespace Mist{
pkt.getString("data", pktData, pktDataLen);
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){
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"];
pData["mediatime"] = currentTime();
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();
uint64_t pktCntNow = statComm.getPacketCount();

View file

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

View file

@ -209,7 +209,7 @@ namespace Mist{
if (kDur > longest_key){longest_key = kDur;}
}
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;
}else{
sendOk("Key duration matches upstream");

View file

@ -195,7 +195,7 @@ namespace Mist{
continue;
}
r["data"]["codecs"].append(codec);
r["data"]["tracks"].append(it->first);
r["data"]["tracks"].append((uint64_t)it->first);
++it;
}
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++){
r["data"]["tracks"].append(it->first);
r["data"]["tracks"].append((uint64_t)it->first);
}
webSock->sendFrame(r.toString());
}
@ -448,7 +448,7 @@ namespace Mist{
r["type"] = "info";
r["data"]["msg"] = "Sending header";
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());

View file

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

View file

@ -773,7 +773,7 @@ namespace Mist{
std::set<size_t> validTracks = M.getValidTracks();
for (std::set<size_t>::iterator it = validTracks.begin(); it != validTracks.end(); it++){
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() +
"' system-bitrate='" + JSON::Value(M.getBps(*it)).asString() +
"' width='" + JSON::Value(M.getWidth(*it)).asString() + "' />\n";

View file

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

View file

@ -1403,7 +1403,7 @@ namespace Mist{
r["type"] = "info";
r["data"]["msg"] = "Sending header";
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());
@ -1620,7 +1620,7 @@ namespace Mist{
continue;
}
r["data"]["codecs"].append(codec);
r["data"]["tracks"].append(it->first);
r["data"]["tracks"].append((uint64_t)it->first);
++it;
}
webSock->sendFrame(r.toString());
@ -1731,7 +1731,7 @@ namespace Mist{
}
uint64_t jitter = 0;
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);}
}
r["data"]["jitter"] = jitter;

View file

@ -46,7 +46,7 @@ namespace Mist{
pp[param]["name"] = name;
pp[param]["help"] = help;
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 = ""){

View file

@ -131,7 +131,7 @@ namespace Mist{
pp[param]["name"] = name;
pp[param]["help"] = help;
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 = ""){

View file

@ -552,7 +552,7 @@ namespace Mist{
commandResult["begin"] = startTime();
commandResult["end"] = endTime();
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());
return;
@ -567,7 +567,7 @@ namespace Mist{
commandResult["begin"] = startTime();
commandResult["end"] = endTime();
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());
return;
@ -710,7 +710,7 @@ namespace Mist{
commandResult["begin"] = startTime();
commandResult["end"] = endTime();
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());
}else if (isPushing()){

View file

@ -35,7 +35,7 @@ namespace Mist{
if (pData["sink_tracks"].size() != userSelect.size()){
pData["sink_tracks"].null();
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()){
pData["source_tracks"].null();
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()){
pData["source_tracks"].null();
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()){
pData["sink_tracks"].null();
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
{
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);
if (streamPage.mapped){
streamPage.master = true;
@ -99,7 +99,7 @@ int main(int argc, char **argv){
for (uint64_t j = pages.getDeleted(); j < pages.getEndPos(); j++){
char thisPageName[NAME_BUFFER_SIZE];
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);
p.master = true;
}