From af5ab04708d8c1ece892285153619c27ba991b69 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 28 Oct 2012 10:58:17 +0100 Subject: [PATCH] Changes in signaloff/on and doreboot, enhance hardware deinitialisation --- command.cc | 11 +++++++++++ osd.h | 1 + osdopenvg.cc | 13 ++++++++++--- osdopenvg.h | 1 + videoomx.cc | 27 +++++++++++++++------------ videoomx.h | 3 +-- 6 files changed, 39 insertions(+), 17 deletions(-) diff --git a/command.cc b/command.cc index 77b9d74..cbdd0a8 100644 --- a/command.cc +++ b/command.cc @@ -35,6 +35,7 @@ #include "led.h" #include "video.h" #include "audio.h" +#include "mtd.h" #include "vdr.h" #include "vvolume.h" #include "vserverselect.h" @@ -611,7 +612,17 @@ void Command::doReboot() logger->log("Command", Log::NOTICE, "Reboot"); #ifndef WIN32 #ifndef VOMP_HAS_EXIT + // some plattforms, want a proper deinitialisation of their hardware before reboot + Osd::getInstance()->shutdown(); + Audio::getInstance()->shutdown(); + Video::getInstance()->shutdown(); + Remote::getInstance()->shutdown(); + reboot(LINUX_REBOOT_CMD_RESTART); + // if reboot is not allowed -> stop + stop(); + + #else stop(); diff --git a/osd.h b/osd.h index 5f339fc..cf3a871 100644 --- a/osd.h +++ b/osd.h @@ -35,6 +35,7 @@ class Osd virtual int init(void* device)=0; virtual int shutdown()=0; virtual int restore(){return 1;}; + virtual int stopUpdate() {return 1;}; virtual Surface * createNewSurface()=0; // For Boxx virtual int charSet() {return 1;}; diff --git a/osdopenvg.cc b/osdopenvg.cc index 809227f..709fa36 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -230,9 +230,9 @@ int OsdOpenVG::init(void* device) initted = 1; // must set this here or create surface won't work - if (((VideoOMX*)Video::getInstance())->initUsingOSDObjects()!=1) { //call Video for init stuff + /*if (((VideoOMX*)Video::getInstance())->initUsingOSDObjects()!=1) { //call Video for init stuff return 0; - } + }*/ InitializeMagick(""); pthread_cond_init(&vgtaskCond, NULL); @@ -293,6 +293,13 @@ void OsdOpenVG::destroyPaths() } +int OsdOpenVG::stopUpdate() +{ + threadStop(); + processTasks(); + return 1; +} + int OsdOpenVG::shutdown() { @@ -307,7 +314,7 @@ int OsdOpenVG::shutdown() taskmutex.Lock(); vgmutex.Lock(); - (((VideoOMX*)Video::getInstance())->shutdownUsingOSDObjects()); + //(((VideoOMX*)Video::getInstance())->shutdownUsingOSDObjects()); FT_Done_Face(ft_face); vgDestroyFont(vgfont); diff --git a/osdopenvg.h b/osdopenvg.h index 67357cd..97b19a4 100644 --- a/osdopenvg.h +++ b/osdopenvg.h @@ -76,6 +76,7 @@ class OsdOpenVG : public OsdVector, public Thread_TYPE int init(void* device); int shutdown(); + int stopUpdate(); diff --git a/videoomx.cc b/videoomx.cc index b0452c1..f1eea61 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -26,6 +26,7 @@ #include "woptionpane.h" #include "osdopenvg.h" #include "boxstack.h" +#include "remote.h" #include @@ -83,6 +84,14 @@ int VideoOMX::init(UCHAR tformat) setTVsize(ASPECT4X3); selectVideoMode(0); + OMX_ERRORTYPE error; + error = OMX_Init(); + if (error != OMX_ErrorNone) { + Log::getInstance()->log("Video", Log::DEBUG, "Init OMX failed %x", + error); + return 0; + } + @@ -94,19 +103,7 @@ int VideoOMX::init(UCHAR tformat) return 1; } -int VideoOMX::initUsingOSDObjects() -{ - -// we are called before the audio - OMX_ERRORTYPE error; - error=OMX_Init(); - if (error!=OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, "Init OMX failed %x", error); - return 0; - } - return 1; -} OMX_ERRORTYPE VideoOMX::EventHandler_OMX(OMX_IN OMX_HANDLETYPE handle,OMX_IN OMX_PTR appdata, @@ -396,6 +393,7 @@ void VideoOMX::selectVideoMode(int interlaced) } } + Remote::getInstance()->shutdown(); vc_tv_power_off(); if (mymode) { Log::getInstance()->log("Video", Log::NOTICE, "Switch to optimum mode"); @@ -408,6 +406,7 @@ void VideoOMX::selectVideoMode(int interlaced) vc_tv_hdmi_power_on_best(1920,1080,target_fps,interlaced?HDMI_INTERLACED:HDMI_NONINTERLACED, (EDID_MODE_MATCH_FLAG_T)(HDMI_MODE_MATCH_FRAMERATE|HDMI_MODE_MATCH_RESOLUTION|HDMI_MODE_MATCH_SCANMODE)); } + Remote::getInstance()->init(""); } @@ -541,6 +540,7 @@ int VideoOMX::signalOff() //TODO reinit osd Log::getInstance()->log("Video", Log::NOTICE, "signalOff"); vc_tv_power_off(); + Osd::getInstance()->stopUpdate(); // turn off drawing thread signalon=false; return 1; } @@ -548,8 +548,11 @@ int VideoOMX::signalOff() int VideoOMX::signalOn() { if (!signalon) { + Log::getInstance()->log("Video", Log::NOTICE, "signalOn"); Osd::getInstance()->shutdown(); + selectVideoMode(0); + Osd::getInstance()->restore(); Osd::getInstance()->init((void*)""); BoxStack::getInstance()->redrawAllBoxes(); diff --git a/videoomx.h b/videoomx.h index 6feee0d..fe931d8 100644 --- a/videoomx.h +++ b/videoomx.h @@ -126,8 +126,7 @@ class VideoOMX : public Video int test2(); #endif - int initUsingOSDObjects(); - int shutdownUsingOSDObjects() {return shutdown();}; + static inline OMX_TICKS intToOMXTicks(long long pts) { OMX_TICKS temp; -- 2.39.5