Merged non-LTS code from LTS branch into other repositories.
This commit is contained in:
parent
c69347f4e0
commit
088b917b52
2 changed files with 29 additions and 32 deletions
|
@ -80,10 +80,20 @@ namespace Buffer {
|
|||
waiting_ip = ip;
|
||||
}
|
||||
|
||||
/// Check if this is the IP address to accept push data from.
|
||||
/// \param ip The IP address to check.
|
||||
/// \return True if it is the correct address, false otherwise.
|
||||
bool Stream::checkWaitingIP(std::string ip){
|
||||
///\brief Check if this is the IP address to accept push data from.
|
||||
///\param ip The IP address to check, followed by a space and the password to check.
|
||||
///\return True if it is the correct address or password, false otherwise.
|
||||
bool Stream::checkWaitingIP(std::string push_request){
|
||||
std::string ip = push_request.substr(0, push_request.find(' '));
|
||||
std::string pass = push_request.substr(push_request.find(' ') + 1);
|
||||
if (waiting_ip.length() > 0 && waiting_ip[0] == '@'){
|
||||
if (pass == waiting_ip.substr(1)){
|
||||
return true;
|
||||
}else{
|
||||
std::cout << "Password '" << pass << "' incorrect" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
if (ip == waiting_ip || ip == "::ffff:" + waiting_ip){
|
||||
return true;
|
||||
}else{
|
||||
|
@ -91,6 +101,7 @@ namespace Buffer {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Stores intermediate statistics.
|
||||
/// \param username The name of the user.
|
||||
|
|
|
@ -42,21 +42,21 @@ namespace Controller {
|
|||
if (data.isMember("source")){
|
||||
URL = data["source"].asString();
|
||||
}
|
||||
std::string cmd1, cmd2, cmd3;
|
||||
std::string buffcmd;
|
||||
if (URL == ""){
|
||||
Log("STRM", "Error for stream " + name + "! Source parameter missing.");
|
||||
data["error"] = "Missing source parameter!";
|
||||
return;
|
||||
}
|
||||
if (URL.substr(0, 4) == "push"){
|
||||
std::string pusher = URL.substr(7);
|
||||
buffcmd = "MistBuffer";
|
||||
if (data.isMember("DVR") && data["DVR"].asInt() > 0){
|
||||
data["DVR"] = data["DVR"].asInt();
|
||||
cmd2 = "MistBuffer -t " + data["DVR"].asString() + " -s " + name + " " + pusher;
|
||||
}else{
|
||||
cmd2 = "MistBuffer -s " + name + " " + pusher;
|
||||
buffcmd += " -t " + data["DVR"].asString();
|
||||
}
|
||||
Util::Procs::Start(name, Util::getMyPath() + cmd2);
|
||||
buffcmd += " -s " + name;
|
||||
if (URL.substr(0, 4) == "push"){
|
||||
std::string pusher = URL.substr(7);
|
||||
Util::Procs::Start(name, Util::getMyPath() + buffcmd + " " + pusher);
|
||||
Log("BUFF", "(re)starting stream buffer " + name + " for push data from " + pusher);
|
||||
}else{
|
||||
if (URL.substr(0, 1) == "/"){
|
||||
|
@ -123,23 +123,9 @@ namespace Controller {
|
|||
data["online"] = 1;
|
||||
}
|
||||
return; //MistPlayer handles VoD
|
||||
}else{
|
||||
cmd1 = "ffmpeg -re -async 2 -i " + URL + " -f flv -";
|
||||
cmd2 = "MistFLV2DTSC";
|
||||
}
|
||||
if (data.isMember("DVR") && data["DVR"].asInt() > 0){
|
||||
data["DVR"] = data["DVR"].asInt();
|
||||
cmd3 = "MistBuffer -t " + data["DVR"].asString() + " -s " + name;
|
||||
}else{
|
||||
cmd3 = "MistBuffer -s " + name;
|
||||
}
|
||||
if (cmd2 != ""){
|
||||
Util::Procs::Start(name, cmd1, Util::getMyPath() + cmd2, Util::getMyPath() + cmd3);
|
||||
Log("BUFF", "(re)starting stream buffer " + name + " for ffmpeg data: " + cmd1);
|
||||
}else{
|
||||
Util::Procs::Start(name, cmd1, Util::getMyPath() + cmd3);
|
||||
Log("BUFF", "(re)starting stream buffer " + name + " using input file " + URL);
|
||||
}
|
||||
Util::Procs::Start(name, "ffmpeg -re -async 2 -i " + URL + " -f flv -", Util::getMyPath() + "MistFLV2DTSC", Util::getMyPath() + buffcmd);
|
||||
Log("BUFF", "(re)starting stream buffer " + name + " for ffmpeg data: ffmpeg -re -async 2 -i " + URL + " -f flv -");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue