On Sat, Jan 13, 2007 at 09:48:47PM +0100, Udo Richter wrote:
> Marko Mäkelä wrote:
> >A minor cosmetic thing: the '#' of pre-processor directives should always
> >be located at the first column of the line.  
> 
> The only indented directives are for the debug output I think, and this 
> will probably be removed before the final integration anyway.
> 
> >A more important suggestion: Could you please add a notification method
> >to status.h for notifying plugins whether VDR is currently in
> >interactive mode?  
> 
> You can poll this state on your own by calling 
> Shutdown.IsUserInactive().

I attach my patches to the subtitles and softdevice plugins.  I
intentionally kept them simple: I'm using the existing configuration
flags for disabling output.  It would be better to introduce a separate
variable for the configuration setting, and in MainThreadHook assign
the enable flag to either FALSE or the configured setting.  In that way,
the output could be permanently disabled from the plugin menus, as it
can be done now.

I'll post improved patches when the presence of the shutdown patch can
be tested with #ifdef.

        Marko
Index: softdevice.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/softdevice.c,v
retrieving revision 1.76
diff -p -u -r1.76 softdevice.c
--- softdevice.c	3 Dec 2006 20:38:18 -0000	1.76
+++ softdevice.c	22 Jan 2007 21:06:00 -0000
@@ -15,6 +15,7 @@
 
 #include <vdr/osd.h>
 #include <vdr/dvbspu.h>
+#include <vdr/shutdown.h>
 
 #include <sys/mman.h>
 #include <sys/ioctl.h>
@@ -1084,6 +1085,11 @@ bool cPluginSoftDevice::SetupParse(const
 {
   // Parse your own setup parameters and store their values.
   return setupStore.SetupParse(Name, Value);
+}
+
+void cPluginSoftDevice::MainThreadHook(void)
+{
+  setupStore.shouldSuspend = Shutdown.IsUserInactive();
 }
 
 VDRPLUGINCREATOR(cPluginSoftDevice); // Don't touch this!
Index: softdevice.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/softdevice.h,v
retrieving revision 1.13
diff -p -u -r1.13 softdevice.h
--- softdevice.h	11 Nov 2006 08:45:17 -0000	1.13
+++ softdevice.h	22 Jan 2007 21:06:00 -0000
@@ -58,6 +58,7 @@ public:
   virtual cOsdObject *MainMenuAction(void);
   virtual cMenuSetupPage *SetupMenu(void);
   virtual bool SetupParse(const char *Name, const char *Value);
+  virtual void MainThreadHook(void);
 #if VDRVERSNUM >= 10330
   virtual bool Service(const char *Id, void *Data = NULL);
 #endif
diff -pu subtitles-0.3.11/subtitles.c subtitles-0.3.11/subtitles.c
--- subtitles-0.3.11/subtitles.c	2006-04-28 17:24:44.000000000 +0300
+++ subtitles-0.3.11/subtitles.c	2007-01-25 15:10:02.000000000 +0200
@@ -11,6 +11,7 @@
 #include <vdr/device.h>
 #include <vdr/i18n.h>
 #include <vdr/tools.h>
+#include <vdr/shutdown.h>
 #include <vdr/config.h> // VDRVERSION
 #include "subfilter.h"
 #include "configuration.h"
@@ -49,6 +50,7 @@ public:
   virtual cOsdObject *MainMenuAction(void);
   virtual cMenuSetupPage *SetupMenu(void);
   virtual bool SetupParse(const char *Name, const char *Value);
+  virtual void MainThreadHook(void);
 
   };
 
@@ -132,4 +134,10 @@ bool cPluginSubtitles::SetupParse(const 
 {
     return gSubtitlesConfiguration.Parse(Name,Value);
 }
+
+void cPluginSubtitles::MainThreadHook(void)
+{
+  gSubtitlesConfiguration.enabled = !Shutdown.IsUserInactive();
+}
+
 VDRPLUGINCREATOR(cPluginSubtitles); // Don't touch this!
_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to