mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Added the cPlugin::Housekeeping() function
This commit is contained in:
28
plugin.c
28
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();
|
||||
|
||||
Reference in New Issue
Block a user