mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
eventhandler: Add a few transition events
This commit is contained in:
parent
931a1630ce
commit
d2ddde3229
@ -300,10 +300,12 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_
|
||||
|
||||
// Transitions
|
||||
case OBS_FRONTEND_EVENT_TRANSITION_CHANGED:
|
||||
eventHandler->HandleCurrentSceneTransitionChanged();
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED:
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_TRANSITION_DURATION_CHANGED:
|
||||
eventHandler->HandleCurrentSceneTransitionDurationChanged();
|
||||
break;
|
||||
|
||||
// Outputs
|
||||
|
@ -112,6 +112,10 @@ class EventHandler
|
||||
static void HandleInputAudioTracksChanged(void *param, calldata_t *data); // Direct callback
|
||||
static void HandleInputAudioMonitorTypeChanged(void *param, calldata_t *data); // Direct callback
|
||||
|
||||
// Transitions
|
||||
void HandleCurrentSceneTransitionChanged();
|
||||
void HandleCurrentSceneTransitionDurationChanged();
|
||||
|
||||
// Outputs
|
||||
void HandleStreamStateChanged(ObsOutputState state);
|
||||
void HandleRecordStateChanged(ObsOutputState state);
|
||||
|
@ -18,3 +18,45 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "EventHandler.h"
|
||||
|
||||
/**
|
||||
* The current scene transition has changed.
|
||||
*
|
||||
* @dataField transitionName | String | Name of the new transition
|
||||
*
|
||||
* @eventType CurrentSceneTransitionChanged
|
||||
* @eventSubscription Transitions
|
||||
* @complexity 3
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.0.0
|
||||
* @api events
|
||||
* @category transitions
|
||||
*/
|
||||
void EventHandler::HandleCurrentSceneTransitionChanged()
|
||||
{
|
||||
OBSSourceAutoRelease transition = obs_frontend_get_current_transition();
|
||||
|
||||
json eventData;
|
||||
eventData["transitionName"] = obs_source_get_name(transition);
|
||||
BroadcastEvent(EventSubscription::Transitions, "CurrentSceneTransitionChanged", eventData);
|
||||
}
|
||||
|
||||
/**
|
||||
* The current scene transition duration has changed.
|
||||
*
|
||||
* @dataField transitionDuration | Number | Transition duration in milliseconds
|
||||
*
|
||||
* @eventType CurrentSceneTransitionDurationChanged
|
||||
* @eventSubscription Transitions
|
||||
* @complexity 2
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.0.0
|
||||
* @api events
|
||||
* @category transitions
|
||||
*/
|
||||
void EventHandler::HandleCurrentSceneTransitionDurationChanged()
|
||||
{
|
||||
json eventData;
|
||||
eventData["transitionDuration"] = obs_frontend_get_transition_duration();
|
||||
BroadcastEvent(EventSubscription::Transitions, "CurrentSceneTransitionDurationChanged", eventData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user