Merge branch 'development' into LTS_development
# Conflicts: # lib/http_parser.cpp
This commit is contained in:
commit
eb8694052d
17 changed files with 401 additions and 304 deletions
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <mist/nal.h>
|
||||
#include <mist/rtp.h>
|
||||
#include <mist/sdp.h>
|
||||
#include <mist/url.h>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "output_hls.h"
|
||||
#include <mist/stream.h>
|
||||
#include <mist/url.h>
|
||||
#include <mist/langcodes.h> /*LTS*/
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <mist/amf.h>
|
||||
#include <mist/rtmpchunks.h>
|
||||
#include <mist/http_parser.h>
|
||||
#include <mist/url.h>
|
||||
|
||||
|
||||
namespace Mist {
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue