}
/*
+ * Inform the system that it is in use, thereby preventing the system from entering sleep
+ */
+bool x264_set_thread_execution_state(const bool systemRequired)
+{
+ EXECUTION_STATE state = NULL;
+ if(systemRequired)
+ {
+ state = SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED);
+ }
+ else
+ {
+ state = SetThreadExecutionState(ES_CONTINUOUS);
+ }
+ return (state != NULL);
+}
+
+/*
* Check for debugger (detect routine)
*/
static __forceinline bool x264_check_for_debugger(void)
bool x264_portable(void);
unsigned int x264_process_id(void);
QString x264_query_reg_string(const bool bUser, const QString &path, const QString &name);
+bool x264_set_thread_execution_state(const bool systemRequired);
bool x264_shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown);
void x264_sleep(const unsigned int delay);
bool x264_suspendProcess(const QProcess *proc, const bool suspend);
QMutex EncodeThread::m_mutex_startProcess;
/*
+ * RAII execution state handler
+ */
+static class ExecutionStateHandler
+{
+public:
+ ExecutionStateHandler(void)
+ {
+ x264_set_thread_execution_state(true);
+ }
+ ~ExecutionStateHandler(void)
+ {
+ x264_set_thread_execution_state(false);
+ }
+private:
+ //Disable copy constructor and assignment
+ ExecutionStateHandler(const ExecutionStateHandler &other) {}
+ ExecutionStateHandler &operator=(const ExecutionStateHandler &) {}
+
+ //Prevent object allocation on the heap
+ void *operator new(size_t); void *operator new[](size_t);
+ void operator delete(void *); void operator delete[](void*);
+};
+
+/*
* Macros
*/
#define CHECK_STATUS(ABORT_FLAG, OK_FLAG) do \
{
try
{
+ ExecutionStateHandler executionStateHandler;
encode();
}
catch(char *msg)
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 2
#define VER_X264_PATCH 5
-#define VER_X264_BUILD 623
+#define VER_X264_BUILD 625
#define VER_X264_MINIMUM_REV 2363
#define VER_X264_CURRENT_API 140