10 #define MUTE_DEPRECATED_MAINTHREADHOOK
21 #define LIBVDR_PREFIX "libvdr-"
22 #define SO_INDICATOR ".so."
24 #define MAXPLUGINARGS 1024
25 #define HOUSEKEEPINGDELTA 10
145 esyslog(
"ERROR: plugin '%s' called cPlugin::ConfigDirectory(), which is not thread safe!", PluginName ? PluginName :
"<no name given>");
147 return MakeDirs(buffer,
true) ? *buffer : NULL;
159 esyslog(
"ERROR: plugin '%s' called cPlugin::CacheDirectory(), which is not thread safe!", PluginName ? PluginName :
"<no name given>");
161 return MakeDirs(buffer,
true) ? *buffer : NULL;
173 esyslog(
"ERROR: plugin '%s' called cPlugin::ResourceDirectory(), which is not thread safe!", PluginName ? PluginName :
"<no name given>");
175 return MakeDirs(buffer,
true) ? *buffer : NULL;
183 args = Args ? strdup(Args) : NULL;
204 memmove(s, s + 1, strlen(s));
205 while (*s && *s != c) {
207 memmove(s, s + 1, strlen(s));
212 memmove(s, s + 1, strlen(s));
215 esyslog(
"ERROR: missing closing %c", c);
216 fprintf(stderr,
"vdr: missing closing %c\n", c);
229 const char *error = dlerror();
231 typedef cPlugin *create_t(
void);
232 create_t *create = (create_t *)dlsym(
handle,
"VDRPluginCreator");
234 if (!error && create) {
240 isyslog(
"plugin %s: missing symbol VDRPluginDestroyer(), please rebuild",
fileName);
255 case '\\': memmove(p, p + 1, strlen(p));
259 esyslog(
"ERROR: missing character after \\");
260 fprintf(stderr,
"vdr: missing character after \\\n");
265 case '\'':
if ((p =
SkipQuote(p)) == NULL)
268 default:
if (!*p || isspace(*p)) {
275 esyslog(
"ERROR: plugin argument list too long");
276 fprintf(stderr,
"vdr: plugin argument list too long\n");
295 fprintf(stderr,
"vdr: %s\n", error);
310 fprintf(stderr,
"vdr: attempt to create more than one plugin manager - exiting!\n");
328 directory = Directory ? strdup(Directory) : NULL;
333 if (strcmp(Args,
"*") == 0) {
335 for (
int i = 0; i < Files.
Size(); i++) {
336 char *FileName = Files.
At(i);
344 if (strcmp(name,
"*") != 0) {
354 char *p = strchr(s,
' ');
359 esyslog(
"WARN: missing plugin '%s'", s);
360 fprintf(stderr,
"vdr: missing plugin '%s'\n", s);
449 time_t Now = time(NULL);
455 if (t > Now && (!Next || t < Next)) {
473 return dll ? dll->
Plugin() : NULL;
481 if (p && strcmp(p->
Name(), Name) == 0)
528 while ((dll =
dlls.
Last()) != NULL) {
void destroy_t(cPlugin *)
cDll(const char *FileName, const char *Args)
bool Load(bool Log=false)
bool Confirm(const char *s, int Seconds=10, bool WaitForTimeout=false)
void Del(cListObject *Object, bool DeleteObject=true)
void Add(cListObject *Object, cListObject *After=NULL)
const T * Next(const T *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
const T * Last(void) const
Returns the last element in this list, or NULL if the list is empty.
const T * First(void) const
Returns the first element in this list, or NULL if the list is empty.
const T * Get(int Index) const
Returns the list element at the given Index, or NULL if no such element exists.
const T * Prev(const T *Object) const
static cPluginManager * pluginManager
static cPlugin * GetNextWakeupPlugin(void)
void MainThreadHook(void)
cPluginManager(const char *Directory)
void SetDirectory(const char *Directory)
bool InitializePlugins(void)
void AddPlugin(const char *Args)
static bool Active(const char *Prompt=NULL)
static bool HasPlugins(void)
static bool CallAllServices(const char *Id, void *Data=NULL)
bool LoadPlugins(bool Log=false)
void Shutdown(bool Log=false)
static cPlugin * CallFirstService(const char *Id, void *Data=NULL)
virtual ~cPluginManager()
static cPlugin * GetPlugin(int Index)
virtual time_t WakeupTime(void)
virtual bool Initialize(void)
virtual cMenuSetupPage * SetupMenu(void)
virtual const char * CommandLineHelp(void)
virtual const char * Description(void)=0
virtual void Housekeeping(void)
static cString cacheDirectory
void SetName(const char *s)
void SetupStore(const char *Name, const char *Value=NULL)
virtual const char * MainMenuEntry(void)
static cString resourceDirectory
static void SetCacheDirectory(const char *Dir)
virtual bool Service(const char *Id, void *Data=NULL)
virtual const char * Version(void)=0
virtual cOsdObject * MainMenuAction(void)
static void SetConfigDirectory(const char *Dir)
static void SetResourceDirectory(const char *Dir)
static const char * CacheDirectory(const char *PluginName=NULL)
static const char * ResourceDirectory(const char *PluginName=NULL)
static const char * ConfigDirectory(const char *PluginName=NULL)
virtual void MainThreadHook(void)
virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
virtual cString Active(void)
virtual const char ** SVDRPHelpPages(void)
static cString configDirectory
virtual bool SetupParse(const char *Name, const char *Value)
virtual bool ProcessArgs(int argc, char *argv[])
void Store(const char *Name, const char *Value, const char *Plugin=NULL, bool AllowMultiple=false)
static cString sprintf(const char *fmt,...) __attribute__((format(printf
static tThreadId IsMainThread(void)
void I18nRegister(const char *Plugin)
Registers the named plugin, so that it can use internationalized texts.
#define HOUSEKEEPINGDELTA
static char * SkipQuote(char *s)