More code refactoring: Got rid of the "binaries" class + added a SourceFactory class plus SourceInfo classes for each source type + some improvements of AddJob dialog.
This commit is contained in:
parent
d88c4ca553
commit
9a5076ffcb
@ -253,16 +253,6 @@
|
|||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>x264 (AVC)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>x265 (HEVC)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -303,16 +293,6 @@
|
|||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>32-Bit (x86)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>64-Bit (x86_64)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -353,16 +333,6 @@
|
|||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>8-Bit</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>10-Bit</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -425,26 +395,6 @@
|
|||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>CRF</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>CQ</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2-Pass</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>ABR</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -618,56 +568,6 @@
|
|||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Ultrafast</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Superfast</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Veryfast</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Faster</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Fast</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Medium</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Slow</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Slower</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Veryslow</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Placebo</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Simple x264 Launcher
|
|
||||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License along
|
|
||||||
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
//
|
|
||||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "binaries.h"
|
|
||||||
|
|
||||||
//Internal
|
|
||||||
#include "global.h"
|
|
||||||
#include "model_sysinfo.h"
|
|
||||||
#include "model_preferences.h"
|
|
||||||
#include "model_options.h"
|
|
||||||
|
|
||||||
//MUtils
|
|
||||||
#include <MUtils/Exception.h>
|
|
||||||
|
|
||||||
/* --- Avisynth --- */
|
|
||||||
|
|
||||||
QString AVS_BINARY(const SysinfoModel *sysinfo, const bool& x64)
|
|
||||||
{
|
|
||||||
return QString("%1/toolset/%2/avs2yuv_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences)
|
|
||||||
{
|
|
||||||
const bool avs32 = sysinfo->getAvisynth(SysinfoModel::Avisynth_X86);
|
|
||||||
const bool avs64 = sysinfo->getAvisynth(SysinfoModel::Avisynth_X64) && sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64);
|
|
||||||
return AVS_BINARY(sysinfo, (avs32 && avs64) ? preferences->getPrefer64BitSource() : avs64);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- VapurSynth --- */
|
|
||||||
|
|
||||||
QString VPS_BINARY(const SysinfoModel *sysinfo, const bool& x64)
|
|
||||||
{
|
|
||||||
return QString("%1/core%2/vspipe.exe").arg(sysinfo->getVPSPath(), (x64 ? "64" : "32"));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString VPS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences)
|
|
||||||
{
|
|
||||||
const bool vps32 = sysinfo->getVapourSynth(SysinfoModel::VapourSynth_X86);
|
|
||||||
const bool vps64 = sysinfo->getVapourSynth(SysinfoModel::VapourSynth_X64) && sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64);
|
|
||||||
return VPS_BINARY(sysinfo, (vps32 && vps64) ? preferences->getPrefer64BitSource() : vps64);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- AVS Checker--- */
|
|
||||||
|
|
||||||
QString CHK_BINARY(const SysinfoModel *sysinfo, const bool& x64)
|
|
||||||
{
|
|
||||||
return QString("%1/toolset/%2/avs_check_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
|
|
||||||
}
|
|
@ -28,7 +28,6 @@
|
|||||||
#include "model_sysinfo.h"
|
#include "model_sysinfo.h"
|
||||||
#include "model_status.h"
|
#include "model_status.h"
|
||||||
#include "source_abstract.h"
|
#include "source_abstract.h"
|
||||||
#include "binaries.h"
|
|
||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
#include <MUtils/Global.h>
|
#include <MUtils/Global.h>
|
||||||
|
@ -32,10 +32,11 @@ class AbstractEncoderInfo
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual QFlags<OptionsModel::EncVariant> getVariants(void) const = 0;
|
virtual QFlags<OptionsModel::EncVariant> getVariants(void) const = 0;
|
||||||
virtual QStringList getProfiles(const int &variant) const = 0;
|
virtual QStringList getProfiles(const OptionsModel::EncVariant &variant) const = 0;
|
||||||
virtual QStringList getTunings(void) const = 0;
|
virtual QStringList getTunings(void) const = 0;
|
||||||
|
virtual QStringList getPresets(void) const = 0;
|
||||||
virtual QStringList supportedOutputFormats(void) const = 0;
|
virtual QStringList supportedOutputFormats(void) const = 0;
|
||||||
virtual bool isRCModeSupported(const int rcMode) const = 0;
|
virtual bool isRCModeSupported(const OptionsModel::RCMode &rcMode) const = 0;
|
||||||
virtual bool isInputTypeSupported(const int format) const = 0;
|
virtual bool isInputTypeSupported(const int format) const = 0;
|
||||||
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const = 0;
|
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const = 0;
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@ AbstractEncoder *EncoderFactory::createEncoder(JobObject *jobObject, const Optio
|
|||||||
return encoder;
|
return encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const int &encoderType)
|
const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const OptionsModel::EncType &encoderType)
|
||||||
{
|
{
|
||||||
switch(encoderType)
|
switch(encoderType)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ class EncoderFactory
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static AbstractEncoder *createEncoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile);
|
static AbstractEncoder *createEncoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile);
|
||||||
static const AbstractEncoderInfo& getEncoderInfo(const int &encoderType);
|
static const AbstractEncoderInfo& getEncoderInfo(const OptionsModel::EncType &encoderType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EncoderFactory(void) {/*Disabled*/}
|
EncoderFactory(void) {/*Disabled*/}
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_options.h"
|
#include "model_options.h"
|
||||||
#include "model_status.h"
|
#include "model_status.h"
|
||||||
#include "binaries.h"
|
|
||||||
#include "mediainfo.h"
|
#include "mediainfo.h"
|
||||||
#include "model_sysinfo.h"
|
#include "model_sysinfo.h"
|
||||||
|
|
||||||
@ -101,7 +100,6 @@ public:
|
|||||||
virtual QStringList getTunings(void) const
|
virtual QStringList getTunings(void) const
|
||||||
{
|
{
|
||||||
QStringList tunings;
|
QStringList tunings;
|
||||||
|
|
||||||
tunings << "Film" << "Animation" << "Grain";
|
tunings << "Film" << "Animation" << "Grain";
|
||||||
tunings << "StillImage" << "PSNR" << "SSIM";
|
tunings << "StillImage" << "PSNR" << "SSIM";
|
||||||
tunings << "FastDecode" << "ZeroLatency" << "Touhou";
|
tunings << "FastDecode" << "ZeroLatency" << "Touhou";
|
||||||
@ -109,7 +107,15 @@ public:
|
|||||||
return tunings;
|
return tunings;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QStringList getProfiles(const int &variant) const
|
virtual QStringList getPresets(void) const
|
||||||
|
{
|
||||||
|
QStringList presets;
|
||||||
|
presets << "ultrafast" << "superfast" << "veryfast" << "faster" << "fast";
|
||||||
|
presets << "medium" << "slow" << "slower" << "veryslow" << "placebo";
|
||||||
|
return presets;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual QStringList getProfiles(const OptionsModel::EncVariant &variant) const
|
||||||
{
|
{
|
||||||
QStringList profiles;
|
QStringList profiles;
|
||||||
|
|
||||||
@ -132,7 +138,7 @@ public:
|
|||||||
return extLst;
|
return extLst;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isRCModeSupported(const int rcMode) const
|
virtual bool isRCModeSupported(const OptionsModel::RCMode &rcMode) const
|
||||||
{
|
{
|
||||||
switch(rcMode)
|
switch(rcMode)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_options.h"
|
#include "model_options.h"
|
||||||
#include "model_status.h"
|
#include "model_status.h"
|
||||||
#include "binaries.h"
|
|
||||||
#include "mediainfo.h"
|
#include "mediainfo.h"
|
||||||
#include "model_sysinfo.h"
|
#include "model_sysinfo.h"
|
||||||
|
|
||||||
@ -106,7 +105,15 @@ public:
|
|||||||
return tunings;
|
return tunings;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QStringList getProfiles(const int &variant) const
|
virtual QStringList getPresets(void) const
|
||||||
|
{
|
||||||
|
QStringList presets;
|
||||||
|
presets << "ultrafast" << "superfast" << "veryfast" << "faster" << "fast";
|
||||||
|
presets << "medium" << "slow" << "slower" << "veryslow" << "placebo";
|
||||||
|
return presets;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual QStringList getProfiles(const OptionsModel::EncVariant &variant) const
|
||||||
{
|
{
|
||||||
QStringList profiles;
|
QStringList profiles;
|
||||||
switch(variant)
|
switch(variant)
|
||||||
@ -131,7 +138,7 @@ public:
|
|||||||
return extLst;
|
return extLst;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isRCModeSupported(const int rcMode) const
|
virtual bool isRCModeSupported(const OptionsModel::RCMode &rcMode) const
|
||||||
{
|
{
|
||||||
switch(rcMode)
|
switch(rcMode)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
#include <MUtils/Global.h>
|
#include <MUtils/Global.h>
|
||||||
|
#include <MUtils/Exception.h>
|
||||||
|
|
||||||
//Qt
|
//Qt
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -201,3 +202,12 @@ bool AbstractSource::createProcess(QProcess &processEncode, QProcess&processInpu
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Source Info
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
|
const AbstractSourceInfo& AbstractSource::getSourceInfo(void)
|
||||||
|
{
|
||||||
|
MUTILS_THROW("[getSourceInfo] This function must be overwritten in sub-classes!");
|
||||||
|
}
|
||||||
|
@ -22,11 +22,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "tool_abstract.h"
|
#include "tool_abstract.h"
|
||||||
|
#include "model_options.h"
|
||||||
|
|
||||||
class QRegExp;
|
class QRegExp;
|
||||||
template<class T> class QList;
|
template<class T> class QList;
|
||||||
class QProcess;
|
class QProcess;
|
||||||
|
|
||||||
|
class AbstractSourceInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const bool& x64) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class AbstractSource : public AbstractTool
|
class AbstractSource : public AbstractTool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -38,6 +45,8 @@ public:
|
|||||||
virtual bool createProcess(QProcess &processEncode, QProcess&processInput);
|
virtual bool createProcess(QProcess &processEncode, QProcess&processInput);
|
||||||
virtual void flushProcess(QProcess &processInput) = 0;
|
virtual void flushProcess(QProcess &processInput) = 0;
|
||||||
|
|
||||||
|
static const AbstractSourceInfo& getSourceInfo(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine) = 0;
|
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine) = 0;
|
||||||
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen) = 0;
|
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen) = 0;
|
||||||
|
@ -24,24 +24,39 @@
|
|||||||
#include "source_avisynth.h"
|
#include "source_avisynth.h"
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_sysinfo.h"
|
|
||||||
#include "model_preferences.h"
|
|
||||||
#include "binaries.h"
|
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
static const unsigned int VER_X264_AVS2YUV_VER = 243;
|
static const unsigned int VER_X264_AVS2YUV_VER = 243;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Encoder Info
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
|
class AvisynthSourceInfo : public AbstractSourceInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const bool& x64) const
|
||||||
|
{
|
||||||
|
return QString("%1/toolset/%2/avs2yuv_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const AvisynthSourceInfo s_avisynthEncoderInfo;
|
||||||
|
|
||||||
|
const AbstractSourceInfo &AvisynthSource::getSourceInfo(void)
|
||||||
|
{
|
||||||
|
return s_avisynthEncoderInfo;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// Constructor & Destructor
|
// Constructor & Destructor
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
AvisynthSource::AvisynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
|
AvisynthSource::AvisynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
|
||||||
:
|
:
|
||||||
AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile),
|
AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile)
|
||||||
m_sourceName("Avisynth (avs)"),
|
|
||||||
m_binaryFile(AVS_BINARY(m_sysinfo, m_preferences))
|
|
||||||
{
|
{
|
||||||
/*Nothing to do here*/
|
/*Nothing to do here*/
|
||||||
}
|
}
|
||||||
@ -53,7 +68,7 @@ AvisynthSource::~AvisynthSource(void)
|
|||||||
|
|
||||||
QString AvisynthSource::getName(void) const
|
QString AvisynthSource::getName(void) const
|
||||||
{
|
{
|
||||||
return m_sourceName;
|
return tr("Avisynth (avs)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "source_abstract.h"
|
#include "source_abstract.h"
|
||||||
|
#include "model_sysinfo.h"
|
||||||
|
#include "model_preferences.h"
|
||||||
|
|
||||||
class AvisynthSource : public AbstractSource
|
class AvisynthSource : public AbstractSource
|
||||||
{
|
{
|
||||||
@ -37,6 +39,8 @@ public:
|
|||||||
|
|
||||||
virtual void flushProcess(QProcess &processInput);
|
virtual void flushProcess(QProcess &processInput);
|
||||||
|
|
||||||
|
static const AbstractSourceInfo& getSourceInfo(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
||||||
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
|
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
|
||||||
@ -45,9 +49,6 @@ protected:
|
|||||||
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
||||||
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
|
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
|
||||||
|
|
||||||
virtual QString getBinaryPath() const { return m_binaryFile; }
|
virtual QString getBinaryPath() const { return getSourceInfo().getBinaryPath(m_sysinfo, (m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_preferences->getPrefer64BitSource())); }
|
||||||
virtual void buildCommandLine(QStringList &cmdLine);
|
virtual void buildCommandLine(QStringList &cmdLine);
|
||||||
|
|
||||||
const QString m_sourceName;
|
|
||||||
const QString m_binaryFile;
|
|
||||||
};
|
};
|
||||||
|
54
src/source_factory.cpp
Normal file
54
src/source_factory.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Simple x264 Launcher
|
||||||
|
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
//
|
||||||
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "source_factory.h"
|
||||||
|
|
||||||
|
//Internal
|
||||||
|
#include "source_avisynth.h"
|
||||||
|
#include "source_vapoursynth.h"
|
||||||
|
|
||||||
|
//MUtils
|
||||||
|
#include <MUtils/Exception.h>
|
||||||
|
|
||||||
|
AbstractSource *SourceFactory::createSource(const SourceType &type, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
|
||||||
|
{
|
||||||
|
AbstractSource *source = NULL;
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SourceType_AVS: source = new AvisynthSource (jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile); break;
|
||||||
|
case SourceType_VPS: source = new VapoursynthSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile); break;
|
||||||
|
default: MUTILS_THROW("Invalid source type!");
|
||||||
|
}
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AbstractSourceInfo& SourceFactory::getSourceInfo(const SourceType &type)
|
||||||
|
{
|
||||||
|
const AbstractSourceInfo *sourceInfo = NULL;
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SourceType_AVS: sourceInfo = &AvisynthSource ::getSourceInfo(); break;
|
||||||
|
case SourceType_VPS: sourceInfo = &VapoursynthSource::getSourceInfo(); break;
|
||||||
|
default: MUTILS_THROW("Invalid source type!");
|
||||||
|
}
|
||||||
|
return (*sourceInfo);
|
||||||
|
}
|
||||||
|
|
@ -19,15 +19,25 @@
|
|||||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "model_options.h"
|
#pragma once
|
||||||
|
|
||||||
class SysinfoModel;
|
#include "source_abstract.h"
|
||||||
class PreferencesModel;
|
|
||||||
|
|
||||||
QString AVS_BINARY(const SysinfoModel *sysinfo, const bool &x64);
|
class SourceFactory
|
||||||
QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences);
|
{
|
||||||
|
public:
|
||||||
|
enum SourceType
|
||||||
|
{
|
||||||
|
SourceType_AVS = 0,
|
||||||
|
SourceType_VPS = 1,
|
||||||
|
|
||||||
QString VPS_BINARY(const SysinfoModel *sysinfo, const bool& x64);
|
SourceType_MIN = SourceType_AVS,
|
||||||
QString VPS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences);
|
SourceType_MAX = SourceType_VPS
|
||||||
|
};
|
||||||
|
|
||||||
QString CHK_BINARY(const SysinfoModel *sysinfo, const bool &x64);
|
static AbstractSource *createSource(const SourceType &type, JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile);
|
||||||
|
static const AbstractSourceInfo& getSourceInfo(const SourceType &type);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SourceFactory(void) {/*Disabled*/}
|
||||||
|
};
|
@ -24,9 +24,6 @@
|
|||||||
#include "source_vapoursynth.h"
|
#include "source_vapoursynth.h"
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_sysinfo.h"
|
|
||||||
#include "model_preferences.h"
|
|
||||||
#include "binaries.h"
|
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -34,11 +31,33 @@
|
|||||||
static const unsigned int VER_X264_VSPIPE_API = 3;
|
static const unsigned int VER_X264_VSPIPE_API = 3;
|
||||||
static const unsigned int VER_X264_VSPIPE_VER = 24;
|
static const unsigned int VER_X264_VSPIPE_VER = 24;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Encoder Info
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
|
class VapoursyntSourceInfo : public AbstractSourceInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual QString getBinaryPath(const SysinfoModel *sysinfo, const bool& x64) const
|
||||||
|
{
|
||||||
|
return QString("%1/core%2/vspipe.exe").arg(sysinfo->getVPSPath(), (x64 ? "64" : "32"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const VapoursyntSourceInfo s_vapoursynthEncoderInfo;
|
||||||
|
|
||||||
|
const AbstractSourceInfo &VapoursynthSource::getSourceInfo(void)
|
||||||
|
{
|
||||||
|
return s_vapoursynthEncoderInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Constructor & Destructor
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
VapoursynthSource::VapoursynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
|
VapoursynthSource::VapoursynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile)
|
||||||
:
|
:
|
||||||
AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile),
|
AbstractSource(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile)
|
||||||
m_sourceName("VapourSynth (vpy)"),
|
|
||||||
m_binaryFile(VPS_BINARY(m_sysinfo, m_preferences))
|
|
||||||
{
|
{
|
||||||
/*Nothing to do here*/
|
/*Nothing to do here*/
|
||||||
}
|
}
|
||||||
@ -50,7 +69,7 @@ VapoursynthSource::~VapoursynthSource(void)
|
|||||||
|
|
||||||
QString VapoursynthSource::getName(void) const
|
QString VapoursynthSource::getName(void) const
|
||||||
{
|
{
|
||||||
return m_sourceName;
|
return tr("VapourSynth (vpy)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
@ -59,7 +78,7 @@ QString VapoursynthSource::getName(void) const
|
|||||||
|
|
||||||
bool VapoursynthSource::isSourceAvailable()
|
bool VapoursynthSource::isSourceAvailable()
|
||||||
{
|
{
|
||||||
if(!(m_sysinfo->hasVapourSynth() && (!m_sysinfo->getVPSPath().isEmpty()) && QFileInfo(VPS_BINARY(m_sysinfo, m_preferences)).isFile()))
|
if(!(m_sysinfo->hasVapourSynth() && (!m_sysinfo->getVPSPath().isEmpty()) && QFileInfo(getBinaryPath()).isFile()))
|
||||||
{
|
{
|
||||||
log(tr("\nVPY INPUT REQUIRES VAPOURSYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
|
log(tr("\nVPY INPUT REQUIRES VAPOURSYNTH, BUT IT IS *NOT* AVAILABLE !!!"));
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "source_abstract.h"
|
#include "source_abstract.h"
|
||||||
|
#include "model_sysinfo.h"
|
||||||
|
#include "model_preferences.h"
|
||||||
|
|
||||||
class VapoursynthSource : public AbstractSource
|
class VapoursynthSource : public AbstractSource
|
||||||
{
|
{
|
||||||
@ -37,6 +39,8 @@ public:
|
|||||||
|
|
||||||
virtual void flushProcess(QProcess &processInput);
|
virtual void flushProcess(QProcess &processInput);
|
||||||
|
|
||||||
|
static const AbstractSourceInfo& getSourceInfo(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
||||||
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
|
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified);
|
||||||
@ -44,9 +48,6 @@ protected:
|
|||||||
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
|
||||||
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
|
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
|
||||||
|
|
||||||
virtual QString getBinaryPath() const { return m_binaryFile; }
|
virtual QString getBinaryPath() const { return getSourceInfo().getBinaryPath(m_sysinfo, (m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) && m_preferences->getPrefer64BitSource())); }
|
||||||
virtual void buildCommandLine(QStringList &cmdLine);
|
virtual void buildCommandLine(QStringList &cmdLine);
|
||||||
|
|
||||||
const QString m_sourceName;
|
|
||||||
const QString m_binaryFile;
|
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
//Internal
|
//Internal
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_sysinfo.h"
|
#include "model_sysinfo.h"
|
||||||
#include "binaries.h"
|
|
||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
#include <MUtils/Global.h>
|
#include <MUtils/Global.h>
|
||||||
@ -42,8 +41,15 @@
|
|||||||
QMutex AvisynthCheckThread::m_avsLock;
|
QMutex AvisynthCheckThread::m_avsLock;
|
||||||
QScopedPointer<QFile> AvisynthCheckThread::m_avsDllPath[2];
|
QScopedPointer<QFile> AvisynthCheckThread::m_avsDllPath[2];
|
||||||
|
|
||||||
|
//Helper
|
||||||
#define BOOLIFY(X) ((X) ? '1' : '0')
|
#define BOOLIFY(X) ((X) ? '1' : '0')
|
||||||
|
|
||||||
|
//Utility function
|
||||||
|
QString AVS_CHECK_BINARY(const SysinfoModel *sysinfo, const bool& x64)
|
||||||
|
{
|
||||||
|
return QString("%1/toolset/%2/avs_check_%2.exe").arg(sysinfo->getAppPath(), (x64 ? "x64": "x86"));
|
||||||
|
}
|
||||||
|
|
||||||
class Wow64RedirectionDisabler
|
class Wow64RedirectionDisabler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -221,7 +227,7 @@ bool AvisynthCheckThread::checkAvisynth(const SysinfoModel *const sysinfo, QFile
|
|||||||
process.setReadChannel(QProcess::StandardOutput);
|
process.setReadChannel(QProcess::StandardOutput);
|
||||||
|
|
||||||
//Try to start VSPIPE.EXE
|
//Try to start VSPIPE.EXE
|
||||||
process.start(CHK_BINARY(sysinfo, x64), QStringList());
|
process.start(AVS_CHECK_BINARY(sysinfo, x64), QStringList());
|
||||||
if(!process.waitForStarted())
|
if(!process.waitForStarted())
|
||||||
{
|
{
|
||||||
qWarning("Failed to launch AVS_CHECK.EXE -> %s", process.errorString().toUtf8().constData());
|
qWarning("Failed to launch AVS_CHECK.EXE -> %s", process.errorString().toUtf8().constData());
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_sysinfo.h"
|
#include "model_sysinfo.h"
|
||||||
#include "win_updater.h"
|
#include "win_updater.h"
|
||||||
#include "binaries.h"
|
|
||||||
#include "encoder_factory.h"
|
#include "encoder_factory.h"
|
||||||
|
#include "source_factory.h"
|
||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
#include <MUtils/Global.h>
|
#include <MUtils/Global.h>
|
||||||
@ -48,6 +48,9 @@ QScopedPointer<QFile> BinariesCheckThread::m_binPath[MAX_BINARIES];
|
|||||||
#define NEXT(X) ((*reinterpret_cast<int*>(&(X)))++)
|
#define NEXT(X) ((*reinterpret_cast<int*>(&(X)))++)
|
||||||
#define SHFL(X) ((*reinterpret_cast<int*>(&(X))) <<= 1)
|
#define SHFL(X) ((*reinterpret_cast<int*>(&(X))) <<= 1)
|
||||||
|
|
||||||
|
//External
|
||||||
|
QString AVS_CHECK_BINARY(const SysinfoModel *sysinfo, const bool& x64);
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
// External API
|
// External API
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
@ -158,10 +161,10 @@ void BinariesCheckThread::checkBinaries3(volatile bool &success, const SysinfoMo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(OptionsModel::EncArch arch = OptionsModel::EncArch_x86_32; arch <= OptionsModel::EncArch_x86_64; NEXT(arch))
|
for(int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
binFiles << AVS_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
|
binFiles << SourceFactory::getSourceInfo(SourceFactory::SourceType_AVS).getBinaryPath(sysinfo, bool(i));
|
||||||
binFiles << CHK_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
|
binFiles << AVS_CHECK_BINARY(sysinfo, bool(i));
|
||||||
}
|
}
|
||||||
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
|
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
|
||||||
{
|
{
|
||||||
|
@ -27,15 +27,13 @@
|
|||||||
#include "model_preferences.h"
|
#include "model_preferences.h"
|
||||||
#include "model_sysinfo.h"
|
#include "model_sysinfo.h"
|
||||||
#include "job_object.h"
|
#include "job_object.h"
|
||||||
#include "binaries.h"
|
|
||||||
#include "mediainfo.h"
|
#include "mediainfo.h"
|
||||||
|
|
||||||
//Encoders
|
//Encoders
|
||||||
#include "encoder_factory.h"
|
#include "encoder_factory.h"
|
||||||
|
|
||||||
//Source
|
//Source
|
||||||
#include "source_avisynth.h"
|
#include "source_factory.h"
|
||||||
#include "source_vapoursynth.h"
|
|
||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
#include <MUtils/OSSupport.h>
|
#include <MUtils/OSSupport.h>
|
||||||
@ -139,13 +137,13 @@ EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputF
|
|||||||
case MediaInfo::FILETYPE_AVISYNTH:
|
case MediaInfo::FILETYPE_AVISYNTH:
|
||||||
if(m_sysinfo->hasAvisynth())
|
if(m_sysinfo->hasAvisynth())
|
||||||
{
|
{
|
||||||
m_pipedSource = new AvisynthSource (m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
|
m_pipedSource = SourceFactory::createSource(SourceFactory::SourceType_AVS, m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MediaInfo::FILETYPE_VAPOURSYNTH:
|
case MediaInfo::FILETYPE_VAPOURSYNTH:
|
||||||
if(m_sysinfo->hasVapourSynth())
|
if(m_sysinfo->hasVapourSynth())
|
||||||
{
|
{
|
||||||
m_pipedSource = new VapoursynthSource(m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
|
m_pipedSource = SourceFactory::createSource(SourceFactory::SourceType_VPS, m_jobObject, m_options, m_sysinfo, m_preferences, m_status, &m_abort, &m_pause, &m_semaphorePaused, m_sourceFileName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "model_options.h"
|
#include "model_options.h"
|
||||||
#include "model_preferences.h"
|
#include "model_preferences.h"
|
||||||
#include "model_sysinfo.h"
|
#include "model_sysinfo.h"
|
||||||
#include "binaries.h"
|
|
||||||
#include "job_object.h"
|
#include "job_object.h"
|
||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 6
|
#define VER_X264_MINOR 6
|
||||||
#define VER_X264_PATCH 0
|
#define VER_X264_PATCH 0
|
||||||
#define VER_X264_BUILD 958
|
#define VER_X264_BUILD 962
|
||||||
|
|
||||||
#define VER_X264_PORTABLE_EDITION (0)
|
#define VER_X264_PORTABLE_EDITION (0)
|
||||||
|
|
||||||
|
@ -89,18 +89,6 @@
|
|||||||
WIDGET->addAction(_action); \
|
WIDGET->addAction(_action); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setIndexByData(QComboBox *const box, const int &data)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < box->count(); i++)
|
|
||||||
{
|
|
||||||
if(box->itemData(i).toInt() == data)
|
|
||||||
{
|
|
||||||
box->setCurrentIndex(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(const void*)
|
Q_DECLARE_METATYPE(const void*)
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -270,6 +258,20 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl
|
|||||||
setMinimumSize(size());
|
setMinimumSize(size());
|
||||||
setMaximumHeight(height());
|
setMaximumHeight(height());
|
||||||
|
|
||||||
|
//Init encoder combobox
|
||||||
|
ui->cbxEncoderType->addItem(tr("x264 (AVC)"), OptionsModel::EncType_X264);
|
||||||
|
ui->cbxEncoderType->addItem(tr("x265 (HEVC)"), OptionsModel::EncType_X265);
|
||||||
|
|
||||||
|
//Init arch combobox
|
||||||
|
ui->cbxEncoderArch->addItem(tr("32-Bit"), OptionsModel::EncArch_x86_32);
|
||||||
|
ui->cbxEncoderArch->addItem(tr("64-Bit"), OptionsModel::EncArch_x86_64);
|
||||||
|
|
||||||
|
//Init rc-mode combobox
|
||||||
|
ui->cbxRateControlMode->addItem(tr("CRF"), OptionsModel::RCMode_CRF);
|
||||||
|
ui->cbxRateControlMode->addItem(tr("CQ"), OptionsModel::RCMode_CQ);
|
||||||
|
ui->cbxRateControlMode->addItem(tr("2-Pass"), OptionsModel::RCMode_2Pass);
|
||||||
|
ui->cbxRateControlMode->addItem(tr("ABR"), OptionsModel::RCMode_ABR);
|
||||||
|
|
||||||
//Init combobox items
|
//Init combobox items
|
||||||
ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
|
ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
|
||||||
ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED));
|
ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED));
|
||||||
@ -464,7 +466,8 @@ void AddJobDialog::dropEvent(QDropEvent *event)
|
|||||||
|
|
||||||
void AddJobDialog::encoderIndexChanged(int index)
|
void AddJobDialog::encoderIndexChanged(int index)
|
||||||
{
|
{
|
||||||
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
|
const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
|
||||||
|
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
|
||||||
|
|
||||||
//Update encoder variants
|
//Update encoder variants
|
||||||
const QFlags<OptionsModel::EncVariant> variants = encoderInfo.getVariants();
|
const QFlags<OptionsModel::EncVariant> variants = encoderInfo.getVariants();
|
||||||
@ -485,8 +488,23 @@ void AddJobDialog::encoderIndexChanged(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Update presets
|
||||||
|
const QStringList presets = encoderInfo.getPresets();
|
||||||
|
if(presets.empty())
|
||||||
|
{
|
||||||
|
ui->cbxPreset->setEnabled(false);
|
||||||
|
ui->cbxPreset->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->cbxPreset->setEnabled(true);
|
||||||
|
ui->cbxPreset->clear();
|
||||||
|
ui->cbxPreset->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
|
||||||
|
ui->cbxPreset->addItems(presets);
|
||||||
|
}
|
||||||
|
|
||||||
//Update tunings
|
//Update tunings
|
||||||
QStringList tunings = encoderInfo.getTunings();
|
const QStringList tunings = encoderInfo.getTunings();
|
||||||
if(tunings.empty())
|
if(tunings.empty())
|
||||||
{
|
{
|
||||||
ui->cbxTuning->setEnabled(false);
|
ui->cbxTuning->setEnabled(false);
|
||||||
@ -505,10 +523,11 @@ void AddJobDialog::encoderIndexChanged(int index)
|
|||||||
|
|
||||||
void AddJobDialog::variantIndexChanged(int index)
|
void AddJobDialog::variantIndexChanged(int index)
|
||||||
{
|
{
|
||||||
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
|
const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
|
||||||
|
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
|
||||||
|
|
||||||
//Update encoder profiles
|
//Update encoder profiles
|
||||||
QStringList profiles = encoderInfo.getProfiles(index);
|
const QStringList profiles = encoderInfo.getProfiles(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant->itemData(index).toInt()));
|
||||||
if(profiles.empty())
|
if(profiles.empty())
|
||||||
{
|
{
|
||||||
ui->cbxProfile->setEnabled(false);
|
ui->cbxProfile->setEnabled(false);
|
||||||
@ -562,15 +581,16 @@ void AddJobDialog::accept(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get encoder info
|
//Get encoder info
|
||||||
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
|
const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
|
||||||
|
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
|
||||||
|
|
||||||
//Is selected RC mode supported?
|
//Is selected RC mode supported?
|
||||||
if(!encoderInfo.isRCModeSupported(ui->cbxRateControlMode->currentIndex()))
|
if(!encoderInfo.isRCModeSupported(static_cast<OptionsModel::RCMode>(ui->cbxRateControlMode->currentIndex())))
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Bad RC Mode!"), tr("<nobr>The selected RC mode is not supported by the selected encoder!</nobr>"));
|
QMessageBox::warning(this, tr("Bad RC Mode!"), tr("<nobr>The selected RC mode is not supported by the selected encoder!</nobr>"));
|
||||||
for(int i = 0; i < ui->cbxRateControlMode->count(); i++)
|
for(int i = 0; i < ui->cbxRateControlMode->count(); i++)
|
||||||
{
|
{
|
||||||
if(encoderInfo.isRCModeSupported(i))
|
if(encoderInfo.isRCModeSupported(static_cast<OptionsModel::RCMode>(i)))
|
||||||
{
|
{
|
||||||
ui->cbxRateControlMode->setCurrentIndex(i);
|
ui->cbxRateControlMode->setCurrentIndex(i);
|
||||||
break;
|
break;
|
||||||
@ -991,7 +1011,7 @@ void AddJobDialog::loadTemplateList(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text)
|
void AddJobDialog::updateComboBox(QComboBox *const cbox, const QString &text)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if(QAbstractItemModel *model = cbox->model())
|
if(QAbstractItemModel *model = cbox->model())
|
||||||
@ -1008,15 +1028,32 @@ void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text)
|
|||||||
cbox->setCurrentIndex(index);
|
cbox->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddJobDialog::updateComboBox(QComboBox *const cbox, const int &data)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
if(QAbstractItemModel *model = cbox->model())
|
||||||
|
{
|
||||||
|
for(int i = 0; i < cbox->model()->rowCount(); i++)
|
||||||
|
{
|
||||||
|
if(model->itemData(model->index(i, 0, QModelIndex())).value(Qt::UserRole).toInt() == index)
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cbox->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
void AddJobDialog::restoreOptions(const OptionsModel *options)
|
void AddJobDialog::restoreOptions(const OptionsModel *options)
|
||||||
{
|
{
|
||||||
//Ignore config changes while restoring template!
|
//Ignore config changes while restoring template!
|
||||||
m_monitorConfigChanges = false;
|
m_monitorConfigChanges = false;
|
||||||
|
|
||||||
ui->cbxEncoderType ->setCurrentIndex(options->encType());
|
updateComboBox(ui->cbxEncoderType, options->encType());
|
||||||
ui->cbxEncoderArch ->setCurrentIndex(options->encArch());
|
updateComboBox(ui->cbxEncoderArch, options->encArch());
|
||||||
setIndexByData(ui->cbxEncoderVariant, options->encVariant());
|
updateComboBox(ui->cbxEncoderVariant, options->encVariant());
|
||||||
ui->cbxRateControlMode -> setCurrentIndex(options->rcMode());
|
updateComboBox(ui->cbxRateControlMode, options->rcMode());
|
||||||
|
|
||||||
ui->spinQuantizer->setValue(options->quantizer());
|
ui->spinQuantizer->setValue(options->quantizer());
|
||||||
ui->spinBitrate ->setValue(options->bitrate());
|
ui->spinBitrate ->setValue(options->bitrate());
|
||||||
@ -1028,16 +1065,19 @@ void AddJobDialog::restoreOptions(const OptionsModel *options)
|
|||||||
ui->editCustomX264Params ->setText(options->customEncParams());
|
ui->editCustomX264Params ->setText(options->customEncParams());
|
||||||
ui->editCustomAvs2YUVParams->setText(options->customAvs2YUV());
|
ui->editCustomAvs2YUVParams->setText(options->customAvs2YUV());
|
||||||
|
|
||||||
|
//Force UI update
|
||||||
|
encoderIndexChanged(ui->cbxEncoderType->currentIndex());
|
||||||
|
|
||||||
//Make sure we will monitor config changes again!
|
//Make sure we will monitor config changes again!
|
||||||
m_monitorConfigChanges = true;
|
m_monitorConfigChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddJobDialog::saveOptions(OptionsModel *options)
|
void AddJobDialog::saveOptions(OptionsModel *options)
|
||||||
{
|
{
|
||||||
options->setEncType(static_cast<OptionsModel::EncType>(ui->cbxEncoderType->currentIndex()));
|
options->setEncType (static_cast<OptionsModel::EncType> (ui->cbxEncoderType ->itemData(ui->cbxEncoderType ->currentIndex()).toInt()));
|
||||||
options->setEncArch(static_cast<OptionsModel::EncArch>(ui->cbxEncoderArch->currentIndex()));
|
options->setEncArch (static_cast<OptionsModel::EncArch> (ui->cbxEncoderArch ->itemData(ui->cbxEncoderArch ->currentIndex()).toInt()));
|
||||||
options->setEncVariant(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant->itemData(ui->cbxEncoderVariant->currentIndex()).toInt()));
|
options->setEncVariant(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant ->itemData(ui->cbxEncoderVariant ->currentIndex()).toInt()));
|
||||||
options->setRCMode(static_cast<OptionsModel::RCMode>(ui->cbxRateControlMode->currentIndex()));
|
options->setRCMode (static_cast<OptionsModel::RCMode> (ui->cbxRateControlMode->itemData(ui->cbxRateControlMode->currentIndex()).toInt()));
|
||||||
|
|
||||||
options->setQuantizer(ui->spinQuantizer->value());
|
options->setQuantizer(ui->spinQuantizer->value());
|
||||||
options->setBitrate(ui->spinBitrate->value());
|
options->setBitrate(ui->spinBitrate->value());
|
||||||
@ -1094,7 +1134,8 @@ QString AddJobDialog::currentOutputPath(const bool bWithName)
|
|||||||
|
|
||||||
int AddJobDialog::currentOutputIndx(void)
|
int AddJobDialog::currentOutputIndx(void)
|
||||||
{
|
{
|
||||||
if(ui->cbxEncoderType->currentIndex() == OptionsModel::EncType_X265)
|
const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
|
||||||
|
if(encType == OptionsModel::EncType_X265)
|
||||||
{
|
{
|
||||||
return ARRAY_SIZE(X264_FILE_TYPE_FILTERS) - 1;
|
return ARRAY_SIZE(X264_FILE_TYPE_FILTERS) - 1;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,8 @@ private:
|
|||||||
void loadTemplateList(void);
|
void loadTemplateList(void);
|
||||||
void restoreOptions(const OptionsModel *options);
|
void restoreOptions(const OptionsModel *options);
|
||||||
void saveOptions(OptionsModel *options);
|
void saveOptions(OptionsModel *options);
|
||||||
void updateComboBox(QComboBox *cbox, const QString &text);
|
void updateComboBox(QComboBox *const cbox, const QString &text);
|
||||||
|
void updateComboBox(QComboBox *const cbox, const int &data);
|
||||||
|
|
||||||
QString currentSourcePath(const bool bWithName = false);
|
QString currentSourcePath(const bool bWithName = false);
|
||||||
QString currentOutputPath(const bool bWithName = false);
|
QString currentOutputPath(const bool bWithName = false);
|
||||||
|
@ -25,8 +25,10 @@
|
|||||||
//Internal
|
//Internal
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "model_options.h"
|
#include "model_options.h"
|
||||||
#include "binaries.h"
|
#include "model_sysinfo.h"
|
||||||
|
#include "model_preferences.h"
|
||||||
#include "encoder_factory.h"
|
#include "encoder_factory.h"
|
||||||
|
#include "source_factory.h"
|
||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
#include <MUtils/Sound.h>
|
#include <MUtils/Sound.h>
|
||||||
@ -91,7 +93,7 @@ void HelpDialog::showEvent(QShowEvent *event)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_process->start(AVS_BINARY(m_sysinfo, m_preferences), QStringList());
|
m_process->start(SourceFactory::getSourceInfo(SourceFactory::SourceType_AVS).getBinaryPath(m_sysinfo, m_preferences->getPrefer64BitSource() && m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64)), QStringList());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_process->waitForStarted())
|
if(!m_process->waitForStarted())
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
#include "win_about.h"
|
#include "win_about.h"
|
||||||
#include "win_preferences.h"
|
#include "win_preferences.h"
|
||||||
#include "win_updater.h"
|
#include "win_updater.h"
|
||||||
#include "binaries.h"
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
//MUtils
|
//MUtils
|
||||||
|
@ -285,6 +285,7 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
|
|||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
|
<ClInclude Include="src\source_factory.h" />
|
||||||
<ClInclude Include="tmp\x264_launcher\UIC_win_about.h" />
|
<ClInclude Include="tmp\x264_launcher\UIC_win_about.h" />
|
||||||
<ClInclude Include="tmp\x264_launcher\UIC_win_addJob.h" />
|
<ClInclude Include="tmp\x264_launcher\UIC_win_addJob.h" />
|
||||||
<ClInclude Include="tmp\x264_launcher\UIC_win_editor.h" />
|
<ClInclude Include="tmp\x264_launcher\UIC_win_editor.h" />
|
||||||
@ -349,7 +350,6 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
|
|||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
<ClInclude Include="src\binaries.h" />
|
|
||||||
<ClInclude Include="src\cli.h" />
|
<ClInclude Include="src\cli.h" />
|
||||||
<ClInclude Include="src\encoder_abstract.h" />
|
<ClInclude Include="src\encoder_abstract.h" />
|
||||||
<ClInclude Include="src\encoder_factory.h" />
|
<ClInclude Include="src\encoder_factory.h" />
|
||||||
@ -426,7 +426,6 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
|
|||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\binaries.cpp" />
|
|
||||||
<ClCompile Include="src\encoder_abstract.cpp" />
|
<ClCompile Include="src\encoder_abstract.cpp" />
|
||||||
<ClCompile Include="src\encoder_factory.cpp" />
|
<ClCompile Include="src\encoder_factory.cpp" />
|
||||||
<ClCompile Include="src\encoder_x264.cpp" />
|
<ClCompile Include="src\encoder_x264.cpp" />
|
||||||
@ -441,6 +440,7 @@ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\im
|
|||||||
<ClCompile Include="src\model_recently.cpp" />
|
<ClCompile Include="src\model_recently.cpp" />
|
||||||
<ClCompile Include="src\source_abstract.cpp" />
|
<ClCompile Include="src\source_abstract.cpp" />
|
||||||
<ClCompile Include="src\source_avisynth.cpp" />
|
<ClCompile Include="src\source_avisynth.cpp" />
|
||||||
|
<ClCompile Include="src\source_factory.cpp" />
|
||||||
<ClCompile Include="src\source_vapoursynth.cpp" />
|
<ClCompile Include="src\source_vapoursynth.cpp" />
|
||||||
<ClCompile Include="src\thread_avisynth.cpp" />
|
<ClCompile Include="src\thread_avisynth.cpp" />
|
||||||
<ClCompile Include="src\thread_binaries.cpp" />
|
<ClCompile Include="src\thread_binaries.cpp" />
|
||||||
|
@ -63,9 +63,6 @@
|
|||||||
<ClInclude Include="src\model_sysinfo.h">
|
<ClInclude Include="src\model_sysinfo.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\binaries.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\encoder_abstract.h">
|
<ClInclude Include="src\encoder_abstract.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -111,6 +108,9 @@
|
|||||||
<ClInclude Include="tmp\x264_launcher\UIC_win_updater.h">
|
<ClInclude Include="tmp\x264_launcher\UIC_win_updater.h">
|
||||||
<Filter>Generated Files</Filter>
|
<Filter>Generated Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\source_factory.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\main.cpp">
|
<ClCompile Include="src\main.cpp">
|
||||||
@ -164,9 +164,6 @@
|
|||||||
<ClCompile Include="src\win_updater.cpp">
|
<ClCompile Include="src\win_updater.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\binaries.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\encoder_abstract.cpp">
|
<ClCompile Include="src\encoder_abstract.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -266,6 +263,9 @@
|
|||||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_binaries.cpp">
|
<ClCompile Include="tmp\x264_launcher\MOC_thread_binaries.cpp">
|
||||||
<Filter>Generated Files</Filter>
|
<Filter>Generated Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\source_factory.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="src\win_main.h">
|
<CustomBuild Include="src\win_main.h">
|
||||||
|
Loading…
Reference in New Issue
Block a user