From de15908994f0a958ca608aa94bc6c645b3bd2701 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 21 Oct 2012 20:05:21 +0200 Subject: [PATCH] Implement SignalOn and SignalOff switch back to more mvp like behaviour of program runtime --- GNUmakefile | 6 ++++-- boxstack.cc | 22 ++++++++++++++++++++++ boxstack.h | 1 + command.cc | 2 +- defines.h | 1 + osd.h | 1 + osdopenvg.cc | 2 ++ osdopenvg.h | 2 ++ osdvector.cc | 22 ++++++++++++++++++++++ osdvector.h | 2 ++ remotelinux.cc | 6 +++++- videoomx.cc | 18 ++++++++++++++---- vwelcome.cc | 5 +---- 13 files changed, 78 insertions(+), 12 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 8841645..66fa91a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,6 +1,8 @@ vomp_platform =raspberry # valid platforms are raspberry and mvp - +vomp_options= +#uncomment the line below, if you want to vomp application like, without a reboot option, automatically set for windows! +#vomp_options+= -DVOMP_HAS_EXIT ifeq ($(vomp_platform),mvp) $(info MVP crosscompiler) @@ -107,7 +109,7 @@ release: CXXFLAGS := $(CXXFLAGS_REL) release: clean vompclient strip deps: GNUmakefile - $(CC) -MM $(INCLUDES) $(OBJECTS:%.o=%.cc) > deps + $(CC) -MM $(INCLUDES) $(vomp_options) $(OBJECTS:%.o=%.cc) > deps -include deps diff --git a/boxstack.cc b/boxstack.cc index bee0c81..beb8280 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -222,6 +222,28 @@ void BoxStack::deleteBox(int z) } } +void BoxStack::redrawAllBoxes() +{ +#ifndef WIN32 + pthread_mutex_lock(&boxLock); +#else + WaitForSingleObject(boxLock, INFINITE); +#endif + + for (int z = 0; z < numBoxes; z++) + { + boxes[z]->draw(); + } + + +#ifndef WIN32 + pthread_mutex_unlock(&boxLock); +#else + ReleaseMutex(boxLock); +#endif + update(NULL,NULL); // should blt all +} + void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate) { Log::getInstance()->log("BoxStack", Log::DEBUG, "Update called"); diff --git a/boxstack.h b/boxstack.h index 97465ff..1e0d638 100644 --- a/boxstack.h +++ b/boxstack.h @@ -56,6 +56,7 @@ class BoxStack int remove(Boxx*); void removeAll(); void update(Boxx*, Region* regionToUpdate = NULL); + void redrawAllBoxes(); // -- end int handleCommand(int command); diff --git a/command.cc b/command.cc index 3ce19e2..77b9d74 100644 --- a/command.cc +++ b/command.cc @@ -610,7 +610,7 @@ void Command::doReboot() // just kill it... logger->log("Command", Log::NOTICE, "Reboot"); #ifndef WIN32 -#ifdef VOMP_PLATTFORM_MVP +#ifndef VOMP_HAS_EXIT reboot(LINUX_REBOOT_CMD_RESTART); #else stop(); diff --git a/defines.h b/defines.h index 24c1bf0..76f36c8 100644 --- a/defines.h +++ b/defines.h @@ -52,6 +52,7 @@ long long getTimeMS(); #define CLOSESOCKET closesocket #define DEFAULT_TCP_WINDOWSIZENR 1 /*=2048*/ + #define VOMP_HAS_EXIT #else diff --git a/osd.h b/osd.h index f8b0c92..5f339fc 100644 --- a/osd.h +++ b/osd.h @@ -34,6 +34,7 @@ class Osd virtual int init(void* device)=0; virtual int shutdown()=0; + virtual int restore(){return 1;}; virtual Surface * createNewSurface()=0; // For Boxx virtual int charSet() {return 1;}; diff --git a/osdopenvg.cc b/osdopenvg.cc index 0f892fa..1ac5ba8 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -337,6 +337,8 @@ int OsdOpenVG::shutdown() } + + void OsdOpenVG::threadMethod() { // We have to claim the egl context for this thread diff --git a/osdopenvg.h b/osdopenvg.h index 57d7f08..67357cd 100644 --- a/osdopenvg.h +++ b/osdopenvg.h @@ -78,6 +78,8 @@ class OsdOpenVG : public OsdVector, public Thread_TYPE int shutdown(); + + float getFontHeight(); float getCharWidth(wchar_t c); void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data); diff --git a/osdvector.cc b/osdvector.cc index 791f36a..a1ae4f3 100644 --- a/osdvector.cc +++ b/osdvector.cc @@ -61,6 +61,28 @@ void OsdVector::Blank() // do nothing? remove this one? } +int OsdVector::restore() +{ + // First clear the contents of all registered surfaces + surfaces_mutex.Lock(); + + //Now go through all surfaces and draw them + list::iterator curdraw=scommands.begin(); + while (curdraw!=scommands.end()) { + (*curdraw).commands.clear(); + curdraw++; + } + //also clear all handles, they are now invalid, no need to release them + images_ref.clear();; + monobitmaps.clear(); + jpegs.clear(); + styles.clear(); + styles_ref.clear(); + + surfaces_mutex.Unlock(); + return 1; +} + void OsdVector::drawSurfaces() { surfaces_mutex.Lock(); diff --git a/osdvector.h b/osdvector.h index 028996c..255d49a 100644 --- a/osdvector.h +++ b/osdvector.h @@ -128,6 +128,8 @@ class OsdVector : public Osd virtual ~OsdVector(); + int restore(); + int getFD(); void screenShot(const char* fileName); diff --git a/remotelinux.cc b/remotelinux.cc index 4506da0..08fedb9 100644 --- a/remotelinux.cc +++ b/remotelinux.cc @@ -186,7 +186,11 @@ int RemoteLinux::shutdown() { if (!initted) return 0; deinitCec(); - + while (devices.size()) { + int cur_fd = devices.back(); + devices.pop_back(); + close(cur_fd); + } initted = 0; return 1; diff --git a/videoomx.cc b/videoomx.cc index 6d1f612..b0452c1 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon, 2009 Marten Richter + Copyright 2004-2005 Chris Tallon, 2009-12 Marten Richter This file is part of VOMP. @@ -25,6 +25,7 @@ #include "vdr.h" #include "woptionpane.h" #include "osdopenvg.h" +#include "boxstack.h" #include @@ -538,14 +539,23 @@ void VideoOMX::updateMode() int VideoOMX::signalOff() { //TODO reinit osd - //vc_tv_power_off(); - //signalon=false; + Log::getInstance()->log("Video", Log::NOTICE, "signalOff"); + vc_tv_power_off(); + signalon=false; return 1; } int VideoOMX::signalOn() { - if (!signalon) selectVideoMode(0); + if (!signalon) { + Osd::getInstance()->shutdown(); + selectVideoMode(0); + Osd::getInstance()->restore(); + Osd::getInstance()->init((void*)""); + BoxStack::getInstance()->redrawAllBoxes(); + initted=1; + + } return 1; } diff --git a/vwelcome.cc b/vwelcome.cc index 258bb56..d7b032c 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -75,7 +75,7 @@ VWelcome::VWelcome() #endif sl.addOption(tr("6. Options"), 6, 0); -#ifdef VOMP_PLATTFORM_MVP +#ifndef VOMP_HAS_EXIT sl.addOption(tr("7. Reboot"), 7, 0); #else sl.addOption(tr("7. Exit"), 7, 0); @@ -101,11 +101,8 @@ VWelcome::~VWelcome() void VWelcome::draw() { - Log::getInstance()->log("VWelcome", Log::DEBUG, "Mark1"); TBBoxx::draw(); - Log::getInstance()->log("VWelcome", Log::DEBUG, "Mark2"); drawClock(); - Log::getInstance()->log("VWelcome", Log::DEBUG, "Mark3"); } void VWelcome::drawClock() -- 2.39.5