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

@ -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());