| 134 | } |
| 135 | |
| 136 | void streamfx::obs::source_tracker::rename_source(std::string_view old_name, std::string_view new_name, obs_source_t* source) |
| 137 | { |
| 138 | if (old_name == new_name) { |
| 139 | throw std::runtime_error("New and old name are identical."); |
| 140 | } |
| 141 | |
| 142 | std::lock_guard<decltype(_mutex)> lock(_mutex); |
| 143 | |
| 144 | // Remove the previously tracked entry. |
| 145 | if (auto kv = _sources.find(std::string{old_name}); kv != _sources.end()) { |
| 146 | _sources.erase(kv); |
| 147 | } |
| 148 | |
| 149 | // And then add the new entry. |
| 150 | _sources.emplace(std::string{new_name}, ::streamfx::obs::weak_source{source}); |
| 151 | } |
| 152 | |
| 153 | bool streamfx::obs::source_tracker::filter_sources(std::string, ::streamfx::obs::source source) |
| 154 | { |
no outgoing calls
no test coverage detected