This commit is contained in:
Ramkoemar 2017-09-13 14:13:47 +02:00 committed by Thulinma
parent 08dc361e06
commit f77431d5a3
2 changed files with 34 additions and 1 deletions

View file

@ -3,10 +3,42 @@
#include <mist/http_parser.h> #include <mist/http_parser.h>
#include <mist/stream.h> #include <mist/stream.h>
#include <unistd.h> #include <unistd.h>
#include <mist/procs.h>
namespace Mist{ namespace Mist{
OutHTTPTS::OutHTTPTS(Socket::Connection & conn) : TSOutput(conn){ OutHTTPTS::OutHTTPTS(Socket::Connection & conn) : TSOutput(conn){
sendRepeatingHeaders = 500;//PAT/PMT every 500ms (DVB spec) sendRepeatingHeaders = 500;//PAT/PMT every 500ms (DVB spec)
if(config->getString("target").substr(0,10) == "ts-exec://"){
std::string input = config->getString("target").substr(10);
char *args[128];
uint8_t argCnt = 0;
char *startCh = 0;
for (char *i = (char *)input.c_str(); i <= input.data() + input.size(); ++i){
if (!*i){
if (startCh){args[argCnt++] = startCh;}
break;
}
if (*i == ' '){
if (startCh){
args[argCnt++] = startCh;
startCh = 0;
*i = 0;
}
}else{
if (!startCh){startCh = i;}
}
}
args[argCnt] = 0;
int fin = -1;
Util::Procs::StartPiped(args, &fin, 0, 0);
myConn = Socket::Connection(fin, -1);
wantRequest = false;
parseData = true;
INFO_MSG("ts exec stream");
}
} }
OutHTTPTS::~OutHTTPTS(){} OutHTTPTS::~OutHTTPTS(){}
@ -41,6 +73,7 @@ namespace Mist{
capa["methods"][0u]["type"] = "html5/video/mpeg"; capa["methods"][0u]["type"] = "html5/video/mpeg";
capa["methods"][0u]["priority"] = 1ll; capa["methods"][0u]["priority"] = 1ll;
capa["push_urls"].append("/*.ts"); capa["push_urls"].append("/*.ts");
capa["push_urls"].append("ts-exec://*");
JSON::Value opt; JSON::Value opt;
opt["arg"] = "string"; opt["arg"] = "string";

View file

@ -12,7 +12,7 @@ namespace Mist {
void initialSeek(); void initialSeek();
private: private:
bool isRecording(); bool isRecording();
bool isFileTarget(){return isRecording();} bool isFileTarget(){return isRecording() && config->getString("target").substr(0,10) != "ts-exec://" ;}
}; };
} }