diff --git a/src/Utils.cpp b/src/Utils.cpp index 097689cf..cb394886 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -831,39 +831,6 @@ void getPauseRecordingFunctions(RecordingPausedFunction* recPausedFuncPtr, Pause } } -bool Utils::RecordingPauseSupported() -{ - RecordingPausedFunction recordingPaused = nullptr; - PauseRecordingFunction pauseRecording = nullptr; - getPauseRecordingFunctions(&recordingPaused, &pauseRecording); - - return (recordingPaused && pauseRecording); -} - -bool Utils::RecordingPaused() -{ - RecordingPausedFunction recordingPaused = nullptr; - getPauseRecordingFunctions(&recordingPaused, nullptr); - - if (recordingPaused == nullptr) { - return false; - } - - return recordingPaused(); -} - -void Utils::PauseRecording(bool pause) -{ - PauseRecordingFunction pauseRecording = nullptr; - getPauseRecordingFunctions(nullptr, &pauseRecording); - - if (pauseRecording == nullptr) { - return; - } - - pauseRecording(pause); -} - bool Utils::OpenProjectorSupported() { void* frontendApi = os_dlopen("obs-frontend-api"); diff --git a/src/Utils.h b/src/Utils.h index 611e80da..89e67d87 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -83,9 +83,6 @@ namespace Utils { const char* GetFilenameFormatting(); bool SetFilenameFormatting(const char* filenameFormatting); - bool RecordingPauseSupported(); - bool RecordingPaused(); - void PauseRecording(bool pause); bool OpenProjectorSupported(); void OpenProjector(const char* type, int monitor, const char* geometry, const char* name); diff --git a/src/WSEvents.cpp b/src/WSEvents.cpp index 816ca76f..6010275f 100644 --- a/src/WSEvents.cpp +++ b/src/WSEvents.cpp @@ -747,7 +747,7 @@ void WSEvents::OnExit() { void WSEvents::StreamStatus() { bool streamingActive = obs_frontend_streaming_active(); bool recordingActive = obs_frontend_recording_active(); - bool recordingPaused = Utils::RecordingPaused(); + bool recordingPaused = obs_frontend_recording_paused(); bool replayBufferActive = obs_frontend_replay_buffer_active(); OBSOutputAutoRelease streamOutput = obs_frontend_get_streaming_output(); @@ -831,7 +831,7 @@ void WSEvents::Heartbeat() { bool streamingActive = obs_frontend_streaming_active(); bool recordingActive = obs_frontend_recording_active(); - bool recordingPaused = Utils::RecordingPaused(); + bool recordingPaused = obs_frontend_recording_paused(); OBSDataAutoRelease data = obs_data_create(); OBSOutputAutoRelease recordOutput = obs_frontend_get_recording_output(); diff --git a/src/WSRequestHandler_Recording.cpp b/src/WSRequestHandler_Recording.cpp index 330843d3..df2ed4a0 100644 --- a/src/WSRequestHandler_Recording.cpp +++ b/src/WSRequestHandler_Recording.cpp @@ -10,10 +10,6 @@ RpcResponse ifCanPause(const RpcRequest& request, std::function c return request.failed("recording is not active"); } - if (!Utils::RecordingPauseSupported()) { - return request.failed("recording pauses are not available in this version of OBS Studio"); - } - return callback(); } @@ -77,11 +73,11 @@ RpcResponse WSRequestHandler::StartRecording(const RpcRequest& request) { */ RpcResponse WSRequestHandler::PauseRecording(const RpcRequest& request) { return ifCanPause(request, [request]() { - if (Utils::RecordingPaused()) { + if (obs_frontend_recording_paused()) { return request.failed("recording already paused"); } - Utils::PauseRecording(true); + obs_frontend_recording_pause(true); return request.success(); }); } @@ -97,11 +93,11 @@ RpcResponse WSRequestHandler::PauseRecording(const RpcRequest& request) { */ RpcResponse WSRequestHandler::ResumeRecording(const RpcRequest& request) { return ifCanPause(request, [request]() { - if (!Utils::RecordingPaused()) { + if (!obs_frontend_recording_paused()) { return request.failed("recording is not paused"); } - Utils::PauseRecording(false); + obs_frontend_recording_pause(false); return request.success(); }); } diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index a39f0cce..744a691f 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -26,7 +26,7 @@ RpcResponse WSRequestHandler::GetStreamingStatus(const RpcRequest& request) { OBSDataAutoRelease data = obs_data_create(); obs_data_set_bool(data, "streaming", obs_frontend_streaming_active()); obs_data_set_bool(data, "recording", obs_frontend_recording_active()); - obs_data_set_bool(data, "recording-paused", Utils::RecordingPaused()); + obs_data_set_bool(data, "recording-paused", obs_frontend_recording_paused()); obs_data_set_bool(data, "preview-only", false); if (obs_frontend_streaming_active()) {