I started to use Udo Richter's shutdown rewrite
<http://www.udo-richter.de/vdr/patches.en.html#shutdown>
on my VDR box.  I patched the vdr-softdevice and vdr-subtitles
plugins to take advantage of the method Shutdown.IsUserInactive()
that was introduced by Udo's patch:

http://www.iki.fi/~msmakela/software/vdr/#shutdown
http://www.iki.fi/~msmakela/software/vdr/shutdown-subtitles-0.5.0.patch
http://www.iki.fi/~msmakela/software/vdr/shutdown-softdevice.patch

The softdevice patch is attached.  Please consider applying it.

        Marko
Index: mpeg2decoder.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/mpeg2decoder.c,v
retrieving revision 1.71
diff -p -u -r1.71 mpeg2decoder.c
--- mpeg2decoder.c	28 Jan 2007 19:29:53 -0000	1.71
+++ mpeg2decoder.c	30 Jan 2007 16:35:23 -0000
@@ -1639,12 +1639,17 @@ int cMpeg2Decoder::BufferFill(int Stream
 int cMpeg2Decoder::Decode(const uchar *Data, int Length)
 {
   BUFDEB("Decode %p, Length %d\n",Data,Length);
+#ifdef PATCH_SHUTDOWN_REWRITE
+  bool shouldSuspend = setupStore.doSuspend;
+#else
+  int shouldSuspend = setupStore.shouldSuspend;
+#endif
 
-  if (running && !IsSuspended && setupStore.shouldSuspend)
+  if (running && !IsSuspended && shouldSuspend)
      // still running and should suspend
      Suspend();
 
-  if (!running && IsSuspended && !setupStore.shouldSuspend)
+  if (!running && IsSuspended && !shouldSuspend)
      // not running and should resume
      Resume();
 
Index: setup-softdevice.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/setup-softdevice.c,v
retrieving revision 1.48
diff -p -u -r1.48 setup-softdevice.c
--- setup-softdevice.c	3 Dec 2006 18:26:21 -0000	1.48
+++ setup-softdevice.c	30 Jan 2007 16:35:24 -0000
@@ -107,6 +107,9 @@ cSetupStore::cSetupStore ()
   ppQuality   = 0;
   syncOnFrames  = 0;
   avOffset      = 0;
+#ifdef PATCH_SHUTDOWN_REWRITE
+  doSuspend = false;
+#endif
   shouldSuspend = 0;
   ac3Mode       = 0;
   useMixer      = 0;
Index: setup-softdevice.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/setup-softdevice.h,v
retrieving revision 1.36
diff -p -u -r1.36 setup-softdevice.h
--- setup-softdevice.h	3 Dec 2006 18:26:21 -0000	1.36
+++ setup-softdevice.h	30 Jan 2007 16:35:24 -0000
@@ -155,6 +155,9 @@ class cSetupStore {
     int   tripleBuffering;
     int   useStretchBlit;
     bool  stretchBlitLocked;
+#ifdef PATCH_SHUTDOWN_REWRITE
+    bool  doSuspend;
+#endif
     int   shouldSuspend;
     int   osdMode;
     int   ac3Mode;
Index: softdevice.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/softdevice.c,v
retrieving revision 1.77
diff -p -u -r1.77 softdevice.c
--- softdevice.c	28 Jan 2007 19:38:06 -0000	1.77
+++ softdevice.c	30 Jan 2007 16:35:24 -0000
@@ -15,6 +15,9 @@
 
 #include <vdr/osd.h>
 #include <vdr/dvbspu.h>
+#ifdef PATCH_SHUTDOWN_REWRITE
+# include <vdr/shutdown.h>
+#endif
 
 #include <sys/mman.h>
 #include <sys/ioctl.h>
@@ -1138,5 +1141,12 @@ bool cPluginSoftDevice::SetupParse(const
   // Parse your own setup parameters and store their values.
   return setupStore.SetupParse(Name, Value);
 }
+
+#ifdef PATCH_SHUTDOWN_REWRITE
+void cPluginSoftDevice::MainThreadHook(void)
+{
+  setupStore.doSuspend = setupStore.shouldSuspend || Shutdown.IsUserInactive();
+}
+#endif
 
 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	30 Jan 2007 16:35:24 -0000
@@ -58,6 +58,9 @@ public:
   virtual cOsdObject *MainMenuAction(void);
   virtual cMenuSetupPage *SetupMenu(void);
   virtual bool SetupParse(const char *Name, const char *Value);
+#ifdef PATCH_SHUTDOWN_REWRITE
+  virtual void MainThreadHook(void);
+#endif
 #if VDRVERSNUM >= 10330
   virtual bool Service(const char *Id, void *Data = NULL);
 #endif
_______________________________________________
Softdevice-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/softdevice-devel

Reply via email to