Now that VDR 1.5.1 includes the rewritten shutdown logic by Udo Richter,
I hope that the attached patch can be applied to softdevice. It
suspends the output when ShutdownHandler.IsUserInactive() holds.
The setup menu item for suspending output still works.
Please note that the variable "Shutdown" of Udo's patch was renamed to
"ShutdownHandler" in VDR 1.5.1. The attached patch uses "ShutdownHandler".
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);
+#if VDRVERSNUM >= 10501 || defined 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.49
diff -p -u -r1.49 setup-softdevice.c
--- setup-softdevice.c 10 Feb 2007 00:02:14 -0000 1.49
+++ setup-softdevice.c 25 Feb 2007 19:51:31 -0000
@@ -96,6 +96,9 @@ cSetupStore::cSetupStore ()
ppQuality = 0;
syncOnFrames = 0;
avOffset = 0;
+#if VDRVERSNUM >= 10501 || defined 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.37
diff -p -u -r1.37 setup-softdevice.h
--- setup-softdevice.h 10 Feb 2007 00:02:14 -0000 1.37
+++ setup-softdevice.h 25 Feb 2007 19:51:31 -0000
@@ -157,6 +157,9 @@ class cSetupStore {
int tripleBuffering;
int useStretchBlit;
bool stretchBlitLocked;
+#if VDRVERSNUM >= 10501 || defined 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.78
diff -p -u -r1.78 softdevice.c
--- softdevice.c 9 Feb 2007 23:55:22 -0000 1.78
+++ softdevice.c 12 Feb 2007 20:04:42 -0000
@@ -15,6 +15,9 @@
#include <vdr/osd.h>
#include <vdr/dvbspu.h>
+#if VDRVERSNUM >= 10501 || defined PATCH_SHUTDOWN_REWRITE
+# include <vdr/shutdown.h>
+#endif
#include <sys/mman.h>
#include <sys/ioctl.h>
@@ -506,6 +509,12 @@ bool cSoftDevice::Flush(int TimeoutMs)
return decoder->BufferFill() == 0;
};
+#if VDRVERSNUM >= 10501 || defined PATCH_SHUTDOWN_REWRITE
+# define SHOULD_SUSPEND setupStore.doSuspend
+#else
+# define SHOULD_SUSPEND setupStore.shouldSuspend
+#endif
+
#if VDRVERSNUM < 10318
/* ----------------------------------------------------------------------------
*/
@@ -526,7 +535,7 @@ int cSoftDevice::PlayAudio(const uchar *
{
SOFTDEB("PlayAudio... %p length %d\n",Data,Length);
#if VDRVERSNUM >= 10342
- if (setupStore.shouldSuspend && !Transferring()) {
+ if (SHOULD_SUSPEND && !Transferring()) {
usleep(10000); // avoid burning CPU
return 0;
}
@@ -587,7 +596,7 @@ int cSoftDevice::PlayVideo(const uchar *
{
SOFTDEB("PlayVideo %x length %d\n",Data,Length);
#if VDRVERSNUM >= 10342
- if (setupStore.shouldSuspend && !Transferring()) {
+ if (SHOULD_SUSPEND && !Transferring()) {
usleep(10000); // avoid burning CPU
return 0;
}
@@ -1150,5 +1159,13 @@ bool cPluginSoftDevice::SetupParse(const
// Parse your own setup parameters and store their values.
return setupStore.SetupParse(Name, Value);
}
+
+#if VDRVERSNUM >= 10501 || defined PATCH_SHUTDOWN_REWRITE
+void cPluginSoftDevice::MainThreadHook(void)
+{
+ setupStore.doSuspend =
+ setupStore.shouldSuspend || ShutdownHandler.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);
+#if VDRVERSNUM >= 10501 || defined 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