Added support for modified x264 progress output, as used by some patched build (e.g. Komisar's "kMod" builds).

This commit is contained in:
LoRd_MuldeR 2013-10-13 22:09:05 +02:00
parent 4c76729c4b
commit 7fcd1a6358
2 changed files with 24 additions and 13 deletions

View File

@ -338,6 +338,22 @@ void EncodeThread::encode(void)
setStatus(JobStatus_Completed); setStatus(JobStatus_Completed);
} }
#define X264_UPDATE_PROGRESS(X) do \
{ \
bool ok = false; \
unsigned int progress = (X).cap(1).toUInt(&ok); \
setStatus((pass == 2) ? JobStatus_Running_Pass2 : ((pass == 1) ? JobStatus_Running_Pass1 : JobStatus_Running)); \
if(ok && ((progress > last_progress) || (last_progress == UINT_MAX))) \
{ \
setProgress(progress); \
size_estimate = estimateSize(progress); \
last_progress = progress; \
} \
setDetails(tr("%1, est. file size %2").arg(text.mid(offset).trimmed(), sizeToString(size_estimate))); \
last_indexing = UINT_MAX; \
} \
while(0)
bool EncodeThread::runEncodingPass(bool x264_x64, bool x264_10bit, bool avs2yuv_x64, int inputType, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile) bool EncodeThread::runEncodingPass(bool x264_x64, bool x264_10bit, bool avs2yuv_x64, int inputType, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
{ {
QProcess processEncode, processInput; QProcess processEncode, processInput;
@ -385,6 +401,7 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool x264_10bit, bool avs2yuv_
QRegExp regExpIndexing("indexing.+\\[(\\d+)\\.(\\d+)%\\]"); QRegExp regExpIndexing("indexing.+\\[(\\d+)\\.(\\d+)%\\]");
QRegExp regExpProgress("\\[(\\d+)\\.(\\d+)%\\].+frames"); QRegExp regExpProgress("\\[(\\d+)\\.(\\d+)%\\].+frames");
QRegExp regExpModified("\\[\\s*(\\d+)\\.(\\d+)%\\]\\s+(\\d+)/(\\d+)\\s(\\d+).(\\d+)\\s(\\d+).(\\d+)\\s+(\\d+):(\\d+):(\\d+)\\s+(\\d+):(\\d+):(\\d+)");
QRegExp regExpFrameCnt("^(\\d+) frames:"); QRegExp regExpFrameCnt("^(\\d+) frames:");
QTextCodec *localCodec = QTextCodec::codecForName("System"); QTextCodec *localCodec = QTextCodec::codecForName("System");
@ -475,17 +492,7 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool x264_10bit, bool avs2yuv_
int offset = -1; int offset = -1;
if((offset = regExpProgress.lastIndexIn(text)) >= 0) if((offset = regExpProgress.lastIndexIn(text)) >= 0)
{ {
bool ok = false; X264_UPDATE_PROGRESS(regExpProgress);
unsigned int progress = regExpProgress.cap(1).toUInt(&ok);
setStatus((pass == 2) ? JobStatus_Running_Pass2 : ((pass == 1) ? JobStatus_Running_Pass1 : JobStatus_Running));
if(ok && ((progress > last_progress) || (last_progress == UINT_MAX)))
{
setProgress(progress);
size_estimate = estimateSize(progress);
last_progress = progress;
}
setDetails(tr("%1, est. file size %2").arg(text.mid(offset).trimmed(), sizeToString(size_estimate)));
last_indexing = UINT_MAX;
} }
else if((offset = regExpIndexing.lastIndexIn(text)) >= 0) else if((offset = regExpIndexing.lastIndexIn(text)) >= 0)
{ {
@ -506,6 +513,10 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool x264_10bit, bool avs2yuv_
setStatus((pass == 2) ? JobStatus_Running_Pass2 : ((pass == 1) ? JobStatus_Running_Pass1 : JobStatus_Running)); setStatus((pass == 2) ? JobStatus_Running_Pass2 : ((pass == 1) ? JobStatus_Running_Pass1 : JobStatus_Running));
setDetails(text.mid(offset).trimmed()); setDetails(text.mid(offset).trimmed());
} }
else if((offset = regExpModified.lastIndexIn(text)) >= 0)
{
X264_UPDATE_PROGRESS(regExpModified);
}
else if(!text.isEmpty()) else if(!text.isEmpty())
{ {
last_progress = last_indexing = UINT_MAX; last_progress = last_indexing = UINT_MAX;

View File

@ -21,8 +21,8 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 2 #define VER_X264_MINOR 2
#define VER_X264_PATCH 2 #define VER_X264_PATCH 3
#define VER_X264_BUILD 583 #define VER_X264_BUILD 586
#define VER_X264_MINIMUM_REV 2350 #define VER_X264_MINIMUM_REV 2350
#define VER_X264_CURRENT_API 138 #define VER_X264_CURRENT_API 138