Removed TransitionEnd event + changed TransitionBegin triggering

This commit is contained in:
Palakis 2017-02-28 16:01:06 +01:00
parent 1ebb6f9257
commit 6f39da20a9
4 changed files with 17 additions and 39 deletions

View File

@ -17,7 +17,6 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
- ["TransitionDurationChanged"](#transitiondurationchanged)
- ["TransitionListChanged"](#transitionlistchanged)
- ["TransitionBegin"](#transitionbegin)
- ["TransitionEnd"](#transitionend)
- ["ProfileChanged"](#profilechanged)
- ["ProfileListChanged"](#profilelistchanged)
- ["StreamStarting"](#streamstarting)
@ -109,12 +108,7 @@ The list of available transitions has been modified (Transitions have been added
---
#### "TransitionBegin"
A non-fixed transition has begun.
---
#### "TransitionEnd"
A non-fixed transition has ended.
A transition other than "Cut" has begun.
---

View File

@ -22,6 +22,20 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include "Utils.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)
{
_srv = srv;
@ -147,12 +161,10 @@ void WSEvents::broadcastUpdate(const char *updateType, obs_data_t *additionalFie
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);
signal_handler_connect(transition_handler, "transition_start", OnTransitionBegin, this);
signal_handler_connect(transition_handler, "transition_stop", OnTransitionEnd, this);
}
signal_handler_connect(transition_handler, "transition_start", OnTransitionBegin, this); }
else
{
transition_handler = nullptr;
@ -193,7 +205,6 @@ void WSEvents::OnTransitionChange()
if (transition_handler)
{
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();
@ -370,21 +381,4 @@ void WSEvents::OnTransitionBegin(void* param, calldata_t* data)
instance->broadcastUpdate("TransitionBegin");
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");
}

View File

@ -72,8 +72,6 @@ class WSEvents : public QObject
void OnExit();
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

View File

@ -97,10 +97,6 @@ void WSServer::broadcast(QString message)
}
_clMutex.unlock();
// Dirty hack because several quick successive calls to sendTextMessage()
// can deadlock the socket
QThread::msleep(50);
}
void WSServer::onNewConnection()
@ -130,10 +126,6 @@ void WSServer::textMessageReceived(QString message)
{
WSRequestHandler handler(pSocket);
handler.processIncomingMessage(message);
// Dirty hack because several quick successive calls to sendTextMessage()
// can deadlock the socket
QThread::msleep(50);
}
}