mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
events: fix how and when TransitionBegin is hooked
This commit is contained in:
@ -104,8 +104,6 @@ WSEvents::WSEvents(WSServerPtr srv) :
|
|||||||
|
|
||||||
heartbeatTimer.start(STATUS_INTERVAL);
|
heartbeatTimer.start(STATUS_INTERVAL);
|
||||||
|
|
||||||
hookTransitionBeginEvent();
|
|
||||||
|
|
||||||
// Connect to signals of all existing sources
|
// Connect to signals of all existing sources
|
||||||
obs_enum_sources([](void* param, obs_source_t* source) {
|
obs_enum_sources([](void* param, obs_source_t* source) {
|
||||||
auto self = reinterpret_cast<WSEvents*>(param);
|
auto self = reinterpret_cast<WSEvents*>(param);
|
||||||
@ -134,8 +132,6 @@ WSEvents::~WSEvents() {
|
|||||||
return true;
|
return true;
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
unhookTransitionBeginEvent();
|
|
||||||
|
|
||||||
obs_frontend_remove_event_callback(WSEvents::FrontendEventHandler, this);
|
obs_frontend_remove_event_callback(WSEvents::FrontendEventHandler, this);
|
||||||
os_cpu_usage_info_destroy(cpuUsageInfo);
|
os_cpu_usage_info_destroy(cpuUsageInfo);
|
||||||
}
|
}
|
||||||
@ -147,13 +143,17 @@ void WSEvents::FrontendEventHandler(enum obs_frontend_event event, void* private
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event == OBS_FRONTEND_EVENT_SCENE_CHANGED) {
|
if (event == OBS_FRONTEND_EVENT_FINISHED_LOADING) {
|
||||||
|
owner->hookTransitionBeginEvent();
|
||||||
|
}
|
||||||
|
else if (event == OBS_FRONTEND_EVENT_SCENE_CHANGED) {
|
||||||
owner->OnSceneChange();
|
owner->OnSceneChange();
|
||||||
}
|
}
|
||||||
else if (event == OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED) {
|
else if (event == OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED) {
|
||||||
owner->OnSceneListChange();
|
owner->OnSceneListChange();
|
||||||
}
|
}
|
||||||
else if (event == OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED) {
|
else if (event == OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED) {
|
||||||
|
owner->hookTransitionBeginEvent();
|
||||||
owner->OnSceneCollectionChange();
|
owner->OnSceneCollectionChange();
|
||||||
}
|
}
|
||||||
else if (event == OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED) {
|
else if (event == OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED) {
|
||||||
@ -222,6 +222,7 @@ void WSEvents::FrontendEventHandler(enum obs_frontend_event event, void* private
|
|||||||
owner->OnPreviewSceneChanged();
|
owner->OnPreviewSceneChanged();
|
||||||
}
|
}
|
||||||
else if (event == OBS_FRONTEND_EVENT_EXIT) {
|
else if (event == OBS_FRONTEND_EVENT_EXIT) {
|
||||||
|
owner->unhookTransitionBeginEvent();
|
||||||
owner->OnExit();
|
owner->OnExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user