Added ability to mask source tracks for processes

This commit is contained in:
Thulinma 2020-06-05 22:27:05 +02:00
parent 3db3a869ae
commit 36a1a88cb0
8 changed files with 58 additions and 9 deletions

View file

@ -17,6 +17,7 @@ void handleUSR1(int signum, siginfo_t *sigInfo, void *ignore){
}
int main(int argc, char *argv[]){
DTSC::trackValidMask = TRACK_VALID_EXT_HUMAN;
Util::redirectLogsIfNeeded();
Util::Config conf(argv[0]);
mistOut::init(&conf);

View file

@ -103,6 +103,9 @@ namespace Mist{
realTime = 0;
}
}
if (isRecording() && DTSC::trackValidMask == TRACK_VALID_EXT_HUMAN){
DTSC::trackValidMask = TRACK_VALID_EXT_PUSH;
}
/*LTS-END*/
}

View file

@ -41,6 +41,7 @@ void sourceThread(void *){
}
int main(int argc, char *argv[]){
DTSC::trackValidMask = TRACK_VALID_INT_PROCESS;
Util::Config config(argv[0]);
JSON::Value capa;
@ -85,6 +86,12 @@ int main(int argc, char *argv[]){
capa["name"] = "MKVExec";
capa["desc"] = "Pipe MKV in, expect MKV out. You choose the executable in between yourself.";
capa["optional"]["masksource"]["name"] = "Make source track(s) unavailable for users";
capa["optional"]["masksource"]["help"] = "If enabled, makes the source track(s) internal-only, so that external users and pushes cannot access them.";
capa["optional"]["masksource"]["type"] = "boolean";
capa["optional"]["masksource"]["default"] = false;
capa["required"]["exec"]["name"] = "Executable";
capa["required"]["exec"]["help"] = "What to executable to run on the stream data";
capa["required"]["exec"]["type"] = "string";

View file

@ -60,6 +60,13 @@ namespace Mist{
realTime = 0;
};
void sendHeader(){
if (opt["masksource"].asBool()){
for (std::map<size_t, Comms::Users>::iterator ti = userSelect.begin(); ti != userSelect.end(); ++ti){
if (ti->first == INVALID_TRACK_ID){continue;}
INFO_MSG("Masking source track %zu", ti->first);
meta.validateTrack(ti->first, meta.trackValid(ti->first) & ~(TRACK_VALID_EXT_HUMAN | TRACK_VALID_EXT_PUSH));
}
}
realTime = 0;
OutEBML::sendHeader();
};

View file

@ -69,6 +69,7 @@ void sourceThread(void *){
}
int main(int argc, char *argv[]){
DTSC::trackValidMask = TRACK_VALID_INT_PROCESS;
Util::Config config(argv[0]);
JSON::Value capa;
@ -96,6 +97,12 @@ int main(int argc, char *argv[]){
capa["desc"] = "Use a local FFMPEG installed binary to do encoding"; // description
capa["sort"] = "n"; // sort the parameters by this key
capa["optional"]["masksource"]["name"] = "Make source track unavailable for users";
capa["optional"]["masksource"]["help"] = "If enabled, makes the source track internal-only, so that external users and pushes cannot access it.";
capa["optional"]["masksource"]["type"] = "boolean";
capa["optional"]["masksource"]["default"] = false;
capa["required"]["x-LSP-kind"]["name"] = "Input type"; // human readable name of option
capa["required"]["x-LSP-kind"]["help"] = "The type of input to use"; // extra information
capa["required"]["x-LSP-kind"]["type"] = "select"; // type of input field to use
@ -404,6 +411,10 @@ namespace Mist{
void EncodeOutputEBML::sendHeader(){
realTime = 0;
size_t idx = getMainSelectedTrack();
if (opt["masksource"].asBool()){
INFO_MSG("Masking source track %zu", idx);
meta.validateTrack(idx, meta.trackValid(idx) & ~(TRACK_VALID_EXT_HUMAN | TRACK_VALID_EXT_PUSH));
}
res_x = M.getWidth(idx);
res_y = M.getHeight(idx);
Enc.setResolution(res_x, res_y);

View file

@ -58,6 +58,11 @@ namespace Mist{
};
virtual void initialSeek(){
if (!meta){return;}
if (opt["masksource"].asBool()){
size_t mainTrack = getMainSelectedTrack();
INFO_MSG("Masking source track %zu", mainTrack);
meta.validateTrack(mainTrack, meta.trackValid(mainTrack) & ~(TRACK_VALID_EXT_HUMAN | TRACK_VALID_EXT_PUSH));
}
if (!meta.getLive() || opt["leastlive"].asBool()){
INFO_MSG("Seeking to earliest point in stream");
seek(0);
@ -407,6 +412,7 @@ void sourceThread(void *){
}
int main(int argc, char *argv[]){
DTSC::trackValidMask = TRACK_VALID_INT_PROCESS;
Util::Config config(argv[0]);
JSON::Value capa;
@ -433,6 +439,11 @@ int main(int argc, char *argv[]){
capa["name"] = "Livepeer";
capa["desc"] = "Use livepeer to transcode video.";
capa["optional"]["masksource"]["name"] = "Make source track unavailable for users";
capa["optional"]["masksource"]["help"] = "If enabled, makes the source track internal-only, so that external users and pushes cannot access it.";
capa["optional"]["masksource"]["type"] = "boolean";
capa["optional"]["masksource"]["default"] = false;
capa["optional"]["sink"]["name"] = "Target stream";
capa["optional"]["sink"]["help"] = "What stream the encoded track should be added to. Defaults "
"to source stream. May contain variables.";