Enable Parameters on TSSRT listener

This commit is contained in:
Matthew James 2022-07-22 00:44:28 +08:00 committed by Thulinma
parent 1c6a483e49
commit 0430a644df
4 changed files with 9 additions and 7 deletions

View file

@ -462,12 +462,11 @@ namespace Socket{
SRTServer::SRTServer(int fromSock){conn = SRTConnection(fromSock);}
SRTServer::SRTServer(int port, std::string hostname, bool nonblock, const std::string &_direction){
SRTServer::SRTServer(int port, std::string hostname, std::map<std::string, std::string> _params, bool nonblock, const std::string &_direction){
// We always create a server as listening
std::map<std::string, std::string> listenMode;
listenMode["mode"] = "listener";
_params["mode"] = "listener";
if (hostname == ""){hostname = "0.0.0.0";}
conn.connect(hostname, port, _direction, listenMode);
conn.connect(hostname, port, _direction, _params);
conn.setBlocking(true);
if (!conn){
ERROR_MSG("Unable to create socket");

View file

@ -97,7 +97,7 @@ namespace Socket{
public:
SRTServer();
SRTServer(int existingSock);
SRTServer(int port, std::string hostname, bool nonblock = false, const std::string &_direction = "input");
SRTServer(int port, std::string hostname, std::map<std::string, std::string> params, bool nonblock = false, const std::string &_direction = "input");
SRTConnection accept(bool nonblock = false, const std::string &direction = "input");
void setBlocking(bool blocking);
bool connected() const;

View file

@ -137,7 +137,9 @@ namespace Mist{
HTTP::URL u(source);
INFO_MSG("Parsed url: %s", u.getUrl().c_str());
if (Socket::interpretSRTMode(u) == "listener"){
sSock = Socket::SRTServer(u.getPort(), u.host, false);
std::map<std::string, std::string> arguments;
HTTP::parseVars(u.args, arguments);
sSock = Socket::SRTServer(u.getPort(), u.host, arguments, false);
struct sigaction new_action;
struct sigaction cur_action;
new_action.sa_sigaction = signal_handler;

View file

@ -434,7 +434,8 @@ int main(int argc, char *argv[]){
sigaction(SIGUSR1, &new_action, NULL);
}
if (conf.getInteger("port") && conf.getString("interface").size()){
server_socket = Socket::SRTServer(conf.getInteger("port"), conf.getString("interface"), false, "output");
std::map<std::string, std::string> arguments;
server_socket = Socket::SRTServer(conf.getInteger("port"), conf.getString("interface"), arguments, false, "output");
}
if (!server_socket.connected()){
DEVEL_MSG("Failure to open socket");