Removed ALL the compile warnings!

This commit is contained in:
Thulinma 2014-01-05 15:28:53 +01:00
parent d8113e7829
commit 05d23a0ac6
21 changed files with 1472 additions and 1018 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
*.la
*.lo
*.swp
*.bak
*~
.deps
Makefile.in

2339
Doxyfile

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ prefix = /usr
exec_prefix = $(prefix)
bindir = $(prefix)/bin
PACKAGE_VERSION ::= $(shell git describe --tags 2> /dev/null || cat VERSION 2> /dev/null || echo "Unknown")
PACKAGE_VERSION := $(shell git describe --tags 2> /dev/null || cat VERSION 2> /dev/null || echo "Unknown")
DEBUG = 4
RELEASE = Generic_$(shell getconf LONG_BIT)
@ -10,16 +10,16 @@ ifeq ($(PACKAGE_VERSION),Unknown)
$(warning Version is unknown - consider creating a VERSION file or fixing your git setup.)
endif
CPPFLAGS = -Wall -g -O2 -DDEBUG="$(DEBUG)" -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" -DRELEASE="\"$(RELEASE)\""
CPPFLAGS = -Wall -funsigned-char -g -O2 -DDEBUG="$(DEBUG)" -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" -DRELEASE="\"$(RELEASE)\""
LDLIBS = -lmist
.DEFAULT_GOAL ::= all
.DEFAULT_GOAL := all
all: controller buffers connectors analysers converters
DOXYGEN ::= $(shell doxygen -v 2> /dev/null)
DOXYGEN := $(shell doxygen -v 2> /dev/null)
ifdef DOXYGEN
all: docs
else
@ -164,7 +164,7 @@ BUILT_SOURCES=controller/server.html.h connectors/embed.js.h
lspSOURCES=../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/pages.js ../lsp/tablesort.js
lspDATA=../lsp/header.html ../lsp/main.css ../lsp/footer.html
JAVA ::= $(shell which java 2> /dev/null)
JAVA := $(shell which java 2> /dev/null)
ifdef JAVA
CLOSURE=java -jar lsp/closure-compiler.jar --warning_level QUIET
else
@ -172,7 +172,7 @@ $(warning Java not installed - not compressing javascript codes before inclusion
CLOSURE=cat
endif
XXD ::= $(shell which xxd 2> /dev/null)
XXD := $(shell which xxd 2> /dev/null)
ifndef XXD
$(error xxd not installed - cannot continue. Please install xxd)
endif
@ -194,11 +194,12 @@ src/controller/server.html: $(lspDATA) $(lspSOURCES)
src/controller/server.html.h: src/controller/server.html
cd src/controller; xxd -i server.html server.html.h
docs: src/*
docs: src/* Doxyfile
doxygen ./Doxyfile > /dev/null
clean:
rm -f *.o Mist*
rm -f *.o Mist* src/controller/server.html src/connectors/embed.js.h src/controller/server.html.h
rm -rf ./docs
install: controller buffers connectors analysers converters
install ./Mist* $(DESTDIR)$(bindir)
@ -207,3 +208,4 @@ uninstall:
rm -f $(DESTDIR)$(bindir)/Mist*
.PHONY: clean uninstall

View file

@ -84,7 +84,7 @@ namespace Buffer {
}
///\brief Check if this is the IP address to accept push data from.
///\param ip The IP address to check, followed by a space and the password to check.
///\param push_request The IP address to check, followed by a space and the password to check.
///\return True if it is the correct address or password, false otherwise.
bool Stream::checkWaitingIP(std::string push_request){
std::string ip = push_request.substr(0, push_request.find(' '));
@ -180,7 +180,7 @@ namespace Buffer {
metadata.tracks.erase(trackId);
std::set<DTSC::livePos> toDelete;
for (std::map<DTSC::livePos, JSON::Value >::iterator it = buffers.begin(); it != buffers.end(); it++){
if (it->first.trackID == trackId){
if (it->first.trackID == (unsigned long long int)trackId){
toDelete.insert(it->first);
}
}
@ -244,7 +244,7 @@ namespace Buffer {
}
/// Removes a user from the userlist.
/// \param newUser The user to be removed.
/// \param oldUser The user to be removed.
void Stream::removeUser(user * oldUser){
tthread::lock_guard<tthread::recursive_mutex> guard(stats_mutex);
users.erase(oldUser);
@ -259,6 +259,7 @@ namespace Buffer {
///Creates a new user from a newly connected socket.
///Also prints "User connected" text to stdout.
///\param fd A connection to the user.
///\param ID Unique ID of the user.
user::user(Socket::Connection fd, long long ID){
sID = JSON::Value(ID).asString();
S = fd;

View file

@ -173,7 +173,7 @@ int main(int argc, char** argv){
}
case 's': { //second-seek
int ms = JSON::Value(in_out.Received().get().substr(2)).asInt();
bool ret = source.seek_time(ms);
source.seek_time(ms);
lasttime = Util::epoch();
lastTime = 0;
playUntil = 0;

View file

@ -44,8 +44,9 @@ namespace Connector_HTTP {
///\brief Builds a bootstrap for use in HTTP Dynamic streaming.
///\param streamName The name of the stream.
///\param metadata The current metadata, used to generate the index.
///\param fragnum The index of the current fragment
///\param trackMeta The current metadata of this track, used to generate the index.
///\param isLive Whether or not the stream is live.
///\param fragnum The index of the current fragment.
///\return The generated bootstrap.
std::string dynamicBootstrap(std::string & streamName, DTSC::Track & trackMeta, bool isLive = false, int fragnum = 0){
std::string empty;
@ -153,7 +154,6 @@ namespace Connector_HTTP {
bool handlingRequest = false;
int Quality = 0;
int Segment = -1;
int ReqFragment = -1;
long long mstime = 0;
long long mslen = 0;
@ -195,7 +195,6 @@ namespace Connector_HTTP {
Quality = atoi(tmp_qual.substr(0, tmp_qual.find("Seg") - 1).c_str());
int temp;
temp = HTTP_R.url.find("Seg") + 3;
Segment = atoi(HTTP_R.url.substr(temp, HTTP_R.url.find("-", temp) - temp).c_str());
temp = HTTP_R.url.find("Frag") + 4;
ReqFragment = atoi(HTTP_R.url.substr(temp).c_str());
#if DEBUG >= 5

View file

@ -1,5 +1,5 @@
///\file conn_http_progressive.cpp
///\brief Contains the main code for the HTTP Progressive Connector
///\file conn_http_json.cpp
///\brief Contains the main code for the HTTP JSON Connector
#include <iostream>
#include <queue>
@ -29,7 +29,6 @@ namespace Connector_HTTP {
///\param conn A socket describing the connection the client.
///\return The exit code of the connector.
int JSONConnector(Socket::Connection conn){
bool progressive_has_sent_header = false;//Indicates whether we have sent a header.
DTSC::Stream Strm; //Incoming stream buffer.
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
bool inited = false;//Whether the stream is initialized

View file

@ -27,13 +27,13 @@
namespace Connector_HTTP {
///\brief Builds an index file for HTTP Live streaming.
///\param metadata The current metadata, used to generate the index.
///\param isLive Whether or not the stream is live.
///\return The index file for HTTP Live Streaming.
std::string liveIndex(DTSC::Meta & metadata, bool isLive){
std::stringstream result;
result << "#EXTM3U\r\n";
int audioId = -1;
std::string audioName;
bool defAudio = false;//set default audio track;
for (std::map<int,DTSC::Track>::iterator it = metadata.tracks.begin(); it != metadata.tracks.end(); it++){
if (it->second.codec == "AAC"){
audioId = it->first;
@ -106,11 +106,11 @@ namespace Connector_HTTP {
TS::Packet PackData;
int PacketNumber = 0;
long long unsigned int TimeStamp = 0;
int ThisNaluSize;
unsigned int ThisNaluSize;
char VideoCounter = 0;
char AudioCounter = 0;
long long unsigned int lastVid = 0;
bool IsKeyFrame;
bool IsKeyFrame = false;
MP4::AVCC avccbox;
bool haveAvcc = false;
@ -179,7 +179,7 @@ namespace Connector_HTTP {
continue;
}
}
for (int i = 0; i < allTracks.size(); i++){
for (unsigned int i = 0; i < allTracks.size(); i++){
if (allTracks[i] == '_'){
allTracks[i] = ' ';
}
@ -258,7 +258,7 @@ namespace Connector_HTTP {
ToPack.append(avccbox.asAnnexB());
while (Strm.lastData().size() > 4){
ThisNaluSize = (Strm.lastData()[0] << 24) + (Strm.lastData()[1] << 16) + (Strm.lastData()[2] << 8) + Strm.lastData()[3];
Strm.lastData().replace(0, 4, TS::NalHeader, 4);
Strm.lastData().replace(0, 4, "\000\000\000\001", 4);
if (ThisNaluSize + 4 == Strm.lastData().size()){
ToPack.append(Strm.lastData());
break;

View file

@ -1,5 +1,5 @@
///\file conn_http_progressive.cpp
///\brief Contains the main code for the HTTP Progressive Connector
///\file conn_http_progressive_flv.cpp
///\brief Contains the main code for the HTTP Progressive FLV Connector
#include <iostream>
#include <queue>
@ -40,8 +40,6 @@ namespace Connector_HTTP {
unsigned int seek_sec = 0;//Seek position in ms
unsigned int seek_byte = 0;//Seek position in bytes
bool isMP3 = false;//Indicates whether the request is audio-only mp3.
int videoID = -1;
int audioID = -1;

View file

@ -1,5 +1,5 @@
///\file conn_http_progressive.cpp
///\brief Contains the main code for the HTTP Progressive Connector
///\file conn_http_progressive_mp3.cpp
///\brief Contains the main code for the HTTP Progressive MP3 Connector
#include <iostream>
#include <queue>

View file

@ -1,5 +1,5 @@
///\file conn_http_progressive.cpp
///\brief Contains the main code for the HTTP Progressive Connector
///\file conn_http_progressive_mp4.cpp
///\brief Contains the main code for the HTTP Progressive MP4 Connector
#include <iostream>
#include <queue>
@ -27,7 +27,6 @@ namespace Connector_HTTP {
///\param conn A socket describing the connection the client.
///\return The exit code of the connector.
int progressiveConnector(Socket::Connection conn){
bool progressive_has_sent_header = false;//Indicates whether we have sent a header.
bool ready4data = false; //Set to true when streaming is to begin.
DTSC::Stream Strm; //Incoming stream buffer.
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
@ -40,8 +39,6 @@ namespace Connector_HTTP {
std::set<MP4::keyPart>::iterator keyPartIt;
unsigned int lastStats = 0;//Indicates the last time that we have sent stats to the server socket.
unsigned int seek_sec = 0;//Seek position in ms
unsigned int seek_byte = 0;//Seek position in bytes
int videoID = -1;
int audioID = -1;
@ -60,29 +57,7 @@ namespace Connector_HTTP {
size_t extDot = streamname.rfind('.');
if (extDot != std::string::npos){
streamname.resize(extDot);
}; //strip the extension
int start = 0;
if ( !HTTP_R.GetVar("start").empty()){
start = atoi(HTTP_R.GetVar("start").c_str());
}
if ( !HTTP_R.GetVar("starttime").empty()){
start = atoi(HTTP_R.GetVar("starttime").c_str());
}
if ( !HTTP_R.GetVar("apstart").empty()){
start = atoi(HTTP_R.GetVar("apstart").c_str());
}
if ( !HTTP_R.GetVar("ec_seek").empty()){
start = atoi(HTTP_R.GetVar("ec_seek").c_str());
}
if ( !HTTP_R.GetVar("fs").empty()){
start = atoi(HTTP_R.GetVar("fs").c_str());
}
//under 3 hours we assume seconds, otherwise byte position
if (start < 10800){
seek_sec = start * 1000; //ms, not s
}else{
seek_byte = start; //divide by 1mbit, then *1000 for ms.
}
} //strip the extension
ready4data = true;
HTTP_R.Clean(); //clean for any possible next requests
}
@ -142,7 +117,6 @@ namespace Connector_HTTP {
byterate += Strm.metadata.tracks[audioID].bps;
}
if ( !byterate){byterate = 1;}
seek_sec = (seek_byte / byterate) * 1000;
inited = true;
}

View file

@ -1,5 +1,5 @@
///\file conn_http_progressive.cpp
///\brief Contains the main code for the HTTP Progressive Connector
///\file conn_http_progressive_ogg.cpp
///\brief Contains the main code for the HTTP Progressive OGG Connector
#include <iostream>
#include <queue>
@ -46,10 +46,6 @@ namespace Connector_HTTP {
long long int currGran = 0;
long long int prevGran = 0;
std::string sendBuffer;
bool OggEOS = false;
bool OggCont = false;
unsigned int lastStats = 0;//Indicates the last time that we have sent stats to the server socket.
unsigned int seek_sec = 0;//Seek position in ms

View file

@ -111,7 +111,7 @@ namespace Connector_HTTP {
"Index=\"" << index << "\" "
"Bitrate=\"" << (*it)->second.bps * 8 << "\" "
"CodecPrivateData=\"" << std::hex;
for (int i = 0; i < (*it)->second.init.size(); i++){
for (unsigned int i = 0; i < (*it)->second.init.size(); i++){
Result << std::setfill('0') << std::setw(2) << std::right << (int)(*it)->second.init[i];
}
Result << std::dec << "\" "
@ -160,7 +160,7 @@ namespace Connector_HTTP {
MP4::AVCC avccbox;
avccbox.setPayload((*it)->second.init);
std::string tmpString = avccbox.asAnnexB();
for (int i = 0; i < tmpString.size(); i++){
for (unsigned int i = 0; i < tmpString.size(); i++){
Result << std::setfill('0') << std::setw(2) << std::right << (int)tmpString[i];
}
Result << std::dec << "\" "
@ -197,7 +197,6 @@ namespace Connector_HTTP {
///\return The exit code of the connector.
int smoothConnector(Socket::Connection conn){
std::deque<std::string> dataBuffer;//A buffer for the data that needs to be sent to the client.
int dataSize = 0;//The amount of bytes in the dataBuffer
DTSC::Stream Strm;//Incoming stream buffer.
HTTP::Parser HTTP_R;//HTTP Receiver
@ -308,11 +307,9 @@ namespace Connector_HTTP {
std::stringstream sstream;
long long mstime = 0;
long long mslen = 0;
for (std::deque<DTSC::Key>::iterator it = myRef.keys.begin(); it != myRef.keys.end(); it++){
if (it->getTime() >= (requestedTime / 10000)){
mstime = it->getTime();
mslen = it->getLength();
if (Strm.metadata.live){
if (it == myRef.keys.end() - 2){
HTTP_S.Clean();
@ -347,7 +344,6 @@ namespace Connector_HTTP {
trackRef = it->second;
}
}
static long long int seqNum = 1;
//Also obtain the associated keyframe;
DTSC::Key keyObj;
int partOffset = 0;
@ -376,12 +372,10 @@ namespace Connector_HTTP {
}
ss.SendNow(sstream.str().c_str());
unsigned int myDuration;
//Wrap everything in mp4 boxes
MP4::MFHD mfhd_box;
mfhd_box.setSequenceNumber(((keyObj.getNumber() - 1) * 2) + myRef.trackID);
myDuration = keyObj.getLength() * 10000;
MP4::TFHD tfhd_box;
tfhd_box.setFlags(MP4::tfhdSampleFlag);
@ -437,7 +431,7 @@ namespace Connector_HTTP {
fragref_box.setVersion(1);
fragref_box.setFragmentCount(0);
int fragCount = 0;
for (int i = 0; fragCount < 2 && i < trackRef.keys.size() - 1; i++){
for (unsigned int i = 0; fragCount < 2 && i < trackRef.keys.size() - 1; i++){
if (trackRef.keys[i].getTime() > (requestedTime / 10000)){
fragref_box.setTime(fragCount, trackRef.keys[i].getTime() * 10000);
fragref_box.setDuration(fragCount, trackRef.keys[i].getLength() * 10000);

View file

@ -1,5 +1,5 @@
///\file conn_http_progressive.cpp
///\brief Contains the main code for the HTTP Progressive Connector
///\file conn_http_srt.cpp
///\brief Contains the main code for the HTTP SRT Connector
#include <iostream>
#include <queue>
@ -29,7 +29,6 @@ namespace Connector_HTTP {
///\param conn A socket describing the connection the client.
///\return The exit code of the connector.
int SRTConnector(Socket::Connection conn){
bool progressive_has_sent_header = false;//Indicates whether we have sent a header.
DTSC::Stream Strm; //Incoming stream buffer.
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
bool inited = false;//Whether the stream is initialized
@ -39,7 +38,7 @@ namespace Connector_HTTP {
unsigned int lastStats = 0;//Indicates the last time that we have sent stats to the server socket.
unsigned int seek_time = 0;//Seek position in ms
int trackID = -1; // the track to be selected
int curIndex; // SRT index
int curIndex = 0; // SRT index
bool subtitleTrack = false; // check whether the requested track is a srt track
bool isWebVTT = false;

View file

@ -28,6 +28,7 @@ namespace Connector_TS {
///\brief Main function for the TS Connector
///\param conn A socket describing the connection the client.
///\param streamName The stream to connect to.
///\param trackIDs Space separated list of wanted tracks.
///\return The exit code of the connector.
int tsConnector(Socket::Connection conn, std::string streamName, std::string trackIDs){
std::string ToPack;
@ -35,13 +36,10 @@ namespace Connector_TS {
std::string DTMIData;
int PacketNumber = 0;
long long unsigned int TimeStamp = 0;
int ThisNaluSize;
unsigned int ThisNaluSize;
char VideoCounter = 0;
char AudioCounter = 0;
bool WritePesHeader;
bool IsKeyFrame;
bool FirstKeyFrame = true;
bool FirstIDRInKeyFrame;
bool IsKeyFrame = false;
MP4::AVCC avccbox;
bool haveAvcc = false;
@ -115,7 +113,7 @@ namespace Connector_TS {
ToPack.append(avccbox.asAnnexB());
while (Strm.lastData().size() > 4){
ThisNaluSize = (Strm.lastData()[0] << 24) + (Strm.lastData()[1] << 16) + (Strm.lastData()[2] << 8) + Strm.lastData()[3];
Strm.lastData().replace(0, 4, TS::NalHeader, 4);
Strm.lastData().replace(0, 4, "\000\000\000\001", 4);
if (ThisNaluSize + 4 == Strm.lastData().size()){
ToPack.append(Strm.lastData());
break;

View file

@ -147,7 +147,6 @@ namespace Controller {
std::ifstream loadavg("/proc/loadavg");
if (loadavg){
char line[300];
int bufcache = 0;
loadavg.getline(line, 300);
//parse lines here
float onemin, fivemin, fifteenmin;

View file

@ -115,7 +115,7 @@ namespace Controller {
if (!gotAll){continue;}
}
/// \TODO Check dependencies?
/// \todo Check dependencies?
new_connectors[counter] = (*ait).toString();
if (Util::Procs::isActive(toConn(counter))){

View file

@ -222,8 +222,6 @@ namespace Controller {
///\param in The requested configuration.
///\param out The new configuration after parsing.
void CheckStreams(JSON::Value & in, JSON::Value & out){
bool changed = false;
//check for new streams and updates
for (JSON::ObjIter jit = in.ObjBegin(); jit != in.ObjEnd(); jit++){
if (out.isMember(jit->first)){

View file

@ -17,7 +17,6 @@ namespace Converters{
//JSON::Value meta = DTSCFile.getMeta();
srand (Util::getMS());//randomising with milliseconds from boot
std::vector<unsigned int> curSegTable;
char* curNewPayload;
OGG::headerPages oggMeta;
//Creating ID headers for theora and vorbis
DTSC::readOnlyMeta fileMeta = DTSCFile.getMeta();
@ -38,7 +37,7 @@ namespace Converters{
std::map< long long int, std::vector<JSON::Value> > DTSCBuffer;
long long unsigned int prevGran;
long long int currID;
long long int currGran;
long long unsigned int currGran;
OGG::Page curOggPage;
@ -50,7 +49,7 @@ namespace Converters{
}else{
prevGran = 0;
}
if (prevGran != 0 && (prevGran == -1 || currGran != prevGran)){
if (prevGran != 0 && (currGran != prevGran)){
curOggPage.readDTSCVector(DTSCBuffer[currID], oggMeta.DTSCID2OGGSerial[currID], oggMeta.DTSCID2seqNum[currID]);
std::cout << std::string((char*)curOggPage.getPage(), curOggPage.getPageSize());
DTSCBuffer[currID].clear();

View file

@ -24,11 +24,10 @@ namespace Converters {
DTSC::Stream Strm;
int PacketNumber = 0;
long long unsigned int TimeStamp = 0;
int ThisNaluSize;
unsigned int ThisNaluSize;
char VideoCounter = 0;
char AudioCounter = 0;
bool WritePesHeader;
bool IsKeyFrame;
bool IsKeyFrame = false;
MP4::AVCC avccbox;
bool haveAvcc = false;
std::stringstream TSBuf;
@ -82,7 +81,7 @@ namespace Converters {
ToPack.append(avccbox.asAnnexB());
while (Strm.lastData().size()){
ThisNaluSize = (Strm.lastData()[0] << 24) + (Strm.lastData()[1] << 16) + (Strm.lastData()[2] << 8) + Strm.lastData()[3];
Strm.lastData().replace(0, 4, TS::NalHeader, 4);
Strm.lastData().replace(0, 4, "\000\000\000\001", 4);
if (ThisNaluSize + 4 == Strm.lastData().size()){
ToPack.append(Strm.lastData());
break;

View file

@ -30,8 +30,8 @@ namespace Converters{
std::string oggBuffer;
OGG::Page oggPage;
//Read all of std::cin to oggBuffer
double mspft;//microseconds per frame
double mspfv;//microseconds per frame vorbis
double mspft = 0;//microseconds per frame
double mspfv = 0;//microseconds per frame vorbis
JSON::Value DTSCOut;
JSON::Value DTSCHeader;
DTSCHeader.null();
@ -40,7 +40,6 @@ namespace Converters{
long long int lastTrackID = 1;
int headerSeen = 0;
bool headerWritten = false;//important bool, used for outputting the simple DTSC header.
bool allStreamsSeen = false; //other important bool used for error checking the EOS.
//while stream busy
while (std::cin.good()){
for (unsigned int i = 0; (i < 1024) && (std::cin.good()); i++){//buffering