obs-frontend-api: Make a few frontend API thread-safe
Additionally, check for null output handlers.
This commit is contained in:
parent
9cf40e230b
commit
d17ee20863
@ -232,7 +232,12 @@ struct OBSStudioAPI : obs_frontend_callbacks {
|
||||
|
||||
bool obs_frontend_streaming_active(void) override
|
||||
{
|
||||
return main->outputHandler->StreamingActive();
|
||||
bool active;
|
||||
QMetaObject::invokeMethod(main,
|
||||
"StreamingActive",
|
||||
WaitConnection(),
|
||||
Q_RETURN_ARG(bool, active));
|
||||
return active;
|
||||
}
|
||||
|
||||
void obs_frontend_recording_start(void) override
|
||||
@ -247,7 +252,12 @@ struct OBSStudioAPI : obs_frontend_callbacks {
|
||||
|
||||
bool obs_frontend_recording_active(void) override
|
||||
{
|
||||
return main->outputHandler->RecordingActive();
|
||||
bool active;
|
||||
QMetaObject::invokeMethod(main,
|
||||
"RecordingActive",
|
||||
WaitConnection(),
|
||||
Q_RETURN_ARG(bool, active));
|
||||
return active;
|
||||
}
|
||||
|
||||
void obs_frontend_replay_buffer_start(void) override
|
||||
@ -267,7 +277,12 @@ struct OBSStudioAPI : obs_frontend_callbacks {
|
||||
|
||||
bool obs_frontend_replay_buffer_active(void) override
|
||||
{
|
||||
return main->outputHandler->ReplayBufferActive();
|
||||
bool active;
|
||||
QMetaObject::invokeMethod(main,
|
||||
"ReplayBufferActive",
|
||||
WaitConnection(),
|
||||
Q_RETURN_ARG(bool, active));
|
||||
return active;
|
||||
}
|
||||
|
||||
void *obs_frontend_add_tools_menu_qaction(const char *name) override
|
||||
|
@ -6998,3 +6998,24 @@ OBSBasic *OBSBasic::Get()
|
||||
{
|
||||
return reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
}
|
||||
|
||||
bool OBSBasic::StreamingActive()
|
||||
{
|
||||
if (!outputHandler)
|
||||
return false;
|
||||
return outputHandler->StreamingActive();
|
||||
}
|
||||
|
||||
bool OBSBasic::RecordingActive()
|
||||
{
|
||||
if (!outputHandler)
|
||||
return false;
|
||||
return outputHandler->RecordingActive();
|
||||
}
|
||||
|
||||
bool OBSBasic::ReplayBufferActive()
|
||||
{
|
||||
if (!outputHandler)
|
||||
return false;
|
||||
return outputHandler->ReplayBufferActive();
|
||||
}
|
||||
|
@ -789,6 +789,10 @@ private slots:
|
||||
public slots:
|
||||
void on_actionResetTransform_triggered();
|
||||
|
||||
bool StreamingActive();
|
||||
bool RecordingActive();
|
||||
bool ReplayBufferActive();
|
||||
|
||||
public:
|
||||
explicit OBSBasic(QWidget *parent = 0);
|
||||
virtual ~OBSBasic();
|
||||
|
Loading…
x
Reference in New Issue
Block a user