Merge branch 'development' into LTS_development
# Conflicts: # lib/stream.cpp # lib/stream.h # src/input/input.cpp # src/output/output_http_internal.cpp
This commit is contained in:
commit
bef46f969c
8 changed files with 74 additions and 97 deletions
|
@ -122,22 +122,11 @@ bool Util::streamAlive(std::string & streamname){
|
|||
}
|
||||
|
||||
/// Assures the input for the given stream name is active.
|
||||
/// Does stream name sanitizion first, followed by a stream name length check (<= 100 chars).
|
||||
/// Then, checks if an input is already active by running streamAlive(). If yes, aborts.
|
||||
/// If no, loads up the server configuration and attempts to start the given stream according to current config.
|
||||
/// Does stream name sanitation first, followed by a stream name length check (<= 100 chars).
|
||||
/// Then, checks if an input is already active by running streamAlive(). If yes, return true.
|
||||
/// If no, loads up the server configuration and attempts to start the given stream according to current configuration.
|
||||
/// At this point, fails and aborts if MistController isn't running.
|
||||
/// \triggers
|
||||
/// The `"STREAM_LOAD"` trigger is stream-specific, and is ran right before launching an input for an inactive stream. If cancelled, the input is not launched. Its payload is:
|
||||
/// ~~~~~~~~~~~~~~~
|
||||
/// streamname
|
||||
/// ~~~~~~~~~~~~~~~
|
||||
/// The `"STREAM_SOURCE"` trigger is stream-specific, and is ran right before launching an input for an inactive stream. It cannot be cancelled, but an invalid source can be returned; which is effectively equivalent to cancelling.
|
||||
/// This trigger is special: the response is used as source override for this stream, and not handled as normal. If used, the handler for this trigger MUST return a valid source to allow the stream input to load up at all. If used multiple times, the last defined handler overrides any and all previous handlers.
|
||||
/// Its payload is:
|
||||
/// ~~~~~~~~~~~~~~~
|
||||
/// streamname
|
||||
/// ~~~~~~~~~~~~~~~
|
||||
bool Util::startInput(std::string streamname, std::string filename, bool forkFirst) {
|
||||
bool Util::startInput(std::string streamname, std::string filename, bool forkFirst, bool isProvider) {
|
||||
sanitizeName(streamname);
|
||||
if (streamname.size() > 100){
|
||||
FAIL_MSG("Stream opening denied: %s is longer than 100 characters (%lu).", streamname.c_str(), streamname.size());
|
||||
|
@ -214,6 +203,7 @@ bool Util::startInput(std::string streamname, std::string filename, bool forkFir
|
|||
DTSC::Scan inputs = config.getMember("capabilities").getMember("inputs");
|
||||
DTSC::Scan input;
|
||||
unsigned int input_size = inputs.getSize();
|
||||
bool noProviderNoPick = false;
|
||||
for (unsigned int i = 0; i < input_size; ++i){
|
||||
DTSC::Scan tmp_input = inputs.getIndice(i);
|
||||
|
||||
|
@ -227,6 +217,10 @@ bool Util::startInput(std::string streamname, std::string filename, bool forkFir
|
|||
MEDIUM_MSG("Checking input %s: %s (%s)", inputs.getIndiceName(i).c_str(), tmp_input.getMember("name").asString().c_str(), source.c_str());
|
||||
|
||||
if (filename.substr(0,front.size()) == front && filename.substr(filename.size()-back.size()) == back){
|
||||
if (tmp_input.getMember("non-provider") && !isProvider){
|
||||
noProviderNoPick = true;
|
||||
continue;
|
||||
}
|
||||
player_bin = Util::getMyPath() + "MistIn" + tmp_input.getMember("name").asString();
|
||||
curPrio = tmp_input.getMember("priority").asInt();
|
||||
selected = true;
|
||||
|
@ -240,6 +234,10 @@ bool Util::startInput(std::string streamname, std::string filename, bool forkFir
|
|||
MEDIUM_MSG("Checking input %s: %s (%s)", inputs.getIndiceName(i).c_str(), tmp_input.getMember("name").asString().c_str(), source.c_str());
|
||||
|
||||
if (filename.substr(0,front.size()) == front && filename.substr(filename.size()-back.size()) == back){
|
||||
if (tmp_input.getMember("non-provider") && !isProvider){
|
||||
noProviderNoPick = true;
|
||||
continue;
|
||||
}
|
||||
player_bin = Util::getMyPath() + "MistIn" + tmp_input.getMember("name").asString();
|
||||
curPrio = tmp_input.getMember("priority").asInt();
|
||||
selected = true;
|
||||
|
@ -252,7 +250,11 @@ bool Util::startInput(std::string streamname, std::string filename, bool forkFir
|
|||
|
||||
if (!selected){
|
||||
configLock.post();//unlock the config semaphore
|
||||
FAIL_MSG("No compatible input found for stream %s: %s", streamname.c_str(), filename.c_str());
|
||||
if (noProviderNoPick){
|
||||
INFO_MSG("Not a media provider for stream %s: %s", streamname.c_str(), filename.c_str());
|
||||
}else{
|
||||
FAIL_MSG("No compatible input found for stream %s: %s", streamname.c_str(), filename.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -470,4 +472,3 @@ static std::string strftime_now(const std::string& format) {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
/* roxlu-end */
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Util {
|
|||
std::string getTmpFolder();
|
||||
void sanitizeName(std::string & streamname);
|
||||
bool streamAlive(std::string & streamname);
|
||||
bool startInput(std::string streamname, std::string filename = "", bool forkFirst = true);
|
||||
bool startInput(std::string streamname, std::string filename = "", bool forkFirst = true, bool isProvider = false);
|
||||
int startPush(const std::string & streamname, std::string & target);
|
||||
JSON::Value getStreamConfig(std::string streamname);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue