diff --git a/UI/api-interface.cpp b/UI/api-interface.cpp index 7eac76a18..bc5c12b3b 100644 --- a/UI/api-interface.cpp +++ b/UI/api-interface.cpp @@ -239,6 +239,11 @@ struct OBSStudioAPI : obs_frontend_callbacks { QMetaObject::invokeMethod(main, "StartReplayBuffer"); } + void obs_frontend_replay_buffer_save(void) override + { + QMetaObject::invokeMethod(main, "ReplayBufferSave"); + } + void obs_frontend_replay_buffer_stop(void) override { QMetaObject::invokeMethod(main, "StopReplayBuffer"); diff --git a/UI/obs-frontend-api/obs-frontend-api.cpp b/UI/obs-frontend-api/obs-frontend-api.cpp index 8f00a9f44..c86a51333 100644 --- a/UI/obs-frontend-api/obs-frontend-api.cpp +++ b/UI/obs-frontend-api/obs-frontend-api.cpp @@ -210,6 +210,11 @@ void obs_frontend_replay_buffer_start(void) if (callbacks_valid()) c->obs_frontend_replay_buffer_start(); } +void obs_frontend_replay_buffer_save(void) +{ + if (callbacks_valid()) c->obs_frontend_replay_buffer_save(); +} + void obs_frontend_replay_buffer_stop(void) { if (callbacks_valid()) c->obs_frontend_replay_buffer_stop(); diff --git a/UI/obs-frontend-api/obs-frontend-api.h b/UI/obs-frontend-api/obs-frontend-api.h index 0622f3b7d..51dd05930 100644 --- a/UI/obs-frontend-api/obs-frontend-api.h +++ b/UI/obs-frontend-api/obs-frontend-api.h @@ -71,6 +71,7 @@ EXPORT void obs_frontend_recording_stop(void); EXPORT bool obs_frontend_recording_active(void); EXPORT void obs_frontend_replay_buffer_start(void); +EXPORT void obs_frontend_replay_buffer_save(void); EXPORT void obs_frontend_replay_buffer_stop(void); EXPORT bool obs_frontend_replay_buffer_active(void); diff --git a/UI/obs-frontend-api/obs-frontend-internal.hpp b/UI/obs-frontend-api/obs-frontend-internal.hpp index a0edc7f4c..805856857 100644 --- a/UI/obs-frontend-api/obs-frontend-internal.hpp +++ b/UI/obs-frontend-api/obs-frontend-internal.hpp @@ -41,6 +41,7 @@ struct obs_frontend_callbacks { virtual bool obs_frontend_recording_active(void)=0; virtual void obs_frontend_replay_buffer_start(void)=0; + virtual void obs_frontend_replay_buffer_save(void) = 0; virtual void obs_frontend_replay_buffer_stop(void)=0; virtual bool obs_frontend_replay_buffer_active(void)=0; diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index e804fdacc..bdd2cb4b9 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -4639,6 +4639,20 @@ void OBSBasic::ReplayBufferStart() blog(LOG_INFO, REPLAY_BUFFER_START); } +void OBSBasic::ReplayBufferSave() +{ + if (!outputHandler || !outputHandler->replayBuffer) + return; + if (!outputHandler->ReplayBufferActive()) + return; + + calldata_t cd = {0}; + proc_handler_t *ph = obs_output_get_proc_handler( + outputHandler->replayBuffer); + proc_handler_call(ph, "save", &cd); + calldata_free(&cd); +} + void OBSBasic::ReplayBufferStop(int code) { if (!outputHandler || !outputHandler->replayBuffer) diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index 1325f3dde..ffa3103a5 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -380,6 +380,7 @@ public slots: void StopReplayBuffer(); void ReplayBufferStart(); + void ReplayBufferSave(); void ReplayBufferStopping(); void ReplayBufferStop(int code);