Removed ALL the compile warnings!
This commit is contained in:
parent
d8113e7829
commit
05d23a0ac6
21 changed files with 1472 additions and 1018 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,6 +3,7 @@
|
||||||
*.la
|
*.la
|
||||||
*.lo
|
*.lo
|
||||||
*.swp
|
*.swp
|
||||||
|
*.bak
|
||||||
*~
|
*~
|
||||||
.deps
|
.deps
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
|
18
Makefile
18
Makefile
|
@ -2,7 +2,7 @@ prefix = /usr
|
||||||
exec_prefix = $(prefix)
|
exec_prefix = $(prefix)
|
||||||
bindir = $(prefix)/bin
|
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
|
DEBUG = 4
|
||||||
RELEASE = Generic_$(shell getconf LONG_BIT)
|
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.)
|
$(warning Version is unknown - consider creating a VERSION file or fixing your git setup.)
|
||||||
endif
|
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
|
LDLIBS = -lmist
|
||||||
|
|
||||||
|
|
||||||
.DEFAULT_GOAL ::= all
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
all: controller buffers connectors analysers converters
|
all: controller buffers connectors analysers converters
|
||||||
|
|
||||||
DOXYGEN ::= $(shell doxygen -v 2> /dev/null)
|
DOXYGEN := $(shell doxygen -v 2> /dev/null)
|
||||||
ifdef DOXYGEN
|
ifdef DOXYGEN
|
||||||
all: docs
|
all: docs
|
||||||
else
|
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
|
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
|
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
|
ifdef JAVA
|
||||||
CLOSURE=java -jar lsp/closure-compiler.jar --warning_level QUIET
|
CLOSURE=java -jar lsp/closure-compiler.jar --warning_level QUIET
|
||||||
else
|
else
|
||||||
|
@ -172,7 +172,7 @@ $(warning Java not installed - not compressing javascript codes before inclusion
|
||||||
CLOSURE=cat
|
CLOSURE=cat
|
||||||
endif
|
endif
|
||||||
|
|
||||||
XXD ::= $(shell which xxd 2> /dev/null)
|
XXD := $(shell which xxd 2> /dev/null)
|
||||||
ifndef XXD
|
ifndef XXD
|
||||||
$(error xxd not installed - cannot continue. Please install xxd)
|
$(error xxd not installed - cannot continue. Please install xxd)
|
||||||
endif
|
endif
|
||||||
|
@ -194,11 +194,12 @@ src/controller/server.html: $(lspDATA) $(lspSOURCES)
|
||||||
src/controller/server.html.h: src/controller/server.html
|
src/controller/server.html.h: src/controller/server.html
|
||||||
cd src/controller; xxd -i server.html server.html.h
|
cd src/controller; xxd -i server.html server.html.h
|
||||||
|
|
||||||
docs: src/*
|
docs: src/* Doxyfile
|
||||||
doxygen ./Doxyfile > /dev/null
|
doxygen ./Doxyfile > /dev/null
|
||||||
|
|
||||||
clean:
|
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: controller buffers connectors analysers converters
|
||||||
install ./Mist* $(DESTDIR)$(bindir)
|
install ./Mist* $(DESTDIR)$(bindir)
|
||||||
|
@ -207,3 +208,4 @@ uninstall:
|
||||||
rm -f $(DESTDIR)$(bindir)/Mist*
|
rm -f $(DESTDIR)$(bindir)/Mist*
|
||||||
|
|
||||||
.PHONY: clean uninstall
|
.PHONY: clean uninstall
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
///\brief Check if this is the IP address to accept push data from.
|
///\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.
|
///\return True if it is the correct address or password, false otherwise.
|
||||||
bool Stream::checkWaitingIP(std::string push_request){
|
bool Stream::checkWaitingIP(std::string push_request){
|
||||||
std::string ip = push_request.substr(0, push_request.find(' '));
|
std::string ip = push_request.substr(0, push_request.find(' '));
|
||||||
|
@ -180,7 +180,7 @@ namespace Buffer {
|
||||||
metadata.tracks.erase(trackId);
|
metadata.tracks.erase(trackId);
|
||||||
std::set<DTSC::livePos> toDelete;
|
std::set<DTSC::livePos> toDelete;
|
||||||
for (std::map<DTSC::livePos, JSON::Value >::iterator it = buffers.begin(); it != buffers.end(); it++){
|
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);
|
toDelete.insert(it->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ namespace Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes a user from the userlist.
|
/// 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){
|
void Stream::removeUser(user * oldUser){
|
||||||
tthread::lock_guard<tthread::recursive_mutex> guard(stats_mutex);
|
tthread::lock_guard<tthread::recursive_mutex> guard(stats_mutex);
|
||||||
users.erase(oldUser);
|
users.erase(oldUser);
|
||||||
|
@ -259,6 +259,7 @@ namespace Buffer {
|
||||||
///Creates a new user from a newly connected socket.
|
///Creates a new user from a newly connected socket.
|
||||||
///Also prints "User connected" text to stdout.
|
///Also prints "User connected" text to stdout.
|
||||||
///\param fd A connection to the user.
|
///\param fd A connection to the user.
|
||||||
|
///\param ID Unique ID of the user.
|
||||||
user::user(Socket::Connection fd, long long ID){
|
user::user(Socket::Connection fd, long long ID){
|
||||||
sID = JSON::Value(ID).asString();
|
sID = JSON::Value(ID).asString();
|
||||||
S = fd;
|
S = fd;
|
||||||
|
|
|
@ -173,7 +173,7 @@ int main(int argc, char** argv){
|
||||||
}
|
}
|
||||||
case 's': { //second-seek
|
case 's': { //second-seek
|
||||||
int ms = JSON::Value(in_out.Received().get().substr(2)).asInt();
|
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 = Util::epoch();
|
||||||
lastTime = 0;
|
lastTime = 0;
|
||||||
playUntil = 0;
|
playUntil = 0;
|
||||||
|
|
|
@ -44,8 +44,9 @@ namespace Connector_HTTP {
|
||||||
|
|
||||||
///\brief Builds a bootstrap for use in HTTP Dynamic streaming.
|
///\brief Builds a bootstrap for use in HTTP Dynamic streaming.
|
||||||
///\param streamName The name of the stream.
|
///\param streamName The name of the stream.
|
||||||
///\param metadata The current metadata, used to generate the index.
|
///\param trackMeta The current metadata of this track, used to generate the index.
|
||||||
///\param fragnum The index of the current fragment
|
///\param isLive Whether or not the stream is live.
|
||||||
|
///\param fragnum The index of the current fragment.
|
||||||
///\return The generated bootstrap.
|
///\return The generated bootstrap.
|
||||||
std::string dynamicBootstrap(std::string & streamName, DTSC::Track & trackMeta, bool isLive = false, int fragnum = 0){
|
std::string dynamicBootstrap(std::string & streamName, DTSC::Track & trackMeta, bool isLive = false, int fragnum = 0){
|
||||||
std::string empty;
|
std::string empty;
|
||||||
|
@ -153,7 +154,6 @@ namespace Connector_HTTP {
|
||||||
bool handlingRequest = false;
|
bool handlingRequest = false;
|
||||||
|
|
||||||
int Quality = 0;
|
int Quality = 0;
|
||||||
int Segment = -1;
|
|
||||||
int ReqFragment = -1;
|
int ReqFragment = -1;
|
||||||
long long mstime = 0;
|
long long mstime = 0;
|
||||||
long long mslen = 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());
|
Quality = atoi(tmp_qual.substr(0, tmp_qual.find("Seg") - 1).c_str());
|
||||||
int temp;
|
int temp;
|
||||||
temp = HTTP_R.url.find("Seg") + 3;
|
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;
|
temp = HTTP_R.url.find("Frag") + 4;
|
||||||
ReqFragment = atoi(HTTP_R.url.substr(temp).c_str());
|
ReqFragment = atoi(HTTP_R.url.substr(temp).c_str());
|
||||||
#if DEBUG >= 5
|
#if DEBUG >= 5
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///\file conn_http_progressive.cpp
|
///\file conn_http_json.cpp
|
||||||
///\brief Contains the main code for the HTTP Progressive Connector
|
///\brief Contains the main code for the HTTP JSON Connector
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
@ -29,7 +29,6 @@ namespace Connector_HTTP {
|
||||||
///\param conn A socket describing the connection the client.
|
///\param conn A socket describing the connection the client.
|
||||||
///\return The exit code of the connector.
|
///\return The exit code of the connector.
|
||||||
int JSONConnector(Socket::Connection conn){
|
int JSONConnector(Socket::Connection conn){
|
||||||
bool progressive_has_sent_header = false;//Indicates whether we have sent a header.
|
|
||||||
DTSC::Stream Strm; //Incoming stream buffer.
|
DTSC::Stream Strm; //Incoming stream buffer.
|
||||||
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
|
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
|
||||||
bool inited = false;//Whether the stream is initialized
|
bool inited = false;//Whether the stream is initialized
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
namespace Connector_HTTP {
|
namespace Connector_HTTP {
|
||||||
///\brief Builds an index file for HTTP Live streaming.
|
///\brief Builds an index file for HTTP Live streaming.
|
||||||
///\param metadata The current metadata, used to generate the index.
|
///\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.
|
///\return The index file for HTTP Live Streaming.
|
||||||
std::string liveIndex(DTSC::Meta & metadata, bool isLive){
|
std::string liveIndex(DTSC::Meta & metadata, bool isLive){
|
||||||
std::stringstream result;
|
std::stringstream result;
|
||||||
result << "#EXTM3U\r\n";
|
result << "#EXTM3U\r\n";
|
||||||
int audioId = -1;
|
int audioId = -1;
|
||||||
std::string audioName;
|
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++){
|
for (std::map<int,DTSC::Track>::iterator it = metadata.tracks.begin(); it != metadata.tracks.end(); it++){
|
||||||
if (it->second.codec == "AAC"){
|
if (it->second.codec == "AAC"){
|
||||||
audioId = it->first;
|
audioId = it->first;
|
||||||
|
@ -106,11 +106,11 @@ namespace Connector_HTTP {
|
||||||
TS::Packet PackData;
|
TS::Packet PackData;
|
||||||
int PacketNumber = 0;
|
int PacketNumber = 0;
|
||||||
long long unsigned int TimeStamp = 0;
|
long long unsigned int TimeStamp = 0;
|
||||||
int ThisNaluSize;
|
unsigned int ThisNaluSize;
|
||||||
char VideoCounter = 0;
|
char VideoCounter = 0;
|
||||||
char AudioCounter = 0;
|
char AudioCounter = 0;
|
||||||
long long unsigned int lastVid = 0;
|
long long unsigned int lastVid = 0;
|
||||||
bool IsKeyFrame;
|
bool IsKeyFrame = false;
|
||||||
MP4::AVCC avccbox;
|
MP4::AVCC avccbox;
|
||||||
bool haveAvcc = false;
|
bool haveAvcc = false;
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ namespace Connector_HTTP {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < allTracks.size(); i++){
|
for (unsigned int i = 0; i < allTracks.size(); i++){
|
||||||
if (allTracks[i] == '_'){
|
if (allTracks[i] == '_'){
|
||||||
allTracks[i] = ' ';
|
allTracks[i] = ' ';
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ namespace Connector_HTTP {
|
||||||
ToPack.append(avccbox.asAnnexB());
|
ToPack.append(avccbox.asAnnexB());
|
||||||
while (Strm.lastData().size() > 4){
|
while (Strm.lastData().size() > 4){
|
||||||
ThisNaluSize = (Strm.lastData()[0] << 24) + (Strm.lastData()[1] << 16) + (Strm.lastData()[2] << 8) + Strm.lastData()[3];
|
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()){
|
if (ThisNaluSize + 4 == Strm.lastData().size()){
|
||||||
ToPack.append(Strm.lastData());
|
ToPack.append(Strm.lastData());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///\file conn_http_progressive.cpp
|
///\file conn_http_progressive_flv.cpp
|
||||||
///\brief Contains the main code for the HTTP Progressive Connector
|
///\brief Contains the main code for the HTTP Progressive FLV Connector
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
@ -40,8 +40,6 @@ namespace Connector_HTTP {
|
||||||
unsigned int seek_sec = 0;//Seek position in ms
|
unsigned int seek_sec = 0;//Seek position in ms
|
||||||
unsigned int seek_byte = 0;//Seek position in bytes
|
unsigned int seek_byte = 0;//Seek position in bytes
|
||||||
|
|
||||||
bool isMP3 = false;//Indicates whether the request is audio-only mp3.
|
|
||||||
|
|
||||||
int videoID = -1;
|
int videoID = -1;
|
||||||
int audioID = -1;
|
int audioID = -1;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///\file conn_http_progressive.cpp
|
///\file conn_http_progressive_mp3.cpp
|
||||||
///\brief Contains the main code for the HTTP Progressive Connector
|
///\brief Contains the main code for the HTTP Progressive MP3 Connector
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///\file conn_http_progressive.cpp
|
///\file conn_http_progressive_mp4.cpp
|
||||||
///\brief Contains the main code for the HTTP Progressive Connector
|
///\brief Contains the main code for the HTTP Progressive MP4 Connector
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
@ -27,7 +27,6 @@ namespace Connector_HTTP {
|
||||||
///\param conn A socket describing the connection the client.
|
///\param conn A socket describing the connection the client.
|
||||||
///\return The exit code of the connector.
|
///\return The exit code of the connector.
|
||||||
int progressiveConnector(Socket::Connection conn){
|
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.
|
bool ready4data = false; //Set to true when streaming is to begin.
|
||||||
DTSC::Stream Strm; //Incoming stream buffer.
|
DTSC::Stream Strm; //Incoming stream buffer.
|
||||||
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
|
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
|
||||||
|
@ -40,8 +39,6 @@ namespace Connector_HTTP {
|
||||||
std::set<MP4::keyPart>::iterator keyPartIt;
|
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 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 videoID = -1;
|
||||||
int audioID = -1;
|
int audioID = -1;
|
||||||
|
@ -60,29 +57,7 @@ namespace Connector_HTTP {
|
||||||
size_t extDot = streamname.rfind('.');
|
size_t extDot = streamname.rfind('.');
|
||||||
if (extDot != std::string::npos){
|
if (extDot != std::string::npos){
|
||||||
streamname.resize(extDot);
|
streamname.resize(extDot);
|
||||||
}; //strip the extension
|
} //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.
|
|
||||||
}
|
|
||||||
ready4data = true;
|
ready4data = true;
|
||||||
HTTP_R.Clean(); //clean for any possible next requests
|
HTTP_R.Clean(); //clean for any possible next requests
|
||||||
}
|
}
|
||||||
|
@ -142,7 +117,6 @@ namespace Connector_HTTP {
|
||||||
byterate += Strm.metadata.tracks[audioID].bps;
|
byterate += Strm.metadata.tracks[audioID].bps;
|
||||||
}
|
}
|
||||||
if ( !byterate){byterate = 1;}
|
if ( !byterate){byterate = 1;}
|
||||||
seek_sec = (seek_byte / byterate) * 1000;
|
|
||||||
|
|
||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///\file conn_http_progressive.cpp
|
///\file conn_http_progressive_ogg.cpp
|
||||||
///\brief Contains the main code for the HTTP Progressive Connector
|
///\brief Contains the main code for the HTTP Progressive OGG Connector
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
@ -46,10 +46,6 @@ namespace Connector_HTTP {
|
||||||
long long int currGran = 0;
|
long long int currGran = 0;
|
||||||
long long int prevGran = 0;
|
long long int prevGran = 0;
|
||||||
std::string sendBuffer;
|
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 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_sec = 0;//Seek position in ms
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace Connector_HTTP {
|
||||||
"Index=\"" << index << "\" "
|
"Index=\"" << index << "\" "
|
||||||
"Bitrate=\"" << (*it)->second.bps * 8 << "\" "
|
"Bitrate=\"" << (*it)->second.bps * 8 << "\" "
|
||||||
"CodecPrivateData=\"" << std::hex;
|
"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::setfill('0') << std::setw(2) << std::right << (int)(*it)->second.init[i];
|
||||||
}
|
}
|
||||||
Result << std::dec << "\" "
|
Result << std::dec << "\" "
|
||||||
|
@ -160,7 +160,7 @@ namespace Connector_HTTP {
|
||||||
MP4::AVCC avccbox;
|
MP4::AVCC avccbox;
|
||||||
avccbox.setPayload((*it)->second.init);
|
avccbox.setPayload((*it)->second.init);
|
||||||
std::string tmpString = avccbox.asAnnexB();
|
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::setfill('0') << std::setw(2) << std::right << (int)tmpString[i];
|
||||||
}
|
}
|
||||||
Result << std::dec << "\" "
|
Result << std::dec << "\" "
|
||||||
|
@ -197,7 +197,6 @@ namespace Connector_HTTP {
|
||||||
///\return The exit code of the connector.
|
///\return The exit code of the connector.
|
||||||
int smoothConnector(Socket::Connection conn){
|
int smoothConnector(Socket::Connection conn){
|
||||||
std::deque<std::string> dataBuffer;//A buffer for the data that needs to be sent to the client.
|
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.
|
DTSC::Stream Strm;//Incoming stream buffer.
|
||||||
HTTP::Parser HTTP_R;//HTTP Receiver
|
HTTP::Parser HTTP_R;//HTTP Receiver
|
||||||
|
@ -308,11 +307,9 @@ namespace Connector_HTTP {
|
||||||
std::stringstream sstream;
|
std::stringstream sstream;
|
||||||
|
|
||||||
long long mstime = 0;
|
long long mstime = 0;
|
||||||
long long mslen = 0;
|
|
||||||
for (std::deque<DTSC::Key>::iterator it = myRef.keys.begin(); it != myRef.keys.end(); it++){
|
for (std::deque<DTSC::Key>::iterator it = myRef.keys.begin(); it != myRef.keys.end(); it++){
|
||||||
if (it->getTime() >= (requestedTime / 10000)){
|
if (it->getTime() >= (requestedTime / 10000)){
|
||||||
mstime = it->getTime();
|
mstime = it->getTime();
|
||||||
mslen = it->getLength();
|
|
||||||
if (Strm.metadata.live){
|
if (Strm.metadata.live){
|
||||||
if (it == myRef.keys.end() - 2){
|
if (it == myRef.keys.end() - 2){
|
||||||
HTTP_S.Clean();
|
HTTP_S.Clean();
|
||||||
|
@ -347,7 +344,6 @@ namespace Connector_HTTP {
|
||||||
trackRef = it->second;
|
trackRef = it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static long long int seqNum = 1;
|
|
||||||
//Also obtain the associated keyframe;
|
//Also obtain the associated keyframe;
|
||||||
DTSC::Key keyObj;
|
DTSC::Key keyObj;
|
||||||
int partOffset = 0;
|
int partOffset = 0;
|
||||||
|
@ -376,12 +372,10 @@ namespace Connector_HTTP {
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.SendNow(sstream.str().c_str());
|
ss.SendNow(sstream.str().c_str());
|
||||||
unsigned int myDuration;
|
|
||||||
|
|
||||||
//Wrap everything in mp4 boxes
|
//Wrap everything in mp4 boxes
|
||||||
MP4::MFHD mfhd_box;
|
MP4::MFHD mfhd_box;
|
||||||
mfhd_box.setSequenceNumber(((keyObj.getNumber() - 1) * 2) + myRef.trackID);
|
mfhd_box.setSequenceNumber(((keyObj.getNumber() - 1) * 2) + myRef.trackID);
|
||||||
myDuration = keyObj.getLength() * 10000;
|
|
||||||
|
|
||||||
MP4::TFHD tfhd_box;
|
MP4::TFHD tfhd_box;
|
||||||
tfhd_box.setFlags(MP4::tfhdSampleFlag);
|
tfhd_box.setFlags(MP4::tfhdSampleFlag);
|
||||||
|
@ -437,7 +431,7 @@ namespace Connector_HTTP {
|
||||||
fragref_box.setVersion(1);
|
fragref_box.setVersion(1);
|
||||||
fragref_box.setFragmentCount(0);
|
fragref_box.setFragmentCount(0);
|
||||||
int fragCount = 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)){
|
if (trackRef.keys[i].getTime() > (requestedTime / 10000)){
|
||||||
fragref_box.setTime(fragCount, trackRef.keys[i].getTime() * 10000);
|
fragref_box.setTime(fragCount, trackRef.keys[i].getTime() * 10000);
|
||||||
fragref_box.setDuration(fragCount, trackRef.keys[i].getLength() * 10000);
|
fragref_box.setDuration(fragCount, trackRef.keys[i].getLength() * 10000);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///\file conn_http_progressive.cpp
|
///\file conn_http_srt.cpp
|
||||||
///\brief Contains the main code for the HTTP Progressive Connector
|
///\brief Contains the main code for the HTTP SRT Connector
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
@ -29,7 +29,6 @@ namespace Connector_HTTP {
|
||||||
///\param conn A socket describing the connection the client.
|
///\param conn A socket describing the connection the client.
|
||||||
///\return The exit code of the connector.
|
///\return The exit code of the connector.
|
||||||
int SRTConnector(Socket::Connection conn){
|
int SRTConnector(Socket::Connection conn){
|
||||||
bool progressive_has_sent_header = false;//Indicates whether we have sent a header.
|
|
||||||
DTSC::Stream Strm; //Incoming stream buffer.
|
DTSC::Stream Strm; //Incoming stream buffer.
|
||||||
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
|
HTTP::Parser HTTP_R, HTTP_S;//HTTP Receiver en HTTP Sender.
|
||||||
bool inited = false;//Whether the stream is initialized
|
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 lastStats = 0;//Indicates the last time that we have sent stats to the server socket.
|
||||||
unsigned int seek_time = 0;//Seek position in ms
|
unsigned int seek_time = 0;//Seek position in ms
|
||||||
int trackID = -1; // the track to be selected
|
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 subtitleTrack = false; // check whether the requested track is a srt track
|
||||||
bool isWebVTT = false;
|
bool isWebVTT = false;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace Connector_TS {
|
||||||
///\brief Main function for the TS Connector
|
///\brief Main function for the TS Connector
|
||||||
///\param conn A socket describing the connection the client.
|
///\param conn A socket describing the connection the client.
|
||||||
///\param streamName The stream to connect to.
|
///\param streamName The stream to connect to.
|
||||||
|
///\param trackIDs Space separated list of wanted tracks.
|
||||||
///\return The exit code of the connector.
|
///\return The exit code of the connector.
|
||||||
int tsConnector(Socket::Connection conn, std::string streamName, std::string trackIDs){
|
int tsConnector(Socket::Connection conn, std::string streamName, std::string trackIDs){
|
||||||
std::string ToPack;
|
std::string ToPack;
|
||||||
|
@ -35,13 +36,10 @@ namespace Connector_TS {
|
||||||
std::string DTMIData;
|
std::string DTMIData;
|
||||||
int PacketNumber = 0;
|
int PacketNumber = 0;
|
||||||
long long unsigned int TimeStamp = 0;
|
long long unsigned int TimeStamp = 0;
|
||||||
int ThisNaluSize;
|
unsigned int ThisNaluSize;
|
||||||
char VideoCounter = 0;
|
char VideoCounter = 0;
|
||||||
char AudioCounter = 0;
|
char AudioCounter = 0;
|
||||||
bool WritePesHeader;
|
bool IsKeyFrame = false;
|
||||||
bool IsKeyFrame;
|
|
||||||
bool FirstKeyFrame = true;
|
|
||||||
bool FirstIDRInKeyFrame;
|
|
||||||
MP4::AVCC avccbox;
|
MP4::AVCC avccbox;
|
||||||
bool haveAvcc = false;
|
bool haveAvcc = false;
|
||||||
|
|
||||||
|
@ -115,7 +113,7 @@ namespace Connector_TS {
|
||||||
ToPack.append(avccbox.asAnnexB());
|
ToPack.append(avccbox.asAnnexB());
|
||||||
while (Strm.lastData().size() > 4){
|
while (Strm.lastData().size() > 4){
|
||||||
ThisNaluSize = (Strm.lastData()[0] << 24) + (Strm.lastData()[1] << 16) + (Strm.lastData()[2] << 8) + Strm.lastData()[3];
|
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()){
|
if (ThisNaluSize + 4 == Strm.lastData().size()){
|
||||||
ToPack.append(Strm.lastData());
|
ToPack.append(Strm.lastData());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -147,7 +147,6 @@ namespace Controller {
|
||||||
std::ifstream loadavg("/proc/loadavg");
|
std::ifstream loadavg("/proc/loadavg");
|
||||||
if (loadavg){
|
if (loadavg){
|
||||||
char line[300];
|
char line[300];
|
||||||
int bufcache = 0;
|
|
||||||
loadavg.getline(line, 300);
|
loadavg.getline(line, 300);
|
||||||
//parse lines here
|
//parse lines here
|
||||||
float onemin, fivemin, fifteenmin;
|
float onemin, fivemin, fifteenmin;
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace Controller {
|
||||||
if (!gotAll){continue;}
|
if (!gotAll){continue;}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \TODO Check dependencies?
|
/// \todo Check dependencies?
|
||||||
|
|
||||||
new_connectors[counter] = (*ait).toString();
|
new_connectors[counter] = (*ait).toString();
|
||||||
if (Util::Procs::isActive(toConn(counter))){
|
if (Util::Procs::isActive(toConn(counter))){
|
||||||
|
|
|
@ -222,8 +222,6 @@ namespace Controller {
|
||||||
///\param in The requested configuration.
|
///\param in The requested configuration.
|
||||||
///\param out The new configuration after parsing.
|
///\param out The new configuration after parsing.
|
||||||
void CheckStreams(JSON::Value & in, JSON::Value & out){
|
void CheckStreams(JSON::Value & in, JSON::Value & out){
|
||||||
bool changed = false;
|
|
||||||
|
|
||||||
//check for new streams and updates
|
//check for new streams and updates
|
||||||
for (JSON::ObjIter jit = in.ObjBegin(); jit != in.ObjEnd(); jit++){
|
for (JSON::ObjIter jit = in.ObjBegin(); jit != in.ObjEnd(); jit++){
|
||||||
if (out.isMember(jit->first)){
|
if (out.isMember(jit->first)){
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace Converters{
|
||||||
//JSON::Value meta = DTSCFile.getMeta();
|
//JSON::Value meta = DTSCFile.getMeta();
|
||||||
srand (Util::getMS());//randomising with milliseconds from boot
|
srand (Util::getMS());//randomising with milliseconds from boot
|
||||||
std::vector<unsigned int> curSegTable;
|
std::vector<unsigned int> curSegTable;
|
||||||
char* curNewPayload;
|
|
||||||
OGG::headerPages oggMeta;
|
OGG::headerPages oggMeta;
|
||||||
//Creating ID headers for theora and vorbis
|
//Creating ID headers for theora and vorbis
|
||||||
DTSC::readOnlyMeta fileMeta = DTSCFile.getMeta();
|
DTSC::readOnlyMeta fileMeta = DTSCFile.getMeta();
|
||||||
|
@ -38,7 +37,7 @@ namespace Converters{
|
||||||
std::map< long long int, std::vector<JSON::Value> > DTSCBuffer;
|
std::map< long long int, std::vector<JSON::Value> > DTSCBuffer;
|
||||||
long long unsigned int prevGran;
|
long long unsigned int prevGran;
|
||||||
long long int currID;
|
long long int currID;
|
||||||
long long int currGran;
|
long long unsigned int currGran;
|
||||||
OGG::Page curOggPage;
|
OGG::Page curOggPage;
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +49,7 @@ namespace Converters{
|
||||||
}else{
|
}else{
|
||||||
prevGran = 0;
|
prevGran = 0;
|
||||||
}
|
}
|
||||||
if (prevGran != 0 && (prevGran == -1 || currGran != prevGran)){
|
if (prevGran != 0 && (currGran != prevGran)){
|
||||||
curOggPage.readDTSCVector(DTSCBuffer[currID], oggMeta.DTSCID2OGGSerial[currID], oggMeta.DTSCID2seqNum[currID]);
|
curOggPage.readDTSCVector(DTSCBuffer[currID], oggMeta.DTSCID2OGGSerial[currID], oggMeta.DTSCID2seqNum[currID]);
|
||||||
std::cout << std::string((char*)curOggPage.getPage(), curOggPage.getPageSize());
|
std::cout << std::string((char*)curOggPage.getPage(), curOggPage.getPageSize());
|
||||||
DTSCBuffer[currID].clear();
|
DTSCBuffer[currID].clear();
|
||||||
|
|
|
@ -24,11 +24,10 @@ namespace Converters {
|
||||||
DTSC::Stream Strm;
|
DTSC::Stream Strm;
|
||||||
int PacketNumber = 0;
|
int PacketNumber = 0;
|
||||||
long long unsigned int TimeStamp = 0;
|
long long unsigned int TimeStamp = 0;
|
||||||
int ThisNaluSize;
|
unsigned int ThisNaluSize;
|
||||||
char VideoCounter = 0;
|
char VideoCounter = 0;
|
||||||
char AudioCounter = 0;
|
char AudioCounter = 0;
|
||||||
bool WritePesHeader;
|
bool IsKeyFrame = false;
|
||||||
bool IsKeyFrame;
|
|
||||||
MP4::AVCC avccbox;
|
MP4::AVCC avccbox;
|
||||||
bool haveAvcc = false;
|
bool haveAvcc = false;
|
||||||
std::stringstream TSBuf;
|
std::stringstream TSBuf;
|
||||||
|
@ -82,7 +81,7 @@ namespace Converters {
|
||||||
ToPack.append(avccbox.asAnnexB());
|
ToPack.append(avccbox.asAnnexB());
|
||||||
while (Strm.lastData().size()){
|
while (Strm.lastData().size()){
|
||||||
ThisNaluSize = (Strm.lastData()[0] << 24) + (Strm.lastData()[1] << 16) + (Strm.lastData()[2] << 8) + Strm.lastData()[3];
|
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()){
|
if (ThisNaluSize + 4 == Strm.lastData().size()){
|
||||||
ToPack.append(Strm.lastData());
|
ToPack.append(Strm.lastData());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace Converters{
|
||||||
std::string oggBuffer;
|
std::string oggBuffer;
|
||||||
OGG::Page oggPage;
|
OGG::Page oggPage;
|
||||||
//Read all of std::cin to oggBuffer
|
//Read all of std::cin to oggBuffer
|
||||||
double mspft;//microseconds per frame
|
double mspft = 0;//microseconds per frame
|
||||||
double mspfv;//microseconds per frame vorbis
|
double mspfv = 0;//microseconds per frame vorbis
|
||||||
JSON::Value DTSCOut;
|
JSON::Value DTSCOut;
|
||||||
JSON::Value DTSCHeader;
|
JSON::Value DTSCHeader;
|
||||||
DTSCHeader.null();
|
DTSCHeader.null();
|
||||||
|
@ -40,7 +40,6 @@ namespace Converters{
|
||||||
long long int lastTrackID = 1;
|
long long int lastTrackID = 1;
|
||||||
int headerSeen = 0;
|
int headerSeen = 0;
|
||||||
bool headerWritten = false;//important bool, used for outputting the simple DTSC header.
|
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 stream busy
|
||||||
while (std::cin.good()){
|
while (std::cin.good()){
|
||||||
for (unsigned int i = 0; (i < 1024) && (std::cin.good()); i++){//buffering
|
for (unsigned int i = 0; (i < 1024) && (std::cin.good()); i++){//buffering
|
||||||
|
|
Loading…
Add table
Reference in a new issue