#include "log.h"
#include "demuxer.h"
#include "callback.h"
+#include "util.h"
#include "afeed.h"
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "audioomx.h"
+#include <bcm_host.h>
+
#include "videoomx.h"
#include "log.h"
#include "vdr.h"
#include "woptionpane.h"
-
#include "osdopenvg.h"
-#include <bcm_host.h>
+#include "util.h"
extern "C" {
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
}
+#include "audioomx.h"
+
AudioOMX::AudioOMX()
{
initted = 0;
#include "wjpeg.h"
#include "osdvector.h"
+
+#ifdef VOMP_PLATFORM_RASPBERRY
+ #include "ledraspberry.h"
+ #include "osdopenvg.h"
+ #include "videoomx.h"
+ #include "audioomx.h"
+#endif
+
+#ifdef WIN32
+ #include "windowsosd.h"
+ #ifdef WINDOWS_LEGACY
+ #include "osdwinpixel.h"
+ #else
+ #include "osdwinvector.h"
+ #endif
+
+ #include "ledwin.h"
+ #include "videowin.h"
+ #include "audiowin.h"
+#endif
+
#include "control.h"
Control* Control::instance = NULL;
{
if (initted) return false;
crashed = tcrashed;
-
-
- SkinFactory::InitSkin(0);
-
logger = Log::getInstance();
+ SkinFactory::InitSkin(0);
try
{
- vdr = new VDR(); if (!boxstack) throw 1;
- if (!vdr->init()) throw 2;
+ led = new Led_TYPE(); if (!led) throw 10;
+ if (!led->init(-1)) throw 11; // FIXME init(0) on Win32
+
+ timers = new Timers(); if (!timers) throw 20;
+ if (!timers->init()) throw 21;
+
+ video = new Video_TYPE(); if (!video) throw 30;
+ if (!video->init(Video::PAL)) throw 31;
+
+ audio = new Audio_TYPE(); if (!audio) throw 40;
+ if (!audio->init(Audio::MPEG2_PES)) throw 41;
+
+ osd = new Osd_TYPE(); if (!osd) throw 50;
+ if (!osd->init()) throw 51;
+
+ vdr = new VDR(); if (!vdr) throw 60;
+ if (!vdr->init()) throw 61;
- boxstack = new BoxStack(); if (!boxstack) throw 10;
- if (!boxstack->init()) throw 20;
+ boxstack = new BoxStack(); if (!boxstack) throw 70;
+ if (!boxstack->init()) throw 71;
- sleeptimer = new Sleeptimer(); if (!sleeptimer) throw 30;
+ sleeptimer = new Sleeptimer(); if (!sleeptimer) throw 80;
- wol = new Wol(); if (!wol) throw 40;
+ wol = new Wol(); if (!wol) throw 90;
+
+ inputMan = new InputMan(); if (!inputMan) throw 100;
+ if (!inputMan->init()) throw 101;
}
catch (int e)
{
- 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");
+ if (e == 10) logger->log("Control", Log::EMERG, "LED module failed to create");
+ else if (e == 11) logger->log("Control", Log::EMERG, "LED module failed to initialise");
+ else if (e == 20) logger->log("Control", Log::EMERG, "Timers module failed to create");
+ else if (e == 21) logger->log("Control", Log::EMERG, "Timers module failed to initialise");
+ else if (e == 30) logger->log("Control", Log::EMERG, "Video module failed to create");
+ else if (e == 31) logger->log("Control", Log::EMERG, "Video module failed to initialise");
+ else if (e == 40) logger->log("Control", Log::EMERG, "Audio module failed to create");
+ else if (e == 41) logger->log("Control", Log::EMERG, "Audio module failed to initialise");
+ else if (e == 50) logger->log("Control", Log::EMERG, "OSD module failed to create");
+ else if (e == 51) logger->log("Control", Log::EMERG, "OSD module failed to initialise");
+ else if (e == 60) logger->log("Control", Log::EMERG, "VDR module failed to create");
+ else if (e == 61) logger->log("Control", Log::EMERG, "VDR module failed to initialise");
+ else if (e == 70) logger->log("Control", Log::EMERG, "BoxStack module failed to create");
+ else if (e == 71) logger->log("Control", Log::EMERG, "BoxStack module failed to initialise");
+ else if (e == 80) logger->log("Control", Log::EMERG, "SleepTimer module failed to create");
+ else if (e == 90) logger->log("Control", Log::EMERG, "WOL module failed to create");
+ else if (e == 100) logger->log("Control", Log::EMERG, "InputMan module failed to create");
+ else if (e == 101) logger->log("Control", Log::EMERG, "InputMan module failed to initialise");
switch(e)
{
- case 40:
+ case 101:
+ delete inputMan;
+ inputMan = NULL;
FALLTHROUGH
- case 30:
+ case 100:
+ delete wol;
+ wol = NULL;
FALLTHROUGH
- case 20:
+ case 90:
+ delete sleeptimer;
+ sleeptimer = NULL;
+ FALLTHROUGH
+ case 80:
+ boxstack->shutdown();
+ FALLTHROUGH
+ case 71:
delete boxstack;
boxstack = NULL;
FALLTHROUGH
- case 10:
+ case 70:
+ vdr->shutdown();
FALLTHROUGH
- case 2:
+ case 61:
delete vdr;
vdr = NULL;
FALLTHROUGH
- case 1:
+ case 60:
+ osd->shutdown();
+ FALLTHROUGH
+ case 51:
+ delete osd;
+ osd = NULL;
+ FALLTHROUGH
+ case 50:
+ audio->shutdown();
+ FALLTHROUGH
+ case 41:
+ delete audio;
+ audio = NULL;
+ FALLTHROUGH
+ case 40:
+ video->shutdown();
+ FALLTHROUGH
+ case 31:
+ delete video;
+ video = NULL;
+ FALLTHROUGH
+ case 30:
+ timers->shutdown();
+ FALLTHROUGH
+ case 21:
+ delete timers;
+ timers = NULL;
FALLTHROUGH
- ;
+ case 20:
+ led->shutdown();
+ FALLTHROUGH
+ case 11:
+ delete led;
+ led = NULL;
+ FALLTHROUGH
+ case 10:
+ FALLTHROUGH
+ ;
}
return false;
}
-
- inputMan = InputMan::getInstance();
-
- if (!inputMan)
- {
- initted = false;
- return 0;
- }
-
-
-
initted = true;
return true;
}
if (!initted) return;
initted = false;
+ if (inputMan)
+ {
+ inputMan->shutdown();
+ delete inputMan;
+ inputMan = NULL;
+ logger->log("Control", Log::NOTICE, "InputMan module shut down");
+ }
+
if (wol)
{
delete wol;
vdr = NULL;
logger->log("Control", Log::NOTICE, "VDR module shut down");
}
+
+ if (osd)
+ {
+ osd->shutdown();
+ delete osd;
+ osd = NULL;
+ logger->log("Control", Log::NOTICE, "OSD module shut down");
+ }
+
+ if (audio)
+ {
+ audio->shutdown();
+ delete audio;
+ audio = NULL;
+ logger->log("Control", Log::NOTICE, "Audio module shut down");
+ }
+
+ if (video)
+ {
+ video->shutdown();
+ delete video;
+ video = NULL;
+ logger->log("Control", Log::NOTICE, "Video module shut down");
+ }
+
+ if (timers)
+ {
+ timers->shutdown();
+ delete timers;
+ timers = NULL;
+ logger->log("Control", Log::NOTICE, "Timers module shut down");
+ }
+
+ if (led)
+ {
+ led->shutdown();
+ delete led;
+ led = NULL;
+ logger->log("Control", Log::NOTICE, "LED module shut down");
+ }
}
void Control::stop()
void Control::doWallpaper()
{
- Video* video = Video::getInstance();
-
// Blue background
Boxx* bbg = new Boxx();
bbg->setSize(video->getScreenWidth(), video->getScreenHeight());
if (!VDR::getInstance()->isConnected()) { connectionLost(); return; }
logger->log("Control", Log::INFO, "Entering doJustConnected");
- Video* video = Video::getInstance();
- Audio* audio = Audio::getInstance();
boxstack->remove(vconnect);
VInfo* vi = new VInfo();
boxstack->remove(wallpaper);
delete wallpaper_pict; wallpaper_pict = NULL; wallpaper = NULL;
- Osd* osd = Osd::getInstance();
#ifndef __ANDROID__
osd->shutdown();
#endif
class WJpeg;
class Sleeptimer;
class Wol;
+class Audio;
+class Video;
+class Osd;
+class Timers;
+class Led;
struct ASLPref
{
private:
// I own:
+ Led* led{};
+ Timers* timers{};
+ Osd* osd{};
+ Video* video{};
+ Audio* audio{};
VDR* vdr{};
BoxStack* boxstack{};
Sleeptimer* sleeptimer{};
Wol* wol{};
+ InputMan* inputMan{};
static Control* instance;
Log* logger;
- InputMan* inputMan;
bool initted{};
bool irun{};
// Global useful functions
-//ULLONG htonll(ULLONG a);
-//ULLONG ntohll(ULLONG a);
-void MILLISLEEP(ULONG a);
long long getTimeMS();
#include <string>
#ifdef WIN32
+ #define Led_TYPE LedWin
+ #define Video_TYPE VideoWin
#define Thread_TYPE ThreadWin
#define ThreadID_TYPE unsigned int
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "imageomx.h"
+#include <bcm_host.h>
#include "videoomx.h"
#include "log.h"
#include "vdr.h"
#include "woptionpane.h"
-
+#include "util.h"
#include "osdopenvg.h"
-#include <bcm_host.h>
+
+#include "imageomx.h"
ImageOMX::ImageOMX(OsdVector::PictureReader * treader):OsdVector::PictureDecoder(treader)
{
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-// FIXME
-// Work towards main and winmain only containing what they need for their own platforms
-// Move anything common to utils or control. Move any module startup / shutdown that can
-// be done in control to there.
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+// For open
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include <thread>
#include <string>
#endif
#include "log.h"
-#include "timers.h"
+#include "util.h"
#include "control.h"
-#include "inputman.h"
#ifdef VOMP_PLATTFORM_NMT
#include "lednmt.h"
#include "videonmt.h"
#endif
-#ifdef VOMP_PLATFORM_RASPBERRY
- #include "ledraspberry.h"
- #include "osdopenvg.h"
- #include "audioomx.h"
- #include "videoomx.h"
-#endif
-
-
#ifndef WIN32 // FIXME do we need any if WIN32 stuff in here? windows has own winmain file
void threadSignalReceiverFunction();
#endif
-ULLONG htonll(ULLONG);
-ULLONG ntohll(ULLONG);
void shutdown(int code);
const std::string& getCommandLineServer();
-// Global variables --------------------------------------------------------------------------------------------------
Log* logger;
-InputMan* inputMan;
-Led* led;
-Osd* osd;
-Timers* timers;
Control* control;
-Video* video;
-Audio* audio;
-// Temporary, will move to Config system
+// Temporary, will move to Config system NCONFIG
std::string argvServer;
#ifdef HANDLE_VT_SWITCHING
}
}
- // Init global vars ------------------------------------------------------------------------------------------------
- logger = new Log();
- timers = new Timers();
- inputMan = new InputMan();
-
- led = new Led_TYPE();
- osd = new Osd_TYPE();
- audio = new Audio_TYPE();
- video = new Video_TYPE();
-
- control = new Control();
-
- if (!logger || !timers || !inputMan || !led || !osd || !video || !audio || !control)
+ // Start Log --------------------------------------------------------------------------------------------------
+ logger = new Log();
+ if (!logger)
{
- printf("Could not create objects. Memory problems?\n");
+ printf("Failed to create Log object\n");
shutdown(1);
}
- // Get logging module started --------------------------------------------------------------------------------------
-
if (!logger->init(Log::DEBUG, "dummy", debugEnabled ? 1 : 0)) // NCONFIG x2
{
printf("Could not initialise log object. Aborting.\n");
shutdown(1);
}
- logger->log("Core", Log::INFO, "Starting up...");
+ logger->log("Main", Log::INFO, "Starting up...");
- // Daemonize if not -d
+ // Daemonize --------------------------------------------------------------------------------------------------
if (daemonize)
{
int sigBlockResult = pthread_sigmask(SIG_SETMASK, &set, NULL);
if (sigBlockResult)
{
- logger->log("Core", Log::EMERG, "Could not block signals: %i", sigBlockResult);
+ logger->log("Main", Log::EMERG, "Could not block signals: %i", sigBlockResult);
shutdown(1);
}
std::thread threadSignalReceiver(threadSignalReceiverFunction);
threadSignalReceiver.detach();
- logger->log("Core", Log::INFO, "Signal handlers set up successfully");
+ logger->log("Main", Log::INFO, "Signal handlers set up successfully");
// VT Switching -----------------------------------------------------------------------------------------------
)
{
- logger->log("Core", Log::EMERG, "Could not open /dev/tty. Please change permissions");
+ logger->log("Main", Log::EMERG, "Could not open /dev/tty. Please change permissions");
}
else
{
int free_vt;
if (ioctl(fdtty, VT_OPENQRY, &free_vt) == -1 || free_vt == -1)
{
- logger->log("Core", Log::EMERG, "Could not retrieve free virtual console, please change permissions");
+ logger->log("Main", Log::EMERG, "Could not retrieve free virtual console, please change permissions");
}
else
{
}
#endif
- // Init modules ----------------------------------------------------------------------------------------------------
- int success;
-
- success = inputMan->init();
-
- if (success)
- {
- logger->log("Core", Log::INFO, "InputMan module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "InputMan module failed to initialise");
- shutdown(1);
- }
-
- success = led->init(-1);
- if (success)
- {
- logger->log("Core", Log::INFO, "LED module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "LED module failed to initialise");
- shutdown(1);
- }
-
- success = timers->init();
- if (success)
- {
- logger->log("Core", Log::INFO, "Timers module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Timers module failed to initialise");
- shutdown(1);
- }
-
- UCHAR videoFormat = Video::PAL; // PALNTSC FIXME
-
- success = video->init(videoFormat);
- if (success)
- {
- logger->log("Core", Log::INFO, "Video module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Video module failed to initialise");
- shutdown(1);
- }
+ // Run control ----------------------------------------------------------------------------------------------------
- success = osd->init();
- if (success)
- {
- logger->log("Core", Log::INFO, "OSD module initialised");
- }
- else
+ control = new Control();
+ if (!control)
{
- logger->log("Core", Log::EMERG, "OSD module failed to initialise");
+ logger->log("Main", Log::EMERG, "Control module failed to create");
shutdown(1);
}
- success = audio->init(Audio::MPEG2_PES);
- if (success)
+ if (!control->init(crashed))
{
- logger->log("Core", Log::INFO, "Audio module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Audio module failed to initialise");
- shutdown(1);
- }
-
-
-
-
-
-
- bool bsuccess = control->init(crashed);
- if (bsuccess)
- {
- logger->log("Core", Log::INFO, "Control module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Control module failed to initialise");
+ logger->log("Main", Log::EMERG, "Control module failed to initialise");
+ delete control;
+ control = NULL;
shutdown(1);
}
- // Other init ------------------------------------------------------------------------------------------------------
-
- logger->log("Core", Log::NOTICE, "Startup successful");
-
- // Run main loop ---------------------------------------------------------------------------------------------------
-
- // Ok, all major device components and other bits are loaded and ready
control->run();
-
- // When that returns quit ------------------------------------------------------------------------------------------
-
control->shutdown();
shutdown(0);
{
if(sigwait(&set, &sig))
{
- logger->log("Core", Log::CRIT, "Sigwait returned fail - signal handler exiting");
+ logger->log("Main", Log::CRIT, "Sigwait returned fail - signal handler exiting");
return;
}
- logger->log("Core", Log::NOTICE, "Signal received: %i", sig);
+ logger->log("Main", Log::NOTICE, "Signal received: %i", sig);
if ((sig == SIGINT) || (sig == SIGTERM)) control->stop();
}
{
delete control;
control = NULL;
- logger->log("Core", Log::NOTICE, "Control module shut down");
- }
-
- if (osd)
- {
- osd->shutdown();
- delete osd;
- logger->log("Core", Log::NOTICE, "OSD module shut down");
- }
-
- if (audio)
- {
- audio->shutdown();
- delete audio;
- logger->log("Core", Log::NOTICE, "Audio module shut down");
+ logger->log("Main", Log::NOTICE, "Control module shut down");
}
- if (video)
- {
- video->shutdown();
- delete video;
- logger->log("Core", Log::NOTICE, "Video module shut down");
- }
-
- if (timers)
- {
- timers->shutdown();
- delete timers;
- logger->log("Core", Log::NOTICE, "Timers module shut down");
- }
-
- if (led)
- {
- led->shutdown();
- delete led;
- logger->log("Core", Log::NOTICE, "LED module shut down");
- }
-
- if (inputMan)
- {
- inputMan->shutdown();
- delete inputMan;
- logger->log("Core", Log::NOTICE, "InputMan module shut down");
- }
-
-
-
#ifdef HANDLE_VT_SWITCHING
ioctl(fdtty, VT_UNLOCKSWITCH, 1);
close(fdtty);
if (logger)
{
- logger->log("Core", Log::NOTICE, "Log module shutting down... bye!\n\n");
+ logger->log("Main", Log::NOTICE, "Log module shutting down... bye!\n\n");
logger->shutdown();
delete logger;
}
// -------------------------------------------------------------------------------------------------------------------
-ULLONG htonll(ULLONG a)
-{
- #if BYTE_ORDER == BIG_ENDIAN
- return a;
- #else
- ULLONG b = 0;
-
- b = ((a << 56) & 0xFF00000000000000ULL)
- | ((a << 40) & 0x00FF000000000000ULL)
- | ((a << 24) & 0x0000FF0000000000ULL)
- | ((a << 8) & 0x000000FF00000000ULL)
- | ((a >> 8) & 0x00000000FF000000ULL)
- | ((a >> 24) & 0x0000000000FF0000ULL)
- | ((a >> 40) & 0x000000000000FF00ULL)
- | ((a >> 56) & 0x00000000000000FFULL) ;
-
- return b;
- #endif
-}
-
-ULLONG ntohll(ULLONG a)
-{
- return htonll(a);
-}
-
-void MILLISLEEP(ULONG a)
-{
-#ifndef WIN32
- struct timespec delayTime;
- delayTime.tv_sec = a / 1000;
- delayTime.tv_nsec = (a % 1000) * 1000000;
- nanosleep(&delayTime, NULL);
-#else
- Sleep(a);
-#endif
-}
-
long long getTimeMS()
{
struct timespec ts;
-OBJ_COMMON = control.o thread.o timers.o i18n.o udp4.o udp6.o vdpc.o tcp.o \
+OBJ_COMMON = util.o control.o thread.o timers.o i18n.o udp4.o udp6.o vdpc.o tcp.o \
message.o messagequeue.o wol.o audio.o video.o log.o \
vdr.o recman.o recording.o recinfo.o channel.o rectimer.o event.o \
directory.o mark.o option.o vfeed.o afeed.o \
#include "dvbsubtitles.h"
#include "osdreceiver.h"
#include "buffer.h"
+#include "util.h"
#include "playervideorec.h"
#include "log.h"
#include "demuxer.h"
#include "callback.h"
+#include "util.h"
#include "tfeed.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "util.h"
+
#include "threadp.h"
// Undeclared functions, only for use in this file to start the thread
#include "wol.h"
#include "vserverselect.h"
#include "messagequeue.h"
+#include "util.h"
#include "vconnect.h"
#include "log.h"
#include "demuxer.h"
#include "callback.h"
+#include "util.h"
#include "vfeed.h"
#include "osdopenvg.h"
#include "boxstack.h"
#include "inputman.h"
+#include "util.h"
#include "videoomx.h"
#include "colour.h"
#include "video.h"
#include "surface.h"
+#include "util.h"
#include "vscreensaver.h"
along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "vsleeptimer.h"
#include "input.h"
#include "wsymbol.h"
#include "boxstack.h"
#include "message.h"
#include "messagequeue.h"
+#include "util.h"
+
+#include "vsleeptimer.h"
Sleeptimer* Sleeptimer::instance = NULL;
#include "log.h"
#include "inputman.h"
#include "inputwin.h"
-#include "ledwin.h"
-#include "timers.h"
-#include "videowin.h"
-#include "audiowin.h"
+#include "util.h"
+
#include "windowsosd.h"
-#ifdef WINDOWS_LEGACY
-#include "osdwinpixel.h"
-#else
-#include "osdwinvector.h"
-#endif
+
#include "control.h"
#include "message.h"
#include "messagequeue.h"
// Global variables --------------------------------------------------------------------------------------------------
int debugEnabled = 0;
Log* logger;
-InputMan* remote;
InputWin* inputWin;
-Led* led;
-Osd* osd;
-Timers* timers;
Control* control;
-Video* video;
-Audio* audio;
std::string commandLineServer; // NCONFIG
bool wnd_fullscreen=false;
MessageQueue* messageQueue;
-
-void MILLISLEEP(ULONG a)
-{
- Sleep(a);
-}
-
int getClockRealTime(struct timespec *tp){
SYSTEMTIME systime;
__int64 filetime;
// Init global vars ------------------------------------------------------------------------------------------------
logger = new Log();
- remote = new InputMan();
- led = new LedWin();
- timers = new Timers();
- osd = new Osd_TYPE();
- video = new VideoWin();
- audio = new AudioWin();
control = new Control();
- if (!logger || !remote || !led || !osd || !video || !audio || !control)
+ if (!logger || !control)
{
ERROR_MSG("Could not create objects. Memory problems?\n");
shutdown(1);
logger->log("Core", Log::INFO, "Starting up...");
-
// Init modules ----------------------------------------------------------------------------------------------------
int success;
- success = remote->init();
- if (success)
- {
- logger->log("Core", Log::INFO, "Remote module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Remote module failed to initialise");
- shutdown(1);
- WSACleanup();
- return 0;
- }
-
- inputWin = remote->getInputWin();
-
- success = led->init(0);
- if (success)
- {
- logger->log("Core", Log::INFO, "LED module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "LED module failed to initialise");
- shutdown(1);
- WSACleanup();
- return 0;
- }
-
- success = timers->init();
- if (success)
- {
- logger->log("Core", Log::INFO, "Timers module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Timers module failed to initialise");
- shutdown(1);
- WSACleanup();
- return 0;
- }
-
- UCHAR videoFormat = Video::PAL; // PALNTSC FIXME.
-
- success = video->init(videoFormat);
- if (success)
- {
- logger->log("Core", Log::INFO, "Video module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Video module failed to initialise");
- shutdown(1);
- WSACleanup();
- return 0;
- }
-
dynamic_cast<WindowsOsd*>(osd)->setWindow(win);
- success = osd->init();
- if (success)
- {
- logger->log("Core", Log::INFO, "OSD module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "OSD module failed to initialise");
- shutdown(1);
- WSACleanup();
- return 0;
- }
- video->setDefaultAspect();
-
- success = audio->init(Audio::MPEG2_PES);
- if (success)
- {
- logger->log("Core", Log::INFO, "Audio module initialised");
- }
- else
- {
- logger->log("Core", Log::EMERG, "Audio module failed to initialise");
- shutdown(1);
- WSACleanup();
- return 0;
- }
success = control->init();
if (success)
else
{
logger->log("Core", Log::EMERG, "Control module failed to initialise");
+ delete control;
+ control = NULL;
shutdown(1);
WSACleanup();
return 0;
}
+ inputWin = InputMan::getInstance()->getInputWin();
+ Video::getInstance()->setDefaultAspect();
+
// Other init ------------------------------------------------------------------------------------------------------
logger->log("Core", Log::NOTICE, "Startup successful");
}
} else {
//Render, moved to OSD !
- Sleep(20);
+ MILLISLEEP(20);
//((OsdWin*)osd)->Render();
}
}
UCHAR mode=Video::PAL;
UCHAR aspect=Video::ASPECT4X3;
UCHAR tvsize=Video::ASPECT4X3;
+ Video* video = Video::getInstance();
if (video) {
mode=video->getMode();
aspect=((VideoWin*)video)->getAspectRatio();
logger->log("Core", Log::NOTICE, "Control module shut down");
}
- if (osd)
- {
- osd->shutdown();
- delete osd;
- logger->log("Core", Log::NOTICE, "OSD module shut down");
- }
-
- if (audio)
- {
- audio->shutdown();
- delete audio;
- logger->log("Core", Log::NOTICE, "Audio module shut down");
- }
-
- if (video)
- {
- video->shutdown();
- delete video;
- logger->log("Core", Log::NOTICE, "Video module shut down");
- }
-
- if (timers)
- {
- timers->shutdown();
- delete timers;
- logger->log("Core", Log::NOTICE, "Timers module shut down");
- }
-
- if (led)
- {
- led->shutdown();
- delete led;
- logger->log("Core", Log::NOTICE, "LED module shut down");
- }
-
- if (remote)
- {
- remote->shutdown();
- delete remote;
- logger->log("Core", Log::NOTICE, "Remote module shut down");
- }
-
if (logger)
{
logger->log("Core", Log::NOTICE, "Log module shutting down... bye!\n\n");
// -------------------------------------------------------------------------------------------------------------------
-ULLONG htonll(ULLONG a)
-{
- return (((ULLONG)htonl((ULONG)((a<<32)>> 32))<<32)
- |(ULONG)htonl(((ULONG) (a >> 32))));
-}
-
-ULLONG ntohll(ULLONG a)
-{
- return htonll(a);
-}
-
const std::string& getCommandLineServer()
{
return commandLineServer;