try
{
+ vdr = new VDR(); if (!boxstack) throw 1;
+ if (!vdr->init()) throw 2;
+
boxstack = new BoxStack(); if (!boxstack) throw 10;
if (!boxstack->init()) throw 20;
}
catch (int e)
{
- if (e == 10) logger->log("Control", Log::EMERG, "BoxStack module failed to create");
+ if (e == 1 ) logger->log("Control", Log::EMERG, "VDR module failed to create");
+ else if (e == 2 ) logger->log("Control", Log::EMERG, "VDR module failed to initialise");
+ else if (e == 10) logger->log("Control", Log::EMERG, "BoxStack module failed to create");
else if (e == 20) logger->log("Control", Log::EMERG, "BoxStack module failed to initialise");
else if (e == 30) logger->log("Control", Log::EMERG, "SleepTimer module failed to create");
else if (e == 40) logger->log("Control", Log::EMERG, "WOL module failed to create");
FALLTHROUGH
case 10:
FALLTHROUGH
+ case 2:
+ delete vdr;
+ vdr = NULL;
+ FALLTHROUGH
+ case 1:
+ FALLTHROUGH
}
return false;
logger->log("Control", Log::NOTICE, "BoxStack module shut down");
}
+ if (vdr)
+ {
+ vdr->shutdown();
+ delete vdr;
+ vdr = NULL;
+ logger->log("Control", Log::NOTICE, "VDR module shut down");
+ }
}
void Control::stop()
// FIXME make config system
- VDR* vdr = VDR::getInstance();
char* config;
// See if we're supposed to do network logging
#include "defines.h"
#include "messagequeue.h"
+class VDR;
class VConnect;
class Message;
class InputMan;
private:
// I own:
+ VDR* vdr{};
BoxStack* boxstack{};
Sleeptimer* sleeptimer{};
Wol* wol{};
long long getTimeMS();
#include <string>
-#include <chrono>
-#include <iomanip>
-std::string tp2str(const std::chrono::time_point<std::chrono::system_clock>& tp);
int getClockRealTime(struct timespec *tp);
#include <thread>
#include <string>
-#include <chrono>
-#include <iomanip>
+
#ifndef WIN32
#include <unistd.h>
#include "log.h"
#include "timers.h"
-#include "vdr.h"
#include "control.h"
#include "inputman.h"
Osd* osd;
Timers* timers;
Control* control;
-VDR* vdr;
Video* video;
Audio* audio;
// Init global vars ------------------------------------------------------------------------------------------------
logger = new Log();
timers = new Timers();
- vdr = new VDR();
inputMan = new InputMan();
led = new Led_TYPE();
// Get logging module started --------------------------------------------------------------------------------------
- if (!logger->init(Log::DEBUG, "dummy", debugEnabled ? 1 : 0))
+ if (!logger->init(Log::DEBUG, "dummy", debugEnabled ? 1 : 0)) // NCONFIG x2
{
printf("Could not initialise log object. Aborting.\n");
shutdown(1);
shutdown(1);
}
- success = vdr->init();
- if (success)
- {
- logger->log("Core", Log::INFO, "VDR module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "VDR module failed to initialise");
- shutdown(1);
- }
logger->log("Core", Log::NOTICE, "Control module shut down");
}
- if (vdr)
- {
- vdr->shutdown();
- delete vdr;
- logger->log("Core", Log::NOTICE, "VDR module shut down");
- }
-
if (osd)
{
osd->shutdown();
else return b;
}
-std::string tp2str(const std::chrono::time_point<std::chrono::system_clock>& tp)
-{
- auto tms = std::chrono::time_point_cast<std::chrono::milliseconds>(tp);
- std::chrono::milliseconds e = tms.time_since_epoch();
- long long c = e.count();
- time_t tt = c / 1000;
- int ttm = c % 1000;
- auto stm = std::localtime(&tt);
- std::stringstream ss;
- ss << std::put_time(stm, "%T") << "." << std::setfill('0') << std::setw(3) << ttm;
- return ss.str();
-}
-
const std::string& getCommandLineServer()
{
return argvServer;
#include "timers.h"
#include "videowin.h"
#include "audiowin.h"
-#include "vdr.h"
#include "windowsosd.h"
#ifdef WINDOWS_LEGACY
#include "osdwinpixel.h"
Osd* osd;
Timers* timers;
Control* control;
-VDR* vdr;
Video* video;
Audio* audio;
-std::string commandLineServer;
+std::string commandLineServer; // NCONFIG
bool wnd_fullscreen=false;
bool wnd_topmost=false;
led = new LedWin();
timers = new Timers();
osd = new Osd_TYPE();
- vdr = new VDR();
video = new VideoWin();
audio = new AudioWin();
control = new Control();
{
logger->log("Core", Log::EMERG, "OSD module failed to initialise");
shutdown(1);
- WSACleanup();
- return 0;
+ WSACleanup();
+ return 0;
}
video->setDefaultAspect();
{
logger->log("Core", Log::EMERG, "Audio module failed to initialise");
shutdown(1);
- WSACleanup();
- return 0;
- }
-
- success = vdr->init();
- if (success)
- {
- logger->log("Core", Log::INFO, "VDR module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "VDR module failed to initialise");
- shutdown(1);
- WSACleanup();
- return 0;
+ WSACleanup();
+ return 0;
}
success = control->init();
{
logger->log("Core", Log::EMERG, "Control module failed to initialise");
shutdown(1);
- WSACleanup();
- return 0;
+ WSACleanup();
+ return 0;
}
// Other init ------------------------------------------------------------------------------------------------------
return htonll(a);
}
-std::string tp2str(const std::chrono::time_point<std::chrono::system_clock>& tp)
-{
- auto tms = std::chrono::time_point_cast<std::chrono::milliseconds>(tp);
- std::chrono::milliseconds e = tms.time_since_epoch();
- long long c = e.count();
- time_t tt = c / 1000;
- int ttm = c % 1000;
- auto stm = std::localtime(&tt);
- std::stringstream ss;
- ss << std::put_time(stm, "%T") << "." << std::setfill('0') << std::setw(3) << ttm;
- return ss.str();
-}
-
const std::string& getCommandLineServer()
{
return commandLineServer;