obs-frontend-api: Add frontend api functions for the virtual camera

This adds functions to the frontend api to start/stop the virtual
camera, to check if it is active and adds function to get the output
reference. It also adds api events for when the virtual camera is
started or stopped.
This commit is contained in:
Clayton Groeneveld
2020-12-07 14:39:02 -06:00
committed by Jim
parent 96ef45cef5
commit 3bc4e8ecba
6 changed files with 99 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ extern volatile bool streaming_active;
extern volatile bool recording_active;
extern volatile bool recording_paused;
extern volatile bool replaybuf_active;
extern volatile bool virtualcam_active;
/* ------------------------------------------------------------------------- */
@@ -548,6 +549,28 @@ struct OBSStudioAPI : obs_frontend_callbacks {
Q_ARG(OBSSource, OBSSource(source)));
}
obs_output_t *obs_frontend_get_virtualcam_output(void) override
{
OBSOutput output = main->outputHandler->virtualCam;
obs_output_addref(output);
return output;
}
void obs_frontend_start_virtualcam(void) override
{
QMetaObject::invokeMethod(main, "StartVirtualCam");
}
void obs_frontend_stop_virtualcam(void) override
{
QMetaObject::invokeMethod(main, "StopVirtualCam");
}
bool obs_frontend_virtualcam_active(void) override
{
return os_atomic_load_bool(&virtualcam_active);
}
void on_load(obs_data_t *settings) override
{
for (size_t i = saveCallbacks.size(); i > 0; i--) {