Merge branch 'development' into LTS_development

# Conflicts:
#	lib/http_parser.cpp
This commit is contained in:
Thulinma 2020-03-03 12:28:04 +01:00
commit eb8694052d
17 changed files with 401 additions and 304 deletions

View file

@ -8,6 +8,7 @@
#include <mist/procs.h>
#include <mist/stream.h>
#include <mist/bitfields.h>
#include <mist/url.h>
#include "controller_statistics.h"
#include "controller_limits.h"
#include "controller_push.h"

View file

@ -2,6 +2,7 @@
#include <mist/stream.h>
#include <mist/http_parser.h>
#include <mist/encode.h>
#include <mist/url.h>
#include "input_balancer.h"
namespace Mist {

View file

@ -4,6 +4,7 @@
#include <mist/nal.h>
#include <mist/rtp.h>
#include <mist/sdp.h>
#include <mist/url.h>
#include <set>
#include <string>

View file

@ -1,5 +1,6 @@
#include "output_hls.h"
#include <mist/stream.h>
#include <mist/url.h>
#include <mist/langcodes.h> /*LTS*/
#include <unistd.h>

View file

@ -3,6 +3,7 @@
#include <mist/stream.h>
#include <mist/encode.h>
#include <mist/langcodes.h>
#include <mist/url.h>
#include "flashPlayer.h"
#include "oldFlashPlayer.h"
#include <mist/websocket.h>

View file

@ -4,6 +4,7 @@
#include <mist/stream.h>
#include <unistd.h>
#include <mist/procs.h>
#include <mist/url.h>
namespace Mist{
OutHTTPTS::OutHTTPTS(Socket::Connection & conn) : TSOutput(conn){

View file

@ -3,6 +3,7 @@
#include <mist/amf.h>
#include <mist/rtmpchunks.h>
#include <mist/http_parser.h>
#include <mist/url.h>
namespace Mist {

View file

@ -6,6 +6,7 @@
#include <mist/rtp.h>
#include <mist/sdp.h>
#include <mist/socket.h>
#include <mist/url.h>
namespace Mist{
class OutRTSP : public Output{

View file

@ -1,6 +1,7 @@
#include "output_ts.h"
#include <mist/http_parser.h>
#include <mist/defines.h>
#include <mist/url.h>
namespace Mist {
OutTS::OutTS(Socket::Connection & conn) : TSOutput(conn){

View file

@ -1,25 +1,89 @@
///\file sourcery.cpp
///Utility program used for c-string dumping files.
#undef DEBUG
#define DEBUG -1
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <string>
#include "../lib/url.h"
#include "../lib/url.cpp"
#include "../lib/encode.h"
#include "../lib/encode.cpp"
std::string getContents(const char * fileName){
std::ifstream inFile(fileName);
std::string fullText;
if (inFile){
std::ostringstream contents;
contents << inFile.rdbuf();
inFile.close();
return contents.str();
}
return "";
}
int main(int argc, char* argv[]){
if (argc < 4) {
std::cerr << "Usage: " << argv[0] << " <inputFile> <variableName> <outputFile>" << std::endl;
std::cerr << "Usage: " << argv[0] << " <inputFile> <variableName> <outputFile> [<splittext>]" << std::endl;
return 42;
}
const char * splitText = 0;
if (argc >= 5){splitText = argv[4];}
char workDir[512];
getcwd(workDir, 512);
HTTP::URL inUri(std::string("file://") + workDir + "/");
inUri = inUri.link(argv[1]);
//Read the entire first argument into a string buffer
std::string fullText = getContents(inUri.getFilePath().c_str());
//replace every <script src="*"></script> with the contents of the file '*'
while (fullText.find("<script src=\"") != std::string::npos){
size_t locStart = fullText.find("<script src=\"");
size_t locEnd = fullText.find("\"></script>", locStart);
//Assume we should abort if the strlen of the filename is > 230 chars
if (locEnd - locStart >= 230){break;}
HTTP::URL fileName = inUri.link(fullText.substr(locStart+13, locEnd-locStart-13));
std::string subText = getContents(fileName.getFilePath().c_str());
fullText = fullText.substr(0, locStart) + "<script>" + subText + fullText.substr(locEnd+2);
}
size_t splitPoint = std::string::npos;
size_t splitLen = 0;
if (splitText){
splitPoint = fullText.find(splitText);
if (splitPoint != std::string::npos){
splitLen = strlen(splitText);
}
}
std::ofstream tmp(argv[3]);
//begin the first line
tmp << "const char *" << argv[2] << " = " << std::endl << " \"";
if (!splitLen){
tmp << "const char *" << argv[2] << " = " << std::endl << " \"";
}else{
tmp << "const char *" << argv[2] << "_prefix = " << std::endl << " \"";
}
uint32_t i = 0; //Current line byte counter
uint32_t total = 0; //Finished lines so far byte counter
std::ifstream inFile(argv[1]);
bool sawQ = false;
while (inFile.good()){
unsigned char thisChar = inFile.get();
if (!inFile.good()){break;}
for (size_t pos = 0; pos < fullText.size(); ++pos){
if (pos == splitPoint){
tmp << "\";" << std::endl << "uint32_t " << argv[2] << "_prefix_len = " << i + total << ";" << std::endl;
tmp << "const char *" << argv[2] << "_suffix = " << std::endl << " \"";
i = 0;
total = 0;
sawQ = false;
pos += splitLen;
}
unsigned char thisChar = fullText.at(pos);
switch (thisChar){
//Filter special characters.
case '\n': tmp << "\\n"; break;
@ -51,7 +115,7 @@ int main(int argc, char* argv[]){
}
}
//end the last line, plus length variable
tmp << "\";" << std::endl << "uint32_t " << argv[2] << "_len = " << i + total << ";" << std::endl;
tmp << "\";" << std::endl << "uint32_t " << argv[2] << (splitLen?"_suffix":"") << "_len = " << i + total << ";" << std::endl;
tmp.close();
return 0;
}