/* MediaMtx (C++) - settings of the reusable parts (WebRTC server, recorder) Shared by the stand-alone server (Projects/MediaMtx, which adds the command line, the paths file, the RTSP sources and the API) and la_mojo (kernelModuleEmbedVideo, which feeds the streams itself). The names follow MediaMTX (webrtcAddress, recordPath, ...). */ #pragma once #include #include #include #include namespace mtx { // A finished recording segment (the file is closed and complete) struct SegmentInfo { std::string path; // path name (e.g. stream_12) std::string file; // full file name int64_t startUs = 0; // local wall clock when its first sample was written (us since the epoch) int64_t durationUs = 0; // from the timestamps of the samples int width = 0; int height = 0; }; struct ServerConf { // WebRTC (WHEP) std::string webrtcAddress = ":8889"; std::string webrtcAllowOrigin = "*"; std::vector webrtcICEServers; // e.g. stun:stun.l.google.com:19302 std::string webrtcBindAddress; // ICE: bind to this local address (default: all) uint16_t webrtcUDPPortMin = 8189; uint16_t webrtcUDPPortMax = 8289; // recording std::string recordPath = "./recordings/%path/%Y-%m-%d_%H-%M-%S-%f"; int64_t recordSegmentDurationMs = 60000; int64_t recordPartDurationMs = 1000; // Called (from the recorder thread) for every closed segment; must not block. Optional. std::function onSegmentDone; }; // "60s", "1m", "500ms", "1h", "1.5s"; plain number = seconds bool parseDurationMs(const std::string & s, int64_t & ms); // "host:port" / ":port" -> host ("" = any) and port bool splitHostPort(const std::string & addr, std::string & host, uint16_t & port); // rtsp://user:pass@host/... -> rtsp://host/... (for logs) std::string hideCredentials(const std::string & url); } // namespace mtx