utils: remove dynamic loaded functions for recording pause

This commit is contained in:
Stéphane Lepin 2020-03-17 23:45:57 +01:00
parent a5af45fb31
commit 88d39ab47a
5 changed files with 7 additions and 47 deletions

View File

@ -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");

View File

@ -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);

View File

@ -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();

View File

@ -10,10 +10,6 @@ RpcResponse ifCanPause(const RpcRequest& request, std::function<RpcResponse()> 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();
});
}

View File

@ -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()) {