Removed ALL the compile warnings!

This commit is contained in:
Thulinma 2014-01-05 15:26:41 +01:00
parent b5a4ea1b93
commit 12a0c1942c
18 changed files with 218 additions and 211 deletions

View file

@ -10,7 +10,7 @@ ifeq ($(PACKAGE_VERSION),Unknown)
$(warning Version is unknown - consider creating a VERSION file or fixing your git setup.)
endif
CPPFLAGS = -Wall -g -O2 -fPIC -DDEBUG="$(DEBUG)" -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\""
CPPFLAGS = -Wall -funsigned-char -g -O2 -fPIC -DDEBUG="$(DEBUG)" -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\""
LDLIBS = -lcrypto

View file

@ -436,7 +436,7 @@ void Util::getMyExec(std::deque<std::string> & execs){
struct dirent *dp;
do {
errno = 0;
if (dp = readdir(d)){
if ((dp = readdir(d))){
if (strncmp(dp->d_name, "Mist", 4) == 0){
execs.push_back(dp->d_name);
}

View file

@ -214,11 +214,10 @@ void DTSC::Stream::addMeta(JSON::Value & newMeta){
/// Adds a single DTSC packet to the stream, updating the internal metadata if needed.
void DTSC::Stream::addPacket(JSON::Value & newPack){
long long unsigned int now = Util::getMS();
livePos newPos;
newPos.trackID = newPack["trackid"].asInt();
newPos.seekTime = newPack["time"].asInt();
if (buffercount > 1 && metadata.tracks[newPos.trackID].keys.size() > 1 && newPos.seekTime < metadata.tracks[newPos.trackID].keys.rbegin()->getTime()){
if (buffercount > 1 && metadata.tracks[newPos.trackID].keys.size() > 1 && newPos.seekTime < (long long unsigned int)metadata.tracks[newPos.trackID].keys.rbegin()->getTime()){
resetStream();
}
while (buffers.count(newPos) > 0){
@ -250,7 +249,7 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
}
if (buffercount > 1){
metadata.update(newPack);
if (newPack.isMember("keyframe") || metadata.tracks[newPos.trackID].keys.rbegin()->getTime() == newPos.seekTime){
if (newPack.isMember("keyframe") || (long long unsigned int)metadata.tracks[newPos.trackID].keys.rbegin()->getTime() == newPos.seekTime){
keyframes[newPos.trackID].insert(newPos);
}
metadata.live = true;
@ -271,12 +270,12 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
/// Will print a warning to std::cerr if a track has less than 2 keyframes left because of this.
void DTSC::Stream::cutOneBuffer(){
int trid = buffers.begin()->first.trackID;
int delTime = buffers.begin()->first.seekTime;
long long unsigned int delTime = buffers.begin()->first.seekTime;
if (buffercount > 1){
while (keyframes[trid].size() > 0 && keyframes[trid].begin()->seekTime <= delTime){
keyframes[trid].erase(keyframes[trid].begin());
}
while (metadata.tracks[trid].keys.size() && metadata.tracks[trid].keys[0].getTime() <= delTime){
while (metadata.tracks[trid].keys.size() && (long long unsigned int)metadata.tracks[trid].keys[0].getTime() <= delTime){
for (int i = 0; i < metadata.tracks[trid].keys[0].getParts(); i++){
metadata.tracks[trid].parts.pop_front();
}
@ -489,6 +488,7 @@ DTSC::File & DTSC::File::operator =(const File & rhs){
headerSize = rhs.headerSize;
trackMapping = rhs.trackMapping;
memcpy(buffer, rhs.buffer, 4);
return *this;
}
DTSC::File::operator bool() const{
@ -696,7 +696,7 @@ void DTSC::File::seekNext(){
version = 2;
}
if (version == 0){
fprintf(stderr, "Invalid packet header @ %#x - %.4s != %.4s\n", lastreadpos, buffer, DTSC::Magic_Packet2);
fprintf(stderr, "Invalid packet header @ %#x - %.4s != %.4s\n", (unsigned int)lastreadpos, buffer, DTSC::Magic_Packet2);
strbuffer = "";
jsonbuffer.null();
return;
@ -729,13 +729,13 @@ void DTSC::File::seekNext(){
seekPos tmpPos;
tmpPos.bytePos = tempLoc;
tmpPos.trackID = ntohl(((int*)newHeader)[2]);
tmpPos.seekTime = 0;
if (selectedTracks.find(tmpPos.trackID) != selectedTracks.end()){
tmpPos.seekTime = ((long long unsigned int)ntohl(((int*)newHeader)[3])) << 32;
tmpPos.seekTime += ntohl(((int*)newHeader)[4]);
}else{
tmpPos.seekTime = -1;
long tid = jsonbuffer["trackid"].asInt();
for (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() > jsonbuffer["time"].asInt()){
tmpPos.seekTime = metadata.tracks[tid].keys[i].getTime();
tmpPos.bytePos = metadata.tracks[tid].keys[i].getBpos();
@ -744,7 +744,6 @@ void DTSC::File::seekNext(){
}
}
}
if (tmpPos.seekTime != -1){
bool insert = true;
for (std::set<seekPos>::iterator curPosIter = currentPositions.begin(); curPosIter != currentPositions.end(); curPosIter++){
if ((*curPosIter).trackID == tmpPos.trackID && (*curPosIter).seekTime >= tmpPos.seekTime){
@ -760,7 +759,6 @@ void DTSC::File::seekNext(){
}
}
}
}
}
@ -810,7 +808,7 @@ void DTSC::File::parseNext(){
version = 2;
}
if (version == 0){
fprintf(stderr, "Invalid packet header @ %#x - %.4s != %.4s\n", lastreadpos, buffer, DTSC::Magic_Packet2);
fprintf(stderr, "Invalid packet header @ %#x - %.4s != %.4s\n", (unsigned int)lastreadpos, buffer, DTSC::Magic_Packet2);
strbuffer = "";
jsonbuffer.null();
return;
@ -852,7 +850,7 @@ JSON::Value & DTSC::File::getJSON(){
return jsonbuffer;
}
bool DTSC::File::seek_time(int ms, int trackNo, bool forceSeek){
bool DTSC::File::seek_time(unsigned int ms, int trackNo, bool forceSeek){
seekPos tmpPos;
tmpPos.trackID = trackNo;
if (!forceSeek && jsonbuffer && ms > jsonbuffer["time"].asInt() && trackNo >= jsonbuffer["trackid"].asInt()){
@ -862,11 +860,11 @@ bool DTSC::File::seek_time(int ms, int trackNo, bool forceSeek){
tmpPos.seekTime = 0;
tmpPos.bytePos = 0;
}
for (int i = 0; i < metadata.tracks[trackNo].keyLen; i++){
for (unsigned int i = 0; i < metadata.tracks[trackNo].keyLen; i++){
if (metadata.tracks[trackNo].keys[i].getTime() > ms){
break;
}
if (metadata.tracks[trackNo].keys[i].getTime() > tmpPos.seekTime){
if ((long long unsigned int)metadata.tracks[trackNo].keys[i].getTime() > tmpPos.seekTime){
tmpPos.seekTime = metadata.tracks[trackNo].keys[i].getTime();
tmpPos.bytePos = metadata.tracks[trackNo].keys[i].getBpos();
}
@ -901,13 +899,14 @@ bool DTSC::File::seek_time(int ms, int trackNo, bool forceSeek){
}
}
currentPositions.insert(tmpPos);
return true;
}
/// Attempts to seek to the given time in ms within the file.
/// Returns true if successful, false otherwise.
bool DTSC::File::seek_time(int ms){
bool DTSC::File::seek_time(unsigned int ms){
currentPositions.clear();
seekPos tmpPos;
/// \todo Check this. Doesn't seem right?
for (std::set<int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
seek_bpos(0);
seek_time(ms,(*it));
@ -948,7 +947,7 @@ bool DTSC::File::atKeyframe(){
}
long long int bTime = jsonbuffer["time"].asInt();
int trackid = jsonbuffer["trackid"].asInt();
for (int i = 0; i < metadata.tracks[trackid].keyLen; i++){
for (unsigned int i = 0; i < metadata.tracks[trackid].keyLen; i++){
if (metadata.tracks[trackid].keys[i].getTime() >= bTime){
return (metadata.tracks[trackid].keys[i].getTime() == bTime);
}

View file

@ -119,8 +119,8 @@ namespace DTSC {
void setBpos(long long unsigned int newBpos);
long getLength();
void setLength(long newLength);
short getNumber();
void setNumber(short newNumber);
unsigned short getNumber();
void setNumber(unsigned short newNumber);
short getParts();
void setParts(short newParts);
long getTime();
@ -193,7 +193,7 @@ namespace DTSC {
std::deque<Fragment> fragments;
std::deque<Key> keys;
std::deque<Part> parts;
Key & getKey(int keyNum);
Key & getKey(unsigned int keyNum);
void reset();
};
@ -246,8 +246,8 @@ namespace DTSC {
void parseNext();
std::string & getPacket();
JSON::Value & getJSON();
bool seek_time(int seconds);
bool seek_time(int seconds, int trackNo, bool forceSeek = false);
bool seek_time(unsigned int ms);
bool seek_time(unsigned int ms, int trackNo, bool forceSeek = false);
bool seek_bpos(int bpos);
void rewritePacket(std::string & newPacket, int bytePos);
void writePacket(std::string & newPacket);
@ -280,7 +280,7 @@ namespace DTSC {
class Stream{
public:
Stream();
~Stream();
virtual ~Stream();
Stream(unsigned int buffers, unsigned int bufferTime = 0);
Meta metadata;
JSON::Value & getPacket();

View file

@ -1,5 +1,29 @@
#include "dtsc.h"
/// Retrieves a short in network order from the pointer p.
static short btohs(char * p){
return (p[0] << 8) + p[1];
}
/// Stores a short value of val in network order to the pointer p.
static void htobs(char * p, short val){
p[0] = (val >> 8) & 0xFF;
p[1] = val & 0xFF;
}
/// Retrieves a long in network order from the pointer p.
static long btohl(char * p){
return (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3];
}
/// Stores a long value of val in network order to the pointer p.
static void htobl(char * p, long val){
p[0] = (val >> 24) & 0xFF;
p[1] = (val >> 16) & 0xFF;
p[2] = (val >> 8) & 0xFF;
p[3] = val & 0xFF;
}
namespace DTSC {
long Part::getSize(){
return ((long)data[0] << 16) | ((long)data[1] << 8) | data[2];
@ -12,19 +36,19 @@ namespace DTSC {
}
short Part::getDuration(){
return ntohs(((short*)(data+3))[0]);
return btohs(data+3);
}
void Part::setDuration(short newDuration){
((short*)(data+3))[0] = htons(newDuration);
htobs(data+3, newDuration);
}
long Part::getOffset(){
return ntohl(((int*)(data+5))[0]);
return btohl(data+5);
}
void Part::setOffset(long newOffset){
((int*)(data+5))[0] = htonl(newOffset);
htobl(data+5, newOffset);
}
char* Part::getData(){
@ -53,28 +77,28 @@ namespace DTSC {
data[5] = (newLength >> 16) & 0xFF;
}
short Key::getNumber(){
return ntohs(((short*)(data+8))[0]);
unsigned short Key::getNumber(){
return btohs(data+8);
}
void Key::setNumber(short newNumber){
((short*)(data+8))[0] = htons(newNumber);
void Key::setNumber(unsigned short newNumber){
htobs(data+8, newNumber);
}
short Key::getParts(){
return ntohs(((short*)(data+10))[0]);
return btohs(data+10);
}
void Key::setParts(short newParts){
((short*)(data+10))[0] = htons(newParts);
htobs(data+10, newParts);
}
long Key::getTime(){
return ntohl(((int*)(data+12))[0]);
return btohl(data+12);
}
void Key::setTime(long newTime){
((int*)(data+12))[0] = htonl(newTime);
htobl(data+12, newTime);
}
char* Key::getData(){
@ -82,11 +106,11 @@ namespace DTSC {
}
long Fragment::getDuration(){
return ntohl(((int*)data)[0]);
return btohl(data);
}
void Fragment::setDuration(long newDuration){
((int*)data)[0] = htonl(newDuration);
htobl(data, newDuration);
}
char Fragment::getLength(){
@ -98,19 +122,19 @@ namespace DTSC {
}
short Fragment::getNumber(){
return ntohs(((short*)(data+5))[0]);
return btohs(data+5);
}
void Fragment::setNumber(short newNumber){
((short*)(data+5))[0] = htons(newNumber);
htobs(data+5, newNumber);
}
long Fragment::getSize(){
return ntohl(((int*)(data+7))[0]);
return btohl(data+7);
}
void Fragment::setSize(long newSize){
((int*)(data+7))[0] = htonl(newSize);
htobl(data+7, newSize);
}
char* Fragment::getData(){
@ -301,7 +325,7 @@ namespace DTSC {
fragments.rbegin()->setSize(fragments.rbegin()->getSize() + pack["data"].asString().size());
}
Key & Track::getKey(int keyNum){
Key & Track::getKey(unsigned int keyNum){
static Key empty;
if (keyNum < keys[0].getNumber()){
return empty;

View file

@ -16,7 +16,6 @@ Filesystem::Directory::~Directory(){
}
void Filesystem::Directory::FillEntries(){
fprintf(stderr, "Filling Entries of %s:\n", (MyBase + MyPath).c_str());
ValidDir = true;
struct stat StatBuf;
Entries.clear();
@ -27,15 +26,15 @@ void Filesystem::Directory::FillEntries(){
dirent * entry;
while ((entry = readdir(Dirp))){
if (stat((MyBase + MyPath + "/" + entry->d_name).c_str(), &StatBuf) == -1){
#if DEBUG >= 4
fprintf(stderr, "\tSkipping %s\n\t\tReason: %s\n", entry->d_name, strerror(errno));
#endif
continue;
}
///Convert stat to string
Entries[std::string(entry->d_name)] = StatBuf;
}
}
fprintf(stderr, "Valid dir: %d\n", ValidDir);
fprintf(stderr, "#Entries: %d\n", Entries.size());
}
void Filesystem::Directory::Print(){

View file

@ -198,7 +198,7 @@ void HTTP::Parser::Proxy(Socket::Connection & from, Socket::Connection & to){
}
unsigned int chunkLen = 0;
if ( !tmpA.empty()){
for (int i = 0; i < tmpA.size(); ++i){
for (unsigned int i = 0; i < tmpA.size(); ++i){
chunkLen = (chunkLen << 4) | unhex(tmpA[i]);
}
if (chunkLen == 0){
@ -457,7 +457,7 @@ bool HTTP::Parser::parse(std::string & HTTPbuffer){
}
unsigned int chunkLen = 0;
if ( !tmpA.empty()){
for (int i = 0; i < tmpA.size(); ++i){
for (unsigned int i = 0; i < tmpA.size(); ++i){
chunkLen = (chunkLen << 4) | unhex(tmpA[i]);
}
if (chunkLen == 0){

View file

@ -638,6 +638,7 @@ unsigned int JSON::Value::packedSize() const{
}
return ret;
}
return 0;
}//packedSize
/// Pre-packs any object-type JSON::Value to a std::string for transfer over the network, including proper DTMI header.
@ -1089,7 +1090,7 @@ JSON::Value JSON::fromDTMI2(std::string data){
long long int tmpTrackID = ntohl(((int*)(data.c_str()))[0]);
JSON::Value tmp = fromDTMI(data.substr(12));
long long int tmpTime = ntohl(((int*)(data.c_str() + 4))[0]);
tmpTime << 32;
tmpTime <<= 32;
tmpTime += ntohl(((int*)(data.c_str() + 8))[0]);
tmp["time"] = tmpTime;
tmp["trackid"] = tmpTrackID;
@ -1101,7 +1102,7 @@ JSON::Value JSON::fromDTMI2(const unsigned char * data, unsigned int len, unsign
if (len < 13){return tmp;}
long long int tmpTrackID = ntohl(((int*)data)[0]);
long long int tmpTime = ntohl(((int*)data)[1]);
tmpTime << 32;
tmpTime <<= 32;
tmpTime += ntohl(((int*)data)[2]);
i += 12;
tmp = fromDTMI(data, len, i);

View file

@ -541,7 +541,7 @@ namespace MP4 {
}
if (current < wanted){
//make bigger
if (boxedSize() + (wanted - current) > data_size){
if (boxedSize() + (wanted - current) > (size_t)data_size){
//realloc if managed, otherwise fail
if ( !managed){
return false;
@ -599,7 +599,7 @@ namespace MP4 {
uint32_t containerBox::getContentCount(){
int res = 0;
int tempLoc = 0;
unsigned int tempLoc = 0;
while (tempLoc < boxedSize() - 8){
res++;
tempLoc += Box(getBox(tempLoc).asBox(), false).boxedSize();
@ -609,8 +609,8 @@ namespace MP4 {
void containerBox::setContent(Box & newContent, uint32_t no){
int tempLoc = 0;
int contentCount = getContentCount();
for (int i = 0; i < no; i++){
unsigned int contentCount = getContentCount();
for (unsigned int i = 0; i < no; i++){
if (i < contentCount){
tempLoc += getBoxLen(tempLoc);
}else{
@ -630,7 +630,7 @@ namespace MP4 {
if (no > getContentCount()){
return ret;
}
int i = 0;
unsigned int i = 0;
int tempLoc = 0;
while (i < no){
tempLoc += getBoxLen(tempLoc);
@ -642,7 +642,7 @@ namespace MP4 {
std::string containerBox::toPrettyContainerString(uint32_t indent, std::string boxName){
std::stringstream r;
r << std::string(indent, ' ') << boxName <<" (" << boxedSize() << ")" << std::endl;
for (int i = 0; i < getContentCount(); i++){
for (unsigned int i = 0; i < getContentCount(); i++){
Box curBox = MP4::Box(getContent(i).asBox(), false);
r << curBox.toPrettyString(indent + 1);
}
@ -651,7 +651,7 @@ namespace MP4 {
uint32_t containerFullBox::getContentCount(){
int res = 0;
int tempLoc = 4;
unsigned int tempLoc = 4;
while (tempLoc < boxedSize() - 8){
res++;
tempLoc += getBoxLen(tempLoc);
@ -661,8 +661,8 @@ namespace MP4 {
void containerFullBox::setContent(Box & newContent, uint32_t no){
int tempLoc = 4;
int contentCount = getContentCount();
for (int i = 0; i < no; i++){
unsigned int contentCount = getContentCount();
for (unsigned int i = 0; i < no; i++){
if (i < contentCount){
tempLoc += getBoxLen(tempLoc);
}else{
@ -682,8 +682,8 @@ namespace MP4 {
if (no > getContentCount()){
return ret;
}
int i = 0;
int tempLoc = 4;
unsigned int i = 0;
unsigned int tempLoc = 4;
while (i < no){
tempLoc += getBoxLen(tempLoc);
i++;
@ -818,7 +818,7 @@ namespace MP4 {
int countLoc = 29 + getStringLen(29) + 1;
int tempLoc = countLoc + 1;
//attempt to reach the wanted position
int i;
unsigned int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){
tempLoc += getStringLen(tempLoc) + 1;
}
@ -843,7 +843,7 @@ namespace MP4 {
return "";
}
int tempLoc = 29 + getStringLen(29) + 1 + 1; //position of first entry
for (int i = 0; i < no; i++){
for (unsigned int i = 0; i < no; i++){
tempLoc += getStringLen(tempLoc) + 1;
}
return getString(tempLoc);
@ -851,7 +851,7 @@ namespace MP4 {
uint32_t ABST::getQualityEntryCount(){
int countLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
countLoc += getStringLen(countLoc) + 1;
}
return getInt8(countLoc);
@ -859,12 +859,12 @@ namespace MP4 {
void ABST::setQualityEntry(std::string & newEntry, uint32_t no){
int countLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
countLoc += getStringLen(countLoc) + 1;
}
int tempLoc = countLoc + 1;
//attempt to reach the wanted position
int i;
unsigned int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){
tempLoc += getStringLen(tempLoc) + 1;
}
@ -888,11 +888,11 @@ namespace MP4 {
return "";
}
int tempLoc = 29 + getStringLen(29) + 1 + 1; //position of serverentries;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += 1; //first qualityentry
for (int i = 0; i < no; i++){
for (unsigned int i = 0; i < no; i++){
tempLoc += getStringLen(tempLoc) + 1;
}
return getString(tempLoc);
@ -900,11 +900,11 @@ namespace MP4 {
void ABST::setDrmData(std::string newDrm){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
setString(newDrm, tempLoc);
@ -912,11 +912,11 @@ namespace MP4 {
char* ABST::getDrmData(){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
return getString(tempLoc);
@ -924,11 +924,11 @@ namespace MP4 {
void ABST::setMetaData(std::string newMetaData){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1;
@ -937,11 +937,11 @@ namespace MP4 {
char* ABST::getMetaData(){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1;
@ -950,11 +950,11 @@ namespace MP4 {
uint32_t ABST::getSegmentRunTableCount(){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1; //DrmData
@ -964,11 +964,11 @@ namespace MP4 {
void ABST::setSegmentRunTable(ASRT & newSegment, uint32_t no){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1; //DrmData
@ -976,7 +976,7 @@ namespace MP4 {
int countLoc = tempLoc;
tempLoc++; //skip segmentRuntableCount
//attempt to reach the wanted position
int i;
unsigned int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){
tempLoc += getBoxLen(tempLoc);
}
@ -1005,18 +1005,17 @@ namespace MP4 {
return (ASRT&)res;
}
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1; //DrmData
tempLoc += getStringLen(tempLoc) + 1; //MetaData
int countLoc = tempLoc;
tempLoc++; //segmentRuntableCount
for (int i = 0; i < no; ++i){
for (unsigned int i = 0; i < no; ++i){
tempLoc += getBoxLen(tempLoc);
}
return (ASRT&)getBox(tempLoc);
@ -1024,16 +1023,16 @@ namespace MP4 {
uint32_t ABST::getFragmentRunTableCount(){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1; //DrmData
tempLoc += getStringLen(tempLoc) + 1; //MetaData
for (int i = getInt8(tempLoc++); i != 0; --i){
for (unsigned int i = getInt8(tempLoc++); i != 0; --i){
tempLoc += getBoxLen(tempLoc);
}
return getInt8(tempLoc);
@ -1041,34 +1040,34 @@ namespace MP4 {
void ABST::setFragmentRunTable(AFRT & newFragment, uint32_t no){
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1; //DrmData
tempLoc += getStringLen(tempLoc) + 1; //MetaData
for (int i = getInt8(tempLoc++); i != 0; --i){
for (unsigned int i = getInt8(tempLoc++); i != 0; --i){
tempLoc += getBoxLen(tempLoc);
}
int countLoc = tempLoc;
tempLoc++;
//attempt to reach the wanted position
int i;
unsigned int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){
tempLoc += getBoxLen(tempLoc);
}
//we are now either at the end, or at the right position
//let's reserve any unreserved space...
if (no + 1 > getInt8(countLoc)){
int amount = no + 1 - getInt8(countLoc);
unsigned int amount = no + 1 - getInt8(countLoc);
if ( !reserve(payloadOffset + tempLoc, 0, amount * 8)){
return;
};
//set empty erro boxes as contents
for (int j = 0; j < amount; ++j){
for (unsigned int j = 0; j < amount; ++j){
memcpy(data + payloadOffset + tempLoc + j * 8, "\000\000\000\010erro", 8);
}
setInt8(no + 1, countLoc); //set new count
@ -1085,21 +1084,20 @@ namespace MP4 {
return (AFRT&)res;
}
uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc++;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
tempLoc += getStringLen(tempLoc) + 1; //DrmData
tempLoc += getStringLen(tempLoc) + 1; //MetaData
for (int i = getInt8(tempLoc++); i != 0; --i){
for (unsigned int i = getInt8(tempLoc++); i != 0; --i){
tempLoc += getBoxLen(tempLoc);
}
int countLoc = tempLoc;
tempLoc++;
for (int i = 0; i < no; i++){
for (unsigned int i = 0; i < no; i++){
tempLoc += getBoxLen(tempLoc);
}
return (AFRT&)getBox(tempLoc);
@ -1126,11 +1124,11 @@ namespace MP4 {
r << std::string(indent + 1, ' ') << "SmpteTimeCodeOffset " << getSmpteTimeCodeOffset() << std::endl;
r << std::string(indent + 1, ' ') << "MovieIdentifier " << getMovieIdentifier() << std::endl;
r << std::string(indent + 1, ' ') << "ServerEntryTable (" << getServerEntryCount() << ")" << std::endl;
for (int i = 0; i < getServerEntryCount(); i++){
for (unsigned int i = 0; i < getServerEntryCount(); i++){
r << std::string(indent + 2, ' ') << i << ": " << getServerEntry(i) << std::endl;
}
r << std::string(indent + 1, ' ') << "QualityEntryTable (" << getQualityEntryCount() << ")" << std::endl;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
r << std::string(indent + 2, ' ') << i << ": " << getQualityEntry(i) << std::endl;
}
r << std::string(indent + 1, ' ') << "DrmData " << getDrmData() << std::endl;
@ -1185,7 +1183,7 @@ namespace MP4 {
int countLoc = 8;
int tempLoc = countLoc + 1;
//attempt to reach the wanted position
int i;
unsigned int i;
for (i = 0; i < getQualityEntryCount() && i < no; ++i){
tempLoc += getStringLen(tempLoc) + 1;
}
@ -1209,7 +1207,7 @@ namespace MP4 {
return "";
}
int tempLoc = 9; //position of first quality entry
for (int i = 0; i < no; i++){
for (unsigned int i = 0; i < no; i++){
tempLoc += getStringLen(tempLoc) + 1;
}
return getString(tempLoc);
@ -1217,7 +1215,7 @@ namespace MP4 {
uint32_t AFRT::getFragmentRunCount(){
int tempLoc = 9;
for (int i = 0; i < getQualityEntryCount(); ++i){
for (unsigned int i = 0; i < getQualityEntryCount(); ++i){
tempLoc += getStringLen(tempLoc) + 1;
}
return getInt32(tempLoc);
@ -1225,12 +1223,12 @@ namespace MP4 {
void AFRT::setFragmentRun(afrt_runtable newRun, uint32_t no){
int tempLoc = 9;
for (int i = 0; i < getQualityEntryCount(); ++i){
for (unsigned int i = 0; i < getQualityEntryCount(); ++i){
tempLoc += getStringLen(tempLoc) + 1;
}
int countLoc = tempLoc;
tempLoc += 4;
for (int i = 0; i < no; i++){
for (unsigned int i = 0; i < no; i++){
if (i + 1 > getInt32(countLoc)){
setInt32(0, tempLoc);
setInt64(0, tempLoc + 4);
@ -1259,12 +1257,11 @@ namespace MP4 {
return res;
}
int tempLoc = 9;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
int countLoc = tempLoc;
tempLoc += 4;
for (int i = 0; i < no; i++){
for (unsigned int i = 0; i < no; i++){
if (getInt32(tempLoc + 12) == 0){
tempLoc += 17;
}else{
@ -1293,11 +1290,11 @@ namespace MP4 {
}
r << std::string(indent + 1, ' ') << "Timescale " << getTimeScale() << std::endl;
r << std::string(indent + 1, ' ') << "QualitySegmentUrlModifiers (" << getQualityEntryCount() << ")" << std::endl;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
r << std::string(indent + 2, ' ') << i << ": " << getQualityEntry(i) << std::endl;
}
r << std::string(indent + 1, ' ') << "FragmentRunEntryTable (" << getFragmentRunCount() << ")" << std::endl;
for (int i = 0; i < getFragmentRunCount(); i++){
for (unsigned int i = 0; i < getFragmentRunCount(); i++){
afrt_runtable myRun = getFragmentRun(i);
if (myRun.duration){
r << std::string(indent + 2, ' ') << i << ": " << myRun.firstFragment << " is at " << ((double)myRun.firstTimestamp / (double)getTimeScale())
@ -1340,7 +1337,7 @@ namespace MP4 {
int countLoc = 4;
int tempLoc = countLoc + 1;
//attempt to reach the wanted position
int i;
unsigned int i;
for (i = 0; i < getQualityEntryCount() && i < no; ++i){
tempLoc += getStringLen(tempLoc) + 1;
}
@ -1364,7 +1361,7 @@ namespace MP4 {
return "";
}
int tempLoc = 5; //position of qualityentry count;
for (int i = 0; i < no; i++){
for (unsigned int i = 0; i < no; i++){
tempLoc += getStringLen(tempLoc) + 1;
}
return getString(tempLoc);
@ -1372,7 +1369,7 @@ namespace MP4 {
uint32_t ASRT::getSegmentRunEntryCount(){
int tempLoc = 5; //position of qualityentry count;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
return getInt32(tempLoc);
@ -1380,7 +1377,7 @@ namespace MP4 {
void ASRT::setSegmentRun(uint32_t firstSegment, uint32_t fragmentsPerSegment, uint32_t no){
int tempLoc = 5; //position of qualityentry count;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
tempLoc += getStringLen(tempLoc) + 1;
}
int countLoc = tempLoc;
@ -1398,10 +1395,9 @@ namespace MP4 {
return res;
}
int tempLoc = 5; //position of qualityentry count;
for (int i = 0; i < getQualityEntryCount(); ++i){
for (unsigned int i = 0; i < getQualityEntryCount(); ++i){
tempLoc += getStringLen(tempLoc) + 1;
}
int countLoc = tempLoc;
tempLoc += 4 + 8 * no;
res.firstSegment = getInt32(tempLoc);
res.fragmentsPerSegment = getInt32(tempLoc + 4);
@ -1418,11 +1414,11 @@ namespace MP4 {
r << std::string(indent + 1, ' ') << "Replacement or new table" << std::endl;
}
r << std::string(indent + 1, ' ') << "QualityEntryTable (" << getQualityEntryCount() << ")" << std::endl;
for (int i = 0; i < getQualityEntryCount(); i++){
for (unsigned int i = 0; i < getQualityEntryCount(); i++){
r << std::string(indent + 2, ' ') << i << ": " << getQualityEntry(i) << std::endl;
}
r << std::string(indent + 1, ' ') << "SegmentRunEntryTable (" << getSegmentRunEntryCount() << ")" << std::endl;
for (int i = 0; i < getSegmentRunEntryCount(); i++){
for (unsigned int i = 0; i < getSegmentRunEntryCount(); i++){
r << std::string(indent + 2, ' ') << i << ": First=" << getSegmentRun(i).firstSegment << ", FragmentsPerSegment="
<< getSegmentRun(i).fragmentsPerSegment << std::endl;
}
@ -1463,7 +1459,7 @@ namespace MP4 {
uint32_t TRAF::getContentCount(){
int res = 0;
int tempLoc = 0;
unsigned int tempLoc = 0;
while (tempLoc < boxedSize() - 8){
res++;
tempLoc += getBoxLen(tempLoc);
@ -1473,8 +1469,8 @@ namespace MP4 {
void TRAF::setContent(Box & newContent, uint32_t no){
int tempLoc = 0;
int contentCount = getContentCount();
for (int i = 0; i < no; i++){
unsigned int contentCount = getContentCount();
for (unsigned int i = 0; i < no; i++){
if (i < contentCount){
tempLoc += getBoxLen(tempLoc);
}else{
@ -1494,7 +1490,7 @@ namespace MP4 {
if (no > getContentCount()){
return ret;
}
int i = 0;
unsigned int i = 0;
int tempLoc = 0;
while (i < no){
tempLoc += getBoxLen(tempLoc);
@ -1695,7 +1691,7 @@ namespace MP4 {
}
r << std::string(indent + 1, ' ') << "SampleInformation (" << getSampleInformationCount() << "):" << std::endl;
for (int i = 0; i < getSampleInformationCount(); ++i){
for (unsigned int i = 0; i < getSampleInformationCount(); ++i){
r << std::string(indent + 2, ' ') << "[" << i << "] ";
trunSampleInformation samp = getSampleInformation(i);
if (flags & trunsampleDuration){
@ -2205,7 +2201,7 @@ namespace MP4 {
void AVCC::setSPS(std::string newSPS){
setInt16(newSPS.size(), 6);
for (int i = 0; i < newSPS.size(); i++){
for (unsigned int i = 0; i < newSPS.size(); i++){
setInt8(newSPS[i], 8 + i);
} //not null-terminated
}
@ -2231,7 +2227,7 @@ namespace MP4 {
void AVCC::setPPS(std::string newPPS){
int offset = 8 + getSPSLen() + 1;
setInt16(newPPS.size(), offset);
for (int i = 0; i < newPPS.size(); i++){
for (unsigned int i = 0; i < newPPS.size(); i++){
setInt8(newPPS[i], offset + 2 + i);
} //not null-terminated
}
@ -2401,7 +2397,7 @@ namespace MP4 {
}
void ESDS::setUpstreamFlag(bool newVal){
setInt8(getStreamType()<<2 + ((uint8_t)newVal << 1) + (uint8_t)getReservedFlag() , 18);
setInt8((getStreamType()<<2) + ((uint8_t)newVal << 1) + (uint8_t)getReservedFlag() , 18);
}
bool ESDS::getReservedFlag(){
@ -2472,7 +2468,7 @@ namespace MP4 {
void ESDS::setESHeaderStartCodes(std::string newVal){
setConfigDescriptorTypeLength(newVal.size());
for (int i = 0; i < newVal.size(); i++){
for (unsigned int i = 0; i < newVal.size(); i++){
setInt8(newVal[i],35+i);
}
}
@ -2559,7 +2555,7 @@ namespace MP4 {
}
uint32_t SDTP::getValue(size_t index){
getInt8(index);
return getInt8(index);
}
std::string SDTP::toPrettyString(uint32_t indent){
@ -2659,7 +2655,7 @@ namespace MP4 {
r << std::string(indent + 1, ' ') << "MajorBrand: 0x" << std::hex << getMajorBrand() << std::dec << std::endl;
r << std::string(indent + 1, ' ') << "MinorVersion: " << getMinorVersion() << std::endl;
r << std::string(indent + 1, ' ') << "CompatibleBrands (" << getCompatibleBrandsCount() << "):" << std::endl;
for (int i = 0; i < getCompatibleBrandsCount(); i++){
for (unsigned int i = 0; i < getCompatibleBrandsCount(); i++){
r << std::string(indent + 2, ' ') << "[" << i << "] CompatibleBrand: 0x" << std::hex << getCompatibleBrands(i) << std::dec << std::endl;
}
return r.str();
@ -2706,7 +2702,7 @@ namespace MP4 {
}
uint32_t TREX::getDefaultSampleDuration(){
getInt32(8);
return getInt32(8);
}
void TREX::setDefaultSampleSize(uint32_t newDefaultSampleSize){
@ -2714,7 +2710,7 @@ namespace MP4 {
}
uint32_t TREX::getDefaultSampleSize(){
getInt32(12);
return getInt32(12);
}
void TREX::setDefaultSampleFlags(uint32_t newDefaultSampleFlags){
@ -2722,7 +2718,7 @@ namespace MP4 {
}
uint32_t TREX::getDefaultSampleFlags(){
getInt32(16);
return getInt32(16);
}
std::string TREX::toPrettyString(uint32_t indent){
@ -2785,7 +2781,7 @@ namespace MP4 {
}
uint32_t MFRO::getSize(){
getInt32(0);
return getInt32(0);
}
std::string MFRO::toPrettyString(uint32_t indent){
@ -2883,7 +2879,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[vmhd] Video Media Header Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "GraphicsMode: " << getGraphicsMode() << std::endl;
for (int i = 0; i < getOpColorCount(); i++){
for (unsigned int i = 0; i < getOpColorCount(); i++){
r << std::string(indent + 1, ' ') << "OpColor["<<i<<"]: " << getOpColor(i) << std::endl;
}
return r.str();
@ -3069,7 +3065,7 @@ namespace MP4 {
}
void DREF::setDataEntry(fullBox & newDataEntry, size_t index){
int i;
unsigned int i;
uint32_t offset = 8; //start of boxes
for (i=0; i< getEntryCount() && i < index; i++){
offset += getBoxLen(offset);
@ -3095,7 +3091,7 @@ namespace MP4 {
return (Box &)res;
}
for (int i=0; i < index; i++){
for (unsigned int i=0; i < index; i++){
offset += getBoxLen(offset);
}
return (Box &)getBox(offset);
@ -3106,7 +3102,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[dref] Data Reference Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "EntryCount: " << getEntryCount() << std::endl;
for (int32_t i = 0; i< getEntryCount(); i++){
for (unsigned int i = 0; i< getEntryCount(); i++){
r << getDataEntry(i).toPrettyString(indent+1);
}
return r.str();
@ -3276,7 +3272,7 @@ namespace MP4 {
r << std::string(indent + 1, ' ') << "Rate: " << getRate() << std::endl;
r << std::string(indent + 1, ' ') << "Volume: " << getVolume() << std::endl;
r << std::string(indent + 1, ' ') << "Matrix: ";
for (int32_t i = 0; i< getMatrixCount(); i++){
for (unsigned int i = 0; i< getMatrixCount(); i++){
r << getMatrix(i);
if (i!=getMatrixCount()-1){
r << ", ";
@ -3297,7 +3293,7 @@ namespace MP4 {
}
uint32_t TFRA::getTrackID(){
getInt32(4);
return getInt32(4);
}
void TFRA::setLengthSizeOfTrafNum(char newVal){
@ -3480,7 +3476,7 @@ namespace MP4 {
r << std::string(indent + 1, ' ') << "lengthSizeOfTrunNum: " << (int)getLengthSizeOfTrunNum() << std::endl;
r << std::string(indent + 1, ' ') << "lengthSizeOfSampleNum: " << (int)getLengthSizeOfSampleNum() << std::endl;
r << std::string(indent + 1, ' ') << "NumberOfEntry: " << getNumberOfEntry() << std::endl;
for (int i = 0; i < getNumberOfEntry(); i++){
for (unsigned int i = 0; i < getNumberOfEntry(); i++){
static TFRAEntry temp;
temp = getTFRAEntry(i);
r << std::string(indent + 1, ' ') << "Entry[" << i <<"]:"<< std::endl;
@ -3692,7 +3688,7 @@ namespace MP4 {
r << std::string(indent + 1, ' ') << "AlternateGroup: " << getAlternateGroup() << std::endl;
r << std::string(indent + 1, ' ') << "Volume: " << getVolume() << std::endl;
r << std::string(indent + 1, ' ') << "Matrix: ";
for (int32_t i = 0; i< getMatrixCount(); i++){
for (unsigned int i = 0; i< getMatrixCount(); i++){
r << getMatrix(i);
if (i!=getMatrixCount()-1){
r << ", ";
@ -3830,7 +3826,7 @@ namespace MP4 {
void STTS::setSTTSEntry(STTSEntry newSTTSEntry, uint32_t no){
if(no + 1 > getEntryCount()){
setEntryCount(no + 1);
for (int i = getEntryCount(); i < no; i++){
for (unsigned int i = getEntryCount(); i < no; i++){
setInt64(0, 8 + (i * 8));//filling up undefined entries of 64 bits
}
}
@ -3854,7 +3850,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[stts] Sample Table Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "EntryCount: " << getEntryCount() << std::endl;
for (int i = 0; i < getEntryCount(); i++){
for (unsigned int i = 0; i < getEntryCount(); i++){
static STTSEntry temp;
temp = getSTTSEntry(i);
r << std::string(indent + 1, ' ') << "Entry[" << i <<"]:"<< std::endl;
@ -3879,7 +3875,7 @@ namespace MP4 {
void CTTS::setCTTSEntry(CTTSEntry newCTTSEntry, uint32_t no){
if(no + 1 > getEntryCount()){
for (int i = getEntryCount(); i < no; i++){
for (unsigned int i = getEntryCount(); i < no; i++){
setInt64(0, 8 + (i * 8));//filling up undefined entries of 64 bits
}
}
@ -3903,7 +3899,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[stts] Sample Table Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "EntryCount: " << getEntryCount() << std::endl;
for (int i = 0; i < getEntryCount(); i++){
for (unsigned int i = 0; i < getEntryCount(); i++){
static CTTSEntry temp;
temp = getCTTSEntry(i);
r << std::string(indent + 1, ' ') << "Entry[" << i <<"]:"<< std::endl;
@ -3932,7 +3928,7 @@ namespace MP4 {
void STSC::setSTSCEntry(STSCEntry newSTSCEntry, uint32_t no){
if(no + 1 > getEntryCount()){
setEntryCount(no+1);
for (int i = getEntryCount(); i < no; i++){
for (unsigned int i = getEntryCount(); i < no; i++){
setInt64(0, 8 + (i * 12));//filling up undefined entries of 64 bits
setInt32(0, 8 + (i * 12) + 8);
}
@ -3959,7 +3955,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[stsc] Sample To Chunk Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "EntryCount: " << getEntryCount() << std::endl;
for (int i = 0; i < getEntryCount(); i++){
for (unsigned int i = 0; i < getEntryCount(); i++){
static STSCEntry temp;
temp = getSTSCEntry(i);
r << std::string(indent + 1, ' ') << "Entry[" << i <<"]:"<< std::endl;
@ -3987,7 +3983,7 @@ namespace MP4 {
void STCO::setChunkOffset(uint32_t newChunkOffset, uint32_t no){
if (no + 1 > getEntryCount()){
for (int i = getEntryCount(); i < no; i++){
for (unsigned int i = getEntryCount(); i < no; i++){
setInt32(0, 8 + i * 4);//filling undefined entries
}
setEntryCount(no+1);
@ -4007,7 +4003,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[stco] Chunk Offset Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "EntryCount: " << getEntryCount() << std::endl;
for (int i = 0; i < getEntryCount(); i++){
for (unsigned int i = 0; i < getEntryCount(); i++){
r << std::string(indent + 1, ' ') << "ChunkOffset[" << i <<"]: " << getChunkOffset(i) << std::endl;
}
return r.str();
@ -4039,7 +4035,7 @@ namespace MP4 {
void STSZ::setEntrySize(uint32_t newEntrySize, uint32_t no){
if (no + 1 > getSampleCount()){
setSampleCount(no + 1);
for (int i = getSampleCount(); i < no; i++){
for (unsigned int i = getSampleCount(); i < no; i++){
setInt32(0, 12 + i * 4);//filling undefined entries
}
}
@ -4059,7 +4055,7 @@ namespace MP4 {
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "SampleSize: " << getSampleSize() << std::endl;
r << std::string(indent + 1, ' ') << "SampleCount: " << getSampleCount() << std::endl;
for (int i = 0; i < getSampleCount(); i++){
for (unsigned int i = 0; i < getSampleCount(); i++){
r << std::string(indent + 1, ' ') << "EntrySize[" << i <<"]: " << getEntrySize(i) << std::endl;
}
return r.str();
@ -4264,7 +4260,7 @@ namespace MP4 {
}
uint16_t VisualSampleEntry::getDepth(){
getInt16(74);
return getInt16(74);
}
void VisualSampleEntry::setCLAP(Box& clap){
@ -4435,8 +4431,8 @@ namespace MP4 {
void STSD::setEntry(Box & newContent, uint32_t no){
int tempLoc = 8;
int entryCount = getEntryCount();
for (int i = 0; i < no; i++){
unsigned int entryCount = getEntryCount();
for (unsigned int i = 0; i < no; i++){
if (i < entryCount){
tempLoc += getBoxLen(tempLoc);
}else{
@ -4459,7 +4455,7 @@ namespace MP4 {
if (no > getEntryCount()){
return ret;
}
int i = 0;
unsigned int i = 0;
int tempLoc = 8;
while (i < no){
tempLoc += getBoxLen(tempLoc);
@ -4473,7 +4469,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[stsd] Sample Description Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "EntrySize: " << getEntryCount() << std::endl;
for (int i = 0; i < getEntryCount(); i++){
for (unsigned int i = 0; i < getEntryCount(); i++){
Box curBox = Box(getEntry(i).asBox(), false);
r << curBox.toPrettyString(indent + 1);
}
@ -4508,7 +4504,7 @@ namespace MP4 {
}
uint32_t STSS::getEntryCount(){
getInt32(4);
return getInt32(4);
}
void STSS::setSampleNumber(uint32_t newVal, uint32_t index){
@ -4530,7 +4526,7 @@ namespace MP4 {
r << std::string(indent, ' ') << "[stss] Sync Sample Box (" << boxedSize() << ")" << std::endl;
r << fullBox::toPrettyString(indent);
r << std::string(indent + 1, ' ') << "EntryCount: " << getEntryCount() << std::endl;
for (int i = 0; i < getEntryCount(); i++){
for (unsigned int i = 0; i < getEntryCount(); i++){
r << std::string(indent + 1, ' ') << "SampleNumber[" << i <<"] : " << getSampleNumber(i) << std::endl;
}
return r.str();

View file

@ -308,32 +308,32 @@ namespace MP4{
MP4::STBL checkStblBox;
MP4::STCO checkStcoBox;
checkTrakBox = ((MP4::TRAK&)moovBox.getContent(i));
for (int j = 0; j < checkTrakBox.getContentCount(); j++){
for (unsigned int j = 0; j < checkTrakBox.getContentCount(); j++){
if (checkTrakBox.getContent(j).isType("mdia")){
checkMdiaBox = ((MP4::MDIA&)checkTrakBox.getContent(j));
break;
}
}
for (int j = 0; j < checkMdiaBox.getContentCount(); j++){
for (unsigned int j = 0; j < checkMdiaBox.getContentCount(); j++){
if (checkMdiaBox.getContent(j).isType("minf")){
checkMinfBox = ((MP4::MINF&)checkMdiaBox.getContent(j));
break;
}
}
for (int j = 0; j < checkMinfBox.getContentCount(); j++){
for (unsigned int j = 0; j < checkMinfBox.getContentCount(); j++){
if (checkMinfBox.getContent(j).isType("stbl")){
checkStblBox = ((MP4::STBL&)checkMinfBox.getContent(j));
break;
}
}
for (int j = 0; j < checkStblBox.getContentCount(); j++){
for (unsigned int j = 0; j < checkStblBox.getContentCount(); j++){
if (checkStblBox.getContent(j).isType("stco")){
checkStcoBox = ((MP4::STCO&)checkStblBox.getContent(j));
break;
}
}
//got the STCO box, fixing values with MP4 header offset
for (int j = 0; j < checkStcoBox.getEntryCount(); j++){
for (unsigned int j = 0; j < checkStcoBox.getEntryCount(); j++){
checkStcoBox.setChunkOffset(checkStcoBox.getChunkOffset(j) + byteOffset, j);
}
}

View file

@ -33,7 +33,6 @@ bool NAL_Unit::ReadData(std::string & InputData){
if (AnnexB){
MyData = "";
InputData.erase(0, 3); //Intro Bytes
bool FinalByteRead = false;
int Location = std::min(InputData.find(ShortAnnexB), InputData.find(FullAnnexB));
MyData = InputData.substr(0, Location);
InputData.erase(0, Location);
@ -41,7 +40,7 @@ bool NAL_Unit::ReadData(std::string & InputData){
if (InputData.size() < 4){
return false;
}
int UnitLen = (InputData[0] << 24) + (InputData[1] << 16) + (InputData[2] << 8) + InputData[3];
unsigned int UnitLen = (InputData[0] << 24) + (InputData[1] << 16) + (InputData[2] << 8) + InputData[3];
if (InputData.size() < 4 + UnitLen){
return false;
}

View file

@ -66,7 +66,7 @@ namespace OGG{
}
memcpy(data, newData.c_str(), 27);//copying the header, always 27 bytes
if (newData.size() < 27 + getPageSegments()){//check input size
if (newData.size() < 27u + getPageSegments()){//check input size
return false;
}
if(!checkDataSize(27 + getPageSegments())){//check if size available in memory
@ -279,7 +279,7 @@ namespace OGG{
}
bool Page::typeNone(){
if (getHeaderType() & 0x07 == 0x00){
if ((getHeaderType() & 0x07) == 0x00){
return true;
}
return false;
@ -319,7 +319,7 @@ namespace OGG{
r << std::string(indent + 2,' ') << "Payloadsize: " << dataSum << std::endl;
if (codec == "theora"){
int offset = 0;
for (int i = 0; i < getSegmentTableDeque().size(); i++){
for (unsigned int i = 0; i < getSegmentTableDeque().size(); i++){
theora::header tmpHeader;
int len = getSegmentTableDeque()[i];
if (tmpHeader.read(getFullPayload()+offset,len)){
@ -334,7 +334,7 @@ namespace OGG{
}else if(codec == "vorbis"){
r << "Vorbis Data" << std::endl;
int offset = 0;
for (int i = 0; i < getSegmentTableDeque().size(); i++){
for (unsigned int i = 0; i < getSegmentTableDeque().size(); i++){
vorbis::header tmpHeader;
int len = getSegmentTableDeque()[i];
if (tmpHeader.read(getFullPayload()+offset,len)){

View file

@ -445,12 +445,9 @@ void Socket::Connection::SendNow(const char * data, size_t len){
while (upbuffer.size() > 0 && connected()){
iwrite(upbuffer.get());
}
int i = iwrite(data, len);
unsigned int i = iwrite(data, len);
while (i < len && connected()){
int j = iwrite(data + i, std::min(len - i, (size_t)51200));
if (j > 0){
i += j;
}
i += iwrite(data + i, std::min(len - i, (size_t)51200));
}
if (!bing){setBlocking(false);}
}
@ -469,7 +466,7 @@ void Socket::Connection::Send(const char * data, size_t len){
if (upbuffer.size() > 0){
upbuffer.append(data, len);
}else{
int i = iwrite(data, len);
unsigned int i = iwrite(data, len);
if (i < len){
upbuffer.append(data + i, len - i);
}
@ -515,11 +512,11 @@ void Socket::Connection::Send(std::string & data){
/// \param buffer Location of the buffer to write from.
/// \param len Amount of bytes to write.
/// \returns The amount of bytes actually written.
int Socket::Connection::iwrite(const void * buffer, int len){
unsigned int Socket::Connection::iwrite(const void * buffer, int len){
if ( !connected() || len < 1){
return 0;
}
int r;
unsigned int r;
if (sock >= 0){
r = send(sock, buffer, len, 0);
}else{
@ -614,8 +611,8 @@ bool Socket::Connection::iwrite(std::string & buffer){
if (buffer.size() < 1){
return false;
}
int tmp = iwrite((void*)buffer.c_str(), buffer.size());
if (tmp < 1){
unsigned int tmp = iwrite((void*)buffer.c_str(), buffer.size());
if ( !tmp){
return false;
}
buffer = buffer.substr(tmp);

View file

@ -54,7 +54,7 @@ namespace Socket {
Buffer downbuffer; ///< Stores temporary data coming in.
Buffer upbuffer; ///< Stores temporary data going out.
int iread(void * buffer, int len); ///< Incremental read call.
int iwrite(const void * buffer, int len); ///< Incremental write call.
unsigned int iwrite(const void * buffer, int len); ///< Incremental write call.
bool iread(Buffer & buffer); ///< Incremental write call that is compatible with Socket::Buffer.
bool iwrite(std::string & buffer); ///< Write call that is compatible with std::string.
public:

View file

@ -70,7 +70,7 @@ Socket::Connection Util::Stream::getLive(std::string streamname){
Socket::Connection Util::Stream::getVod(std::string filename, std::string streamname){
std::string name = "MistPlayer " + filename;
std::string player_bin = Util::getMyPath() + "MistPlayer";
char* const argv[] = {(char*)player_bin.c_str(), (char*)filename.c_str(), "-s", (char*)streamname.c_str(), NULL};
char* const argv[] = {(char*)player_bin.c_str(), (char*)filename.c_str(), (char*)"-s", (char*)streamname.c_str(), (char*)0};
int fdin = -1, fdout = -1, fderr = fileno(stderr);
Util::Procs::StartPiped(name, argv, &fdin, &fdout, &fderr);
// if StartPiped fails then fdin and fdout will be unmodified (-1)

View file

@ -60,10 +60,10 @@ namespace theora{
if (getVMIN() != 2){return false;}
if (getFMBW() == 0){return false;}
if (getFMBH() == 0){return false;}
if (getPICW() > getFMBW() * 16){return false;}
if (getPICH() > getFMBH() * 16){return false;}
if (getPICX() > (getFMBW() * 16) - getPICW()){return false;}
if (getPICY() > (getFMBH() * 16) - getPICH()){return false;}
if ((short)getPICW() > getFMBW() * 16){return false;}
if ((short)getPICH() > getFMBH() * 16){return false;}
if ((short)getPICX() > (getFMBW() * 16) - (short)getPICW()){return false;}
if ((short)getPICY() > (getFMBH() * 16) - (short)getPICH()){return false;}
if (getFRN() == 0){return false;}
if (getFRD() == 0){return false;}
return true;
@ -212,9 +212,8 @@ namespace theora{
std::string header::getUserComment(size_t index){
if (index >= getNComments()){return "";}
int len;
int offset = 11 + commentLen(7) + 4;
for (int i = 0; i < index; i++){
for (size_t i = 0; i < index; i++){
offset += 4 + commentLen(offset);
}
return std::string(data + offset + 4,commentLen(offset));
@ -247,7 +246,7 @@ namespace theora{
case 1:
result << std::string(indent+2,' ') << "Vendor: " << getVendor() << std::endl;
result << std::string(indent+2,' ') << "User Comments (" << getNComments() << "):" << std::endl;
for (int i = 0; i < getNComments(); i++){
for (long unsigned int i = 0; i < getNComments(); i++){
result << std::string(indent+4,' ') << "[" << i << "] " << getUserComment(i) << std::endl;
}
break;

View file

@ -129,7 +129,7 @@ int64_t TS::Packet::PCR(){
int64_t Result = 0;
Result = (((strBuf[6] << 24) + (strBuf[7] << 16) + (strBuf[8] << 8) + strBuf[9]) << 1) + (strBuf[10] & 0x80 >> 7);
Result = Result * 300;
Result += ((strBuf[10] & 0x01) << 8 + strBuf[11]);
Result += (((strBuf[10] & 0x01) << 8) + strBuf[11]);
return Result;
}
@ -388,7 +388,7 @@ std::string & TS::Packet::getPESAudioLeadIn(unsigned int NewLen, long long unsig
/// Stores as many bytes from NewVal as possible in the packet.
/// \param NewVal The data to store in the packet.
void TS::Packet::FillFree(std::string & NewVal){
int toWrite = BytesFree();
unsigned int toWrite = BytesFree();
if (toWrite == NewVal.size()){
strBuf += NewVal;
NewVal.clear();

View file

@ -97,11 +97,4 @@ namespace TS {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
/// The full Bytesteam Nal-Header.
static char NalHeader[4] = {0x00, 0x00, 0x00, 0x01};
/// The shortened Bytesteam Nal-Header.
static char ShortNalHeader[3] = {0x00, 0x00, 0x01};
}
;
//TS namespace
} //TS namespace