mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
base: Add starting WebSocketServer files
This commit is contained in:
@ -66,11 +66,13 @@ configure_file(
|
|||||||
set(obs-websocket_SOURCES
|
set(obs-websocket_SOURCES
|
||||||
src/obs-websocket.cpp
|
src/obs-websocket.cpp
|
||||||
src/Config.cpp
|
src/Config.cpp
|
||||||
|
src/WebSocketServer.cpp
|
||||||
src/forms/SettingsDialog.cpp)
|
src/forms/SettingsDialog.cpp)
|
||||||
|
|
||||||
set(obs-websocket_HEADERS
|
set(obs-websocket_HEADERS
|
||||||
src/obs-websocket.h
|
src/obs-websocket.h
|
||||||
src/Config.h
|
src/Config.h
|
||||||
|
src/WebSocketServer.h
|
||||||
src/forms/SettingsDialog.h)
|
src/forms/SettingsDialog.h)
|
||||||
|
|
||||||
|
|
||||||
|
1
src/WebSocketServer.cpp
Normal file
1
src/WebSocketServer.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "WebSocketServer.h"
|
11
src/WebSocketServer.h
Normal file
11
src/WebSocketServer.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class WebSocketServer : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
;
|
||||||
|
};
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <obs-module.h>
|
||||||
#include <obs-frontend-api.h>
|
#include <obs-frontend-api.h>
|
||||||
#include <QtWidgets/QMessageBox>
|
#include <QtWidgets/QMessageBox>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "obs-websocket.h"
|
#include "obs-websocket.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "WebSocketServer.h"
|
||||||
#include "forms/SettingsDialog.h"
|
#include "forms/SettingsDialog.h"
|
||||||
|
|
||||||
// Auto release definitions
|
// Auto release definitions
|
||||||
@ -18,7 +19,8 @@ void ___data_array_dummy_addref(obs_data_array_t*) {}
|
|||||||
void ___output_dummy_addref(obs_output_t*) {}
|
void ___output_dummy_addref(obs_output_t*) {}
|
||||||
|
|
||||||
void ___data_item_dummy_addref(obs_data_item_t*) {}
|
void ___data_item_dummy_addref(obs_data_item_t*) {}
|
||||||
void ___data_item_release(obs_data_item_t* dataItem) {
|
void ___data_item_release(obs_data_item_t* dataItem)
|
||||||
|
{
|
||||||
obs_data_item_release(&dataItem);
|
obs_data_item_release(&dataItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,9 +29,11 @@ OBS_DECLARE_MODULE()
|
|||||||
OBS_MODULE_USE_DEFAULT_LOCALE("obs-websocket", "en-US")
|
OBS_MODULE_USE_DEFAULT_LOCALE("obs-websocket", "en-US")
|
||||||
|
|
||||||
ConfigPtr _config;
|
ConfigPtr _config;
|
||||||
|
WebSocketServerPtr _webSocketServer;
|
||||||
SettingsDialog *_settingsDialog = nullptr;
|
SettingsDialog *_settingsDialog = nullptr;
|
||||||
|
|
||||||
bool obs_module_load(void) {
|
bool obs_module_load(void)
|
||||||
|
{
|
||||||
blog(LOG_INFO, "you can haz websockets (version %s)", OBS_WEBSOCKET_VERSION);
|
blog(LOG_INFO, "you can haz websockets (version %s)", OBS_WEBSOCKET_VERSION);
|
||||||
blog(LOG_INFO, "Qt version (compile-time): %s | Qt version (run-time): %s",
|
blog(LOG_INFO, "Qt version (compile-time): %s | Qt version (run-time): %s",
|
||||||
QT_VERSION_STR, qVersion());
|
QT_VERSION_STR, qVersion());
|
||||||
@ -37,6 +41,8 @@ bool obs_module_load(void) {
|
|||||||
_config = ConfigPtr(new Config());
|
_config = ConfigPtr(new Config());
|
||||||
_config->Load();
|
_config->Load();
|
||||||
|
|
||||||
|
_webSocketServer = WebSocketServerPtr(new WebSocketServer());
|
||||||
|
|
||||||
obs_frontend_push_ui_translation(obs_module_get_string);
|
obs_frontend_push_ui_translation(obs_module_get_string);
|
||||||
QMainWindow* mainWindow = (QMainWindow*)obs_frontend_get_main_window();
|
QMainWindow* mainWindow = (QMainWindow*)obs_frontend_get_main_window();
|
||||||
_settingsDialog = new SettingsDialog(mainWindow);
|
_settingsDialog = new SettingsDialog(mainWindow);
|
||||||
@ -52,11 +58,18 @@ bool obs_module_load(void) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void obs_module_unload() {
|
void obs_module_unload()
|
||||||
|
{
|
||||||
_config.reset();
|
_config.reset();
|
||||||
blog(LOG_INFO, "Finished shutting down.");
|
blog(LOG_INFO, "Finished shutting down.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigPtr GetConfig() {
|
ConfigPtr GetConfig()
|
||||||
|
{
|
||||||
return _config;
|
return _config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebSocketServerPtr GetWebSocketServer()
|
||||||
|
{
|
||||||
|
return _webSocketServer;
|
||||||
|
}
|
@ -31,4 +31,9 @@ using OBSDataItemAutoRelease =
|
|||||||
class Config;
|
class Config;
|
||||||
typedef std::shared_ptr<Config> ConfigPtr;
|
typedef std::shared_ptr<Config> ConfigPtr;
|
||||||
|
|
||||||
|
class WebSocketServer;
|
||||||
|
typedef std::shared_ptr<WebSocketServer> WebSocketServerPtr;
|
||||||
|
|
||||||
ConfigPtr GetConfig();
|
ConfigPtr GetConfig();
|
||||||
|
|
||||||
|
WebSocketServerPtr GetWebSocketServer();
|
Reference in New Issue
Block a user