Make "custom" Avs2YUV parameters work again.

This commit is contained in:
LoRd_MuldeR 2015-11-18 20:48:54 +01:00
parent 3a777274cc
commit 1e2b69c6f4
8 changed files with 87 additions and 69 deletions

View File

@ -44,20 +44,6 @@
#include <QThread> #include <QThread>
#include <QLocale> #include <QLocale>
// ------------------------------------------------------------
// Helper Macros
// ------------------------------------------------------------
#define APPEND_AND_CLEAR(LIST, STR) do \
{ \
if(!((STR).isEmpty())) \
{ \
(LIST) << (STR); \
(STR).clear(); \
} \
} \
while(0)
// ------------------------------------------------------------ // ------------------------------------------------------------
// Constructor & Destructor // Constructor & Destructor
// ------------------------------------------------------------ // ------------------------------------------------------------
@ -264,38 +250,6 @@ bool AbstractEncoder::runEncodingPass(AbstractSource* pipedSource, const QString
// Utilities // Utilities
// ------------------------------------------------------------ // ------------------------------------------------------------
QStringList AbstractEncoder::splitParams(const QString &params, const QString &sourceFile, const QString &outputFile)
{
QStringList list;
bool ignoreWhitespaces = false;
QString temp;
for(int i = 0; i < params.length(); i++)
{
const QChar c = params.at(i);
if(c == QChar::fromLatin1('"'))
{
ignoreWhitespaces = (!ignoreWhitespaces);
continue;
}
else if((!ignoreWhitespaces) && (c == QChar::fromLatin1(' ')))
{
APPEND_AND_CLEAR(list, temp);
continue;
}
temp.append(c);
}
APPEND_AND_CLEAR(list, temp);
list.replaceInStrings("$(INPUT)", QDir::toNativeSeparators(sourceFile), Qt::CaseInsensitive);
list.replaceInStrings("$(OUTPUT)", QDir::toNativeSeparators(outputFile), Qt::CaseInsensitive);
return list;
}
double AbstractEncoder::estimateSize(const QString &fileName, const double &progress) double AbstractEncoder::estimateSize(const QString &fileName, const double &progress)
{ {
double estimatedSize = 0.0; double estimatedSize = 0.0;

View File

@ -57,7 +57,6 @@ protected:
virtual void runEncodingPass_init(QList<QRegExp*> &patterns) = 0; virtual void runEncodingPass_init(QList<QRegExp*> &patterns) = 0;
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass, double &last_progress, double &size_estimate) = 0; virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass, double &last_progress, double &size_estimate) = 0;
static QStringList splitParams(const QString &params, const QString &sourceFile, const QString &outputFile);
static double estimateSize(const QString &fileName, const double &progress); static double estimateSize(const QString &fileName, const double &progress);
static QString sizeToString(qint64 size); static QString sizeToString(qint64 size);

View File

@ -38,7 +38,7 @@
//x265 version info //x265 version info
static const unsigned int VERSION_X265_MINIMUM_VER = 18; static const unsigned int VERSION_X265_MINIMUM_VER = 18;
static const unsigned int VERSION_X265_MINIMUM_REV = 0; static const unsigned int VERSION_X265_MINIMUM_REV = 60;
// ------------------------------------------------------------ // ------------------------------------------------------------
// Helper Macros // Helper Macros

View File

@ -156,6 +156,11 @@ bool AvisynthSource::isVersionSupported(const unsigned int &revision, const bool
void AvisynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine) void AvisynthSource::checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine)
{ {
if(!m_options->customAvs2YUV().isEmpty())
{
cmdLine << splitParams(m_options->customAvs2YUV());
}
cmdLine << "-frames" << "1"; cmdLine << "-frames" << "1";
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true)) << "NUL"; cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true)) << "NUL";
@ -217,6 +222,11 @@ void AvisynthSource::checkSourceProperties_parseLine(const QString &line, QList<
void AvisynthSource::buildCommandLine(QStringList &cmdLine) void AvisynthSource::buildCommandLine(QStringList &cmdLine)
{ {
if(!m_options->customAvs2YUV().isEmpty())
{
cmdLine << splitParams(m_options->customAvs2YUV());
}
cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true)); cmdLine << QDir::toNativeSeparators(x264_path2ansi(m_sourceFile, true));
cmdLine << "-"; cmdLine << "-";
} }

View File

@ -39,6 +39,23 @@
QMutex AbstractTool::s_mutexStartProcess; QMutex AbstractTool::s_mutexStartProcess;
// ------------------------------------------------------------
// Helper Macros
// ------------------------------------------------------------
static void APPEND_AND_CLEAR(QStringList &list, QString &str)
{
if(!str.isEmpty())
{
const QString temp = str.trimmed();
if(!temp.isEmpty())
{
list << temp;
}
str.clear();
}
}
// ------------------------------------------------------------ // ------------------------------------------------------------
// Constructor & Destructor // Constructor & Destructor
// ------------------------------------------------------------ // ------------------------------------------------------------
@ -210,6 +227,43 @@ QString AbstractTool::commandline2string(const QString &program, const QStringLi
return commandline; return commandline;
} }
QStringList AbstractTool::splitParams(const QString &params, const QString &sourceFile, const QString &outputFile)
{
QStringList list;
bool ignoreWhitespaces = false;
QString temp;
for(int i = 0; i < params.length(); i++)
{
const QChar c = params.at(i);
if(c == QLatin1Char('"'))
{
ignoreWhitespaces = (!ignoreWhitespaces);
continue;
}
else if((!ignoreWhitespaces) && (c == QChar::fromLatin1(' ')))
{
APPEND_AND_CLEAR(list, temp);
continue;
}
temp.append(c);
}
APPEND_AND_CLEAR(list, temp);
if(!sourceFile.isEmpty())
{
list.replaceInStrings("$(INPUT)", QDir::toNativeSeparators(sourceFile), Qt::CaseInsensitive);
}
if(!outputFile.isEmpty())
{
list.replaceInStrings("$(OUTPUT)", QDir::toNativeSeparators(outputFile), Qt::CaseInsensitive);
}
return list;
}
QString AbstractTool::stringToHash(const QString &string) QString AbstractTool::stringToHash(const QString &string)
{ {
QByteArray result(10, char(0)); QByteArray result(10, char(0));

View File

@ -87,6 +87,7 @@ protected:
QSemaphore *const m_semaphorePause; QSemaphore *const m_semaphorePause;
static QString commandline2string(const QString &program, const QStringList &arguments); static QString commandline2string(const QString &program, const QStringList &arguments);
static QStringList splitParams(const QString &params, const QString &sourceFile = QString(), const QString &outputFile = QString());
static QString stringToHash(const QString &string); static QString stringToHash(const QString &string);
static unsigned int makeRevision(const unsigned int &core, const unsigned int &build); static unsigned int makeRevision(const unsigned int &core, const unsigned int &build);
static void splitRevision(const unsigned int &revision, unsigned int &core, unsigned int &build); static void splitRevision(const unsigned int &revision, unsigned int &core, unsigned int &build);

View File

@ -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 2 #define VER_X264_PATCH 2
#define VER_X264_BUILD 990 #define VER_X264_BUILD 994
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)