| 172 | ******************************************************************************/ |
| 173 | |
| 174 | static void SaveSceneSwitcher(obs_data_t *save_data, bool saving, void *) |
| 175 | { |
| 176 | if (!switcher) { |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | if (saving) { |
| 181 | std::lock_guard<std::mutex> lock(switcher->m); |
| 182 | switcher->Prune(); |
| 183 | OBSDataAutoRelease data = obs_data_create(); |
| 184 | switcher->SaveSettings(data); |
| 185 | obs_data_set_obj(save_data, "advanced-scene-switcher", data); |
| 186 | } else { |
| 187 | // Stop the scene switcher at least once to |
| 188 | // avoid scene duplication issues with scene collection changes |
| 189 | switcher->Stop(); |
| 190 | |
| 191 | OBSDataAutoRelease data = |
| 192 | obs_data_get_obj(save_data, "advanced-scene-switcher"); |
| 193 | if (!data) { |
| 194 | data = obs_data_create(); |
| 195 | } |
| 196 | |
| 197 | switcher->m.lock(); |
| 198 | if (switcher->VersionChanged(data, g_GIT_SHA1)) { |
| 199 | AskForBackup(data); |
| 200 | } |
| 201 | |
| 202 | switcher->LoadSettings(data); |
| 203 | switcher->m.unlock(); |
| 204 | |
| 205 | if (switcher->stop) { |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | if (ShouldSkipPluginStartOnUncleanShutdown()) { |
| 210 | return; |
| 211 | } |
| 212 | |
| 213 | switcher->Start(); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /****************************************************************************** |
| 218 | * Main switcher thread |
no test coverage detected