libobs/util: Add functions to inhibit sleep

These fucntions prevent the computer from going to sleep, hibernating,
or starting up a screen saver.

On linux, it will also attempt to use DBus to prevent gnome/kde/etc
sleep, but it's not necessarily required in order to compile the
library.  Otherwise, it will simply call "xdg-screensaver reset" once
every 30 seconds to reset the screensaver timer.
This commit is contained in:
jp9000
2015-09-12 19:18:03 -07:00
parent 88ab25870e
commit d78d0072a0
7 changed files with 454 additions and 0 deletions

View File

@@ -9,6 +9,12 @@ include_directories(${FFMPEG_INCLUDE_DIRS})
list(REMOVE_ITEM FFMPEG_LIBRARIES ${FFMPEG_AVCODEC_LIBRARIES})
if(UNIX)
find_package(DBus QUIET)
else()
set(HAVE_DBUS "0")
endif()
find_package(ImageMagick QUIET COMPONENTS MagickCore)
if(NOT ImageMagick_MagickCore_FOUND AND NOT FFMPEG_AVCODEC_FOUND)
@@ -103,6 +109,15 @@ elseif(UNIX)
util/pipe-posix.c
util/platform-nix.c)
if(DBUS_FOUND)
set(libobs_PLATFORM_SOURCES ${libobs_PLATFORM_SOURCES}
util/platform-nix-dbus.c)
include_directories(${DBUS_INCLUDE_DIRS})
set(libobs_PLATFORM_DEPS
${libobs_PLATFORM_DEPS}
${DBUS_LIBRARIES})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
# use the sysinfo compatibility library on bsd
find_package(Libsysinfo REQUIRED)