Check x264 version + added simple build script.
This commit is contained in:
parent
8ebfc46240
commit
a30b5b7300
BIN
etc/date.exe
Normal file
BIN
etc/date.exe
Normal file
Binary file not shown.
@ -758,8 +758,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>buttonAccept</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
<tabstop>editSource</tabstop>
|
||||
<tabstop>buttonBrowseSource</tabstop>
|
||||
<tabstop>editOutput</tabstop>
|
||||
@ -770,6 +768,10 @@
|
||||
<tabstop>cbxPreset</tabstop>
|
||||
<tabstop>cbxTuning</tabstop>
|
||||
<tabstop>cbxProfile</tabstop>
|
||||
<tabstop>cbxCustomParams</tabstop>
|
||||
<tabstop>checkBoxRun</tabstop>
|
||||
<tabstop>buttonAccept</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../res/resources.qrc"/>
|
||||
|
@ -290,7 +290,9 @@
|
||||
<addaction name="actionWebX264"/>
|
||||
<addaction name="actionWebKomisar"/>
|
||||
<addaction name="actionWebJarod"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionWebWiki"/>
|
||||
<addaction name="actionWebBluRay"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
@ -360,6 +362,15 @@
|
||||
<string>MeWiki - x264 Settings</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWebBluRay">
|
||||
<property name="icon">
|
||||
<iconset resource="../res/resources.qrc">
|
||||
<normaloff>:/buttons/book_open.png</normaloff>:/buttons/book_open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>x264 BluRay Authoring</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>buttonAddJob</tabstop>
|
||||
|
@ -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", "<nobr>LameXP was started with elevated rights. This is a potential security risk!</nobr>", "Quit Program (Recommended)", "Ignore") == 0)
|
||||
if(QMessageBox::warning(NULL, "Simple x264 Launcher", "<nobr>Program was started with elevated rights. This is a potential security risk!</nobr>", "Quit Program (Recommended)", "Ignore") == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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(); }
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "model_options.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QTime>
|
||||
@ -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<QByteArray> 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,9 +413,20 @@ void EncodeThread::setStatus(JobStatus newStatus)
|
||||
if(m_status != newStatus)
|
||||
{
|
||||
m_status = newStatus;
|
||||
emit statusChanged(m_jobId, 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);
|
||||
}
|
||||
}
|
||||
|
||||
void EncodeThread::setProgress(unsigned int newProgress)
|
||||
|
@ -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); }
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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)
|
||||
|
@ -33,6 +33,21 @@
|
||||
#include <QValidator>
|
||||
#include <QDir>
|
||||
|
||||
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,14 +180,7 @@ 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()))
|
||||
{
|
||||
@ -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<OptionsModel::RCMode>(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;
|
||||
}
|
||||
|
@ -57,4 +57,5 @@ private:
|
||||
void restoreOptions(OptionsModel *options);
|
||||
void saveOptions(OptionsModel *options);
|
||||
void updateComboBox(QComboBox *cbox, const QString &text);
|
||||
QString makeFileFilter(void);
|
||||
};
|
||||
|
@ -33,9 +33,12 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
#include <QLibrary>
|
||||
|
||||
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("<nobr>At least on required tool could not be found:<br>%1<br><br>Please re-install the program in order to fix the problem!</nobr>").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;
|
||||
}
|
||||
}
|
||||
|
||||
//Pre-release popup
|
||||
if(PRE_RELEASE)
|
||||
{
|
||||
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!<br><br>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(); }
|
||||
int val = QMessageBox::information(this, tr("Pre-Release Version"), tr("Note: This is a pre-release version. Please do NOT use for production!<br>Click the button #%1 in order to continue...<br><br>(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("<nobr>It appears that Avisynth is not currently installed on your computer.<br>Thus Avisynth input will not be working at all!<br><br>Please download and install Avisynth:<br><a href=\"http://sourceforge.net/projects/avisynth2/files/AviSynth%202.5/\">http://sourceforge.net/projects/avisynth2/files/AviSynth 2.5/</a></nobr>").replace("-", "−"), tr("Quit"), tr("Ignore"));
|
||||
if(val != 1) { close(); qApp->exit(-1); return; }
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -91,6 +91,22 @@
|
||||
<AdditionalDependencies>QtMain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
</PreBuildEvent>
|
||||
<PreLinkEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreLinkEvent>
|
||||
<PreLinkEvent>
|
||||
<Message>
|
||||
</Message>
|
||||
</PreLinkEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="gui\win_main.ui">
|
||||
|
70
z_build.bat
Normal file
70
z_build.bat
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user