From 11544ebe755cdcf345f53c581c2b1370ccd95e87 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 28 Jan 2014 11:24:53 +0000 Subject: Try to prevent windows machines going to sleep during encodes. --- src/lib/cross.cc | 8 ++++++++ src/lib/cross.h | 1 + src/lib/encoder.cc | 2 ++ 3 files changed, 11 insertions(+) (limited to 'src/lib') diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 57b3f93b2..9f7a76124 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -298,3 +298,11 @@ dcpomatic_fseek (FILE* stream, int64_t offset, int whence) return fseek (stream, offset, whence); #endif } + +void +kick () +{ +#ifdef DCPOMATIC_WINDOWS + SetThreadExecutionState (ES_CONTINUOUS); +#endif +} diff --git a/src/lib/cross.h b/src/lib/cross.h index 7e032e5a1..822b36631 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -35,3 +35,4 @@ extern boost::filesystem::path app_contents (); #endif extern FILE * fopen_boost (boost::filesystem::path, std::string); extern int dcpomatic_fseek (FILE *, int64_t, int); +void kick (); diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index fbec3e4d0..92b4763be 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -180,6 +180,8 @@ Encoder::frame_done () void Encoder::process_video (shared_ptr image, Eyes eyes, ColourConversion conversion, bool same) { + kick (); + boost::mutex::scoped_lock lock (_mutex); /* XXX: discard 3D here if required */ -- cgit v1.2.3