Added mkv-exec input and output support
This commit is contained in:
parent
10b134d062
commit
a5bdaaaa5c
2 changed files with 64 additions and 1 deletions
|
@ -15,6 +15,8 @@ namespace Mist{
|
||||||
capa["source_match"].append("/*.mk3d");
|
capa["source_match"].append("/*.mk3d");
|
||||||
capa["source_match"].append("/*.mks");
|
capa["source_match"].append("/*.mks");
|
||||||
capa["source_match"].append("/*.webm");
|
capa["source_match"].append("/*.webm");
|
||||||
|
capa["source_match"].append("mkv-exec:*");
|
||||||
|
capa["always_match"].append("mkv-exec:*");
|
||||||
capa["source_file"] = "$source";
|
capa["source_file"] = "$source";
|
||||||
capa["priority"] = 9;
|
capa["priority"] = 9;
|
||||||
capa["codecs"].append("H264");
|
capa["codecs"].append("H264");
|
||||||
|
@ -92,11 +94,41 @@ namespace Mist{
|
||||||
|
|
||||||
bool InputEBML::needsLock(){
|
bool InputEBML::needsLock(){
|
||||||
// Standard input requires no lock, otherwise default behaviour.
|
// Standard input requires no lock, otherwise default behaviour.
|
||||||
if (config->getString("input") == "-"){return false;}
|
if (config->getString("input") == "-" || config->getString("input").substr(0, 9) == "mkv-exec:"){return false;}
|
||||||
return Input::needsLock();
|
return Input::needsLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputEBML::preRun(){
|
bool InputEBML::preRun(){
|
||||||
|
if (config->getString("input").substr(0, 9) == "mkv-exec:"){
|
||||||
|
standAlone = false;
|
||||||
|
std::string input = config->getString("input").substr(9);
|
||||||
|
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, fout = -1;
|
||||||
|
Util::Procs::StartPiped(args, &fin, &fout, 0);
|
||||||
|
if (fout == -1){return false;}
|
||||||
|
dup2(fout, 0);
|
||||||
|
inFile = stdin;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (config->getString("input") == "-"){
|
if (config->getString("input") == "-"){
|
||||||
inFile = stdin;
|
inFile = stdin;
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -15,6 +15,36 @@ namespace Mist{
|
||||||
seekSize = 0;
|
seekSize = 0;
|
||||||
doctype = "matroska";
|
doctype = "matroska";
|
||||||
if (config->getString("target").size()){
|
if (config->getString("target").size()){
|
||||||
|
if (config->getString("target").substr(0, 9) == "mkv-exec:"){
|
||||||
|
std::string input = config->getString("target").substr(9);
|
||||||
|
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.open(fin, -1);
|
||||||
|
|
||||||
|
wantRequest = false;
|
||||||
|
parseData = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (config->getString("target").find(".webm") != std::string::npos){doctype = "webm";}
|
if (config->getString("target").find(".webm") != std::string::npos){doctype = "webm";}
|
||||||
initialize();
|
initialize();
|
||||||
if (!M.getLive()){calcVodSizes();}
|
if (!M.getLive()){calcVodSizes();}
|
||||||
|
@ -96,6 +126,7 @@ namespace Mist{
|
||||||
capa["exceptions"]["codec:DTS"] = blacklistNonChrome;
|
capa["exceptions"]["codec:DTS"] = blacklistNonChrome;
|
||||||
capa["push_urls"].append("/*.mkv");
|
capa["push_urls"].append("/*.mkv");
|
||||||
capa["push_urls"].append("/*.webm");
|
capa["push_urls"].append("/*.webm");
|
||||||
|
capa["push_urls"].append("mkv-exec:*");
|
||||||
|
|
||||||
JSON::Value opt;
|
JSON::Value opt;
|
||||||
opt["arg"] = "string";
|
opt["arg"] = "string";
|
||||||
|
|
Loading…
Add table
Reference in a new issue