From 2f936c22b443086d6d621ab37dd9523d8f153f1d Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Thu, 18 Jan 2007 18:29:30 +0000 Subject: - added status monitor to reload timers when a recording starts or stops --- Makefile | 4 ++-- live.cpp | 5 ++++- status.cpp | 21 +++++++++++++++++++++ status.h | 23 +++++++++++++++++++++++ timers.cpp | 2 +- timers.h | 1 + 6 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 status.cpp create mode 100644 status.h diff --git a/Makefile b/Makefile index 310be38..1f40b4b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile,v 1.28 2007/01/17 01:15:59 tadi Exp $ +# $Id: Makefile,v 1.29 2007/01/18 18:29:30 lordjaxom Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -59,7 +59,7 @@ SUBDIRS = httpd pages css images javascript ### The object files (add further files here): PLUGINOBJS = $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \ - tools.o recordings.o tasks.o + tools.o recordings.o tasks.o status.o WEBLIBS = pages/libpages.a css/libcss.a images/libimages.a \ javascript/libjavascript.a diff --git a/live.cpp b/live.cpp index 9058080..e5f97ff 100644 --- a/live.cpp +++ b/live.cpp @@ -3,13 +3,14 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: live.cpp,v 1.12 2007/01/16 18:34:31 lordjaxom Exp $ + * $Id: live.cpp,v 1.13 2007/01/18 18:29:30 lordjaxom Exp $ */ #include #include "i18n.h" #include "live.h" #include "setup.h" +#include "status.h" #include "tasks.h" #include "thread.h" #include "timers.h" @@ -42,6 +43,8 @@ bool Plugin::Start(void) m_configDirectory = cPlugin::ConfigDirectory( PLUGIN_NAME_I18N ); RegisterI18n( vdrlive::Phrases ); + // force status monitor startup + LiveStatusMonitor(); // XXX error handling m_thread.reset( new ServerThread ); m_thread->Start(); diff --git a/status.cpp b/status.cpp new file mode 100644 index 0000000..acc60fe --- /dev/null +++ b/status.cpp @@ -0,0 +1,21 @@ +#include "status.h" +#include "timers.h" + +namespace vdrlive { + +StatusMonitor::StatusMonitor() +{ +} + +void StatusMonitor::Recording( cDevice const*, char const*, char const*, bool ) +{ + LiveTimerManager().DoReloadTimers(); +} + +StatusMonitor& LiveStatusMonitor() +{ + static StatusMonitor instance; + return instance; +} + +} // namespace vdrlive diff --git a/status.h b/status.h new file mode 100644 index 0000000..6f1b3ce --- /dev/null +++ b/status.h @@ -0,0 +1,23 @@ +#ifndef VDR_LIVE_STATUS_H +#define VDR_LIVE_STATUS_H + +#include + +namespace vdrlive { + +class StatusMonitor: public cStatus +{ + friend StatusMonitor& LiveStatusMonitor(); + +private: + StatusMonitor(); + StatusMonitor( StatusMonitor const& ); + + virtual void Recording( cDevice const* Device, char const* Name, char const* FileName, bool On ); +}; + +StatusMonitor& LiveStatusMonitor(); + +} // namespace vdrlive + +#endif // VDR_LIVE_STATUS_H diff --git a/timers.cpp b/timers.cpp index b497d1b..9f0c8fb 100644 --- a/timers.cpp +++ b/timers.cpp @@ -109,7 +109,7 @@ void TimerManager::DoPendingWork() dsyslog("SV: signalling waiters"); m_updateWait.Broadcast(); } - m_timers.ReloadTimers(); + DoReloadTimers(); } void TimerManager::DoUpdateTimers() diff --git a/timers.h b/timers.h index 55feb46..0ada455 100644 --- a/timers.h +++ b/timers.h @@ -41,6 +41,7 @@ public: // may only be called from Plugin::MainThreadHook void DoPendingWork(); + void DoReloadTimers() { m_timers.ReloadTimers(); } private: typedef std::pair< cTimer*, std::string > TimerPair; -- cgit v1.2.3