mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Removed TransitionEnd event + changed TransitionBegin triggering
This commit is contained in:
@ -17,7 +17,6 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
|
|||||||
- ["TransitionDurationChanged"](#transitiondurationchanged)
|
- ["TransitionDurationChanged"](#transitiondurationchanged)
|
||||||
- ["TransitionListChanged"](#transitionlistchanged)
|
- ["TransitionListChanged"](#transitionlistchanged)
|
||||||
- ["TransitionBegin"](#transitionbegin)
|
- ["TransitionBegin"](#transitionbegin)
|
||||||
- ["TransitionEnd"](#transitionend)
|
|
||||||
- ["ProfileChanged"](#profilechanged)
|
- ["ProfileChanged"](#profilechanged)
|
||||||
- ["ProfileListChanged"](#profilelistchanged)
|
- ["ProfileListChanged"](#profilelistchanged)
|
||||||
- ["StreamStarting"](#streamstarting)
|
- ["StreamStarting"](#streamstarting)
|
||||||
@ -109,12 +108,7 @@ The list of available transitions has been modified (Transitions have been added
|
|||||||
---
|
---
|
||||||
|
|
||||||
#### "TransitionBegin"
|
#### "TransitionBegin"
|
||||||
A non-fixed transition has begun.
|
A transition other than "Cut" has begun.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### "TransitionEnd"
|
|
||||||
A non-fixed transition has ended.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
38
WSEvents.cpp
38
WSEvents.cpp
@ -22,6 +22,20 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "WSEvents.h"
|
#include "WSEvents.h"
|
||||||
|
|
||||||
|
bool transition_is_cut(obs_source_t *transition)
|
||||||
|
{
|
||||||
|
if (!transition)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (obs_source_get_type(transition) == OBS_SOURCE_TYPE_TRANSITION
|
||||||
|
&& strcmp(obs_source_get_id(transition), "cut_transition") == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
WSEvents::WSEvents(WSServer *srv)
|
WSEvents::WSEvents(WSServer *srv)
|
||||||
{
|
{
|
||||||
_srv = srv;
|
_srv = srv;
|
||||||
@ -147,12 +161,10 @@ void WSEvents::broadcastUpdate(const char *updateType, obs_data_t *additionalFie
|
|||||||
|
|
||||||
void WSEvents::connectTransitionSignals(obs_source_t* current_transition)
|
void WSEvents::connectTransitionSignals(obs_source_t* current_transition)
|
||||||
{
|
{
|
||||||
if (!obs_transition_fixed(current_transition))
|
if (!transition_is_cut(current_transition))
|
||||||
{
|
{
|
||||||
transition_handler = obs_source_get_signal_handler(current_transition);
|
transition_handler = obs_source_get_signal_handler(current_transition);
|
||||||
signal_handler_connect(transition_handler, "transition_start", OnTransitionBegin, this);
|
signal_handler_connect(transition_handler, "transition_start", OnTransitionBegin, this); }
|
||||||
signal_handler_connect(transition_handler, "transition_stop", OnTransitionEnd, this);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transition_handler = nullptr;
|
transition_handler = nullptr;
|
||||||
@ -193,7 +205,6 @@ void WSEvents::OnTransitionChange()
|
|||||||
if (transition_handler)
|
if (transition_handler)
|
||||||
{
|
{
|
||||||
signal_handler_disconnect(transition_handler, "transition_start", OnTransitionBegin, this);
|
signal_handler_disconnect(transition_handler, "transition_start", OnTransitionBegin, this);
|
||||||
signal_handler_disconnect(transition_handler, "transition_stop", OnTransitionEnd, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_source_t* current_transition = obs_frontend_get_current_transition();
|
obs_source_t* current_transition = obs_frontend_get_current_transition();
|
||||||
@ -371,20 +382,3 @@ void WSEvents::OnTransitionBegin(void* param, calldata_t* data)
|
|||||||
|
|
||||||
blog(LOG_INFO, "transition begin");
|
blog(LOG_INFO, "transition begin");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSEvents::OnTransitionEnd(void* param, calldata_t* data)
|
|
||||||
{
|
|
||||||
UNUSED_PARAMETER(data);
|
|
||||||
|
|
||||||
WSEvents* instance = static_cast<WSEvents*>(param);
|
|
||||||
instance->broadcastUpdate("TransitionEnd");
|
|
||||||
|
|
||||||
blog(LOG_INFO, "transition end");
|
|
||||||
}
|
|
||||||
|
|
||||||
void WSEvents::OnTransitionStopped(void* param, calldata_t* data)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
blog(LOG_INFO, "transition stopped");
|
|
||||||
}
|
|
@ -72,8 +72,6 @@ class WSEvents : public QObject
|
|||||||
void OnExit();
|
void OnExit();
|
||||||
|
|
||||||
static void OnTransitionBegin(void *param, calldata_t *data);
|
static void OnTransitionBegin(void *param, calldata_t *data);
|
||||||
static void OnTransitionEnd(void *param, calldata_t *data);
|
|
||||||
static void OnTransitionStopped(void *param, calldata_t *data);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WSEVENTS_H
|
#endif // WSEVENTS_H
|
@ -97,10 +97,6 @@ void WSServer::broadcast(QString message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_clMutex.unlock();
|
_clMutex.unlock();
|
||||||
|
|
||||||
// Dirty hack because several quick successive calls to sendTextMessage()
|
|
||||||
// can deadlock the socket
|
|
||||||
QThread::msleep(50);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSServer::onNewConnection()
|
void WSServer::onNewConnection()
|
||||||
@ -130,10 +126,6 @@ void WSServer::textMessageReceived(QString message)
|
|||||||
{
|
{
|
||||||
WSRequestHandler handler(pSocket);
|
WSRequestHandler handler(pSocket);
|
||||||
handler.processIncomingMessage(message);
|
handler.processIncomingMessage(message);
|
||||||
|
|
||||||
// Dirty hack because several quick successive calls to sendTextMessage()
|
|
||||||
// can deadlock the socket
|
|
||||||
QThread::msleep(50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user