Merge pull request #1051 from RytoEX/add-frontend-replay-buffer-save

UI: Add Frontend API function to save replay buffer
This commit is contained in:
Jim 2017-11-24 22:41:54 -08:00 committed by GitHub
commit a63028dd9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -4650,6 +4650,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)

View File

@ -380,6 +380,7 @@ public slots:
void StopReplayBuffer();
void ReplayBufferStart();
void ReplayBufferSave();
void ReplayBufferStopping();
void ReplayBufferStop(int code);