diff --git a/ChangeLog b/ChangeLog index 67f53a3..6a96d63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +User master_red +Date: Mon Aug 10 15:29:33 CEST 2015 + + Configurable enable DPMS, while black screen is displayed. + User johns -Date: +Date: Tue Jun 30 10:12:09 CET 2015 Fix bug: wrong and crash, if vdr draws pixmaps outside OSD. Fix bug: wrong version number check for av_frame_alloc(), ... diff --git a/po/de_DE.po b/po/de_DE.po index 68812a4..5e2d706 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDR \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-31 12:36+0100\n" +"POT-Creation-Date: 2015-06-10 21:21+0200\n" "PO-Revision-Date: blabla\n" "Last-Translator: blabla\n" "Language-Team: blabla\n" @@ -501,6 +501,9 @@ msgstr "Unterbrechen stoppt X11" msgid "Video" msgstr "Video" +msgid "Enable Screensaver(DPMS) at black screen" +msgstr "Bildschirmschoner(DPMS) bei schwarzen Bild aktivieren" + msgid "Video background color (RGB)" msgstr "Video Hintergrundfrabe (RGB)" diff --git a/softhddevice.cpp b/softhddevice.cpp index 7310a1f..f9b0983 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -165,6 +165,10 @@ static int ConfigPipAltVideoWidth; ///< config pip alt. video width in % static int ConfigPipAltVideoHeight = 50; ///< config pip alt. video height in % #endif +#ifdef USE_SCREENSAVER +static char ConfigEnableDPMSatBlackScreen; ///< Enable DPMS(Screensaver) while displaying black screen(radio) +#endif + static volatile int DoMakePrimary; ///< switch primary device to this #define SUSPEND_EXTERNAL -1 ///< play external suspend mode @@ -764,6 +768,9 @@ class cMenuSetupSoft:public cMenuSetupPage int PipAltVideoHeight; #endif +#ifdef USE_SCREENSAVER + int EnableDPMSatBlackScreen; +#endif /// @} private: inline cOsdItem * CollapsedItem(const char *, int &, const char * = NULL); @@ -882,6 +889,11 @@ void cMenuSetupSoft::Create(void) // Add(CollapsedItem(tr("Video"), Video)); if (Video) { +#ifdef USE_SCREENSAVER + Add(new + cMenuEditBoolItem(tr("Enable Screensaver(DPMS) at black screen"), + &EnableDPMSatBlackScreen, trVDR("no"), trVDR("yes"))); +#endif Add(new cMenuEditStraItem(trVDR("4:3 video display format"), &Video4to3DisplayFormat, 3, video_display_formats_4_3)); Add(new cMenuEditStraItem(trVDR("16:9+other video display format"), @@ -1198,6 +1210,11 @@ cMenuSetupSoft::cMenuSetupSoft(void) PipAltVideoWidth = ConfigPipAltVideoWidth; PipAltVideoHeight = ConfigPipAltVideoHeight; #endif + +#ifdef USE_SCREENSAVER + EnableDPMSatBlackScreen = ConfigEnableDPMSatBlackScreen; +#endif + Create(); } @@ -1362,6 +1379,12 @@ void cMenuSetupSoft::Store(void) SetupStore("pip.Alt.VideoHeight", ConfigPipAltVideoHeight = PipAltVideoHeight); #endif + +#ifdef USE_SCREENSAVER + SetupStore("EnableDPMSatBlackScreen", ConfigEnableDPMSatBlackScreen = + EnableDPMSatBlackScreen); + SetDPMSatBlackScreen(ConfigEnableDPMSatBlackScreen); +#endif } ////////////////////////////////////////////////////////////////////////////// @@ -3241,6 +3264,15 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) return true; } #endif + +#ifdef USE_SCREENSAVER + if (!strcasecmp(name, "EnableDPMSatBlackScreen")) { + ConfigEnableDPMSatBlackScreen = atoi(value); + SetDPMSatBlackScreen(ConfigEnableDPMSatBlackScreen); + return true; + } +#endif + return false; } diff --git a/video.c b/video.c index e0ef3d9..d7a7d36 100644 --- a/video.c +++ b/video.c @@ -430,6 +430,11 @@ static int OsdDirtyHeight; ///< osd dirty area height static int64_t VideoDeltaPTS; ///< FIXME: fix pts +#ifdef USE_SCREENSAVER +static char DPMSDisabled; ///< flag we have disabled dpms +static char EnableDPMSatBlackScreen; ///< flag we should enable dpms at black screen +#endif + //---------------------------------------------------------------------------- // Common Functions //---------------------------------------------------------------------------- @@ -438,6 +443,13 @@ static void VideoThreadLock(void); ///< lock video thread static void VideoThreadUnlock(void); ///< unlock video thread static void VideoThreadExit(void); ///< exit/kill video thread +#ifdef USE_SCREENSAVER +static void X11SuspendScreenSaver(xcb_connection_t *, int); +static int X11HaveDPMS(xcb_connection_t *); +static void X11DPMSReenable(xcb_connection_t *); +static void X11DPMSDisable(xcb_connection_t *); +#endif + /// /// Update video pts. /// @@ -4909,7 +4921,20 @@ static void VaapiDisplayFrame(void) decoder->LastSurface = decoder->BlackSurface; #endif VaapiMessage(3, "video/vaapi: black surface displayed\n"); +#ifdef USE_SCREENSAVER + if (EnableDPMSatBlackScreen && DPMSDisabled) { + Debug(3, "Black surface, DPMS enabled"); + X11DPMSReenable(Connection); + X11SuspendScreenSaver(Connection, 1); + } +#endif continue; +#ifdef USE_SCREENSAVER + } else if (!DPMSDisabled) { // always disable + Debug(3, "DPMS disabled"); + X11DPMSDisable(Connection); + X11SuspendScreenSaver(Connection, 0); +#endif } surface = decoder->SurfacesRb[decoder->SurfaceRead]; @@ -8605,8 +8630,21 @@ static void VdpauDisplayFrame(void) || decoder->Closing < -300) { VdpauBlackSurface(decoder); VdpauMessage(3, "video/vdpau: black surface displayed\n"); +#ifdef USE_SCREENSAVER + if (EnableDPMSatBlackScreen && DPMSDisabled) { + VdpauMessage(3, "Black surface, DPMS enabled\n"); + X11DPMSReenable(Connection); + X11SuspendScreenSaver(Connection, 1); + } +#endif } continue; +#ifdef USE_SCREENSAVER + } else if (!DPMSDisabled) { // always disable + VdpauMessage(3, "DPMS disabled\n"); + X11DPMSDisable(Connection); + X11SuspendScreenSaver(Connection, 0); +#endif } VdpauMixVideo(decoder, i); @@ -10572,8 +10610,6 @@ void VideoGetVideoSize(VideoHwDecoder * hw_decoder, int *width, int *height, // DPMS / Screensaver //---------------------------------------------------------------------------- -static char DPMSDisabled; ///< flag we have disabled dpms - /// /// Suspend X11 screen saver. /// @@ -10664,11 +10700,11 @@ static void X11DPMSDisable(xcb_connection_t * connection) if (reply) { if (reply->state) { Debug(3, "video: dpms was enabled\n"); - DPMSDisabled = 1; xcb_dpms_disable(connection); // monitor powersave off } free(reply); } + DPMSDisabled = 1; } } @@ -11303,6 +11339,16 @@ void VideoSetAutoCrop(int interval, int delay, int tolerance) #endif } +/// +/// Set EnableDPMSatBlackScreen +/// +/// Currently this only choose the driver. +/// +void SetDPMSatBlackScreen(int enable) +{ + EnableDPMSatBlackScreen = enable; +} + /// /// Raise video window. /// diff --git a/video.h b/video.h index baa16dc..7b676db 100644 --- a/video.h +++ b/video.h @@ -222,7 +222,10 @@ extern int VideoDecodeInput(VideoStream *); /// Get number of input buffers. extern int VideoGetBuffers(const VideoStream *); - /// Raise the frontend window -extern int VideoRaiseWindow(); + /// Set DPMS at Blackscreen switch +extern void SetDPMSatBlackScreen(int); + + /// Raise the frontend window +extern int VideoRaiseWindow(void); /// @}