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

Function SetupRecordingTimer

plugins/base/macro-condition-recording.cpp:167–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167bool SetupRecordingTimer()
168{
169 static std::atomic_bool recordingStopped = {true};
170 static std::atomic_bool recordingPaused = {false};
171 static auto handleRecordingEvents = [](enum obs_frontend_event event,
172 void *) {
173 switch (event) {
174 case OBS_FRONTEND_EVENT_RECORDING_STOPPED:
175 recordingStopped = true;
176 break;
177 case OBS_FRONTEND_EVENT_RECORDING_STARTED:
178 recordingStopped = false;
179 break;
180 case OBS_FRONTEND_EVENT_RECORDING_PAUSED:
181 recordingPaused = true;
182 break;
183 case OBS_FRONTEND_EVENT_RECORDING_UNPAUSED:
184 recordingPaused = false;
185 break;
186 default:
187 break;
188 };
189 };
190 obs_frontend_add_event_callback(handleRecordingEvents, nullptr);
191 std::thread thread([]() {
192 while (true) {
193 std::this_thread::sleep_for(std::chrono::seconds(1));
194 if (recordingStopped) {
195 currentRecordingDurationInSeconds = 0;
196 continue;
197 }
198 if (recordingPaused) {
199 continue;
200 }
201 ++currentRecordingDurationInSeconds;
202 }
203 });
204 thread.detach();
205 return true;
206}
207
208} // namespace advss

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected