When job's are added via "--add-job", the job will now be either started immediately or enqueued, depending on the preferences. Before those job's were *always* started immediately. Furthermore, two [four] new command-line options can be used to control the startup behavior: The options "--[no-]force-start" and "--[no-]force-enqueue" will enabled [disable] that the *next* job added via "--add-job" is started immediately or appended to the queue, respectively. Neither of those is enabled, default behavior applies.

This commit is contained in:
LoRd_MuldeR 2014-02-01 15:34:11 +01:00
parent b5ee60f8d9
commit c899d1aa3f
5 changed files with 66 additions and 37 deletions

View File

@ -230,22 +230,30 @@ in older versions of the Simple x264 Launcher is *NOT* needed anymore!!
13. Command-line Syntax 13. Command-line Syntax
----------------------- -----------------------
PLEASE NOTE: These are parameters you can pass to Simple x264 Launcher, they
can **not** be passed to x264 (or avs2yuv) itself as "custom" parameters !!!
The following command-line switches are available: The following command-line switches are available:
--add-file <file> ............... Create a new job via "Add Job" dialog --add-file <file> ............... Create a new job via "Add Job" dialog
--add-job <src> <dest> <tpl> .... Create a new job in a non-interactive way --add-job <src> <dest> <tpl> .... Create a new job in a non-interactive way
--console ....................... Show the "debug" console --[no-]force-start .............. Next job will [not] be started immediately
--no-console .................... Don't show the "debug" console --[no-]force-enqueue ............ Next job will [not] be appended to queue
--no-style ...................... Don't use the Qt "Plastique" style --skip-avisynth-check ........... Skip Avisynth check, disable .AVS input
--skip-avisynth-check ........... Skip Avisynth check, disable .AVS input --skip-vapoursynth-check ........ Skip VapourSynth check, disables .VPY input
--skip-vapoursynth-check ........ Skip VapourSynth check, disables .VPY input --force-cpu-no-64bit ............ Forcefully disable 64-Bit support
--force-cpu-no-64bit ............ Forcefully disable 64-Bit support --no-deadlock-detection ......... Don't abort processes on timeout/deadlock
--no-deadlock-detection ......... Don't abort processes on timeout/deadlock --[no-]console .................. Do [not] show the "debug" console window
--no-style ...................... Don't use the Qt "Plastique" UI-style
HINT: Pass "-" as the <tpl> parameter to encode with *default* template. Some details on the "--add-job" command-line switch:
PLEASE NOTE: These are parameters you can pass to Simple x264 Launcher, they <src> .... Specifies the source media file or Avisynth/VapourSynth script
can *not* be passed to x264 itself as "custom" parameters !!! <dest> ... Specifies the output H.264/MKV/MP4 file to be written
<tpl> .... Specifies the template name to be used, can be "-" to use defaults
Use "--[no-]force-start" or "--[no-]force-enqueue" to tweak startup behavior.
If neither of those switches is used, the default startup behavior applies.
14. Help & Support 14. Help & Support

View File

@ -137,6 +137,7 @@ static int x264_main(int argc, char* argv[])
void handleMultipleInstances(QStringList args, IPC *ipc) void handleMultipleInstances(QStringList args, IPC *ipc)
{ {
bool commandSent = false; bool commandSent = false;
unsigned int flags = 0;
//Skip the program file name //Skip the program file name
args.takeFirst(); args.takeFirst();
@ -165,12 +166,9 @@ void handleMultipleInstances(QStringList args, IPC *ipc)
commandSent = true; commandSent = true;
if(args.size() >= 3) if(args.size() >= 3)
{ {
QStringList lst; const QStringList list = args.mid(0, 3);
for(int i = 0; i < 3; i++) args.erase(args.begin(), args.begin() + 3);
{ if(!ipc->sendAsync(IPC_OPCODE_ADD_JOB, list, flags))
lst << args.takeFirst();
}
if(!ipc->sendAsync(IPC_OPCODE_ADD_JOB, lst))
{ {
break; break;
} }
@ -181,13 +179,22 @@ void handleMultipleInstances(QStringList args, IPC *ipc)
args.clear(); args.clear();
} }
} }
else else if(X264_STRCMP(current, "--force-start") || X264_STRCMP(current, "--no-force-start"))
{ {
if(!current.startsWith("--")) const bool bEnabled = X264_STRCMP(current, "--force-start");
{ flags = bEnabled ? (flags | IPC_FLAG_FORCE_START) : (flags & (~IPC_FLAG_FORCE_START));
qWarning("Unknown argument: %s", current.toUtf8().constData()); if(bEnabled) flags = flags & (~IPC_FLAG_FORCE_ENQUEUE);
break; }
} else if(X264_STRCMP(current, "--force-enqueue") || X264_STRCMP(current, "--no-force-enqueue"))
{
const bool bEnabled = X264_STRCMP(current, "--force-enqueue");
flags = bEnabled ? (flags | IPC_FLAG_FORCE_ENQUEUE) : (flags & (~IPC_FLAG_FORCE_ENQUEUE));
if(bEnabled) flags = flags & (~IPC_FLAG_FORCE_START);
}
else if(!current.startsWith("--"))
{
qWarning("Unknown argument: %s", current.toUtf8().constData());
break;
} }
} }

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 3 #define VER_X264_MINOR 3
#define VER_X264_PATCH 0 #define VER_X264_PATCH 0
#define VER_X264_BUILD 738 #define VER_X264_BUILD 740
#define VER_X264_MINIMUM_REV 2380 #define VER_X264_MINIMUM_REV 2380
#define VER_X264_CURRENT_API 142 #define VER_X264_CURRENT_API 142

