You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
949 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. MediaMtx (C++) - path manager (MediaMTX: internal/core/path_manager.go)
  3. */
  4. #pragma once
  5. #include <map>
  6. #include <memory>
  7. #include <mutex>
  8. #include <string>
  9. #include <vector>
  10. #include "../conf/conf.h"
  11. #include "path.h"
  12. namespace mtx {
  13. class PathManager : public LogParent, public PathProvider
  14. {
  15. public:
  16. explicit PathManager(const Conf & global);
  17. ~PathManager();
  18. // Starts new paths, stops removed ones, restarts changed ones
  19. void applyPaths(const std::vector<PathConf> & paths);
  20. void closeAll();
  21. std::shared_ptr<Path> find(const std::string & name) const;
  22. // PathProvider (WebRTC server)
  23. std::shared_ptr<MediaPath> findPath(const std::string & name) const override { return find(name); }
  24. std::vector<PathInfo> list() const;
  25. std::vector<PathConf> confs() const;
  26. private:
  27. Conf m_global;
  28. mutable std::mutex m_mutex;
  29. std::map<std::string, std::shared_ptr<Path>> m_paths;
  30. };
  31. } // namespace mtx