diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-03-03 11:26:53 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-03-03 11:26:53 +0000 |
| commit | 9d075e8e4d9751eee153c0f00fb541a4217f116b (patch) | |
| tree | 73e17ebaf60f8eafe86e0d1f627185ace63411d8 /src/lib/cross.cc | |
| parent | 2ca921e378cd32ca44c389008a60dd08dd58f6e0 (diff) | |
Try to prevent OS X from sleeping during DCP encode.
Diffstat (limited to 'src/lib/cross.cc')
| -rw-r--r-- | src/lib/cross.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 9f7a76124..786f4b997 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -34,6 +34,7 @@ #ifdef DCPOMATIC_OSX #include <sys/sysctl.h> #include <mach-o/dyld.h> +#include <IOKit/pwr_mgt/IOPMLib.h> #endif #ifdef DCPOMATIC_POSIX #include <sys/types.h> @@ -300,9 +301,23 @@ dcpomatic_fseek (FILE* stream, int64_t offset, int whence) } void -kick () +Waker::nudge () { #ifdef DCPOMATIC_WINDOWS SetThreadExecutionState (ES_CONTINUOUS); #endif } + +Waker::Waker () +{ +#ifdef DCPOMATIC_OSX + IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id); +#endif +} + +Waker::~Waker () +{ +#ifdef DCPOMATIC_OSX + IOPMAssertionRelease (_assertion_id); +#endif +} |
