mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Added update type TransitionDurationChanged
This commit is contained in:
parent
42a80c6185
commit
e30e982ef0
@ -14,6 +14,7 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
|
|||||||
- ["SceneCollectionChanged"](#scenecollectionchanged)
|
- ["SceneCollectionChanged"](#scenecollectionchanged)
|
||||||
- ["SceneCollectionListChanged"](#scenecollectionlistchanged)
|
- ["SceneCollectionListChanged"](#scenecollectionlistchanged)
|
||||||
- ["SwitchTransition"](#switchtransition)
|
- ["SwitchTransition"](#switchtransition)
|
||||||
|
- ["TransitionDurationChanged"](#transitiondurationchanged)
|
||||||
- ["TransitionListChanged"](#transitionlistchanged)
|
- ["TransitionListChanged"](#transitionlistchanged)
|
||||||
- ["ProfileChanged"](#profilechanged)
|
- ["ProfileChanged"](#profilechanged)
|
||||||
- ["ProfileListChanged"](#profilelistchanged)
|
- ["ProfileListChanged"](#profilelistchanged)
|
||||||
@ -94,6 +95,12 @@ The active transition has been changed.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
#### "TransitionDurationChanged"
|
||||||
|
Triggered when the transition duration has changed.
|
||||||
|
- **"new-duration"** (integer) : new transition duration
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
#### "TransitionListChanged"
|
#### "TransitionListChanged"
|
||||||
The list of available transitions has been modified (Transitions have been added, removed, or renamed).
|
The list of available transitions has been modified (Transitions have been added, removed, or renamed).
|
||||||
|
|
||||||
|
19
Utils.cpp
19
Utils.cpp
@ -209,14 +209,18 @@ obs_data_array_t* Utils::GetProfiles()
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Utils::GetTransitionDuration()
|
QSpinBox* Utils::GetTransitionDurationControl()
|
||||||
{
|
{
|
||||||
QMainWindow *window = (QMainWindow*)obs_frontend_get_main_window();
|
QMainWindow *window = (QMainWindow*)obs_frontend_get_main_window();
|
||||||
QSpinBox* durationControl = window->findChild<QSpinBox*>("transitionDuration");
|
return window->findChild<QSpinBox*>("transitionDuration");
|
||||||
|
}
|
||||||
|
|
||||||
if (durationControl)
|
int Utils::GetTransitionDuration()
|
||||||
|
{
|
||||||
|
QSpinBox* control = GetTransitionDurationControl();
|
||||||
|
if (control)
|
||||||
{
|
{
|
||||||
return durationControl->value();
|
return control->value();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -226,12 +230,11 @@ int Utils::GetTransitionDuration()
|
|||||||
|
|
||||||
void Utils::SetTransitionDuration(int ms)
|
void Utils::SetTransitionDuration(int ms)
|
||||||
{
|
{
|
||||||
QMainWindow *window = (QMainWindow*)obs_frontend_get_main_window();
|
QSpinBox* control = GetTransitionDurationControl();
|
||||||
QSpinBox* durationControl = window->findChild<QSpinBox*>("transitionDuration");
|
|
||||||
|
|
||||||
if (durationControl && ms >= 0)
|
if (control && ms >= 0)
|
||||||
{
|
{
|
||||||
durationControl->setValue(ms);
|
control->setValue(ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
Utils.h
2
Utils.h
@ -19,6 +19,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
#ifndef UTILS_H
|
#ifndef UTILS_H
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
|
#include <QSpinBox>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <obs-module.h>
|
#include <obs-module.h>
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ class Utils
|
|||||||
static obs_data_array_t* GetSceneCollections();
|
static obs_data_array_t* GetSceneCollections();
|
||||||
static obs_data_array_t* GetProfiles();
|
static obs_data_array_t* GetProfiles();
|
||||||
|
|
||||||
|
static QSpinBox* GetTransitionDurationControl();
|
||||||
static int GetTransitionDuration();
|
static int GetTransitionDuration();
|
||||||
static void SetTransitionDuration(int ms);
|
static void SetTransitionDuration(int ms);
|
||||||
|
|
||||||
|
15
WSEvents.cpp
15
WSEvents.cpp
@ -19,7 +19,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
|
|
||||||
#include <util/platform.h>
|
#include <util/platform.h>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include "Utils.h"
|
||||||
#include "WSEvents.h"
|
#include "WSEvents.h"
|
||||||
|
|
||||||
WSEvents::WSEvents(WSServer *srv)
|
WSEvents::WSEvents(WSServer *srv)
|
||||||
@ -27,6 +27,9 @@ WSEvents::WSEvents(WSServer *srv)
|
|||||||
_srv = srv;
|
_srv = srv;
|
||||||
obs_frontend_add_event_callback(WSEvents::FrontendEventHandler, this);
|
obs_frontend_add_event_callback(WSEvents::FrontendEventHandler, this);
|
||||||
|
|
||||||
|
QSpinBox* duration_control = Utils::GetTransitionDurationControl();
|
||||||
|
connect(duration_control, SIGNAL(valueChanged(int)), this, SLOT(TransitionDurationChanged(int)));
|
||||||
|
|
||||||
QTimer *statusTimer = new QTimer();
|
QTimer *statusTimer = new QTimer();
|
||||||
connect(statusTimer, SIGNAL(timeout()), this, SLOT(StreamStatus()));
|
connect(statusTimer, SIGNAL(timeout()), this, SLOT(StreamStatus()));
|
||||||
statusTimer->start(2000); // equal to frontend's constant BITRATE_UPDATE_SECONDS
|
statusTimer->start(2000); // equal to frontend's constant BITRATE_UPDATE_SECONDS
|
||||||
@ -340,3 +343,13 @@ void WSEvents::StreamStatus()
|
|||||||
obs_data_release(data);
|
obs_data_release(data);
|
||||||
obs_output_release(stream_output);
|
obs_output_release(stream_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WSEvents::TransitionDurationChanged(int ms)
|
||||||
|
{
|
||||||
|
obs_data_t* fields = obs_data_create();
|
||||||
|
obs_data_set_int(fields, "new-duration", ms);
|
||||||
|
|
||||||
|
broadcastUpdate("TransitionDurationChanged", fields);
|
||||||
|
|
||||||
|
obs_data_release(fields);
|
||||||
|
}
|
@ -21,7 +21,6 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
#define WSEVENTS_H
|
#define WSEVENTS_H
|
||||||
|
|
||||||
#include <obs-frontend-api.h>
|
#include <obs-frontend-api.h>
|
||||||
|
|
||||||
#include "WSServer.h"
|
#include "WSServer.h"
|
||||||
|
|
||||||
class WSEvents : public QObject
|
class WSEvents : public QObject
|
||||||
@ -35,6 +34,7 @@ class WSEvents : public QObject
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void StreamStatus();
|
void StreamStatus();
|
||||||
|
void TransitionDurationChanged(int ms);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WSServer *_srv;
|
WSServer *_srv;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user