mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
implement proto forwarding for hyperiond internal v4l2 grabber
cleanup Former-commit-id: 669f139386633e3435cdc33639134819464afd4d
This commit is contained in:
parent
738bafee99
commit
629461b944
@ -44,6 +44,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void emitColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
void emitColors(int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms);
|
||||||
|
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void newFrame(const Image<ColorRgb> & image);
|
void newFrame(const Image<ColorRgb> & image);
|
||||||
|
@ -27,7 +27,6 @@ public:
|
|||||||
|
|
||||||
void addJsonSlave(std::string slave);
|
void addJsonSlave(std::string slave);
|
||||||
void addProtoSlave(std::string slave);
|
void addProtoSlave(std::string slave);
|
||||||
void sendMessage();
|
|
||||||
|
|
||||||
QStringList getProtoSlaves();
|
QStringList getProtoSlaves();
|
||||||
QList<MessageForwarder::JsonSlaveAddress> getJsonSlaves();
|
QList<MessageForwarder::JsonSlaveAddress> getJsonSlaves();
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
// Hyperion includes
|
// Hyperion includes
|
||||||
#include <hyperion/Hyperion.h>
|
#include <hyperion/Hyperion.h>
|
||||||
|
|
||||||
|
// hyperion includes
|
||||||
|
#include <utils/Image.h>
|
||||||
|
#include <utils/ColorRgb.h>
|
||||||
|
|
||||||
// forward decl
|
// forward decl
|
||||||
class ProtoClientConnection;
|
class ProtoClientConnection;
|
||||||
class ProtoConnection;
|
class ProtoConnection;
|
||||||
@ -43,6 +47,9 @@ public:
|
|||||||
///
|
///
|
||||||
uint16_t getPort() const;
|
uint16_t getPort() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void sendImageToProtoSlaves(int priority, const Image<ColorRgb> & image, int duration_ms);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
///
|
///
|
||||||
/// Slot which is called when a client tries to create a new connection
|
/// Slot which is called when a client tries to create a new connection
|
||||||
|
@ -94,6 +94,9 @@ void V4L2Wrapper::newFrame(const Image<ColorRgb> &image)
|
|||||||
// process the new image
|
// process the new image
|
||||||
_processor->process(image, _ledColors);
|
_processor->process(image, _ledColors);
|
||||||
|
|
||||||
|
// forward to other hyperions
|
||||||
|
emit emitImage(_priority, image, _timeout_ms);
|
||||||
|
|
||||||
// send colors to Hyperion
|
// send colors to Hyperion
|
||||||
emit emitColors(_priority, _ledColors, _timeout_ms);
|
emit emitColors(_priority, _ledColors, _timeout_ms);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/hyperion)
|
|||||||
# Group the headers that go through the MOC compiler
|
# Group the headers that go through the MOC compiler
|
||||||
SET(Hyperion_QT_HEADERS
|
SET(Hyperion_QT_HEADERS
|
||||||
${CURRENT_HEADER_DIR}/Hyperion.h
|
${CURRENT_HEADER_DIR}/Hyperion.h
|
||||||
${CURRENT_HEADER_DIR}/MessageForwarder.h
|
|
||||||
|
|
||||||
${CURRENT_SOURCE_DIR}/LinearColorSmoothing.h
|
${CURRENT_SOURCE_DIR}/LinearColorSmoothing.h
|
||||||
)
|
)
|
||||||
@ -19,6 +18,7 @@ SET(Hyperion_HEADERS
|
|||||||
${CURRENT_HEADER_DIR}/PriorityMuxer.h
|
${CURRENT_HEADER_DIR}/PriorityMuxer.h
|
||||||
|
|
||||||
${CURRENT_SOURCE_DIR}/MultiColorTransform.h
|
${CURRENT_SOURCE_DIR}/MultiColorTransform.h
|
||||||
|
${CURRENT_HEADER_DIR}/MessageForwarder.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(Hyperion_SOURCES
|
SET(Hyperion_SOURCES
|
||||||
|
@ -35,10 +35,6 @@ void MessageForwarder::addProtoSlave(std::string slave)
|
|||||||
_protoSlaves << QString(slave.c_str());
|
_protoSlaves << QString(slave.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageForwarder::sendMessage()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList MessageForwarder::getProtoSlaves()
|
QStringList MessageForwarder::getProtoSlaves()
|
||||||
{
|
{
|
||||||
return _protoSlaves;
|
return _protoSlaves;
|
||||||
|
@ -70,6 +70,12 @@ void ProtoServer::newMessage(const proto::HyperionRequest * message)
|
|||||||
_proxy_connections.at(i)->sendMessage(*message);
|
_proxy_connections.at(i)->sendMessage(*message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProtoServer::sendImageToProtoSlaves(int priority, const Image<ColorRgb> & image, int duration_ms)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _proxy_connections.size(); ++i)
|
||||||
|
_proxy_connections.at(i)->setImage(image, priority, duration_ms);
|
||||||
|
}
|
||||||
|
|
||||||
void ProtoServer::closedConnection(ProtoClientConnection *connection)
|
void ProtoServer::closedConnection(ProtoClientConnection *connection)
|
||||||
{
|
{
|
||||||
std::cout << "Proto connection closed" << std::endl;
|
std::cout << "Proto connection closed" << std::endl;
|
||||||
|
@ -189,6 +189,39 @@ int main(int argc, char** argv)
|
|||||||
std::cout << "XBMC video checker created and started" << std::endl;
|
std::cout << "XBMC video checker created and started" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- network services -----
|
||||||
|
|
||||||
|
// Create Json server if configuration is present
|
||||||
|
JsonServer * jsonServer = nullptr;
|
||||||
|
if (config.isMember("jsonServer"))
|
||||||
|
{
|
||||||
|
const Json::Value & jsonServerConfig = config["jsonServer"];
|
||||||
|
jsonServer = new JsonServer(&hyperion, jsonServerConfig["port"].asUInt());
|
||||||
|
std::cout << "Json server created and started on port " << jsonServer->getPort() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_PROTOBUF
|
||||||
|
// Create Proto server if configuration is present
|
||||||
|
ProtoServer * protoServer = nullptr;
|
||||||
|
if (config.isMember("protoServer"))
|
||||||
|
{
|
||||||
|
const Json::Value & protoServerConfig = config["protoServer"];
|
||||||
|
protoServer = new ProtoServer(&hyperion, protoServerConfig["port"].asUInt() );
|
||||||
|
std::cout << "Proto server created and started on port " << protoServer->getPort() << std::endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Create Boblight server if configuration is present
|
||||||
|
BoblightServer * boblightServer = nullptr;
|
||||||
|
if (config.isMember("boblightServer"))
|
||||||
|
{
|
||||||
|
const Json::Value & boblightServerConfig = config["boblightServer"];
|
||||||
|
boblightServer = new BoblightServer(&hyperion, boblightServerConfig["port"].asUInt());
|
||||||
|
std::cout << "Boblight server created and started on port " << boblightServer->getPort() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- grabber -----
|
||||||
|
|
||||||
#ifdef ENABLE_DISPMANX
|
#ifdef ENABLE_DISPMANX
|
||||||
// Construct and start the frame-grabber if the configuration is present
|
// Construct and start the frame-grabber if the configuration is present
|
||||||
DispmanxWrapper * dispmanx = nullptr;
|
DispmanxWrapper * dispmanx = nullptr;
|
||||||
@ -214,7 +247,7 @@ int main(int argc, char** argv)
|
|||||||
#if !defined(ENABLE_OSX) && !defined(ENABLE_FB)
|
#if !defined(ENABLE_OSX) && !defined(ENABLE_FB)
|
||||||
if (config.isMember("framegrabber"))
|
if (config.isMember("framegrabber"))
|
||||||
{
|
{
|
||||||
std::cerr << "The dispmanx framegrabber can not be instantiated, becuse it has been left out from the build" << std::endl;
|
std::cerr << "The dispmanx framegrabber can not be instantiated, because it has been left out from the build" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -246,14 +279,19 @@ int main(int argc, char** argv)
|
|||||||
grabberConfig.get("cropTop", 0).asInt(),
|
grabberConfig.get("cropTop", 0).asInt(),
|
||||||
grabberConfig.get("cropBottom", 0).asInt());
|
grabberConfig.get("cropBottom", 0).asInt());
|
||||||
|
|
||||||
|
#ifdef ENABLE_PROTOBUF
|
||||||
|
QObject::connect(v4l2Grabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
|
||||||
|
#endif
|
||||||
|
|
||||||
v4l2Grabber->start();
|
v4l2Grabber->start();
|
||||||
std::cout << "V4l2 grabber created and started" << std::endl;
|
std::cout << "V4l2 grabber created and started" << std::endl;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (config.isMember("grabber-v4l2"))
|
if (config.isMember("grabber-v4l2"))
|
||||||
{
|
{
|
||||||
std::cerr << "The v4l2 grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
|
std::cerr << "The v4l2 grabber can not be instantiated, because it has been left out from the build" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AMLOGIC
|
#ifdef ENABLE_AMLOGIC
|
||||||
@ -309,12 +347,12 @@ int main(int argc, char** argv)
|
|||||||
#else
|
#else
|
||||||
if (config.isMember("framebuffergrabber"))
|
if (config.isMember("framebuffergrabber"))
|
||||||
{
|
{
|
||||||
std::cerr << "The framebuffer grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
|
std::cerr << "The framebuffer grabber can not be instantiated, because it has been left out from the build" << std::endl;
|
||||||
}
|
}
|
||||||
#if !defined(ENABLE_DISPMANX) && !defined(ENABLE_OSX)
|
#if !defined(ENABLE_DISPMANX) && !defined(ENABLE_OSX)
|
||||||
else if (config.isMember("framegrabber"))
|
else if (config.isMember("framegrabber"))
|
||||||
{
|
{
|
||||||
std::cerr << "The framebuffer grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
|
std::cerr << "The framebuffer grabber can not be instantiated, because it has been left out from the build" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -344,44 +382,16 @@ int main(int argc, char** argv)
|
|||||||
#else
|
#else
|
||||||
if (config.isMember("osxgrabber"))
|
if (config.isMember("osxgrabber"))
|
||||||
{
|
{
|
||||||
std::cerr << "The osx grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
|
std::cerr << "The osx grabber can not be instantiated, because it has been left out from the build" << std::endl;
|
||||||
}
|
}
|
||||||
#if !defined(ENABLE_DISPMANX) && !defined(ENABLE_FB)
|
#if !defined(ENABLE_DISPMANX) && !defined(ENABLE_FB)
|
||||||
else if (config.isMember("framegrabber"))
|
else if (config.isMember("framegrabber"))
|
||||||
{
|
{
|
||||||
std::cerr << "The osx grabber can not be instantiated, becuse it has been left out from the build" << std::endl;
|
std::cerr << "The osx grabber can not be instantiated, because it has been left out from the build" << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create Json server if configuration is present
|
|
||||||
JsonServer * jsonServer = nullptr;
|
|
||||||
if (config.isMember("jsonServer"))
|
|
||||||
{
|
|
||||||
const Json::Value & jsonServerConfig = config["jsonServer"];
|
|
||||||
jsonServer = new JsonServer(&hyperion, jsonServerConfig["port"].asUInt());
|
|
||||||
std::cout << "Json server created and started on port " << jsonServer->getPort() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_PROTOBUF
|
|
||||||
// Create Proto server if configuration is present
|
|
||||||
ProtoServer * protoServer = nullptr;
|
|
||||||
if (config.isMember("protoServer"))
|
|
||||||
{
|
|
||||||
const Json::Value & protoServerConfig = config["protoServer"];
|
|
||||||
protoServer = new ProtoServer(&hyperion, protoServerConfig["port"].asUInt() );
|
|
||||||
std::cout << "Proto server created and started on port " << protoServer->getPort() << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Create Boblight server if configuration is present
|
|
||||||
BoblightServer * boblightServer = nullptr;
|
|
||||||
if (config.isMember("boblightServer"))
|
|
||||||
{
|
|
||||||
const Json::Value & boblightServerConfig = config["boblightServer"];
|
|
||||||
boblightServer = new BoblightServer(&hyperion, boblightServerConfig["port"].asUInt());
|
|
||||||
std::cout << "Boblight server created and started on port " << boblightServer->getPort() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run the application
|
// run the application
|
||||||
int rc = app.exec();
|
int rc = app.exec();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user