diff --git a/gui/win_addJob.ui b/gui/win_addJob.ui
index 3a98cdf..d00e673 100644
--- a/gui/win_addJob.ui
+++ b/gui/win_addJob.ui
@@ -788,6 +788,35 @@
+ -
+
+
+ Your custom parameters will be ignored entirely, if you don't fix them!
+
+
+
+
+
+ :/buttons/error.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 6
+ 20
+
+
+
+
-
@@ -913,6 +942,11 @@
-
+
+
+ Lucida Console
+
+
All command-line parameters you enter here will be passed to x264 unmodified and unchecked. Some parameters are forbidden, as they are reserved for the GUI.
diff --git a/src/global.cpp b/src/global.cpp
index 95f4399..e91df9f 100644
--- a/src/global.cpp
+++ b/src/global.cpp
@@ -516,8 +516,14 @@ x264_cpu_t x264_detect_cpu_features(int argc, char **argv)
for(int i = 0; i < argc; i++)
{
if(!_stricmp("--force-cpu-no-64bit", argv[i])) { flag = true; features.x64 = false; }
+ if(!_stricmp("--force-cpu-no-mmx", argv[i])) { flag = true; features.mmx = false; }
if(!_stricmp("--force-cpu-no-sse", argv[i])) { flag = true; features.sse = features.sse2 = features.sse3 = features.ssse3 = false; }
if(!_stricmp("--force-cpu-no-intel", argv[i])) { flag = true; features.intel = false; }
+
+ if(!_stricmp("--force-cpu-have-64bit", argv[i])) { flag = true; features.x64 = true; }
+ if(!_stricmp("--force-cpu-have-mmx", argv[i])) { flag = true; features.mmx = true; }
+ if(!_stricmp("--force-cpu-have-sse", argv[i])) { flag = true; features.sse = features.sse2 = features.sse3 = features.ssse3 = true; }
+ if(!_stricmp("--force-cpu-have-intel", argv[i])) { flag = true; features.intel = true; }
}
if(flag) qWarning("CPU flags overwritten by user-defined parameters. Take care!\n");
}
diff --git a/src/main.cpp b/src/main.cpp
index 1b2df69..1564689 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -62,6 +62,12 @@ static int x264_main(int argc, char* argv[])
qDebug("CPU capabilities : MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s, x64: %s", X264_BOOL(cpuFeatures.mmx), X264_BOOL(cpuFeatures.sse), X264_BOOL(cpuFeatures.sse2), X264_BOOL(cpuFeatures.sse3), X264_BOOL(cpuFeatures.ssse3), X264_BOOL(cpuFeatures.x64));
qDebug(" Number of CPU's : %d\n", cpuFeatures.count);
+ //Make sure this CPU can run x264
+ if(!(cpuFeatures.mmx && cpuFeatures.sse))
+ {
+ qFatal("Sorry, but this machine is not physically capable of running x264. Please get a CPU that supports at least the MMX and ISSE instruction sets!");
+ }
+
//Initialize Qt
if(!x264_init_qt(argc, argv))
{
diff --git a/src/thread_encode.cpp b/src/thread_encode.cpp
index 961205c..fc5b83f 100644
--- a/src/thread_encode.cpp
+++ b/src/thread_encode.cpp
@@ -59,6 +59,15 @@ QMutex EncodeThread::m_mutex_startProcess;
} \
}
+#define APPEND_AND_CLEAR(LIST, STR) \
+{ \
+ if(!((STR).isEmpty())) \
+ { \
+ (LIST) << (STR); \
+ (STR).clear(); \
+ } \
+}
+
/*
* Static vars
*/
@@ -509,8 +518,7 @@ QStringList EncodeThread::buildCommandLine(bool usePipe, unsigned int frames, co
if(!m_options->custom().isEmpty())
{
- //FIXME: Handle custom parameters that contain withspaces within quotes!
- cmdLine.append(m_options->custom().split(" "));
+ cmdLine.append(splitParams(m_options->custom()));
}
cmdLine << "--output" << pathToLocal(QDir::toNativeSeparators(m_outputFileName), true);
@@ -1026,3 +1034,32 @@ QString EncodeThread::commandline2string(const QString &program, const QStringLi
return commandline;
}
+
+QStringList EncodeThread::splitParams(const QString ¶ms)
+{
+ QStringList list;
+ bool isQuoted = false;
+ QString temp;
+
+ for(int i = 0; i < params.length(); i++)
+ {
+ const QChar c = params.at(i);
+
+ if(c == QChar::fromLatin1('"'))
+ {
+ APPEND_AND_CLEAR(list, temp);
+ isQuoted = (!isQuoted);
+ continue;
+ }
+ else if((!isQuoted) && (c == QChar::fromLatin1(' ')))
+ {
+ APPEND_AND_CLEAR(list, temp);
+ continue;
+ }
+
+ temp.append(c);
+ }
+
+ APPEND_AND_CLEAR(list, temp);
+ return list;
+}
\ No newline at end of file
diff --git a/src/thread_encode.h b/src/thread_encode.h
index 3dcc19a..9d26cc8 100644
--- a/src/thread_encode.h
+++ b/src/thread_encode.h
@@ -126,6 +126,7 @@ protected:
//Static functions
static QString commandline2string(const QString &program, const QStringList &arguments);
+ static QStringList splitParams(const QString ¶ms);
signals:
void statusChanged(const QUuid &jobId, EncodeThread::JobStatus newStatus);
diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp
index d7a4f32..f3fae18 100644
--- a/src/win_addJob.cpp
+++ b/src/win_addJob.cpp
@@ -60,37 +60,25 @@
class StringValidator : public QValidator
{
public:
- StringValidator(QLabel *notifier)
+ StringValidator(QLabel *notifier, QLabel *icon)
:
- m_notifier(notifier)
+ m_notifier(notifier), m_icon(icon)
{
m_notifier->hide();
+ m_icon->hide();
}
virtual State validate(QString &input, int &pos) const
{
- bool invalid = false;
-
- invalid = invalid || checkParam(input, "B");
- invalid = invalid || checkParam(input, "o");
- invalid = invalid || checkParam(input, "h");
- invalid = invalid || checkParam(input, "p");
- invalid = invalid || checkParam(input, "q");
+ static const char* p[] = {"B", "o", "h", "p", "q", "fps", "frames", "preset", "tune", "profile",
+ "stdin", "crf", "bitrate", "qp", "pass", "stats", "output", "help","quiet", NULL};
- invalid = invalid || checkParam(input, "fps");
- invalid = invalid || checkParam(input, "frames");
- invalid = invalid || checkParam(input, "preset");
- invalid = invalid || checkParam(input, "tune");
- invalid = invalid || checkParam(input, "profile");
- invalid = invalid || checkParam(input, "stdin");
- invalid = invalid || checkParam(input, "crf");
- invalid = invalid || checkParam(input, "bitrate");
- invalid = invalid || checkParam(input, "qp");
- invalid = invalid || checkParam(input, "pass");
- invalid = invalid || checkParam(input, "stats");
- invalid = invalid || checkParam(input, "output");
- invalid = invalid || checkParam(input, "help");
- invalid = invalid || checkParam(input, "quiet");
+ bool invalid = false;
+
+ for(size_t i = 0; p[i] && (!invalid); i++)
+ {
+ invalid = invalid || checkParam(input, QString::fromLatin1(p[i]));
+ }
return invalid ? QValidator::Intermediate : QValidator::Acceptable;
}
@@ -101,44 +89,45 @@ public:
}
protected:
- QLabel *const m_notifier;
+ QLabel *const m_notifier, *const m_icon;
bool checkParam(const QString &input, const QString ¶m) const
{
+ static const char c[20] = {' ', '*', '?', '<', '>', '/', '\\', '"', '\'', '!', '+', '#', '&', '%', '=', ',', ';', '.', '´', '`'};
+
bool flag = false;
if(param.length() > 1)
{
- flag = flag || input.contains(QString("--%1 ").arg(param), Qt::CaseInsensitive);
- flag = flag || input.contains(QString("--%1*").arg(param), Qt::CaseInsensitive);
- flag = flag || input.contains(QString("--%1?").arg(param), Qt::CaseInsensitive);
- flag = flag || input.contains(QString("--%1<").arg(param), Qt::CaseInsensitive);
- flag = flag || input.contains(QString("--%1>").arg(param), Qt::CaseInsensitive);
- flag = flag || input.contains(QString("--%1/").arg(param), Qt::CaseInsensitive);
- flag = flag || input.contains(QString("--%1\"").arg(param), Qt::CaseInsensitive);
- flag = flag || input.contains(QString("--%1\\").arg(param), Qt::CaseInsensitive);
flag = flag || input.endsWith(QString("--%1").arg(param), Qt::CaseInsensitive);
+ for(size_t i = 0; i < sizeof(c); i++)
+ {
+ flag = flag || input.contains(QString("--%1%2").arg(param, QChar::fromLatin1(c[i])), Qt::CaseInsensitive);
+ }
}
else
{
- flag = flag || input.contains(QString(" -%1").arg(param));
- flag = flag || input.contains(QString("*-%1").arg(param));
- flag = flag || input.contains(QString("?-%1").arg(param));
- flag = flag || input.contains(QString("<-%1").arg(param));
- flag = flag || input.contains(QString(">-%1").arg(param));
- flag = flag || input.contains(QString("/-%1").arg(param));
- flag = flag || input.contains(QString("\"-%1").arg(param));
- flag = flag || input.contains(QString("\\-%1").arg(param));
flag = flag || input.startsWith(QString("-%1").arg(param));
+ for(size_t i = 0; i < sizeof(c); i++)
+ {
+ flag = flag || input.contains(QString("%1-%2").arg(QChar::fromLatin1(c[i]), param), Qt::CaseSensitive);
+ }
}
if(flag)
{
- MessageBeep(MB_ICONWARNING);
- m_notifier->setText(tr("Invalid parameter entered: %1").arg((param.length() > 1) ? QString("--%1").arg(param) : QString("-%1").arg(param)));
- if(m_notifier->isHidden()) m_notifier->show();
+ if(m_notifier)
+ {
+ m_notifier->setText(tr("Invalid parameter: %1").arg((param.length() > 1) ? QString("--%1").arg(param) : QString("-%1").arg(param)));
+ if(m_notifier->isHidden()) m_notifier->show();
+ if(m_icon) { if(m_icon->isHidden()) m_icon->show(); }
+ }
}
else
{
- if(m_notifier->isVisible()) m_notifier->hide();
+ if(m_notifier)
+ {
+ if(m_notifier->isVisible()) m_notifier->hide();
+ if(m_icon) { if(m_icon->isVisible()) m_icon->hide(); }
+ }
}
return flag;
}
@@ -180,7 +169,7 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
//Setup validator
editCustomParams->installEventFilter(this);
- editCustomParams->setValidator(new StringValidator(labelNotification));
+ editCustomParams->setValidator(new StringValidator(labelNotification, iconNotification));
editCustomParams->clear();
//Install event filter
@@ -242,6 +231,7 @@ void AddJobDialog::showEvent(QShowEvent *event)
}
labelNotification->hide();
+ iconNotification->hide();
}
bool AddJobDialog::eventFilter(QObject *o, QEvent *e)