From fa3ae6db933a8930db928dde8d715034c01e10ee Mon Sep 17 00:00:00 2001 From: tt2468 Date: Mon, 1 Feb 2021 05:48:51 -0800 Subject: [PATCH] Frontend-API: Add obs_frontend_reset_video() --- UI/api-interface.cpp | 2 ++ UI/obs-frontend-api/obs-frontend-api.cpp | 6 ++++++ UI/obs-frontend-api/obs-frontend-api.h | 2 ++ UI/obs-frontend-api/obs-frontend-internal.hpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/UI/api-interface.cpp b/UI/api-interface.cpp index 67c66afa7..3b1e0e19b 100644 --- a/UI/api-interface.cpp +++ b/UI/api-interface.cpp @@ -571,6 +571,8 @@ struct OBSStudioAPI : obs_frontend_callbacks { return os_atomic_load_bool(&virtualcam_active); } + void obs_frontend_reset_video(void) override { main->ResetVideo(); } + void on_load(obs_data_t *settings) override { for (size_t i = saveCallbacks.size(); i > 0; i--) { diff --git a/UI/obs-frontend-api/obs-frontend-api.cpp b/UI/obs-frontend-api/obs-frontend-api.cpp index 0304a1057..311d99212 100644 --- a/UI/obs-frontend-api/obs-frontend-api.cpp +++ b/UI/obs-frontend-api/obs-frontend-api.cpp @@ -499,3 +499,9 @@ bool obs_frontend_virtualcam_active(void) return !!callbacks_valid() ? c->obs_frontend_virtualcam_active() : false; } + +void obs_frontend_reset_video(void) +{ + if (callbacks_valid()) + c->obs_frontend_reset_video(); +} diff --git a/UI/obs-frontend-api/obs-frontend-api.h b/UI/obs-frontend-api/obs-frontend-api.h index b0b7c3418..a336b6e18 100644 --- a/UI/obs-frontend-api/obs-frontend-api.h +++ b/UI/obs-frontend-api/obs-frontend-api.h @@ -206,6 +206,8 @@ EXPORT void obs_frontend_start_virtualcam(void); EXPORT void obs_frontend_stop_virtualcam(void); EXPORT bool obs_frontend_virtualcam_active(void); +EXPORT void obs_frontend_reset_video(void); + /* ------------------------------------------------------------------------- */ #ifdef __cplusplus diff --git a/UI/obs-frontend-api/obs-frontend-internal.hpp b/UI/obs-frontend-api/obs-frontend-internal.hpp index fe4c8c76a..3b141375a 100644 --- a/UI/obs-frontend-api/obs-frontend-internal.hpp +++ b/UI/obs-frontend-api/obs-frontend-internal.hpp @@ -127,6 +127,8 @@ struct obs_frontend_callbacks { virtual void obs_frontend_start_virtualcam(void) = 0; virtual void obs_frontend_stop_virtualcam(void) = 0; virtual bool obs_frontend_virtualcam_active(void) = 0; + + virtual void obs_frontend_reset_video(void) = 0; }; EXPORT void