MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / SaveSceneSwitcher

Function SaveSceneSwitcher

lib/advanced-scene-switcher.cpp:174–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 ******************************************************************************/
173
174static 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

Callers 1

Calls 8

AskForBackupFunction · 0.85
PruneMethod · 0.80
SaveSettingsMethod · 0.80
VersionChangedMethod · 0.80
LoadSettingsMethod · 0.80
StopMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected