summaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
authormaster_red <>2015-08-10 15:32:25 +0200
committerJohns <johns98@gmx.net>2015-08-10 15:32:25 +0200
commit700c8e8767e4632a63123b004c304892b31b5074 (patch)
tree98d9cd5769fde3916d49aef153f226730bab3e35 /video.c
parentec58e456072d962a18cb50f4324d266ba4a2aae8 (diff)
downloadvdr-plugin-softhddevice-700c8e8767e4632a63123b004c304892b31b5074.tar.gz
vdr-plugin-softhddevice-700c8e8767e4632a63123b004c304892b31b5074.tar.bz2
Configurable enable DPMS, while black screen is displayed.
Diffstat (limited to 'video.c')
-rw-r--r--video.c52
1 files changed, 49 insertions, 3 deletions
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;
}
}
@@ -11304,6 +11340,16 @@ void VideoSetAutoCrop(int interval, int delay, int tolerance)
}
///
+/// Set EnableDPMSatBlackScreen
+///
+/// Currently this only choose the driver.
+///
+void SetDPMSatBlackScreen(int enable)
+{
+ EnableDPMSatBlackScreen = enable;
+}
+
+///
/// Raise video window.
///
int VideoRaiseWindow(void)