View File

@ -62,8 +62,8 @@ const char *tpl_last = "<LAST_USED>";
#define SET_FONT_BOLD(WIDGET,BOLD) do { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); } while(0) #define SET_FONT_BOLD(WIDGET,BOLD) do { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); } while(0)
#define SET_TEXT_COLOR(WIDGET,COLOR) do { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); } while(0) #define SET_TEXT_COLOR(WIDGET,COLOR) do { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); } while(0)
#define LINK(URL) "<a href=\"" URL "\">" URL "</a>" #define LINK(URL) "<a href=\"" URL "\">" URL "</a>"
#define ENSURE_APP_IS_IDLE() do { if(m_status != STATUS_IDLE) { qWarning("Cannot perfrom this action at this time!"); return; } } while(0)
#define INIT_ERROR_EXIT() do { m_status = STATUS_EXITTING; close(); qApp->exit(-1); return; } while(0) #define INIT_ERROR_EXIT() do { m_status = STATUS_EXITTING; close(); qApp->exit(-1); return; } while(0)
#define ENSURE_APP_IS_IDLE() do { if(m_status != STATUS_IDLE) { x264_beep(x264_beep_warning); qWarning("Cannot perfrom this action at this time!"); return; } } while(0)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Constructor & Destructor // Constructor & Destructor
@ -763,7 +763,7 @@ void MainWindow::init(void)
//Create the IPC listener thread //Create the IPC listener thread
if(m_ipc->isInitialized()) if(m_ipc->isInitialized())
{ {
connect(m_ipc, SIGNAL(receivedCommand(int,QStringList)), this, SLOT(handleCommand(int,QStringList)), Qt::QueuedConnection); connect(m_ipc, SIGNAL(receivedCommand(int,QStringList,quint32)), this, SLOT(handleCommand(int,QStringList,quint32)), Qt::QueuedConnection);
m_ipc->startListening(); m_ipc->startListening();
} }
@ -991,7 +991,7 @@ void MainWindow::handlePendingFiles(void)
} }
} }
void MainWindow::handleCommand(const int &command, const QStringList &args) void MainWindow::handleCommand(const int &command, const QStringList &args, const quint32 &flags)
{ {
if((m_status != STATUS_IDLE) && (m_status != STATUS_AWAITING)) if((m_status != STATUS_IDLE) && (m_status != STATUS_AWAITING))
{ {
@ -1008,6 +1008,7 @@ void MainWindow::handleCommand(const int &command, const QStringList &args)
{ {
qDebug("Arguments: %s", iter->toUtf8().constData()); qDebug("Arguments: %s", iter->toUtf8().constData());
} }
qDebug("The Flags: 0x%08X", flags);
qDebug("---------- IPC ----------\n"); qDebug("---------- IPC ----------\n");
#endif //IPC_LOGGING #endif //IPC_LOGGING
@ -1041,6 +1042,7 @@ void MainWindow::handleCommand(const int &command, const QStringList &args)
if(QFileInfo(args[0]).exists() && QFileInfo(args[0]).isFile()) if(QFileInfo(args[0]).exists() && QFileInfo(args[0]).isFile())
{ {
OptionsModel options; OptionsModel options;
bool runImmediately = (countRunningJobs() < (m_preferences->autoRunNextJob() ? m_preferences->maxRunningJobCount() : 1));
if(!(args[2].isEmpty() || X264_STRCMP(args[2], "-"))) if(!(args[2].isEmpty() || X264_STRCMP(args[2], "-")))
{ {
if(!OptionsModel::loadTemplate(&options, args[2].trimmed())) if(!OptionsModel::loadTemplate(&options, args[2].trimmed()))
@ -1048,7 +1050,9 @@ void MainWindow::handleCommand(const int &command, const QStringList &args)
qWarning("Template '%s' could not be found -> using defaults!", args[2].trimmed().toUtf8().constData()); qWarning("Template '%s' could not be found -> using defaults!", args[2].trimmed().toUtf8().constData());
} }
} }
appendJob(args[0], args[1], &options, true); if((flags & IPC_FLAG_FORCE_START) && (!(flags & IPC_FLAG_FORCE_ENQUEUE))) runImmediately = true;
if((flags & IPC_FLAG_FORCE_ENQUEUE) && (!(flags & IPC_FLAG_FORCE_START))) runImmediately = false;
appendJob(args[0], args[1], &options, runImmediately);
} }
else else
{ {
@ -1493,6 +1497,7 @@ void MainWindow::updateTaskbar(JobStatus status, const QIcon &icon)
bool MainWindow::parseCommandLineArgs(void) bool MainWindow::parseCommandLineArgs(void)
{ {
bool bCommandAccepted = false; bool bCommandAccepted = false;
unsigned int flags = 0;
QStringList files; QStringList files;
QStringList args = x264_arguments(); QStringList args = x264_arguments();
@ -1520,8 +1525,8 @@ bool MainWindow::parseCommandLineArgs(void)
if(args.size() >= 3) if(args.size() >= 3)
{ {
const QStringList list = args.mid(0, 3); const QStringList list = args.mid(0, 3);
handleCommand(IPC_OPCODE_ADD_JOB, list);
args.erase(args.begin(), args.begin() + 3); args.erase(args.begin(), args.begin() + 3);
handleCommand(IPC_OPCODE_ADD_JOB, list, flags);
} }
else else
{ {
@ -1529,13 +1534,22 @@ bool MainWindow::parseCommandLineArgs(void)
args.clear(); args.clear();
} }
} }
else else if(X264_STRCMP(current, "--force-start") || X264_STRCMP(current, "--no-force-start"))
{ {
if(!current.startsWith("--")) const bool bEnabled = X264_STRCMP(current, "--force-start");
{ flags = bEnabled ? (flags | IPC_FLAG_FORCE_START) : (flags & (~IPC_FLAG_FORCE_START));
qWarning("Unknown argument: %s", current.toUtf8().constData()); if(bEnabled) flags = flags & (~IPC_FLAG_FORCE_ENQUEUE);
break; }
} else if(X264_STRCMP(current, "--force-enqueue") || X264_STRCMP(current, "--no-force-enqueue"))
{
const bool bEnabled = X264_STRCMP(current, "--force-enqueue");
flags = bEnabled ? (flags | IPC_FLAG_FORCE_ENQUEUE) : (flags & (~IPC_FLAG_FORCE_ENQUEUE));
if(bEnabled) flags = flags & (~IPC_FLAG_FORCE_START);
}
else if(!current.startsWith("--"))
{
qWarning("Unknown argument: %s", current.toUtf8().constData());
break;
} }
} }

View File

@ -113,7 +113,7 @@ private slots:
void checkUpdates(void); void checkUpdates(void);
void handlePendingFiles(void); void handlePendingFiles(void);
void init(void); void init(void);
void handleCommand(const int &command, const QStringList &args); void handleCommand(const int &command, const QStringList &args, const quint32 &flags = 0);
void jobSelected(const QModelIndex &current, const QModelIndex &previous); void jobSelected(const QModelIndex &current, const QModelIndex &previous);
void jobChangedData(const QModelIndex &top, const QModelIndex &bottom); void jobChangedData(const QModelIndex &top, const QModelIndex &bottom);
void jobLogExtended(const QModelIndex & parent, int start, int end); void jobLogExtended(const QModelIndex & parent, int start, int end);