/* MediaMtx (C++) - configuration No mediamtx.yml: the global settings come from the command line, the paths (streams) from a small paths file (one line per path, reloaded on SIGHUP) and from the control API. Paths file: # name source options stream_3 rtsp://user:pass@10.0.0.5:554/stream1 record=yes transport=tcp stream_4 rtsp://10.0.0.6/live record=no The option names follow MediaMTX (webrtcAddress, recordPath, ...). */ #pragma once #include #include #include #include #include namespace mtx { enum class RtspTransport { Tcp, Udp }; struct PathConf { std::string name; std::string source; // rtsp://... bool record = false; RtspTransport transport = RtspTransport::Tcp; bool operator==(const PathConf & o) const { return name == o.name && source == o.source && record == o.record && transport == o.transport; } bool operator!=(const PathConf & o) const { return ! (*this == o); } }; struct Conf : public ServerConf { // general LogLevel logLevel = LogLevel::Info; bool logStdout = true; std::string logFile; // empty: no file int64_t readTimeoutMs = 10000; // source: no data for this long -> reconnect int64_t sourceRetryPauseMs = 5000; // pause before a reconnect // control API (empty address: disabled) std::string apiAddress = "127.0.0.1:9997"; // paths std::string pathsFile; std::vector paths; // paths file + command line std::vector cmdPaths; // --path options only void mergeCmdPaths(std::vector & out) const; // Parses the command line (and loads the paths file). False + err on a bad option. bool load(int argc, char ** argv, std::string & err); static void printUsage(const char * prog); }; bool loadPathsFile(const std::string & file, std::vector & out, std::string & err); bool savePathsFile(const std::string & file, const std::vector & paths, std::string & err); bool validPathName(const std::string & name); } // namespace mtx