Silence ALL the compile warnings!

This commit is contained in:
Thulinma 2014-06-07 23:46:47 +02:00
parent 51bb561b7b
commit 19e73019fe
7 changed files with 32 additions and 29 deletions

View file

@ -47,7 +47,7 @@ void AMF::Object::addContent(AMF::Object c){
/// Returns a pointer to the object held at indice i. /// Returns a pointer to the object held at indice i.
/// Returns AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice. /// Returns AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice.
/// \param i The indice of the object in this container. /// \param i The indice of the object in this container.
AMF::Object* AMF::Object::getContentP(int i){ AMF::Object* AMF::Object::getContentP(unsigned int i){
if (i >= contents.size()){ if (i >= contents.size()){
return 0; return 0;
} }
@ -57,7 +57,7 @@ AMF::Object* AMF::Object::getContentP(int i){
/// Returns a copy of the object held at indice i. /// Returns a copy of the object held at indice i.
/// Returns a AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice. /// Returns a AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice.
/// \param i The indice of the object in this container. /// \param i The indice of the object in this container.
AMF::Object AMF::Object::getContent(int i){ AMF::Object AMF::Object::getContent(unsigned int i){
return contents.at(i); return contents.at(i);
} }

View file

@ -61,8 +61,8 @@ namespace AMF {
const char * Str(); const char * Str();
int hasContent(); int hasContent();
void addContent(AMF::Object c); void addContent(AMF::Object c);
Object* getContentP(int i); Object* getContentP(unsigned int i);
Object getContent(int i); Object getContent(unsigned int i);
Object* getContentP(std::string s); Object* getContentP(std::string s);
Object getContent(std::string s); Object getContent(std::string s);
Object(); Object();

View file

@ -172,7 +172,7 @@ void DTSC::Stream::endStream(){
if (!metadata.tracks.size()){return;} if (!metadata.tracks.size()){return;}
for (std::map<int,Track>::iterator it = metadata.tracks.begin(); it != metadata.tracks.end(); it++){ for (std::map<int,Track>::iterator it = metadata.tracks.begin(); it != metadata.tracks.end(); it++){
JSON::Value newPack; JSON::Value newPack;
newPack["time"] = it->second.lastms; newPack["time"] = (long long)it->second.lastms;
newPack["trackid"] = it->first; newPack["trackid"] = it->first;
newPack["keyframe"] = 1ll; newPack["keyframe"] = 1ll;
newPack["data"] = ""; newPack["data"] = "";
@ -525,10 +525,12 @@ DTSC::Stream::~Stream(){
DTSC::File::File(){ DTSC::File::File(){
F = 0; F = 0;
buffer = malloc(4);
endPos = 0; endPos = 0;
} }
DTSC::File::File(const File & rhs){ DTSC::File::File(const File & rhs){
buffer = malloc(4);
*this = rhs; *this = rhs;
} }
@ -560,6 +562,7 @@ DTSC::File::operator bool() const{
/// Open a filename for DTSC reading/writing. /// Open a filename for DTSC reading/writing.
/// If create is true and file does not exist, attempt to create. /// If create is true and file does not exist, attempt to create.
DTSC::File::File(std::string filename, bool create){ DTSC::File::File(std::string filename, bool create){
buffer = malloc(4);
if (create){ if (create){
F = fopen(filename.c_str(), "w+b"); F = fopen(filename.c_str(), "w+b");
if(!F){ if(!F){
@ -617,8 +620,7 @@ DTSC::File::File(std::string filename, bool create){
memset(buffer, 0, 4); memset(buffer, 0, 4);
fwrite(buffer, 4, 1, F); //write 4 zero-bytes fwrite(buffer, 4, 1, F); //write 4 zero-bytes
}else{ }else{
uint32_t * ubuffer = (uint32_t *)buffer; headerSize = ntohl(((uint32_t *)buffer)[0]);
headerSize = ntohl(ubuffer[0]);
} }
if (metadata.moreheader != -1){ if (metadata.moreheader != -1){
if (!sepHeader){ if (!sepHeader){
@ -701,7 +703,7 @@ void DTSC::File::readHeader(int pos){
return; return;
} }
if (memcmp(buffer, DTSC::Magic_Header, 4) != 0){ if (memcmp(buffer, DTSC::Magic_Header, 4) != 0){
DEBUG_MSG(DLVL_ERROR, "Invalid header - %.4s != %.4s @ %i", buffer, DTSC::Magic_Header, pos); DEBUG_MSG(DLVL_ERROR, "Invalid header - %.4s != %.4s @ %i", (char*)buffer, DTSC::Magic_Header, pos);
metadata = readOnlyMeta(); metadata = readOnlyMeta();
return; return;
} }
@ -710,7 +712,7 @@ void DTSC::File::readHeader(int pos){
metadata = readOnlyMeta(); metadata = readOnlyMeta();
return; return;
} }
long packSize = ntohl(((uint32_t*)buffer)[0]); long packSize = ntohl(((unsigned long*)buffer)[0]);
std::string strBuffer; std::string strBuffer;
strBuffer.resize(packSize); strBuffer.resize(packSize);
if (packSize){ if (packSize){
@ -787,7 +789,7 @@ void DTSC::File::seekNext(){
version = 2; version = 2;
} }
if (version == 0){ if (version == 0){
DEBUG_MSG(DLVL_ERROR, "Invalid packet header @ %#x - %.4s != %.4s @ %d", (unsigned int)lastreadpos, buffer, DTSC::Magic_Packet2, (int)lastreadpos); DEBUG_MSG(DLVL_ERROR, "Invalid packet header @ %#x - %.4s != %.4s @ %d", (unsigned int)lastreadpos, (char*)buffer, DTSC::Magic_Packet2, (int)lastreadpos);
myPack.null(); myPack.null();
return; return;
} }
@ -796,7 +798,7 @@ void DTSC::File::seekNext(){
myPack.null(); myPack.null();
return; return;
} }
long packSize = ntohl(((uint32_t*)buffer)[0]); long packSize = ntohl(((unsigned long*)buffer)[0]);
char * packBuffer = (char*)malloc(packSize+8); char * packBuffer = (char*)malloc(packSize+8);
if (version == 1){ if (version == 1){
memcpy(packBuffer, "DTPD", 4); memcpy(packBuffer, "DTPD", 4);
@ -829,7 +831,7 @@ void DTSC::File::seekNext(){
}else{ }else{
long tid = myPack.getTrackId(); long tid = myPack.getTrackId();
for (unsigned int i = 0; i != metadata.tracks[tid].keyLen; i++){ for (unsigned int i = 0; i != metadata.tracks[tid].keyLen; i++){
if (metadata.tracks[tid].keys[i].getTime() > myPack.getTime()){ if ((unsigned long long)metadata.tracks[tid].keys[i].getTime() > myPack.getTime()){
tmpPos.seekTime = metadata.tracks[tid].keys[i].getTime(); tmpPos.seekTime = metadata.tracks[tid].keys[i].getTime();
tmpPos.bytePos = metadata.tracks[tid].keys[i].getBpos(); tmpPos.bytePos = metadata.tracks[tid].keys[i].getBpos();
tmpPos.trackID = tid; tmpPos.trackID = tid;
@ -881,9 +883,9 @@ void DTSC::File::parseNext(){
myPack.null(); myPack.null();
return; return;
} }
long packSize = ntohl(((uint32_t*)buffer)[0]); long packSize = ntohl(((unsigned long*)buffer)[0]);
std::string strBuffer = "DTSC"; std::string strBuffer = "DTSC";
strBuffer.append(buffer, 4); strBuffer.append((char*)buffer, 4);
strBuffer.resize(packSize + 8); strBuffer.resize(packSize + 8);
if (fread((void*)(strBuffer.c_str() + 8), packSize, 1, F) != 1){ if (fread((void*)(strBuffer.c_str() + 8), packSize, 1, F) != 1){
DEBUG_MSG(DLVL_ERROR, "Could not read header @ %d", (int)lastreadpos); DEBUG_MSG(DLVL_ERROR, "Could not read header @ %d", (int)lastreadpos);
@ -902,7 +904,7 @@ void DTSC::File::parseNext(){
version = 2; version = 2;
} }
if (version == 0){ if (version == 0){
DEBUG_MSG(DLVL_ERROR, "Invalid packet header @ %#x - %.4s != %.4s @ %d", (unsigned int)lastreadpos, buffer, DTSC::Magic_Packet2, (int)lastreadpos); DEBUG_MSG(DLVL_ERROR, "Invalid packet header @ %#x - %.4s != %.4s @ %d", (unsigned int)lastreadpos, (char*)buffer, DTSC::Magic_Packet2, (int)lastreadpos);
myPack.null(); myPack.null();
return; return;
} }
@ -911,7 +913,7 @@ void DTSC::File::parseNext(){
myPack.null(); myPack.null();
return; return;
} }
long packSize = ntohl(((uint32_t*)buffer)[0]); long packSize = ntohl(((unsigned long*)buffer)[0]);
char * packBuffer = (char*)malloc(packSize+8); char * packBuffer = (char*)malloc(packSize+8);
if (version == 1){ if (version == 1){
memcpy(packBuffer, "DTPD", 4); memcpy(packBuffer, "DTPD", 4);
@ -1071,6 +1073,7 @@ DTSC::File::~File(){
fclose(F); fclose(F);
F = 0; F = 0;
} }
free(buffer);
} }

View file

@ -257,8 +257,8 @@ namespace DTSC {
long long unsigned int partLen; long long unsigned int partLen;
Part * parts; Part * parts;
int trackID; int trackID;
int firstms; unsigned long long firstms;
int lastms; unsigned long long lastms;
int bps; int bps;
int missedFrags; int missedFrags;
std::string init; std::string init;
@ -384,7 +384,7 @@ namespace DTSC {
int currframe; int currframe;
FILE * F; FILE * F;
unsigned long headerSize; unsigned long headerSize;
char buffer[4]; void * buffer;
bool created; bool created;
std::set<seekPos> currentPositions; std::set<seekPos> currentPositions;
std::set<int> selectedTracks; std::set<int> selectedTracks;

View file

@ -1001,7 +1001,7 @@ namespace DTSC {
} }
parts.push_back(newPart); parts.push_back(newPart);
lastms = pack.getTime(); lastms = pack.getTime();
if (pack.getFlag("keyframe") || !keys.size() || (type != "video" && pack.getTime() > 5000 && pack.getTime() - 5000 > keys[keys.size() - 1].getTime())) { if (pack.getFlag("keyframe") || !keys.size() || (type != "video" && pack.getTime() > 5000 && pack.getTime() - 5000 > (unsigned long long)keys[keys.size() - 1].getTime())) {
Key newKey; Key newKey;
newKey.setTime(pack.getTime()); newKey.setTime(pack.getTime());
newKey.setParts(0); newKey.setParts(0);
@ -1019,7 +1019,7 @@ namespace DTSC {
} }
keys.push_back(newKey); keys.push_back(newKey);
firstms = keys[0].getTime(); firstms = keys[0].getTime();
if (!fragments.size() || pack.getTime() - 5000 >= getKey(fragments.rbegin()->getNumber()).getTime()) { if (!fragments.size() || pack.getTime() - 5000 >= (unsigned long long)getKey(fragments.rbegin()->getNumber()).getTime()) {
//new fragment //new fragment
Fragment newFrag; Fragment newFrag;
newFrag.setDuration(0); newFrag.setDuration(0);
@ -1047,7 +1047,7 @@ namespace DTSC {
/// ///
///Will also insert keyframes on non-video tracks, and creates fragments ///Will also insert keyframes on non-video tracks, and creates fragments
void Track::update(JSON::Value & pack) { void Track::update(JSON::Value & pack) {
if (pack["time"].asInt() < lastms) { if ((unsigned long long)pack["time"].asInt() < lastms) {
DEBUG_MSG(DLVL_WARN, "Received packets for track %d in wrong order (%d < %d) - ignoring!", (int)trackID, (int)pack["time"].asInt(), (int)lastms); DEBUG_MSG(DLVL_WARN, "Received packets for track %d in wrong order (%d < %d) - ignoring!", (int)trackID, (int)pack["time"].asInt(), (int)lastms);
return; return;
} }
@ -1876,8 +1876,8 @@ namespace DTSC {
result["parts"] = std::string((char *)parts, partLen * 9); result["parts"] = std::string((char *)parts, partLen * 9);
} }
result["trackid"] = trackID; result["trackid"] = trackID;
result["firstms"] = firstms; result["firstms"] = (long long)firstms;
result["lastms"] = lastms; result["lastms"] = (long long)lastms;
result["bps"] = bps; result["bps"] = bps;
if (missedFrags) { if (missedFrags) {
result["missed_frags"] = missedFrags; result["missed_frags"] = missedFrags;
@ -1923,8 +1923,8 @@ namespace DTSC {
} }
result["parts"] = tmp; result["parts"] = tmp;
result["trackid"] = trackID; result["trackid"] = trackID;
result["firstms"] = firstms; result["firstms"] = (long long)firstms;
result["lastms"] = lastms; result["lastms"] = (long long)lastms;
result["bps"] = bps; result["bps"] = bps;
if (missedFrags) { if (missedFrags) {
result["missed_frags"] = missedFrags; result["missed_frags"] = missedFrags;

View file

@ -568,7 +568,7 @@ bool FLV::Tag::DTSCMetaInit(DTSC::Meta & M, std::set<long unsigned int> & selTra
amfdata.addContent(AMF::Object("", AMF::AMF0_ECMA_ARRAY)); amfdata.addContent(AMF::Object("", AMF::AMF0_ECMA_ARRAY));
AMF::Object trinfo = AMF::Object("trackinfo", AMF::AMF0_STRICT_ARRAY); AMF::Object trinfo = AMF::Object("trackinfo", AMF::AMF0_STRICT_ARRAY);
int i = 0; int i = 0;
int mediaLen = 0; unsigned long long mediaLen = 0;
for (std::set<long unsigned int>::iterator it = selTracks.begin(); it != selTracks.end(); it++){ for (std::set<long unsigned int>::iterator it = selTracks.begin(); it != selTracks.end(); it++){
if (M.tracks[*it].lastms - M.tracks[*it].firstms > mediaLen){ if (M.tracks[*it].lastms - M.tracks[*it].firstms > mediaLen){
mediaLen = M.tracks[*it].lastms - M.tracks[*it].firstms; mediaLen = M.tracks[*it].lastms - M.tracks[*it].firstms;
@ -672,7 +672,7 @@ bool FLV::Tag::DTSCMetaInit(DTSC::Stream & S, DTSC::Track & videoRef, DTSC::Trac
if (audioRef.trackID > 0){ if (audioRef.trackID > 0){
total_byterate += audioRef.bps; total_byterate += audioRef.bps;
} }
for (int i = 0; i < videoRef.lastms / 1000; ++i){ //for each second in the file for (unsigned long long i = 0; i < videoRef.lastms / 1000; ++i){ //for each second in the file
keys.getContentP(0)->addContent(AMF::Object("", i * total_byterate, AMF::AMF0_NUMBER)); //multiply by byterate for fake byte positions keys.getContentP(0)->addContent(AMF::Object("", i * total_byterate, AMF::AMF0_NUMBER)); //multiply by byterate for fake byte positions
keys.getContentP(1)->addContent(AMF::Object("", i, AMF::AMF0_NUMBER)); //seconds keys.getContentP(1)->addContent(AMF::Object("", i, AMF::AMF0_NUMBER)); //seconds
} }

View file

@ -141,7 +141,7 @@ namespace OGG{
return false; return false;
} }
ret = getFullPayload(); ret = getFullPayload();
for (int i = 0; i < index; i++){ for (unsigned int i = 0; i < index; i++){
ret += segmentTableDeque[i]; ret += segmentTableDeque[i];
} }
len = segmentTableDeque[index]; len = segmentTableDeque[index];