summaryrefslogtreecommitdiff
path: root/plugin.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-05-12 10:20:17 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2002-05-12 10:20:17 +0200
commit5d733e59ee0b0de00cf4967287ef7f431828726a (patch)
tree79e51986521582cc10f8a6cf0ae0dd05153cc96f /plugin.c
parent01c68def34bc8b1d2a2b5ac0a21c6eb4a13e04e3 (diff)
downloadvdr-5d733e59ee0b0de00cf4967287ef7f431828726a.tar.gz
vdr-5d733e59ee0b0de00cf4967287ef7f431828726a.tar.bz2
Added the cPlugin::Housekeeping() function
Diffstat (limited to 'plugin.c')
-rw-r--r--plugin.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/plugin.c b/plugin.c
index 00dfb7d4..3bf5112f 100644
--- a/plugin.c
+++ b/plugin.c
@@ -4,19 +4,21 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: plugin.c 1.2 2002/05/12 09:04:51 kls Exp $
+ * $Id: plugin.c 1.3 2002/05/12 10:10:38 kls Exp $
*/
#include "plugin.h"
#include <ctype.h>
#include <dirent.h>
#include <dlfcn.h>
+#include <time.h>
#include "config.h"
#define LIBVDR_PREFIX "libvdr-"
#define SO_INDICATOR ".so."
#define MAXPLUGINARGS 1024
+#define HOUSEKEEPINGDELTA 10 // seconds
// --- cPlugin ---------------------------------------------------------------
@@ -50,6 +52,10 @@ bool cPlugin::Start(void)
return true;
}
+void cPlugin::Housekeeping(void)
+{
+}
+
const char *cPlugin::MainMenuEntry(void)
{
return NULL;
@@ -202,6 +208,8 @@ cPluginManager *cPluginManager::pluginManager = NULL;
cPluginManager::cPluginManager(const char *Directory)
{
directory = NULL;
+ lastHousekeeping = time(NULL);
+ nextHousekeeping = -1;
if (pluginManager) {
fprintf(stderr, "vdr: attempt to create more than one plugin manager - exiting!\n");
exit(2);
@@ -278,13 +286,29 @@ bool cPluginManager::StartPlugins(void)
Setup.OSDLanguage = 0; // the i18n texts are only available _after_ Start()
isyslog(LOG_INFO, "starting plugin: %s (%s): %s", p->Name(), p->Version(), p->Description());
Setup.OSDLanguage = Language;
- if (!dll->Plugin()->Start())
+ if (!p->Start())
return false;
}
}
return true;
}
+void cPluginManager::Housekeeping(void)
+{
+ if (time(NULL) - lastHousekeeping > HOUSEKEEPINGDELTA) {
+ if (++nextHousekeeping >= dlls.Count())
+ nextHousekeeping = 0;
+ cDll *dll = dlls.Get(nextHousekeeping);
+ if (dll) {
+ cPlugin *p = dll->Plugin();
+ if (p) {
+ p->Housekeeping();
+ }
+ }
+ lastHousekeeping = time(NULL);
+ }
+}
+
bool cPluginManager::HasPlugins(void)
{
return pluginManager && pluginManager->dlls.Count();