Removed compiled warnings etc from ogg optimizes.

This commit is contained in:
Thulinma 2014-01-13 16:00:09 +01:00
parent d8b7a3ea1c
commit 211eb38613
4 changed files with 4 additions and 51 deletions

View file

@ -65,7 +65,7 @@ MistConnHTTPProgressiveMP4: src/connectors/conn_http_progressive_mp4.cpp
$(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@ $(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@
connectors: MistConnHTTPProgressiveOGG connectors: MistConnHTTPProgressiveOGG
MistConnHTTPProgressiveOGG: src/connectors/conn_http_progressive_ogg.cpp MistConnHTTPProgressiveOGG: src/connectors/conn_http_progressive_ogg.cpp src/converters/oggconv.cpp
$(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@ $(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@
connectors: MistConnHTTPDynamic connectors: MistConnHTTPDynamic
@ -133,7 +133,7 @@ MistOGG2DTSC: src/converters/ogg2dtsc.cpp
$(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@ $(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@
converters: MistDTSC2OGG converters: MistDTSC2OGG
MistDTSC2OGG: src/converters/dtsc2ogg.cpp MistDTSC2OGG: src/converters/dtsc2ogg.cpp src/converters/oggconv.cpp
$(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@ $(CXX) $(LDFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@
converters: MistDTSCFix converters: MistDTSCFix

View file

@ -45,13 +45,9 @@ namespace Connector_HTTP {
//std::map <long long unsigned int, long long unsigned int> prevGran; //std::map <long long unsigned int, long long unsigned int> prevGran;
std::vector<unsigned int> curSegTable; std::vector<unsigned int> curSegTable;
long long int currID = 0; long long int currID = 0;
long long int currGran = 0;
long long int prevGran = 0;
std::string sendBuffer; std::string sendBuffer;
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;
@ -66,28 +62,6 @@ namespace Connector_HTTP {
#endif #endif
conn.setHost(HTTP_R.GetHeader("X-Origin")); conn.setHost(HTTP_R.GetHeader("X-Origin"));
streamname = HTTP_R.GetHeader("X-Stream"); streamname = HTTP_R.GetHeader("X-Stream");
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
} }
@ -109,7 +83,6 @@ namespace Connector_HTTP {
continue; continue;
} }
Strm.waitForMeta(ss); Strm.waitForMeta(ss);
int byterate = 0;
for (std::map<int,DTSC::Track>::iterator it = Strm.metadata.tracks.begin(); it != Strm.metadata.tracks.end(); it++){ for (std::map<int,DTSC::Track>::iterator it = Strm.metadata.tracks.begin(); it != Strm.metadata.tracks.end(); it++){
if (videoID == -1 && it->second.codec == "theora"){ if (videoID == -1 && it->second.codec == "theora"){
videoID = it->second.trackID; videoID = it->second.trackID;
@ -118,16 +91,6 @@ namespace Connector_HTTP {
audioID = it->second.trackID; audioID = it->second.trackID;
} }
} }
if (videoID != -1){
byterate += Strm.metadata.tracks[videoID].bps;
}
if (audioID != -1){
byterate += Strm.metadata.tracks[audioID].bps;
}
if ( !byterate){byterate = 1;}
if (seek_byte){
seek_sec = (seek_byte / byterate) * 1000;
}
if (videoID == -1 && audioID == -1){ if (videoID == -1 && audioID == -1){
HTTP_S.Clean(); //make sure no parts of old requests are left in any buffers HTTP_S.Clean(); //make sure no parts of old requests are left in any buffers
HTTP_S.SetBody("This stream contains no OGG compatible codecs"); HTTP_S.SetBody("This stream contains no OGG compatible codecs");

View file

@ -17,7 +17,6 @@ namespace Converters{
DTSC::File DTSCFile(conf.getString("filename")); DTSC::File DTSCFile(conf.getString("filename"));
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::converter oggMeta; OGG::converter 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();
@ -29,20 +28,12 @@ namespace Converters{
//create DTSC in OGG pages //create DTSC in OGG pages
DTSCFile.parseNext(); DTSCFile.parseNext();
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 int currID; long long int currID;
long long unsigned int currGran;
OGG::Page curOggPage; OGG::Page curOggPage;
while(DTSCFile.getJSON()){ while(DTSCFile.getJSON()){
currID = DTSCFile.getJSON()["trackid"].asInt(); currID = DTSCFile.getJSON()["trackid"].asInt();
currGran = DTSCFile.getJSON()["granule"].asInt();
if (DTSCBuffer.count(currID) && !DTSCBuffer[currID].empty()){
prevGran = DTSCBuffer[currID][0]["granule"].asInt();
}else{
prevGran = 0;
}
if (!DTSCBuffer[currID].empty()){ if (!DTSCBuffer[currID].empty()){
std::cout << oggMeta.readDTSCVector(DTSCBuffer[currID]); std::cout << oggMeta.readDTSCVector(DTSCBuffer[currID]);
DTSCBuffer[currID].clear(); DTSCBuffer[currID].clear();

View file

@ -92,7 +92,7 @@ namespace OGG{
for (unsigned int i = 0; i < DTSCVec.size(); i++){ for (unsigned int i = 0; i < DTSCVec.size(); i++){
OGG::Page tempPage; OGG::Page tempPage;
tempPage.setSegmentTable(curSegTable); tempPage.setSegmentTable(curSegTable);
if (DTSCVec[i]["data"].asString().size() >= (255-tempPage.getPageSegments())*255){//if segment is too big if (DTSCVec[i]["data"].asString().size() >= (255-tempPage.getPageSegments())*255u){//if segment is too big
//Put page in Buffer and start next page //Put page in Buffer and start next page
if (!curSegTable.empty()){ if (!curSegTable.empty()){
//output page //output page
@ -112,13 +112,12 @@ namespace OGG{
dataBuffer = ""; dataBuffer = "";
} }
std::string remainingData = DTSCVec[i]["data"].asString(); std::string remainingData = DTSCVec[i]["data"].asString();
bool firstLoop;
typeFlag = 0; typeFlag = 0;
while (remainingData.size() > 255*255){ while (remainingData.size() > 255*255){
//output part of the segment //output part of the segment
//granule -1 //granule -1
curSegTable.clear(); curSegTable.clear();
curSegTable.push_back(255*255);///\TODO optimise this curSegTable.push_back(255*255);
retVal.clear(); retVal.clear();
retVal.setVersion(); retVal.setVersion();
retVal.setHeaderType(typeFlag);//normal Page retVal.setHeaderType(typeFlag);//normal Page