Silence ALL the compile warnings!
This commit is contained in:
parent
51bb561b7b
commit
19e73019fe
7 changed files with 32 additions and 29 deletions
|
@ -47,7 +47,7 @@ void AMF::Object::addContent(AMF::Object c){
|
|||
/// 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.
|
||||
/// \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()){
|
||||
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 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.
|
||||
AMF::Object AMF::Object::getContent(int i){
|
||||
AMF::Object AMF::Object::getContent(unsigned int i){
|
||||
return contents.at(i);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ namespace AMF {
|
|||
const char * Str();
|
||||
int hasContent();
|
||||
void addContent(AMF::Object c);
|
||||
Object* getContentP(int i);
|
||||
Object getContent(int i);
|
||||
Object* getContentP(unsigned int i);
|
||||
Object getContent(unsigned int i);
|
||||
Object* getContentP(std::string s);
|
||||
Object getContent(std::string s);
|
||||
Object();
|
||||
|
|
27
lib/dtsc.cpp
27
lib/dtsc.cpp
|
@ -172,7 +172,7 @@ void DTSC::Stream::endStream(){
|
|||
if (!metadata.tracks.size()){return;}
|
||||
for (std::map<int,Track>::iterator it = metadata.tracks.begin(); it != metadata.tracks.end(); it++){
|
||||
JSON::Value newPack;
|
||||
newPack["time"] = it->second.lastms;
|
||||
newPack["time"] = (long long)it->second.lastms;
|
||||
newPack["trackid"] = it->first;
|
||||
newPack["keyframe"] = 1ll;
|
||||
newPack["data"] = "";
|
||||
|
@ -525,10 +525,12 @@ DTSC::Stream::~Stream(){
|
|||
|
||||
DTSC::File::File(){
|
||||
F = 0;
|
||||
buffer = malloc(4);
|
||||
endPos = 0;
|
||||
}
|
||||
|
||||
DTSC::File::File(const File & rhs){
|
||||
buffer = malloc(4);
|
||||
*this = rhs;
|
||||
}
|
||||
|
||||
|
@ -560,6 +562,7 @@ DTSC::File::operator bool() const{
|
|||
/// Open a filename for DTSC reading/writing.
|
||||
/// If create is true and file does not exist, attempt to create.
|
||||
DTSC::File::File(std::string filename, bool create){
|
||||
buffer = malloc(4);
|
||||
if (create){
|
||||
F = fopen(filename.c_str(), "w+b");
|
||||
if(!F){
|
||||
|
@ -617,8 +620,7 @@ DTSC::File::File(std::string filename, bool create){
|
|||
memset(buffer, 0, 4);
|
||||
fwrite(buffer, 4, 1, F); //write 4 zero-bytes
|
||||
}else{
|
||||
uint32_t * ubuffer = (uint32_t *)buffer;
|
||||
headerSize = ntohl(ubuffer[0]);
|
||||
headerSize = ntohl(((uint32_t *)buffer)[0]);
|
||||
}
|
||||
if (metadata.moreheader != -1){
|
||||
if (!sepHeader){
|
||||
|
@ -701,7 +703,7 @@ void DTSC::File::readHeader(int pos){
|
|||
return;
|
||||
}
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
@ -710,7 +712,7 @@ void DTSC::File::readHeader(int pos){
|
|||
metadata = readOnlyMeta();
|
||||
return;
|
||||
}
|
||||
long packSize = ntohl(((uint32_t*)buffer)[0]);
|
||||
long packSize = ntohl(((unsigned long*)buffer)[0]);
|
||||
std::string strBuffer;
|
||||
strBuffer.resize(packSize);
|
||||
if (packSize){
|
||||
|
@ -787,7 +789,7 @@ void DTSC::File::seekNext(){
|
|||
version = 2;
|
||||
}
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
@ -796,7 +798,7 @@ void DTSC::File::seekNext(){
|
|||
myPack.null();
|
||||
return;
|
||||
}
|
||||
long packSize = ntohl(((uint32_t*)buffer)[0]);
|
||||
long packSize = ntohl(((unsigned long*)buffer)[0]);
|
||||
char * packBuffer = (char*)malloc(packSize+8);
|
||||
if (version == 1){
|
||||
memcpy(packBuffer, "DTPD", 4);
|
||||
|
@ -829,7 +831,7 @@ void DTSC::File::seekNext(){
|
|||
}else{
|
||||
long tid = myPack.getTrackId();
|
||||
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.bytePos = metadata.tracks[tid].keys[i].getBpos();
|
||||
tmpPos.trackID = tid;
|
||||
|
@ -881,9 +883,9 @@ void DTSC::File::parseNext(){
|
|||
myPack.null();
|
||||
return;
|
||||
}
|
||||
long packSize = ntohl(((uint32_t*)buffer)[0]);
|
||||
long packSize = ntohl(((unsigned long*)buffer)[0]);
|
||||
std::string strBuffer = "DTSC";
|
||||
strBuffer.append(buffer, 4);
|
||||
strBuffer.append((char*)buffer, 4);
|
||||
strBuffer.resize(packSize + 8);
|
||||
if (fread((void*)(strBuffer.c_str() + 8), packSize, 1, F) != 1){
|
||||
DEBUG_MSG(DLVL_ERROR, "Could not read header @ %d", (int)lastreadpos);
|
||||
|
@ -902,7 +904,7 @@ void DTSC::File::parseNext(){
|
|||
version = 2;
|
||||
}
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
@ -911,7 +913,7 @@ void DTSC::File::parseNext(){
|
|||
myPack.null();
|
||||
return;
|
||||
}
|
||||
long packSize = ntohl(((uint32_t*)buffer)[0]);
|
||||
long packSize = ntohl(((unsigned long*)buffer)[0]);
|
||||
char * packBuffer = (char*)malloc(packSize+8);
|
||||
if (version == 1){
|
||||
memcpy(packBuffer, "DTPD", 4);
|
||||
|
@ -1071,6 +1073,7 @@ DTSC::File::~File(){
|
|||
fclose(F);
|
||||
F = 0;
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -257,8 +257,8 @@ namespace DTSC {
|
|||
long long unsigned int partLen;
|
||||
Part * parts;
|
||||
int trackID;
|
||||
int firstms;
|
||||
int lastms;
|
||||
unsigned long long firstms;
|
||||
unsigned long long lastms;
|
||||
int bps;
|
||||
int missedFrags;
|
||||
std::string init;
|
||||
|
@ -384,7 +384,7 @@ namespace DTSC {
|
|||
int currframe;
|
||||
FILE * F;
|
||||
unsigned long headerSize;
|
||||
char buffer[4];
|
||||
void * buffer;
|
||||
bool created;
|
||||
std::set<seekPos> currentPositions;
|
||||
std::set<int> selectedTracks;
|
||||
|
|
|
@ -1001,7 +1001,7 @@ namespace DTSC {
|
|||
}
|
||||
parts.push_back(newPart);
|
||||
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;
|
||||
newKey.setTime(pack.getTime());
|
||||
newKey.setParts(0);
|
||||
|
@ -1019,7 +1019,7 @@ namespace DTSC {
|
|||
}
|
||||
keys.push_back(newKey);
|
||||
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
|
||||
Fragment newFrag;
|
||||
newFrag.setDuration(0);
|
||||
|
@ -1047,7 +1047,7 @@ namespace DTSC {
|
|||
///
|
||||
///Will also insert keyframes on non-video tracks, and creates fragments
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -1876,8 +1876,8 @@ namespace DTSC {
|
|||
result["parts"] = std::string((char *)parts, partLen * 9);
|
||||
}
|
||||
result["trackid"] = trackID;
|
||||
result["firstms"] = firstms;
|
||||
result["lastms"] = lastms;
|
||||
result["firstms"] = (long long)firstms;
|
||||
result["lastms"] = (long long)lastms;
|
||||
result["bps"] = bps;
|
||||
if (missedFrags) {
|
||||
result["missed_frags"] = missedFrags;
|
||||
|
@ -1923,8 +1923,8 @@ namespace DTSC {
|
|||
}
|
||||
result["parts"] = tmp;
|
||||
result["trackid"] = trackID;
|
||||
result["firstms"] = firstms;
|
||||
result["lastms"] = lastms;
|
||||
result["firstms"] = (long long)firstms;
|
||||
result["lastms"] = (long long)lastms;
|
||||
result["bps"] = bps;
|
||||
if (missedFrags) {
|
||||
result["missed_frags"] = missedFrags;
|
||||
|
|
|
@ -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));
|
||||
AMF::Object trinfo = AMF::Object("trackinfo", AMF::AMF0_STRICT_ARRAY);
|
||||
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++){
|
||||
if (M.tracks[*it].lastms - M.tracks[*it].firstms > mediaLen){
|
||||
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){
|
||||
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(1)->addContent(AMF::Object("", i, AMF::AMF0_NUMBER)); //seconds
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace OGG{
|
|||
return false;
|
||||
}
|
||||
ret = getFullPayload();
|
||||
for (int i = 0; i < index; i++){
|
||||
for (unsigned int i = 0; i < index; i++){
|
||||
ret += segmentTableDeque[i];
|
||||
}
|
||||
len = segmentTableDeque[index];
|
||||
|
|
Loading…
Add table
Reference in a new issue