diff --git a/etc/date.exe b/etc/date.exe
new file mode 100644
index 0000000..069bae1
Binary files /dev/null and b/etc/date.exe differ
diff --git a/gui/win_addJob.ui b/gui/win_addJob.ui
index a30580f..84f4dc8 100644
--- a/gui/win_addJob.ui
+++ b/gui/win_addJob.ui
@@ -758,8 +758,6 @@
- buttonAccept
- buttonCancel
editSource
buttonBrowseSource
editOutput
@@ -770,6 +768,10 @@
cbxPreset
cbxTuning
cbxProfile
+ cbxCustomParams
+ checkBoxRun
+ buttonAccept
+ buttonCancel
diff --git a/gui/win_main.ui b/gui/win_main.ui
index 97a224d..c8adbf4 100644
--- a/gui/win_main.ui
+++ b/gui/win_main.ui
@@ -290,7 +290,9 @@
+
+
@@ -360,6 +362,15 @@
MeWiki - x264 Settings
+
+
+
+ :/buttons/book_open.png:/buttons/book_open.png
+
+
+ x264 BluRay Authoring
+
+
buttonAddJob
diff --git a/src/global.cpp b/src/global.cpp
index e0f275c..f101cc7 100644
--- a/src/global.cpp
+++ b/src/global.cpp
@@ -230,7 +230,7 @@ void x264_message_handler(QtMsgType type, const char *msg)
}
else
{
- QString temp("[LameXP][%1] %2");
+ QString temp("[x264][%1] %2");
switch(type)
{
@@ -253,7 +253,7 @@ void x264_message_handler(QtMsgType type, const char *msg)
if(type == QtCriticalMsg || type == QtFatalMsg)
{
lock.unlock();
- MessageBoxW(NULL, QWCHAR(QString::fromUtf8(msg)), L"LameXP - GURU MEDITATION", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL);
+ MessageBoxW(NULL, QWCHAR(QString::fromUtf8(msg)), L"Simple x264 Launcher - GURU MEDITATION", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL);
FatalAppExit(0, L"The application has encountered a critical error and will exit now!");
TerminateProcess(GetCurrentProcess(), -1);
}
@@ -698,7 +698,7 @@ bool x264_init_qt(int argc, char* argv[])
//Create Qt application instance and setup version info
QApplication *application = new QApplication(argc, argv);
- application->setApplicationName("LameXP - Audio Encoder Front-End");
+ application->setApplicationName("Simple x264 Launcher");
application->setApplicationVersion(QString().sprintf("%d.%02d", x264_version_major(), x264_version_minor()));
application->setOrganizationName("LoRd_MuldeR");
application->setOrganizationDomain("mulder.at.gg");
@@ -731,7 +731,7 @@ bool x264_init_qt(int argc, char* argv[])
//Check for process elevation
if(!x264_check_elevation())
{
- if(QMessageBox::warning(NULL, "LameXP", "LameXP was started with elevated rights. This is a potential security risk!", "Quit Program (Recommended)", "Ignore") == 0)
+ if(QMessageBox::warning(NULL, "Simple x264 Launcher", "Program was started with elevated rights. This is a potential security risk!", "Quit Program (Recommended)", "Ignore") == 0)
{
return false;
}
diff --git a/src/model_jobList.cpp b/src/model_jobList.cpp
index 1ebbd4a..c63b7b5 100644
--- a/src/model_jobList.cpp
+++ b/src/model_jobList.cpp
@@ -210,9 +210,31 @@ QModelIndex JobListModel::insertJob(EncodeThread *thread)
return QModelIndex();
}
+ int n = 2;
+ QString jobName = QFileInfo(thread->sourceFileName()).completeBaseName();
+
+ forever
+ {
+ bool unique = true;
+ for(int i = 0; i < m_jobs.count(); i++)
+ {
+ if(m_name.value(m_jobs.at(i)).compare(jobName, Qt::CaseInsensitive) == 0)
+ {
+ unique = false;
+ break;
+ }
+ }
+ if(!unique)
+ {
+ jobName = QString("%1 (%2)").arg(QFileInfo(thread->sourceFileName()).completeBaseName(), QString::number(n++));
+ continue;
+ }
+ break;
+ }
+
beginInsertRows(QModelIndex(), m_jobs.count(), m_jobs.count());
m_jobs.append(id);
- m_name.insert(id, QFileInfo(thread->sourceFileName()).completeBaseName());
+ m_name.insert(id, jobName);
m_status.insert(id, EncodeThread::JobStatus_Enqueued);
m_progress.insert(id, 0);
m_threads.insert(id, thread);
diff --git a/src/model_options.h b/src/model_options.h
index 9c4d75c..1bd3e56 100644
--- a/src/model_options.h
+++ b/src/model_options.h
@@ -48,7 +48,7 @@ public:
QString custom(void) const { return m_custom; }
//Setter
- void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CQ, mode, RCMode_ABR); }
+ void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); }
void setBitrate(unsigned int bitrate) { m_bitrate = qBound(100U, bitrate, 250000U); }
void setQuantizer(unsigned int quantizer) { m_quantizer = qBound(0U, quantizer, 52U); }
void setPreset(const QString &preset) { m_preset = preset.trimmed(); }
diff --git a/src/thread_encode.cpp b/src/thread_encode.cpp
index eac097c..e285019 100644
--- a/src/thread_encode.cpp
+++ b/src/thread_encode.cpp
@@ -23,6 +23,7 @@
#include "global.h"
#include "model_options.h"
+#include "version.h"
#include
#include
@@ -45,17 +46,41 @@ typedef BOOL (WINAPI *AssignProcessToJobObjectFun)(__in HANDLE hJob, __in HANDLE
QMutex EncodeThread::m_mutex_startProcess;
HANDLE EncodeThread::m_handle_jobObject = NULL;
+/*
+ * Macros
+ */
+#define CHECK_STATUS(ABORT_FLAG, OK_FLAG) \
+{ \
+ if(ABORT_FLAG) \
+ { \
+ log("\nPROCESS ABORTED BY USER !!!"); \
+ setStatus(JobStatus_Aborted); \
+ return; \
+ } \
+ else if(!(OK_FLAG)) \
+ { \
+ setStatus(JobStatus_Failed); \
+ return; \
+ } \
+}
+
+/*
+ * Static vars
+ */
+static const unsigned int REV_MULT = 10000;
+
///////////////////////////////////////////////////////////////////////////////
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
-EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir)
+EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x64)
:
m_jobId(QUuid::createUuid()),
m_sourceFileName(sourceFileName),
m_outputFileName(outputFileName),
m_options(new OptionsModel(*options)),
- m_binDir(binDir)
+ m_binDir(binDir),
+ m_x64(x64)
{
m_abort = false;
}
@@ -112,6 +137,26 @@ void EncodeThread::encode(void)
bool ok = false;
+ //Checking version
+ log(tr("--- VERSION ---\n"));
+ unsigned int revision;
+ ok = ((revision = checkVersion(m_x64)) != UINT_MAX);
+ CHECK_STATUS(m_abort, ok);
+
+ //Is revision supported?
+ log(tr("\nx264 revision: %1 (core #%2)").arg(QString::number(revision % REV_MULT), QString::number(revision / REV_MULT)));
+ if((revision % REV_MULT) < VER_X264_MINIMUM_REV)
+ {
+ log(tr("\nERROR: Your revision of x264 is too old! (Minimum required revision is %2)").arg(QString::number(VER_X264_MINIMUM_REV)));
+ setStatus(JobStatus_Failed);
+ return;
+ }
+ if((revision / REV_MULT) != VER_X264_CURRENT_API)
+ {
+ log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!"));
+ log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(VER_X264_CURRENT_API)));
+ }
+
//Run encoding passes
if(m_options->rcMode() == OptionsModel::RCMode_2Pass)
{
@@ -127,65 +172,33 @@ void EncodeThread::encode(void)
}
}
- log("--- PASS 1 ---\n");
- ok = runEncodingPass(1, passLogFile);
+ log(tr("\n--- PASS 1 ---\n"));
+ ok = runEncodingPass(m_x64, 1, passLogFile);
+ CHECK_STATUS(m_abort, ok);
- if(m_abort)
- {
- log("\nPROCESS ABORTED BY USER !!!");
- setStatus(JobStatus_Aborted);
- return;
- }
- else if(!ok)
- {
- setStatus(JobStatus_Failed);
- return;
- }
-
- log("\n--- PASS 2 ---\n");
- ok = runEncodingPass(2, passLogFile);
-
- if(m_abort)
- {
- log("\nPROCESS ABORTED BY USER !!!");
- setStatus(JobStatus_Aborted);
- return;
- }
- else if(!ok)
- {
- setStatus(JobStatus_Failed);
- return;
- }
+ log(tr("\n--- PASS 2 ---\n"));
+ ok = runEncodingPass(m_x64,2, passLogFile);
+ CHECK_STATUS(m_abort, ok);
}
else
{
- log("--- ENCODING ---\n");
- ok = runEncodingPass();
-
- if(m_abort)
- {
- log("\nPROCESS ABORTED BY USER !!!");
- setStatus(JobStatus_Aborted);
- return;
- }
- else if(!ok)
- {
- setStatus(JobStatus_Failed);
- return;
- }
+ log(tr("\n--- ENCODING ---\n"));
+ ok = runEncodingPass(m_x64);
+ CHECK_STATUS(m_abort, ok);
}
- log(tr("\nJob finished at %1, %2.\n").arg(QDate::currentDate().toString(Qt::ISODate), QTime::currentTime().toString( Qt::ISODate)));
+ log(tr("\n--- DONE ---\n"));
+ log(tr("Job finished at %1, %2.\n").arg(QDate::currentDate().toString(Qt::ISODate), QTime::currentTime().toString( Qt::ISODate)));
setStatus(JobStatus_Completed);
}
-bool EncodeThread::runEncodingPass(int pass, const QString &passLogFile)
+bool EncodeThread::runEncodingPass(bool x64, int pass, const QString &passLogFile)
{
QProcess process;
QStringList cmdLine = buildCommandLine(pass, passLogFile);
log("Creating process:");
- if(!startProcess(process, QString("%1/x264.exe").arg(m_binDir), cmdLine))
+ if(!startProcess(process, QString("%1/%2.exe").arg(m_binDir, x64 ? "x264_x64" : "x264"), cmdLine))
{
return false;;
}
@@ -226,17 +239,17 @@ bool EncodeThread::runEncodingPass(int pass, const QString &passLogFile)
{
bool ok = false;
unsigned int progress = regExpProgress.cap(1).toUInt(&ok);
- if(ok) setProgress(progress);
setStatus((pass == 2) ? JobStatus_Running_Pass2 : ((pass == 1) ? JobStatus_Running_Pass1 : JobStatus_Running));
setDetails(text.mid(offset).trimmed());
+ if(ok) setProgress(progress);
}
else if((offset = regExpIndexing.lastIndexIn(text)) >= 0)
{
bool ok = false;
unsigned int progress = regExpIndexing.cap(1).toUInt(&ok);
- if(ok) setProgress(progress);
setStatus(JobStatus_Indexing);
setDetails(text.mid(offset).trimmed());
+ if(ok) setProgress(progress);
}
else if(!text.isEmpty())
{
@@ -309,6 +322,88 @@ QStringList EncodeThread::buildCommandLine(int pass, const QString &passLogFile)
return cmdLine;
}
+unsigned int EncodeThread::checkVersion(bool x64)
+{
+ QProcess process;
+ QStringList cmdLine = QStringList() << "--version";
+
+ log("Creating process:");
+ if(!startProcess(process, QString("%1/%2.exe").arg(m_binDir, x64 ? "x264_x64" : "x264"), cmdLine))
+ {
+ return false;;
+ }
+
+ QRegExp regExpVersion("x264 (\\d)\\.(\\d+)\\.(\\d+) ([0-9A-Fa-f]{7})");
+
+ bool bTimeout = false;
+ bool bAborted = false;
+
+ unsigned int revision = UINT_MAX;
+ unsigned int coreVers = UINT_MAX;
+
+ while(process.state() != QProcess::NotRunning)
+ {
+ if(m_abort)
+ {
+ process.kill();
+ bAborted = true;
+ break;
+ }
+ if(!process.waitForReadyRead(m_processTimeoutInterval))
+ {
+ if(process.state() == QProcess::Running)
+ {
+ process.kill();
+ qWarning("x264 process timed out <-- killing!");
+ log("\nPROCESS TIMEOUT !!!");
+ bTimeout = true;
+ break;
+ }
+ }
+ while(process.bytesAvailable() > 0)
+ {
+ QList lines = process.readLine().split('\r');
+ while(!lines.isEmpty())
+ {
+ QString text = QString::fromUtf8(lines.takeFirst().constData()).simplified();
+ int offset = -1;
+ if((offset = regExpVersion.lastIndexIn(text)) >= 0)
+ {
+ bool ok1 = false, ok2 = false;
+ unsigned int temp1 = regExpVersion.cap(2).toUInt(&ok1);
+ unsigned int temp2 = regExpVersion.cap(3).toUInt(&ok2);
+ if(ok1) coreVers = temp1;
+ if(ok2) revision = temp2;
+ }
+ if(!text.isEmpty())
+ {
+ log(text);
+ }
+ }
+ }
+ }
+
+ process.waitForFinished();
+ if(process.state() != QProcess::NotRunning)
+ {
+ process.kill();
+ process.waitForFinished(-1);
+ }
+
+ if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS)
+ {
+ return UINT_MAX;
+ }
+
+ if((revision == UINT_MAX) || (coreVers == UINT_MAX))
+ {
+ log(tr("\nFAILED TO DETERMINE X264 VERSION !!!"));
+ return UINT_MAX;
+ }
+
+ return (coreVers * REV_MULT) + revision;
+}
+
///////////////////////////////////////////////////////////////////////////////
// Misc functions
///////////////////////////////////////////////////////////////////////////////
@@ -318,8 +413,19 @@ void EncodeThread::setStatus(JobStatus newStatus)
if(m_status != newStatus)
{
m_status = newStatus;
+ if((newStatus != JobStatus_Completed) && (newStatus != JobStatus_Failed) && (newStatus != JobStatus_Aborted))
+ {
+ setProgress(0);
+ }
+ if(newStatus == JobStatus_Failed)
+ {
+ setDetails("The job has failed. See log for details!");
+ }
+ if(newStatus == JobStatus_Aborted)
+ {
+ setDetails("The job was aborted by the user!");
+ }
emit statusChanged(m_jobId, newStatus);
- setProgress(0);
}
}
diff --git a/src/thread_encode.h b/src/thread_encode.h
index 52f474a..92aa3b3 100644
--- a/src/thread_encode.h
+++ b/src/thread_encode.h
@@ -48,7 +48,7 @@ public:
JobStatus_Aborted = 9
};
- EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir);
+ EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x64);
~EncodeThread(void);
QUuid getId(void) { return this->m_jobId; };
@@ -69,6 +69,7 @@ protected:
const QString m_outputFileName;
const OptionsModel *m_options;
const QString m_binDir;
+ const bool m_x64;
//Flags
volatile bool m_abort;
@@ -82,8 +83,9 @@ protected:
//Encode functions
void encode(void);
- bool runEncodingPass(int pass = 0, const QString &passLogFile = QString());
+ bool runEncodingPass(bool x64, int pass = 0, const QString &passLogFile = QString());
QStringList buildCommandLine(int pass = 0, const QString &passLogFile = QString());
+ unsigned int checkVersion(bool x64);
//Auxiallary Stuff
void log(const QString &text) { emit messageLogged(m_jobId, text); }
diff --git a/src/version.h b/src/version.h
index 11ab6c4..9772932 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
-// LameXP - Audio Encoder Front-End
+// Simple x264 Launcher
// Copyright (C) 2004-2012 LoRd_MuldeR
//
// This program is free software; you can redistribute it and/or modify
@@ -21,3 +21,6 @@
#define VER_X264_MAJOR (2)
#define VER_X264_MINOR (0)
+
+#define VER_X264_MINIMUM_REV (2146)
+#define VER_X264_CURRENT_API (120)
diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp
index a439f10..199bf95 100644
--- a/src/win_addJob.cpp
+++ b/src/win_addJob.cpp
@@ -33,6 +33,21 @@
#include
#include
+static const struct
+{
+ const char *name;
+ const char *fext;
+}
+g_filters[] =
+{
+ {"Avisynth Scripts", "avs"},
+ {"Matroska Files", "mkv"},
+ {"MPEG-4 Part 14 Container", "mp4"},
+ {"Audio Video Interleaved", "avi"},
+ {"Flash Video", "flv"},
+ {NULL, NULL}
+};
+
///////////////////////////////////////////////////////////////////////////////
// Validator
///////////////////////////////////////////////////////////////////////////////
@@ -165,15 +180,8 @@ void AddJobDialog::browseButtonClicked(void)
if(QObject::sender() == buttonBrowseSource)
{
- QString filters;
- filters += tr("Avisynth Scripts (*.avs)").append(";;");
- filters += tr("Matroska Files (*.mkv)").append(";;");
- filters += tr("MPEG-4 Part 14 Container (*.mp4)").append(";;");
- filters += tr("Audio Video Interleaved (*.avi)").append(";;");
- filters += tr("Flash Video (*.flv)").append(";;");
-
- QString filePath = QFileDialog::getOpenFileName(this, tr("Open Source File"), initialDir, filters);
-
+ QString filePath = QFileDialog::getOpenFileName(this, tr("Open Source File"), initialDir, makeFileFilter());
+
if(!(filePath.isNull() || filePath.isEmpty()))
{
editSource->setText(QDir::toNativeSeparators(filePath));
@@ -200,7 +208,7 @@ void AddJobDialog::browseButtonClicked(void)
QString filters;
filters += tr("Matroska Files (*.mkv)").append(";;");
filters += tr("MPEG-4 Part 14 Container (*.mp4)").append(";;");
- filters += tr("H.264 Elementary Stream (*.264)").append(";;");
+ filters += tr("H.264 Elementary Stream (*.264)");
QString filePath = QFileDialog::getSaveFileName(this, tr("Choose Output File"), initialDir, filters);
@@ -254,6 +262,7 @@ void AddJobDialog::restoreOptions(OptionsModel *options)
void AddJobDialog::saveOptions(OptionsModel *options)
{
+ qWarning("Current index: %d", cbxRateControlMode->currentIndex());
options->setRCMode(static_cast(cbxRateControlMode->currentIndex()));
options->setQuantizer(spinQuantizer->value());
options->setBitrate(spinBitrate->value());
@@ -262,3 +271,23 @@ void AddJobDialog::saveOptions(OptionsModel *options)
options->setProfile(cbxProfile->model()->data(cbxProfile->model()->index(cbxProfile->currentIndex(), 0)).toString());
options->setCustom(cbxCustomParams->currentText());
}
+
+QString AddJobDialog::makeFileFilter(void)
+{
+ QString filters("All supported files (");
+
+ for(size_t index = 0; g_filters[index].name && g_filters[index].fext; index++)
+ {
+ filters += QString((index > 0) ? " *.%1" : "*.%1").arg(QString::fromLatin1(g_filters[index].fext));
+ }
+
+ filters += QString(");;");
+
+ for(size_t index = 0; g_filters[index].name && g_filters[index].fext; index++)
+ {
+ filters += QString("%1 (*.%2);;").arg(QString::fromLatin1(g_filters[index].name), QString::fromLatin1(g_filters[index].fext));
+ }
+
+ filters += QString("All files (*.*)");
+ return filters;
+}
diff --git a/src/win_addJob.h b/src/win_addJob.h
index 4440579..1aa34ec 100644
--- a/src/win_addJob.h
+++ b/src/win_addJob.h
@@ -57,4 +57,5 @@ private:
void restoreOptions(OptionsModel *options);
void saveOptions(OptionsModel *options);
void updateComboBox(QComboBox *cbox, const QString &text);
+ QString makeFileFilter(void);
};
diff --git a/src/win_main.cpp b/src/win_main.cpp
index 29bdc6a..e69e15d 100644
--- a/src/win_main.cpp
+++ b/src/win_main.cpp
@@ -33,9 +33,12 @@
#include
#include
#include
+#include
const char *home_url = "http://mulder.brhack.net/";
+#define PRE_RELEASE (1)
+
///////////////////////////////////////////////////////////////////////////////
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
@@ -60,7 +63,8 @@ MainWindow::MainWindow(bool x64supported)
//Update title
labelBuildDate->setText(tr("Built on %1 at %2").arg(x264_version_date().toString(Qt::ISODate), QString::fromLatin1(x264_version_time())));
- if(m_x64supported) setWindowTitle(QString("%1 (x64)").arg(windowTitle()));
+ setWindowTitle(QString("%1 (%2 Mode)").arg(windowTitle(), m_x64supported ? "64-Bit" : "32-Bit"));
+ if(PRE_RELEASE) setWindowTitle(QString("%1 | PRE-RELEASE VERSION").arg(windowTitle()));
//Create model
m_jobList = new JobListModel();
@@ -89,6 +93,7 @@ MainWindow::MainWindow(bool x64supported)
connect(actionWebKomisar, SIGNAL(triggered()), this, SLOT(showWebLink()));
connect(actionWebJarod, SIGNAL(triggered()), this, SLOT(showWebLink()));
connect(actionWebWiki, SIGNAL(triggered()), this, SLOT(showWebLink()));
+ connect(actionWebBluRay, SIGNAL(triggered()), this, SLOT(showWebLink()));
//Create options object
m_options = new OptionsModel();
@@ -118,12 +123,15 @@ void MainWindow::addButtonPressed(void)
if(result == QDialog::Accepted)
{
+ qDebug("RC Mode: %d", m_options->rcMode());
+
EncodeThread *thrd = new EncodeThread
(
addDialog->sourceFile(),
addDialog->outputFile(),
m_options,
- QString("%1/toolset").arg(m_appDir)
+ QString("%1/toolset").arg(m_appDir),
+ m_x64supported
);
QModelIndex newIndex = m_jobList->insertJob(thrd);
@@ -238,6 +246,7 @@ void MainWindow::showWebLink(void)
if(QObject::sender() == actionWebKomisar) QDesktopServices::openUrl(QUrl("http://komisar.gin.by/"));
if(QObject::sender() == actionWebJarod) QDesktopServices::openUrl(QUrl("http://www.x264.nl/"));
if(QObject::sender() == actionWebWiki) QDesktopServices::openUrl(QUrl("http://mewiki.project357.com/wiki/X264_Settings"));
+ if(QObject::sender() == actionWebBluRay) QDesktopServices::openUrl(QUrl("http://www.x264bluray.com/"));
}
void MainWindow::launchNextJob(void)
@@ -272,6 +281,7 @@ void MainWindow::init(void)
static const char *binFiles = "x264.exe:x264_x64.exe:avs2yuv.exe:pipebuf.exe";
QStringList binaries = QString::fromLatin1(binFiles).split(":", QString::SkipEmptyParts);
+ //Check all binaries
while(!binaries.isEmpty())
{
QString current = binaries.takeFirst();
@@ -285,13 +295,31 @@ void MainWindow::init(void)
X264_DELETE(file);
QMessageBox::critical(this, tr("File Not Found!"), tr("At least on required tool could not be found:
%1
Please re-install the program in order to fix the problem!").arg(QDir::toNativeSeparators(QString("%1/toolset/%2").arg(m_appDir, current))).replace("-", "−"));
qFatal(QString("Binary not found: %1/toolset/%2").arg(m_appDir, current).toLatin1().constData());
- return;
+ close(); qApp->exit(-1); return;
}
}
- qsrand(time(NULL)); int rnd = qrand() % 3;
- int val = QMessageBox::warning(this, tr("Pre-Release Version"), tr("Note: This is a pre-release version. Please do NOT use for production!
Click the button #%1 in order to continue...").arg(QString::number(rnd + 1)), tr("(1)"), tr("(2)"), tr("(3)"), qrand() % 3);
- if(rnd != val) { close(); }
+ //Pre-release popup
+ if(PRE_RELEASE)
+ {
+ qsrand(time(NULL)); int rnd = qrand() % 3;
+ int val = QMessageBox::information(this, tr("Pre-Release Version"), tr("Note: This is a pre-release version. Please do NOT use for production!
Click the button #%1 in order to continue...
(There will be no such message box in the final version of this application)").arg(QString::number(rnd + 1)), tr("(1)"), tr("(2)"), tr("(3)"), qrand() % 3);
+ if(rnd != val) { close(); qApp->exit(-1); return; }
+ }
+
+ //Check for Avisynth support
+ bool avsAvailable = false;
+ QLibrary *avsLib = new QLibrary("avisynth.dll");
+ if(avsLib->load())
+ {
+ avsAvailable = (avsLib->resolve("avs_create_script_environment") != NULL);
+ }
+ if(!avsAvailable)
+ {
+ avsLib->unload(); X264_DELETE(avsLib);
+ int val = QMessageBox::warning(this, tr("Avisynth Missing"), tr("It appears that Avisynth is not currently installed on your computer.
Thus Avisynth input will not be working at all!
Please download and install Avisynth:
http://sourceforge.net/projects/avisynth2/files/AviSynth 2.5/").replace("-", "−"), tr("Quit"), tr("Ignore"));
+ if(val != 1) { close(); qApp->exit(-1); return; }
+ }
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/x264_launcher.vcxproj b/x264_launcher.vcxproj
index 35707ad..45fa97b 100644
--- a/x264_launcher.vcxproj
+++ b/x264_launcher.vcxproj
@@ -91,6 +91,22 @@
QtMain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)
UseLinkTimeCodeGeneration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/z_build.bat b/z_build.bat
new file mode 100644
index 0000000..557a8f5
--- /dev/null
+++ b/z_build.bat
@@ -0,0 +1,70 @@
+@echo off
+REM ///////////////////////////////////////////////////////////////////////////
+set "MSVC_PATH=D:\Microsoft Visual Studio 10.0\VC"
+set "NSIS_PATH=E:\NSIS\_Unicode"
+set "QTVC_PATH=E:\QtSDK\4.8.0\MSVC2010"
+set "UPX3_PATH=E:\UPX"
+REM ///////////////////////////////////////////////////////////////////////////
+call "%QTVC_PATH%\bin\qtvars.bat"
+call "%MSVC_PATH%\vcvarsall.bat" x86
+echo ---------------------------------------------------------------------
+echo BEGIN BUILD
+echo ---------------------------------------------------------------------
+MSBuild.exe /property:Configuration=release /target:clean "%~dp0\x264_launcher.sln"
+if not "%ERRORLEVEL%"=="0" goto BuildError
+MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher.sln"
+if not "%ERRORLEVEL%"=="0" goto BuildError
+echo ---------------------------------------------------------------------
+echo BEGIN PACKAGING
+echo ---------------------------------------------------------------------
+set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
+mkdir "%PACK_PATH%"
+mkdir "%PACK_PATH%\imageformats"
+mkdir "%PACK_PATH%\toolset"
+copy "%~dp0\bin\Release\*.exe" "%PACK_PATH%"
+copy "%~dp0\bin\Release\toolset\*.exe" "%PACK_PATH%\toolset"
+REM ///////////////////////////////////////////////////////////////////////////
+copy "%MSVC_PATH%\redist\x86\Microsoft.VC100.CRT\*.dll" "%PACK_PATH%"
+copy "%QTVC_PATH%\bin\QtCore4.dll" "%PACK_PATH%"
+copy "%QTVC_PATH%\bin\QtGui4.dll" "%PACK_PATH%"
+copy "%QTVC_PATH%\bin\QtSvg4.dll" "%PACK_PATH%"
+copy "%QTVC_PATH%\bin\QtXml4.dll" "%PACK_PATH%"
+copy "%QTVC_PATH%\bin\QtXml4.dll" "%PACK_PATH%"
+copy "%QTVC_PATH%\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
+del "%PACK_PATH%\imageformats\*d4.dll"
+REM ///////////////////////////////////////////////////////////////////////////
+"%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\*.exe"
+"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.dll"
+REM ///////////////////////////////////////////////////////////////////////////
+if not exist "%~dp0\etc\date.exe" BuildError
+for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do (
+ if "%%a"=="ISODATE" set "ISO_DATE=%%b"
+)
+if "%ISO_DATE%"=="" BuildError
+REM ///////////////////////////////////////////////////////////////////////////
+set "NSIS_FILE=%TMP%\~%RANDOM%%RANDOM%.nsi"
+echo !define ZIP2EXE_NAME `Simple x264 Launcher (%ISO_DATE%)` > "%NSIS_FILE%"
+echo !define ZIP2EXE_OUTFILE `%~dp0\bin\x264_x64.%ISO_DATE%.exe` >> "%NSIS_FILE%"
+echo !define ZIP2EXE_COMPRESSOR_LZMA >> "%NSIS_FILE%"
+echo !define ZIP2EXE_INSTALLDIR `$PROGRAMFILES\MuldeR\Simple x264 Launcher v2` >> "%NSIS_FILE%"
+echo !include `${NSISDIR}\Contrib\zip2exe\Base.nsh` >> "%NSIS_FILE%"
+echo !include `${NSISDIR}\Contrib\zip2exe\Modern.nsh` >> "%NSIS_FILE%"
+echo !insertmacro SECTION_BEGIN >> "%NSIS_FILE%"
+echo File /r `%PACK_PATH%\*.*` >> "%NSIS_FILE%"
+echo !insertmacro SECTION_END >> "%NSIS_FILE%"
+"%NSIS_PATH%\makensis.exe" "%NSIS_FILE%"
+if not "%ERRORLEVEL%"=="0" goto BuildError
+del "%NSIS_FILE%"
+del /Q /S "%PACK_PATH%\*.*"
+REM ///////////////////////////////////////////////////////////////////////////
+echo.
+echo Build completed.
+echo.
+pause
+goto:eof
+REM ///////////////////////////////////////////////////////////////////////////
+:BuildError
+echo.
+echo Build has failed !!!
+echo.
+pause