Added option to set the process priority of the encoder processes.
This commit is contained in:
parent
4e2094c296
commit
e1e7248b3a
@ -10,7 +10,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>379</width>
|
<width>379</width>
|
||||||
<height>325</height>
|
<height>366</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -34,6 +34,22 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="13" column="1" colspan="5">
|
||||||
|
<spacer name="verticalSpacer_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>8</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item row="2" column="2" colspan="2">
|
<item row="2" column="2" colspan="2">
|
||||||
<widget class="QLabel" name="labelJobCount">
|
<widget class="QLabel" name="labelJobCount">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -47,7 +63,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" rowspan="12">
|
<item row="1" column="0" rowspan="13">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -63,7 +79,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="6" rowspan="12">
|
<item row="1" column="6" rowspan="13">
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -185,7 +201,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="1" colspan="5">
|
<item row="15" column="1" colspan="5">
|
||||||
<spacer name="verticalSpacer_3">
|
<spacer name="verticalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -318,6 +334,51 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="14" column="4">
|
||||||
|
<widget class="QComboBox" name="comboBoxPriority">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="frame">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Normal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Below Normal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Idle</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="14" column="5">
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="14" column="2" colspan="2">
|
||||||
|
<widget class="QLabel" name="labelProcessPriority">
|
||||||
|
<property name="text">
|
||||||
|
<string>Priority for encoder processes:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_options.h"
|
#include "model_options.h"
|
||||||
|
#include "win_preferences.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
@ -103,7 +104,7 @@ static const unsigned int REV_MULT = 10000;
|
|||||||
// Constructor & Destructor
|
// Constructor & Destructor
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64)
|
EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64, unsigned int processPriroity)
|
||||||
:
|
:
|
||||||
m_jobId(QUuid::createUuid()),
|
m_jobId(QUuid::createUuid()),
|
||||||
m_sourceFileName(sourceFileName),
|
m_sourceFileName(sourceFileName),
|
||||||
@ -113,6 +114,7 @@ EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputF
|
|||||||
m_x264_x64(x264_x64),
|
m_x264_x64(x264_x64),
|
||||||
m_x264_10bit(x264_10bit),
|
m_x264_10bit(x264_10bit),
|
||||||
m_avs2yuv_x64(avs2yuv_x64),
|
m_avs2yuv_x64(avs2yuv_x64),
|
||||||
|
m_processPriority(processPriroity),
|
||||||
m_handle_jobObject(NULL),
|
m_handle_jobObject(NULL),
|
||||||
m_semaphorePaused(0)
|
m_semaphorePaused(0)
|
||||||
{
|
{
|
||||||
@ -1115,10 +1117,21 @@ bool EncodeThread::startProcess(QProcess &process, const QString &program, const
|
|||||||
AssignProcessToJobObject(m_handle_jobObject, process.pid()->hProcess);
|
AssignProcessToJobObject(m_handle_jobObject, process.pid()->hProcess);
|
||||||
if(pid != NULL)
|
if(pid != NULL)
|
||||||
{
|
{
|
||||||
|
switch(m_processPriority)
|
||||||
|
{
|
||||||
|
case PreferencesDialog::X264_PRIORITY_NORMAL:
|
||||||
|
SetPriorityClass(process.pid()->hProcess, NORMAL_PRIORITY_CLASS);
|
||||||
|
break;
|
||||||
|
case PreferencesDialog::X264_PRIORITY_BELOWNORMAL:
|
||||||
if(!SetPriorityClass(process.pid()->hProcess, BELOW_NORMAL_PRIORITY_CLASS))
|
if(!SetPriorityClass(process.pid()->hProcess, BELOW_NORMAL_PRIORITY_CLASS))
|
||||||
{
|
{
|
||||||
SetPriorityClass(process.pid()->hProcess, IDLE_PRIORITY_CLASS);
|
SetPriorityClass(process.pid()->hProcess, IDLE_PRIORITY_CLASS);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case PreferencesDialog::X264_PRIORITY_IDLE:
|
||||||
|
SetPriorityClass(process.pid()->hProcess, IDLE_PRIORITY_CLASS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
JobStatus_Undefined = 666
|
JobStatus_Undefined = 666
|
||||||
};
|
};
|
||||||
|
|
||||||
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64);
|
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64, unsigned int processPriroity);
|
||||||
~EncodeThread(void);
|
~EncodeThread(void);
|
||||||
|
|
||||||
QUuid getId(void) { return this->m_jobId; };
|
QUuid getId(void) { return this->m_jobId; };
|
||||||
@ -92,6 +92,7 @@ protected:
|
|||||||
const bool m_x264_x64;
|
const bool m_x264_x64;
|
||||||
const bool m_x264_10bit;
|
const bool m_x264_10bit;
|
||||||
const bool m_avs2yuv_x64;
|
const bool m_avs2yuv_x64;
|
||||||
|
const unsigned int m_processPriority;
|
||||||
|
|
||||||
//Flags
|
//Flags
|
||||||
volatile bool m_abort;
|
volatile bool m_abort;
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 1
|
#define VER_X264_MINOR 1
|
||||||
#define VER_X264_PATCH 3
|
#define VER_X264_PATCH 4
|
||||||
#define VER_X264_BUILD 471
|
#define VER_X264_BUILD 475
|
||||||
|
|
||||||
#define VER_X264_MINIMUM_REV 2282
|
#define VER_X264_MINIMUM_REV 2282
|
||||||
#define VER_X264_CURRENT_API 133
|
#define VER_X264_CURRENT_API 133
|
||||||
|
@ -1109,7 +1109,8 @@ bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputF
|
|||||||
QString("%1/toolset").arg(m_appDir),
|
QString("%1/toolset").arg(m_appDir),
|
||||||
m_cpuFeatures->x64,
|
m_cpuFeatures->x64,
|
||||||
m_preferences.use10BitEncoding,
|
m_preferences.use10BitEncoding,
|
||||||
m_cpuFeatures->x64 && m_preferences.useAvisyth64Bit
|
m_cpuFeatures->x64 && m_preferences.useAvisyth64Bit,
|
||||||
|
m_preferences.processPriority
|
||||||
);
|
);
|
||||||
|
|
||||||
QModelIndex newIndex = m_jobList->insertJob(thrd);
|
QModelIndex newIndex = m_jobList->insertJob(thrd);
|
||||||
|
@ -75,6 +75,7 @@ void PreferencesDialog::showEvent(QShowEvent *event)
|
|||||||
checkUse10BitEncoding->blockSignals(false);
|
checkUse10BitEncoding->blockSignals(false);
|
||||||
|
|
||||||
spinBoxJobCount->setValue(m_preferences->maxRunningJobCount);
|
spinBoxJobCount->setValue(m_preferences->maxRunningJobCount);
|
||||||
|
comboBoxPriority->setCurrentIndex(qBound(0U, m_preferences->processPriority, 2U));
|
||||||
|
|
||||||
checkUse64BitAvs2YUV->setEnabled(m_x64);
|
checkUse64BitAvs2YUV->setEnabled(m_x64);
|
||||||
labelUse64BitAvs2YUV->setEnabled(m_x64);
|
labelUse64BitAvs2YUV->setEnabled(m_x64);
|
||||||
@ -120,6 +121,7 @@ void PreferencesDialog::done(int n)
|
|||||||
m_preferences->saveLogFiles = checkSaveLogFiles->isChecked();
|
m_preferences->saveLogFiles = checkSaveLogFiles->isChecked();
|
||||||
m_preferences->saveToSourcePath = checkSaveToSourceFolder->isChecked();
|
m_preferences->saveToSourcePath = checkSaveToSourceFolder->isChecked();
|
||||||
m_preferences->maxRunningJobCount = spinBoxJobCount->value();
|
m_preferences->maxRunningJobCount = spinBoxJobCount->value();
|
||||||
|
m_preferences->processPriority = comboBoxPriority->currentIndex();
|
||||||
|
|
||||||
savePreferences(m_preferences);
|
savePreferences(m_preferences);
|
||||||
QDialog::done(n);
|
QDialog::done(n);
|
||||||
@ -162,6 +164,7 @@ void PreferencesDialog::initPreferences(Preferences *preferences)
|
|||||||
preferences->useAvisyth64Bit = false;
|
preferences->useAvisyth64Bit = false;
|
||||||
preferences->saveLogFiles = false;
|
preferences->saveLogFiles = false;
|
||||||
preferences->saveToSourcePath = false;
|
preferences->saveToSourcePath = false;
|
||||||
|
preferences->processPriority = X264_PRIORITY_BELOWNORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::loadPreferences(Preferences *preferences)
|
void PreferencesDialog::loadPreferences(Preferences *preferences)
|
||||||
@ -180,6 +183,7 @@ void PreferencesDialog::loadPreferences(Preferences *preferences)
|
|||||||
preferences->useAvisyth64Bit = settings.value("use_64bit_avisynth", QVariant(defaults.useAvisyth64Bit)).toBool();
|
preferences->useAvisyth64Bit = settings.value("use_64bit_avisynth", QVariant(defaults.useAvisyth64Bit)).toBool();
|
||||||
preferences->saveLogFiles = settings.value("save_log_files", QVariant(defaults.saveLogFiles)).toBool();
|
preferences->saveLogFiles = settings.value("save_log_files", QVariant(defaults.saveLogFiles)).toBool();
|
||||||
preferences->saveToSourcePath = settings.value("save_to_source_path", QVariant(defaults.saveToSourcePath)).toBool();
|
preferences->saveToSourcePath = settings.value("save_to_source_path", QVariant(defaults.saveToSourcePath)).toBool();
|
||||||
|
preferences->processPriority = settings.value("process_priority", QVariant(defaults.processPriority)).toUInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::savePreferences(Preferences *preferences)
|
void PreferencesDialog::savePreferences(Preferences *preferences)
|
||||||
@ -195,6 +199,6 @@ void PreferencesDialog::savePreferences(Preferences *preferences)
|
|||||||
settings.setValue("use_64bit_avisynth", preferences->useAvisyth64Bit);
|
settings.setValue("use_64bit_avisynth", preferences->useAvisyth64Bit);
|
||||||
settings.setValue("save_log_files", preferences->saveLogFiles);
|
settings.setValue("save_log_files", preferences->saveLogFiles);
|
||||||
settings.setValue("save_to_source_path", preferences->saveToSourcePath);
|
settings.setValue("save_to_source_path", preferences->saveToSourcePath);
|
||||||
|
settings.setValue("process_priority", preferences->processPriority);
|
||||||
settings.sync();
|
settings.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,14 @@ class PreferencesDialog : public QDialog, private Ui::PreferencesDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
X264_PRIORITY_NORMAL = 0,
|
||||||
|
X264_PRIORITY_BELOWNORMAL = 1,
|
||||||
|
X264_PRIORITY_IDLE = 2,
|
||||||
|
}
|
||||||
|
x264_priority_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
bool autoRunNextJob;
|
bool autoRunNextJob;
|
||||||
@ -37,6 +45,7 @@ public:
|
|||||||
bool useAvisyth64Bit;
|
bool useAvisyth64Bit;
|
||||||
bool saveLogFiles;
|
bool saveLogFiles;
|
||||||
bool saveToSourcePath;
|
bool saveToSourcePath;
|
||||||
|
unsigned int processPriority;
|
||||||
}
|
}
|
||||||
Preferences;
|
Preferences;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user