refactoring and cleanup (#2)

* make hyperion to singelton.
remove arguments for config and hyperion - both are gettable via Hyperion::getInstance

* refactor hyperiond

* remove qt4 comapt
make zeroconf mandatory
refactor hyperiond

* xbmcchecker is now a singleton

* cleanup in hyperiond
zeroconf switchable between static and shared linking

* fix xbmcchecker
This commit is contained in:
redPanther
2016-06-17 01:25:40 +02:00
committed by brindosch
parent 5206202568
commit 88fbc4dfde
51 changed files with 507 additions and 723 deletions

View File

@@ -6,20 +6,12 @@ SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc)
add_subdirectory(hyperion)
add_subdirectory(blackborder)
add_subdirectory(jsonserver)
add_subdirectory(protoserver)
if (ENABLE_ZEROCONF)
add_subdirectory(bonjour)
endif (ENABLE_ZEROCONF)
add_subdirectory(bonjour)
add_subdirectory(boblightserver)
add_subdirectory(leddevice)
add_subdirectory(utils)
add_subdirectory(xbmcvideochecker)
add_subdirectory(effectengine)
add_subdirectory(grabber)
if(ENABLE_QT5)
add_subdirectory(webconfig)
endif()
add_subdirectory(webconfig)

View File

@@ -60,11 +60,7 @@ void BoblightClientConnection::readData()
while(bytes > 0)
{
// create message string (strip the newline)
#ifdef ENABLE_QT5
QString message = QString::fromLatin1(_receiveBuffer.data(), bytes-1);
#else
QString message = QString::fromAscii(_receiveBuffer.data(), bytes-1);
#endif
// remove message data from buffer
_receiveBuffer = _receiveBuffer.mid(bytes);

View File

@@ -17,11 +17,7 @@ set(BoblightServer_SOURCES
${CURRENT_SOURCE_DIR}/BoblightClientConnection.cpp
)
if(ENABLE_QT5)
qt5_wrap_cpp(BoblightServer_HEADERS_MOC ${BoblightServer_QT_HEADERS})
else()
qt4_wrap_cpp(BoblightServer_HEADERS_MOC ${BoblightServer_QT_HEADERS})
endif()
qt5_wrap_cpp(BoblightServer_HEADERS_MOC ${BoblightServer_QT_HEADERS})
add_library(boblightserver
${BoblightServer_HEADERS}
@@ -30,9 +26,7 @@ add_library(boblightserver
${BoblightServer_HEADERS_MOC}
)
if(ENABLE_QT5)
qt5_use_modules(boblightserver Widgets)
endif()
qt5_use_modules(boblightserver Widgets)
target_link_libraries(boblightserver
hyperion

View File

@@ -19,13 +19,8 @@ set(Bonjour_SOURCES
set(Bonjour_RESOURCES
)
if(ENABLE_QT5)
qt5_wrap_cpp(Bonjour_HEADERS_MOC ${Bonjour_QT_HEADERS})
qt5_add_resources(Bonjour_RESOURCES_RCC ${Bonjour_RESOURCES} OPTIONS "-no-compress")
else(ENABLE_QT5)
qt4_wrap_cpp(Bonjour_HEADERS_MOC ${Bonjour_QT_HEADERS})
qt4_add_resources(Bonjour_RESOURCES_RCC ${Bonjour_RESOURCES} OPTIONS "-no-compress")
endif(ENABLE_QT5)
add_library(bonjour
${Bonjour_HEADERS}
@@ -36,17 +31,29 @@ add_library(bonjour
${Bonjour_RESOURCES_RCC}
)
if(ENABLE_QT5)
qt5_use_modules(bonjour Widgets Network)
endif(ENABLE_QT5)
target_link_libraries(bonjour
hyperion
hyperion-utils
${QT_LIBRARIES})
set(USE_SHARED_AVAHI_LIBS OFF CACHE BOOL "use avahi libraries from system")
if (USE_SHARED_AVAHI_LIBS)
target_link_libraries(bonjour
dns_sd
avahi-client
avahi-common
avahi-core
# avahi-qt4
dbus-1)
else()
target_link_libraries(bonjour
libdns_sd.a
libavahi-client.a
libavahi-common.a
libavahi-core.a
libavahi-qt4.a
libdbus-1.a
hyperion
hyperion-utils
${QT_LIBRARIES})
# libavahi-qt4.a
libdbus-1.a)
endif()

View File

@@ -1,15 +0,0 @@
HEADERS = server.h \
bonjourserviceregister.h
SOURCES = server.cpp \
main.cpp \
bonjourserviceregister.cpp
QT += network
!mac:x11:LIBS+=-ldns_sd
win32 {
LIBS+=-ldnssd
# Add your path to bonjour here.
LIBPATH=C:/Temp/mDNSResponder-107.6/mDNSWindows/DLL/Debug
INCLUDEPATH += c:/Temp/mDNSResponder-107.6/mDNSShared
}

View File

@@ -28,13 +28,8 @@ SET(EffectEngineSOURCES
set(EffectEngine_RESOURCES ${CURRENT_SOURCE_DIR}/EffectEngine.qrc)
if(ENABLE_QT5)
QT5_WRAP_CPP(EffectEngineHEADERS_MOC ${EffectEngineQT_HEADERS})
qt5_add_resources(EffectEngine_RESOURCES_RCC ${EffectEngine_RESOURCES} OPTIONS "-no-compress")
else()
QT4_WRAP_CPP(EffectEngineHEADERS_MOC ${EffectEngineQT_HEADERS})
qt4_add_resources(EffectEngine_RESOURCES_RCC ${EffectEngine_RESOURCES} OPTIONS "-no-compress")
endif()
QT5_WRAP_CPP(EffectEngineHEADERS_MOC ${EffectEngineQT_HEADERS})
qt5_add_resources(EffectEngine_RESOURCES_RCC ${EffectEngine_RESOURCES} OPTIONS "-no-compress")
add_library(effectengine
${EffectEngineHEADERS}
@@ -44,9 +39,7 @@ add_library(effectengine
${EffectEngineSOURCES}
)
if(ENABLE_QT5)
qt5_use_modules(effectengine Widgets)
endif()
qt5_use_modules(effectengine Widgets)
target_link_libraries(effectengine
hyperion

View File

@@ -98,11 +98,7 @@ const std::list<ActiveEffectDefinition> &EffectEngine::getActiveEffects()
bool EffectEngine::loadEffectDefinition(const std::string &path, const std::string &effectConfigFile, EffectDefinition & effectDefinition)
{
#ifdef ENABLE_QT5
std::string fileName = path + QDir::separator().toLatin1() + effectConfigFile;
#else
std::string fileName = path + QDir::separator().toAscii() + effectConfigFile;
#endif
std::ifstream file(fileName.c_str());
if (!file.is_open())
@@ -137,11 +133,7 @@ bool EffectEngine::loadEffectDefinition(const std::string &path, const std::stri
// setup the definition
effectDefinition.name = config["name"].asString();
#ifdef ENABLE_QT5
effectDefinition.script = path + QDir::separator().toLatin1() + config["script"].asString();
#else
effectDefinition.script = path + QDir::separator().toAscii() + config["script"].asString();
#endif
effectDefinition.args = config["args"];
// return succes //BLACKLIST OUTPUT TO LOG (Spam). This is more a effect development thing and the list gets longer and longer

View File

@@ -12,7 +12,7 @@
#include <grabber/AmlogicGrabber.h>
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority) :
_updateInterval_ms(1000/updateRate_Hz),
_timeout_ms(2 * _updateInterval_ms),
_priority(priority),
@@ -20,8 +20,8 @@ AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeig
_image(grabWidth, grabHeight),
_frameGrabber(new AmlogicGrabber(grabWidth, grabHeight)),
_processor(ImageProcessorFactory::getInstance().newImageProcessor()),
_ledColors(hyperion->getLedCount(), ColorRgb{0,0,0}),
_hyperion(hyperion)
_ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0}),
_hyperion(Hyperion::getInstance())
{
// Configure the timer to generate events every n milliseconds
_timer.setInterval(_updateInterval_ms);

View File

@@ -15,11 +15,7 @@ SET(AmlogicSOURCES
${CURRENT_SOURCE_DIR}/AmlogicGrabber.cpp
)
if(ENABLE_QT5)
QT5_WRAP_CPP(AmlogicHEADERS_MOC ${AmlogicQT_HEADERS})
else(ENABLE_QT5)
QT4_WRAP_CPP(AmlogicHEADERS_MOC ${AmlogicQT_HEADERS})
endif(ENABLE_QT5)
add_library(amlogic-grabber
${AmlogicHEADERS}

View File

@@ -21,11 +21,7 @@ SET(DispmanxGrabberSOURCES
${CURRENT_SOURCE_DIR}/DispmanxFrameGrabber.cpp
)
if(ENABLE_QT5)
QT5_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS})
else()
QT4_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS})
endif()
QT5_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS})
add_library(dispmanx-grabber
${DispmanxGrabberHEADERS}

View File

@@ -12,7 +12,7 @@
#include <grabber/DispmanxFrameGrabber.h>
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority) :
_updateInterval_ms(1000/updateRate_Hz),
_timeout_ms(2 * _updateInterval_ms),
_priority(priority),
@@ -20,8 +20,8 @@ DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHe
_image(grabWidth, grabHeight),
_frameGrabber(new DispmanxFrameGrabber(grabWidth, grabHeight)),
_processor(ImageProcessorFactory::getInstance().newImageProcessor()),
_ledColors(hyperion->getLedCount(), ColorRgb{0,0,0}),
_hyperion(hyperion)
_ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0}),
_hyperion(Hyperion::getInstance())
{
// Configure the timer to generate events every n milliseconds
_timer.setInterval(_updateInterval_ms);

View File

@@ -21,11 +21,7 @@ SET(FramebufferGrabberSOURCES
${CURRENT_SOURCE_DIR}/FramebufferFrameGrabber.cpp
)
if(ENABLE_QT5)
QT5_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS})
else()
QT4_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS})
endif()
QT5_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS})
add_library(framebuffer-grabber
${FramebufferGrabberHEADERS}

View File

@@ -7,7 +7,7 @@
#include <grabber/FramebufferWrapper.h>
#include <grabber/FramebufferFrameGrabber.h>
FramebufferWrapper::FramebufferWrapper(const std::string & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
FramebufferWrapper::FramebufferWrapper(const std::string & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority) :
_updateInterval_ms(1000/updateRate_Hz),
_timeout_ms(2 * _updateInterval_ms),
_priority(priority),
@@ -15,8 +15,8 @@ FramebufferWrapper::FramebufferWrapper(const std::string & device, const unsigne
_image(grabWidth, grabHeight),
_frameGrabber(new FramebufferFrameGrabber(device, grabWidth, grabHeight)),
_processor(ImageProcessorFactory::getInstance().newImageProcessor()),
_ledColors(hyperion->getLedCount(), ColorRgb{0,0,0}),
_hyperion(hyperion)
_ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0}),
_hyperion(Hyperion::getInstance())
{
// Configure the timer to generate events every n milliseconds
_timer.setInterval(_updateInterval_ms);

View File

@@ -16,11 +16,7 @@ SET(OsxGrabberSOURCES
${CURRENT_SOURCE_DIR}/OsxFrameGrabber.cpp
)
if(ENABLE_QT5)
QT5_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
else()
QT4_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
endif()
QT5_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
add_library(osx-grabber
${OsxGrabberHEADERS}

View File

@@ -7,7 +7,7 @@
#include <grabber/OsxWrapper.h>
#include <grabber/OsxFrameGrabber.h>
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority) :
_updateInterval_ms(1000/updateRate_Hz),
_timeout_ms(2 * _updateInterval_ms),
_priority(priority),
@@ -15,8 +15,8 @@ OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const u
_image(grabWidth, grabHeight),
_frameGrabber(new OsxFrameGrabber(display, grabWidth, grabHeight)),
_processor(ImageProcessorFactory::getInstance().newImageProcessor()),
_ledColors(hyperion->getLedCount(), ColorRgb{0,0,0}),
_hyperion(hyperion)
_ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0}),
_hyperion(Hyperion::getInstance())
{
// Configure the timer to generate events every n milliseconds
_timer.setInterval(_updateInterval_ms);

View File

@@ -16,11 +16,7 @@ SET(V4L2_SOURCES
${CURRENT_SOURCE_DIR}/V4L2Wrapper.cpp
)
if(ENABLE_QT5)
QT5_WRAP_CPP(V4L2_HEADERS_MOC ${V4L2_QT_HEADERS})
else()
QT4_WRAP_CPP(V4L2_HEADERS_MOC ${V4L2_QT_HEADERS})
endif()
QT5_WRAP_CPP(V4L2_HEADERS_MOC ${V4L2_QT_HEADERS})
add_library(v4l2-grabber
${V4L2_HEADERS}
@@ -29,9 +25,7 @@ add_library(v4l2-grabber
${V4L2_HEADERS_MOC}
)
if(ENABLE_QT5)
qt5_use_modules(v4l2-grabber Widgets)
endif(ENABLE_QT5)
target_link_libraries(v4l2-grabber
hyperion

View File

@@ -15,7 +15,6 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
double redSignalThreshold,
double greenSignalThreshold,
double blueSignalThreshold,
Hyperion *hyperion,
int hyperionPriority) :
_timeout_ms(1000),
_priority(hyperionPriority),
@@ -29,8 +28,8 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
pixelDecimation,
pixelDecimation),
_processor(ImageProcessorFactory::getInstance().newImageProcessor()),
_hyperion(hyperion),
_ledColors(hyperion->getLedCount(), ColorRgb{0,0,0}),
_hyperion(Hyperion::getInstance()),
_ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0}),
_timer()
{
// set the signal detection threshold of the grabber

View File

@@ -22,11 +22,7 @@ SET(X11_SOURCES
${CURRENT_SOURCE_DIR}/X11Grabber.cpp
)
if(ENABLE_QT5)
QT5_WRAP_CPP(X11_HEADERS_MOC ${X11_QT_HEADERS})
else()
QT4_WRAP_CPP(X11_HEADERS_MOC ${X11_QT_HEADERS})
endif()
QT5_WRAP_CPP(X11_HEADERS_MOC ${X11_QT_HEADERS})
add_library(x11-grabber
${X11_HEADERS}

View File

@@ -42,13 +42,8 @@ SET(Hyperion_RESOURCES
${CURRENT_SOURCE_DIR}/resource.qrc
)
if(ENABLE_QT5)
QT5_WRAP_CPP(Hyperion_HEADERS_MOC ${Hyperion_QT_HEADERS})
QT5_ADD_RESOURCES(Hyperion_RESOURCES_RCC ${Hyperion_RESOURCES} OPTIONS "-no-compress")
else()
QT4_WRAP_CPP(Hyperion_HEADERS_MOC ${Hyperion_QT_HEADERS})
QT4_ADD_RESOURCES(Hyperion_RESOURCES_RCC ${Hyperion_RESOURCES} OPTIONS "-no-compress")
endif()
QT5_WRAP_CPP(Hyperion_HEADERS_MOC ${Hyperion_QT_HEADERS})
QT5_ADD_RESOURCES(Hyperion_RESOURCES_RCC ${Hyperion_RESOURCES} OPTIONS "-no-compress")
add_library(hyperion
${Hyperion_HEADERS}
@@ -58,9 +53,7 @@ add_library(hyperion
${Hyperion_RESOURCES_RCC}
)
if(ENABLE_QT5)
qt5_use_modules(hyperion Widgets)
endif()
qt5_use_modules(hyperion Widgets)
target_link_libraries(hyperion
blackborder

View File

@@ -1,6 +1,7 @@
// STL includes
#include <cassert>
#include <exception>
// QT includes
#include <QDateTime>
@@ -31,6 +32,24 @@
// effect engine includes
#include <effectengine/EffectEngine.h>
Hyperion* Hyperion::_hyperion = nullptr;
Hyperion* Hyperion::initInstance(const Json::Value& jsonConfig, const std::string configFile)
{
if ( Hyperion::_hyperion != nullptr )
throw std::runtime_error("Hyperion::initInstance can be called only one time");
Hyperion::_hyperion = new Hyperion(jsonConfig,configFile);
return Hyperion::_hyperion;
}
Hyperion* Hyperion::getInstance()
{
if ( Hyperion::_hyperion == nullptr )
throw std::runtime_error("Hyperion::getInstance used without call of Hyperion::initInstance before");
return Hyperion::_hyperion;
}
ColorOrder Hyperion::createColorOrder(const Json::Value &deviceConfig)
{

View File

@@ -20,13 +20,9 @@ set(JsonServer_SOURCES
set(JsonServer_RESOURCES
${CURRENT_SOURCE_DIR}/JsonSchemas.qrc
)
if(ENABLE_QT5)
qt5_wrap_cpp(JsonServer_HEADERS_MOC ${JsonServer_QT_HEADERS})
qt5_add_resources(JsonServer_RESOURCES_RCC ${JsonServer_RESOURCES} OPTIONS "-no-compress")
else()
qt4_wrap_cpp(JsonServer_HEADERS_MOC ${JsonServer_QT_HEADERS})
qt4_add_resources(JsonServer_RESOURCES_RCC ${JsonServer_RESOURCES} OPTIONS "-no-compress")
endif()
qt5_wrap_cpp(JsonServer_HEADERS_MOC ${JsonServer_QT_HEADERS})
qt5_add_resources(JsonServer_RESOURCES_RCC ${JsonServer_RESOURCES} OPTIONS "-no-compress")
add_library(jsonserver
${JsonServer_HEADERS}
@@ -37,9 +33,7 @@ add_library(jsonserver
${JsonServer_RESOURCES_RCC}
)
if(ENABLE_QT5)
qt5_use_modules(jsonserver Widgets Network)
endif()
qt5_use_modules(jsonserver Widgets Network)
target_link_libraries(jsonserver
hyperion

View File

@@ -129,11 +129,7 @@ if(ENABLE_TINKERFORGE)
)
endif()
if(ENABLE_QT5)
QT5_WRAP_CPP(Leddevice_HEADERS_MOC ${Leddevice_QT_HEADERS})
else()
QT4_WRAP_CPP(Leddevice_HEADERS_MOC ${Leddevice_QT_HEADERS})
endif()
QT5_WRAP_CPP(Leddevice_HEADERS_MOC ${Leddevice_QT_HEADERS})
add_library(leddevice
@@ -143,9 +139,7 @@ add_library(leddevice
${Leddevice_SOURCES}
)
if(ENABLE_QT5)
qt5_use_modules(leddevice Widgets Network)
endif()
qt5_use_modules(leddevice Widgets Network)
target_link_libraries(leddevice
hyperion-utils

View File

@@ -34,11 +34,7 @@ protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS
${ProtoServer_PROTOS}
)
if(ENABLE_QT5)
qt5_wrap_cpp(ProtoServer_HEADERS_MOC ${ProtoServer_QT_HEADERS})
else()
qt4_wrap_cpp(ProtoServer_HEADERS_MOC ${ProtoServer_QT_HEADERS})
endif()
qt5_wrap_cpp(ProtoServer_HEADERS_MOC ${ProtoServer_QT_HEADERS})
add_library(protoserver
${ProtoServer_HEADERS}
@@ -49,9 +45,8 @@ add_library(protoserver
${ProtoServer_PROTO_SRCS}
${ProtoServer_PROTO_HDRS}
)
if(ENABLE_QT5)
qt5_use_modules(protoserver Widgets)
endif()
qt5_use_modules(protoserver Widgets)
target_link_libraries(protoserver
hyperion

View File

@@ -49,9 +49,7 @@ add_library(hyperion-utils
${CURRENT_SOURCE_DIR}/jsonschema/JsonSchemaChecker.cpp
)
if(ENABLE_QT5)
qt5_use_modules(hyperion-utils Widgets)
endif()
qt5_use_modules(hyperion-utils Widgets)
target_link_libraries(hyperion-utils
jsoncpp

View File

@@ -29,11 +29,7 @@ set(WebConfig_SOURCES
${CURRENT_SOURCE_DIR}/WebConfig.cpp
)
if(ENABLE_QT5)
qt5_wrap_cpp(WebConfig_HEADERS_MOC ${WebConfig_QT_HEADERS})
else()
qt4_wrap_cpp(WebConfigr_HEADERS_MOC ${WebConfig_QT_HEADERS})
endif()
qt5_wrap_cpp(WebConfig_HEADERS_MOC ${WebConfig_QT_HEADERS})
add_library(webconfig
${WebConfig_HEADERS}
@@ -42,9 +38,7 @@ add_library(webconfig
${WebConfig_HEADERS_MOC}
)
if(ENABLE_QT5)
qt5_use_modules(webconfig Widgets Network)
endif()
qt5_use_modules(webconfig Widgets Network)
target_link_libraries(webconfig
hyperion

View File

@@ -2,13 +2,13 @@
#include "StaticFileServing.h"
WebConfig::WebConfig(Hyperion *hyperion, QObject * parent)
WebConfig::WebConfig(QObject * parent)
: QObject(parent)
, _hyperion(hyperion)
, _port(WEBCONFIG_DEFAULT_PORT)
, _server(nullptr)
{
const Json::Value &config = hyperion->getJsonConfig();
_hyperion = Hyperion::getInstance();
const Json::Value &config = _hyperion->getJsonConfig();
_baseUrl = QString::fromStdString(WEBCONFIG_DEFAULT_PATH);
bool webconfigEnable = true;

View File

@@ -15,11 +15,7 @@ SET(XBMCVideoChecker_SOURCES
${CURRENT_SOURCE_DIR}/XBMCVideoChecker.cpp
)
if(ENABLE_QT5)
QT5_WRAP_CPP(XBMCVideoChecker_HEADERS_MOC ${XBMCVideoChecker_QT_HEADERS})
else()
QT4_WRAP_CPP(XBMCVideoChecker_HEADERS_MOC ${XBMCVideoChecker_QT_HEADERS})
endif()
QT5_WRAP_CPP(XBMCVideoChecker_HEADERS_MOC ${XBMCVideoChecker_QT_HEADERS})
add_library(xbmcvideochecker
${XBMCVideoChecker_HEADERS}
@@ -28,9 +24,7 @@ add_library(xbmcvideochecker
${XBMCVideoChecker_SOURCES}
)
if(ENABLE_QT5)
qt5_use_modules(xbmcvideochecker Widgets)
endif()
qt5_use_modules(xbmcvideochecker Widgets)
target_link_libraries(xbmcvideochecker
hyperion

View File

@@ -5,6 +5,24 @@
#include <xbmcvideochecker/XBMCVideoChecker.h>
XBMCVideoChecker* XBMCVideoChecker::_kodichecker = nullptr;
XBMCVideoChecker* XBMCVideoChecker::initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
{
if ( XBMCVideoChecker::_kodichecker != nullptr )
throw std::runtime_error("XBMCVideoChecker::initInstance can be called only one time");
XBMCVideoChecker::_kodichecker = new XBMCVideoChecker(address, port, grabVideo, grabPhoto, grabAudio, grabMenu, grabPause, grabScreensaver, enable3DDetection);
return XBMCVideoChecker::_kodichecker;
}
XBMCVideoChecker* XBMCVideoChecker::getInstance()
{
return XBMCVideoChecker::_kodichecker;
}
// Request player example:
// {"jsonrpc":"2.0","method":"Player.GetActivePlayers", "id":666}
// {"id":666,"jsonrpc":"2.0","result":[{"playerid":1,"type":"video"}]}