Skip to content

Commit ded6601

Browse files
Updates (#2)
* Align ini-Files to POEditor conventions * Allow full range of priorities * Update minimum OBS version * Fix Windows cache path * Address compile warning * Remove UI backup file * Readd en-GB.init * Streamline Code * cleanup * Address memory leaks reported by OBS * Artifacts for PR * Update socket states and related messages * Add clean-up for artifacts * Fix text Co-authored-by: Paulchen Panther <[email protected]>
1 parent 4a0ce1b commit ded6601

File tree

13 files changed

+149
-321
lines changed

13 files changed

+149
-321
lines changed

.github/workflows/cleanup.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Clean artifacts
2+
3+
# Run cleanup workflow at the end of every day
4+
on:
5+
schedule:
6+
- cron: '0 0 * * *'
7+
8+
jobs:
9+
clean:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: cleanup
13+
uses: kolpav/purge-artifacts-action@v1
14+
with:
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
expire-in: 7days # all artifacts max 7 days old

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
name: 'Linux 64bit'
77
runs-on: ubuntu-latest
88
env:
9-
minimum-obs-version: 25.0.0
9+
minimum-obs-version: 25.0.3
1010
project-name: hyperion-obs
1111
project-git: https://github.com/hyperion-project/hyperion-obs-plugin
1212
maintainer: hyperion-project.org
@@ -54,7 +54,7 @@ jobs:
5454
sudo mv ${{ github.workspace }}/plugin/*.deb ${{ github.workspace }}/plugin/${{ env.project-name }}.${{ env.VERSION }}.linux.x64.deb
5555
5656
- name: Upload plugin
57-
if: startsWith(github.event.ref, 'refs/tags')
57+
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'pull_request'
5858
uses: actions/upload-artifact@v2
5959
with:
6060
name: hyperion-obs
@@ -121,7 +121,7 @@ jobs:
121121
id: build-cache-obs
122122
uses: actions/cache@v1
123123
with:
124-
path: ${{ github.workspace }}/obs-studio/build
124+
path: ${{ github.workspace }}\obs-studio\build
125125
key: ${{ runner.os }}-build-cache-obs-${{ env.OBS_GIT_TAG }}
126126
restore-keys: ${{ runner.os }}-build-cache-obs-
127127

@@ -163,7 +163,7 @@ jobs:
163163
iscc .\build\Windows.iss /O. /F"hyperion-obs.${{ env.VERSION }}.windows.x64"
164164
165165
- name: Upload plugin
166-
if: startsWith(github.event.ref, 'refs/tags')
166+
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'pull_request'
167167
uses: actions/upload-artifact@v2
168168
with:
169169
name: 'hyperion-obs.${{ env.VERSION }}.windows.x64'

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
7070
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${qt_module_path}")
7171
endif()
7272

73+
if(NOT EXISTS ${OBS_SOURCE})
74+
if (DEFINED ENV{OBS_SOURCE})
75+
set(OBS_SOURCE $ENV{OBS_SOURCE})
76+
endif()
77+
endif()
78+
7379
set(OBS_SOURCE "" CACHE PATH "Where is the source code of OBS-Studio located")
7480
set(OBS_BUILD "" CACHE PATH "Where is the build directory of OBS-Studio located")
7581

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ git clone --recursive https://github.com/obsproject/obs-studio.git
5151
git clone --recursive https://github.com/hyperion-project/hyperion-obs-plugin.git
5252
cd hyperion-obs-plugin
5353
mkdir build && cd build
54-
cmake -DOBS_SOURCE=../../obs-studio -DCMAKE_INSTALL_PREFIX=/usr ..
54+
cmake -DOBS_SOURCE=../../obs-studio ..
5555
make -j $(nproc)
5656
sudo make install
5757
```

locale/de-DE.ini

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
UI.Menu="Hyperion Streaming"
2-
UI.Title="Ausgabe an Hyperion"
3-
UI.AutoStart="Starte automatisch"
4-
UI.AutoStartTip="Starte den Stream mit dem OBS-Start."
5-
UI.Address="Adresse"
6-
UI.AddressTip="Der Hostname oder die IP-Adresse (IPv4/IPv6) des Hyperion-Servers."
7-
UI.PortTip="Der beim Hyperion Server konfigurierte Flatbufferport [Standard:19400]."
8-
UI.Priority="Priorität"
9-
UI.PriorityTip="Mit welche Priorität der Stream beim Hyperion-Server empfangen wird [Standard:150]"
10-
UI.SizeDecimation="Ausgabereduzierungsfaktor"
11-
UI.SizeDecimationTip="Bildverkleinerung (Faktor) ausgehend von der ursprünglichen Größe. 1 für die unveränderte/ursprüngliche Größe."
12-
UI.StartTip="Starte Ausgabe an Hyperion"
13-
UI.StopTip="Stoppe Ausgabe an Hyperion"
1+
UI_Menu="Hyperion Streaming"
2+
UI_Title="Ausgabe an Hyperion"
3+
UI_AutoStart="Starte automatisch"
4+
UI_AutoStartTip="Starte den Stream mit dem OBS-Start."
5+
UI_Address="Adresse"
6+
UI_AddressTip="Der Hostname oder die IP-Adresse (IPv4/IPv6) des Hyperion-Servers."
7+
UI_PortTip="Der beim Hyperion Server konfigurierte Flatbufferport [Standard:19400]."
8+
UI_Priority="Priorität"
9+
UI_PriorityTip="Mit welche Priorität der Stream beim Hyperion-Server empfangen wird [Standard:150]"
10+
UI_SizeDecimation="Ausgabereduzierungsfaktor"
11+
UI_SizeDecimationTip="Bildverkleinerung (Faktor) ausgehend von der ursprünglichen Größe. 1 für die unveränderte/ursprüngliche Größe."
12+
UI_StartTip="Starte Ausgabe an Hyperion"
13+
UI_StopTip="Stoppe Ausgabe an Hyperion"

locale/en-GB.ini

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
UI.Menu="Hyperion Streaming"
2-
UI.Title="Stream to Hyperion"
3-
UI.AutoStart="Auto start"
4-
UI.AutoStartTip="Start streaming when OBS is started."
5-
UI.Address="Address"
6-
UI.AddressTip="The hostname or IP-address (IPv4 or IPv6) of the Hyperion server."
7-
UI.PortTip="The Flatbuffer port as configured at the Hyperion Server [Default:19400]."
8-
UI.Priority="Priority"
9-
UI.PriorityTip="With which priority the stream is received at the Hyperion server [Default:150]"
10-
UI.SizeDecimation="Output Decimation"
11-
UI.SizeDecimationTip="Scale the output image down by decimation factor. 1 means no decimation (keep original size)."
12-
UI.StartTip="Start streaming to Hyperion"
13-
UI.StopTip="Stop streaming to Hyperion"
1+
UI_Menu="Hyperion Streaming"
2+
UI_Title="Stream to Hyperion"
3+
UI_AutoStart="Auto start"
4+
UI_AutoStartTip="Start streaming when OBS is started."
5+
UI_Address="Address"
6+
UI_AddressTip="The hostname or IP-address (IPv4 or IPv6) of the Hyperion server."
7+
UI_PortTip="The Flatbuffer port as configured at the Hyperion Server [Default:19400]."
8+
UI_Priority="Priority"
9+
UI_PriorityTip="With which priority the stream is received at the Hyperion server [Default:150]"
10+
UI_SizeDecimation="Output Decimation"
11+
UI_SizeDecimationTip="Scale the output image down by decimation factor. 1 means no decimation (keep original size)."
12+
UI_StartTip="Start streaming to Hyperion"
13+
UI_StopTip="Stop streaming to Hyperion"

locale/en-US.ini

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
UI.Menu="Hyperion Streaming"
2-
UI.Title="Stream to Hyperion"
3-
UI.AutoStart="Auto start"
4-
UI.AutoStartTip="Start streaming when OBS is started."
5-
UI.Address="Address"
6-
UI.AddressTip="The hostname or IP-address (IPv4 or IPv6) of the Hyperion server."
7-
UI.PortTip="The Flatbuffer port as configured at the Hyperion Server [Default:19400]."
8-
UI.Priority="Priority"
9-
UI.PriorityTip="With which priority the stream is received at the Hyperion server [Default:150]"
10-
UI.SizeDecimation="Output Decimation"
11-
UI.SizeDecimationTip="Scale the output image down by decimation factor. 1 means no decimation (keep original size)."
12-
UI.StartTip="Start streaming to Hyperion"
13-
UI.StopTip="Stop streaming to Hyperion"
1+
UI_Menu="Hyperion Streaming"
2+
UI_Title="Stream to Hyperion"
3+
UI_AutoStart="Auto start"
4+
UI_AutoStartTip="Start streaming when OBS is started."
5+
UI_Address="Address"
6+
UI_AddressTip="The hostname or IP-address (IPv4 or IPv6) of the Hyperion server."
7+
UI_PortTip="The Flatbuffer port as configured at the Hyperion Server [Default:19400]."
8+
UI_Priority="Priority"
9+
UI_PriorityTip="With which priority the stream is received at the Hyperion server [Default:150]"
10+
UI_SizeDecimation="Output Decimation"
11+
UI_SizeDecimationTip="Scale the output image down by decimation factor. 1 means no decimation (keep original size)."
12+
UI_StartTip="Start streaming to Hyperion"
13+
UI_StopTip="Stop streaming to Hyperion"

src/FlatBufferConnection.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,32 @@ void FlatBufferConnection::connectToHost()
118118

119119
void FlatBufferConnection::sendMessage(const uint8_t* buffer, uint32_t size)
120120
{
121-
// print out connection message only when state is changed
122-
if (_socket.state() != _prevSocketState )
121+
QAbstractSocket::SocketState socketState = _socket.state();
122+
if (socketState != _prevSocketState )
123123
{
124124
_registered = false;
125-
switch (_socket.state() )
125+
switch (socketState)
126126
{
127127
case QAbstractSocket::UnconnectedState:
128-
emit logMessage(QString("No connection to Hyperion: %1:%2").arg(_host).arg(_port));
128+
emit logMessage(QString("No connection to %1, port: %2").arg(_host).arg(_port));
129+
break;
130+
case QAbstractSocket::ConnectingState:
131+
emit logMessage(QString("Connecting to %1, port: %2").arg(_host).arg(_port));
129132
break;
130133
case QAbstractSocket::ConnectedState:
131-
emit logMessage(QString("Connected to Hyperion: %1:%2").arg(_host).arg(_port));
134+
emit logMessage(QString("Connected to %1, port: %2").arg(_host).arg(_port));
135+
break;
136+
case QAbstractSocket::ClosingState:
137+
emit logMessage(QString("Closing connection to %1, port: %2").arg(_host).arg(_port));
132138
break;
133139
default:
134-
emit logMessage(QString("Connecting to Hyperion: %1:%2").arg(_host).arg(_port));
135140
break;
141+
136142
}
137-
_prevSocketState = _socket.state();
143+
_prevSocketState = socketState;
138144
}
139145

140-
if (_socket.state() == QAbstractSocket::ConnectedState)
146+
if (socketState == QAbstractSocket::ConnectedState)
141147
{
142148
if(!_registered)
143149
{

src/HyperionProperties.cpp

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
#define CONFIG_SECTION "HyperionOutput"
88

9+
static void logger_message(void *data, calldata_t * cd)
10+
{
11+
auto *page = static_cast<HyperionProperties*>(data);
12+
const char* msg = calldata_string(cd, "msg");
13+
page->appendLogText(msg);
14+
}
15+
916
HyperionProperties::HyperionProperties(QWidget *parent)
1017
: QDialog(parent)
1118
, ui(new Ui::HyperionProperties)
@@ -42,9 +49,14 @@ HyperionProperties::HyperionProperties(QWidget *parent)
4249
int sizeDecimation = static_cast<int>(config_get_int(config, CONFIG_SECTION, OBS_SETTINGS_SIZEDECIMATION));
4350
ui->SizeDecimation->setValue(sizeDecimation);
4451
}
45-
52+
4653
enableStart(true);
4754

55+
signal_handler_t *handler = hyperion_get_signal_handler();
56+
signal_handler_connect(handler, "start", OnStartSignal , this);
57+
signal_handler_connect(handler, "stop", OnStopSignal , this);
58+
signal_handler_connect(handler, "log", logger_message, this);
59+
4860
connect(ui->ButtonStart, &QPushButton::clicked, this, &HyperionProperties::saveSettings);
4961
connect(ui->AutoStart, &QCheckBox::stateChanged, this, &HyperionProperties::saveSettings);
5062

@@ -59,25 +71,36 @@ HyperionProperties::HyperionProperties(QWidget *parent)
5971

6072
HyperionProperties::~HyperionProperties()
6173
{
74+
signal_handler_t *handler = hyperion_get_signal_handler();
75+
signal_handler_disconnect(handler, "start", OnStartSignal , this);
76+
signal_handler_disconnect(handler, "stop", OnStopSignal , this);
77+
signal_handler_disconnect(handler, "log", logger_message, this);
78+
6279
saveSettings();
6380
hyperion_release();
81+
6482
delete ui;
6583
}
6684

6785
void HyperionProperties::enableStart(bool enable)
6886
{
6987
ui->ButtonStart->setEnabled(enable);
7088
ui->ButtonStop->setEnabled(!enable);
89+
90+
ui->Address->setEnabled(enable);
91+
ui->Port->setEnabled(enable);
92+
ui->Priority->setEnabled(enable);
93+
ui->SizeDecimation->setEnabled(enable);
7194
}
7295

7396
void HyperionProperties::appendLogText(const char *msg)
7497
{
75-
ui->WarningText->appendPlainText(msg);
98+
ui->LogText->appendPlainText(msg);
7699
}
77100

78101
void HyperionProperties::clearLog()
79102
{
80-
ui->WarningText->clear();
103+
ui->LogText->clear();
81104
}
82105

83106
void HyperionProperties::saveSettings()
@@ -106,42 +129,24 @@ void HyperionProperties::onStart()
106129
int priority = ui->Priority->value();
107130
int sizeDecimation = ui->SizeDecimation->value();
108131

109-
signal_handler_t *handler = hyperion_get_signal_handler();
110-
signal_handler_connect(handler, "stop", output_stopped , this);
111-
signal_handler_connect(handler, "log", logger_message, this);
112-
113-
enableStart(false);
114-
clearLog();
115132
hyperion_start_streaming(address, port, priority, sizeDecimation);
116133
}
117134

118135
void HyperionProperties::onStop()
119136
{
137+
enableStart(true);
120138
hyperion_stop_streaming();
121139
}
122140

123-
static void output_stopped(void *data, calldata_t *cd)
141+
void HyperionProperties::OnStartSignal(void *data, calldata_t *cd)
124142
{
125-
auto *page = static_cast<HyperionProperties*>(data);
126-
auto *output = static_cast<obs_output_t*>(calldata_ptr(cd, "output"));
127-
bool running = calldata_bool(cd, "running");
128-
const char* msg = calldata_string(cd, "msg");
129-
130-
if (running)
131-
{
132-
page->appendLogText(msg);
133-
}
134-
135-
signal_handler_t *handler = obs_output_get_signal_handler(output);
136-
page->enableStart(true);
137-
signal_handler_disconnect(handler, "stop", output_stopped, page);
138-
signal_handler_disconnect(handler, "log", logger_message, page);
143+
auto page = (HyperionProperties *)data;
144+
page->clearLog();
145+
page->enableStart(false);
139146
}
140147

141-
static void logger_message(void *data, calldata_t *cd)
148+
void HyperionProperties::OnStopSignal(void *data, calldata_t *cd)
142149
{
143-
UNUSED_PARAMETER(cd);
144-
auto *page = static_cast<HyperionProperties*>(data);
145-
const char* msg = calldata_string(cd, "msg");
146-
page->appendLogText(msg);
150+
auto page = (HyperionProperties *)data;
151+
page->enableStart(true);
147152
}

src/HyperionProperties.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public Q_SLOTS:
3232

3333
private:
3434
Ui::HyperionProperties *ui;
35-
};
3635

37-
static void output_stopped(void *data, calldata_t *cd);
38-
static void logger_message(void *data, calldata_t *cd);
36+
static void OnStartSignal(void *data, calldata_t *cd);
37+
static void OnStopSignal(void *data, calldata_t *cd);
38+
};
3939

4040
#endif // HYPERIONPROPERTIES_H

0 commit comments

Comments
 (0)