destroy grabbers and other stuff on hyperiond restart via webui (#375)

* remove obsolete kodi code for grabbers

* destroy grabbers and other stuff on hyperiond restart via webui
This commit is contained in:
redPanther 2017-01-22 14:31:11 +01:00 committed by GitHub
parent abc798a479
commit 3aa2573b88
7 changed files with 36 additions and 3 deletions

View File

@ -289,6 +289,7 @@ signals:
void imageToLedsMappingChanged(int mappingType); void imageToLedsMappingChanged(int mappingType);
void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms); void emitImage(int priority, const Image<ColorRgb> & image, const int timeout_ms);
void closing();
private slots: private slots:
/// ///

View File

@ -74,6 +74,7 @@ V4L2Grabber::~V4L2Grabber()
void V4L2Grabber::uninit() void V4L2Grabber::uninit()
{ {
Debug(_log,"uninit grabber: %s", _deviceName.c_str());
// stop if the grabber was not stopped // stop if the grabber was not stopped
if (_initialized) if (_initialized)
{ {

View File

@ -27,6 +27,8 @@ GrabberWrapper::GrabberWrapper(std::string grabberName, const int priority, hype
GrabberWrapper::~GrabberWrapper() GrabberWrapper::~GrabberWrapper()
{ {
stop();
Debug(_log,"Close grabber: %s", _grabberName.c_str());
delete _processor; delete _processor;
} }

View File

@ -449,6 +449,8 @@ Hyperion::Hyperion(const QJsonObject &qjsonConfig, const QString configFile)
void Hyperion::freeObjects() void Hyperion::freeObjects()
{ {
emit closing();
// switch off all leds // switch off all leds
clearall(); clearall();
_device->switchOff(); _device->switchOff();

View File

@ -1,11 +1,18 @@
SET(Hyperiond_QT_HEADERS
hyperiond.h
)
QT5_WRAP_CPP(Hyperiond_HEADERS_MOC ${Hyperiond_QT_HEADERS})
add_executable(hyperiond add_executable(hyperiond
${Hyperiond_QT_HEADERS}
${Hyperiond_HEADERS_MOC}
configMigratorBase.cpp configMigratorBase.cpp
configMigratorBase.h configMigratorBase.h
configMigrator.cpp configMigrator.cpp
configMigrator.h configMigrator.h
hyperiond.cpp hyperiond.cpp
hyperiond.h
main.cpp main.cpp
) )

View File

@ -79,6 +79,13 @@ HyperionDaemon::HyperionDaemon(QString configFile, QObject *parent)
HyperionDaemon::~HyperionDaemon() HyperionDaemon::~HyperionDaemon()
{ {
freeObjects();
delete _hyperion;
}
void HyperionDaemon::freeObjects()
{
Debug(_log, "destroy grabbers and network stuff");
delete _amlGrabber; delete _amlGrabber;
delete _dispmanx; delete _dispmanx;
delete _fbGrabber; delete _fbGrabber;
@ -92,8 +99,17 @@ HyperionDaemon::~HyperionDaemon()
delete _protoServer; delete _protoServer;
delete _boblightServer; delete _boblightServer;
delete _udpListener; delete _udpListener;
delete _hyperion;
_v4l2Grabbers.clear();
_amlGrabber = nullptr;
_dispmanx = nullptr;
_fbGrabber = nullptr;
_osxGrabber = nullptr;
_kodiVideoChecker = nullptr;
_jsonServer = nullptr;
_protoServer = nullptr;
_boblightServer = nullptr;
_udpListener = nullptr;
} }
void HyperionDaemon::run() void HyperionDaemon::run()
@ -113,7 +129,7 @@ void HyperionDaemon::run()
#endif #endif
Info(_log, "Hyperion started"); Info(_log, "Hyperion started");
connect(_hyperion,SIGNAL(closing()),this,SLOT(freeObjects()));
} }
int HyperionDaemon::tryLoadConfig(const QString & configFile, const int schemaVersion) int HyperionDaemon::tryLoadConfig(const QString & configFile, const int schemaVersion)

View File

@ -49,6 +49,7 @@
class HyperionDaemon : public QObject class HyperionDaemon : public QObject
{ {
Q_OBJECT
public: public:
HyperionDaemon(QString configFile, QObject *parent=nullptr); HyperionDaemon(QString configFile, QObject *parent=nullptr);
~HyperionDaemon(); ~HyperionDaemon();
@ -65,6 +66,9 @@ public:
void createGrabberV4L2(); void createGrabberV4L2();
void createSystemFrameGrabber(); void createSystemFrameGrabber();
public slots:
void freeObjects();
private: private:
void createGrabberDispmanx(); void createGrabberDispmanx();
void createGrabberAmlogic(); void createGrabberAmlogic();