diff --git a/src/Config.h b/src/Config.h index 282a167a..082629cc 100644 --- a/src/Config.h +++ b/src/Config.h @@ -27,10 +27,10 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 -#define VER_LAMEXP_MINOR_LO 3 -#define VER_LAMEXP_TYPE Final -#define VER_LAMEXP_PATCH 2 -#define VER_LAMEXP_BUILD 774 +#define VER_LAMEXP_MINOR_LO 4 +#define VER_LAMEXP_TYPE Alpha +#define VER_LAMEXP_PATCH 1 +#define VER_LAMEXP_BUILD 777 /////////////////////////////////////////////////////////////////////////////// // Tools versions diff --git a/src/Decoder_MP3.cpp b/src/Decoder_MP3.cpp index 4db4d084..0c16f757 100644 --- a/src/Decoder_MP3.cpp +++ b/src/Decoder_MP3.cpp @@ -56,6 +56,7 @@ bool MP3Decoder::decode(const QString &sourceFile, const QString &outputFile, vo bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; QRegExp regExp("\\s+Time:\\s+(\\d+):(\\d+)\\.(\\d+)\\s+\\[(\\d+):(\\d+)\\.(\\d+)\\],"); @@ -94,7 +95,12 @@ bool MP3Decoder::decode(const QString &sourceFile, const QString &outputFile, vo int timeLeft = (60 * values[3]) + values[4]; if(timeDone > 0 || timeLeft > 0) { - statusUpdated(static_cast((static_cast(timeDone) / static_cast(timeDone + timeLeft)) * 100.0)); + int newProgress = qRound((static_cast(timeDone) / static_cast(timeDone + timeLeft)) * 100.0); + if(newProgress > prevProgress) + { + emit statusUpdated(newProgress); + prevProgress = qMin(newProgress + 2, 99); + } } } else if(!text.isEmpty()) diff --git a/src/Decoder_Vorbis.cpp b/src/Decoder_Vorbis.cpp index a63392c2..abe0bae7 100644 --- a/src/Decoder_Vorbis.cpp +++ b/src/Decoder_Vorbis.cpp @@ -56,6 +56,7 @@ bool VorbisDecoder::decode(const QString &sourceFile, const QString &outputFile, bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; QRegExp regExp(" (\\d+)% decoded."); @@ -85,7 +86,11 @@ bool VorbisDecoder::decode(const QString &sourceFile, const QString &outputFile, { bool ok = false; int progress = regExp.cap(1).toInt(&ok); - if(ok) emit statusUpdated(progress); + if(ok && (progress > prevProgress)) + { + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); + } } else if(!text.isEmpty()) { diff --git a/src/Encoder_AAC.cpp b/src/Encoder_AAC.cpp index ceb99c06..2f311842 100644 --- a/src/Encoder_AAC.cpp +++ b/src/Encoder_AAC.cpp @@ -97,6 +97,8 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; + QRegExp regExp("Processed\\s+(\\d+)\\s+seconds"); QRegExp regExp_pass1("First\\s+pass:\\s+processed\\s+(\\d+)\\s+seconds"); @@ -130,7 +132,12 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf int progress = regExp_pass1.cap(1).toInt(&ok); if(ok && metaInfo.fileDuration() > 0) { - emit statusUpdated(static_cast((static_cast(progress) / static_cast(metaInfo.fileDuration())) * 50.0)); + int newProgress = qRound((static_cast(progress) / static_cast(metaInfo.fileDuration())) * 50.0); + if(newProgress > prevProgress) + { + emit statusUpdated(newProgress); + prevProgress = qMin(newProgress + 2, 99); + } } } else if(regExp_pass2.lastIndexIn(text) >= 0) @@ -139,7 +146,12 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf int progress = regExp_pass2.cap(1).toInt(&ok); if(ok && metaInfo.fileDuration() > 0) { - emit statusUpdated(static_cast((static_cast(progress) / static_cast(metaInfo.fileDuration())) * 50.0) + 50); + int newProgress = qRound((static_cast(progress) / static_cast(metaInfo.fileDuration())) * 50.0) + 50; + if(newProgress > prevProgress) + { + emit statusUpdated(newProgress); + prevProgress = qMin(newProgress + 2, 99); + } } } else if(regExp.lastIndexIn(text) >= 0) @@ -148,7 +160,12 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf int progress = regExp.cap(1).toInt(&ok); if(ok && metaInfo.fileDuration() > 0) { - emit statusUpdated(static_cast((static_cast(progress) / static_cast(metaInfo.fileDuration())) * 100.0)); + int newProgress = qRound((static_cast(progress) / static_cast(metaInfo.fileDuration())) * 100.0); + if(newProgress > prevProgress) + { + emit statusUpdated(newProgress); + prevProgress = qMin(newProgress + 2, 99); + } } } else if(!text.isEmpty()) diff --git a/src/Encoder_AAC_FHG.cpp b/src/Encoder_AAC_FHG.cpp index 13d8f984..1f1b7e16 100644 --- a/src/Encoder_AAC_FHG.cpp +++ b/src/Encoder_AAC_FHG.cpp @@ -97,6 +97,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel &meta bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; QRegExp regExp("Progress:\\s*(\\d+)%"); @@ -126,7 +127,11 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel &meta { bool ok = false; int progress = regExp.cap(1).toInt(&ok); - if(ok) emit statusUpdated(progress); + if(ok && (progress > prevProgress)) + { + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); + } } else if(!text.isEmpty()) { diff --git a/src/Encoder_AC3.cpp b/src/Encoder_AC3.cpp index d6aed475..ed2a126a 100644 --- a/src/Encoder_AC3.cpp +++ b/src/Encoder_AC3.cpp @@ -93,6 +93,7 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; QRegExp regExp("progress:(\\s+)(\\d+)%(\\s+)\\|"); @@ -122,7 +123,11 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf { bool ok = false; int progress = regExp.cap(2).toInt(&ok); - if(ok) emit statusUpdated(progress); + if(ok && (progress > prevProgress)) + { + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); + } } else if(!text.isEmpty()) { diff --git a/src/Encoder_FLAC.cpp b/src/Encoder_FLAC.cpp index 04042a32..0f46c38f 100644 --- a/src/Encoder_FLAC.cpp +++ b/src/Encoder_FLAC.cpp @@ -71,6 +71,7 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; QRegExp regExp("\\s(\\d+)% complete"); @@ -100,7 +101,11 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn { bool ok = false; int progress = regExp.cap(1).toInt(&ok); - if(ok) emit statusUpdated(progress); + if(ok && (progress > prevProgress)) + { + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); + } } else if(!text.isEmpty()) { diff --git a/src/Encoder_MP3.cpp b/src/Encoder_MP3.cpp index 2b851610..687ed7f4 100644 --- a/src/Encoder_MP3.cpp +++ b/src/Encoder_MP3.cpp @@ -139,6 +139,7 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; QRegExp regExp("\\(.*(\\d+)%\\)\\|"); @@ -168,7 +169,11 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf { bool ok = false; int progress = regExp.cap(1).toInt(&ok); - if(ok) emit statusUpdated(progress); + if(ok && (progress > prevProgress)) + { + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); + } } else if(!text.isEmpty()) { diff --git a/src/Encoder_Vorbis.cpp b/src/Encoder_Vorbis.cpp index 65fa8e4a..a2cb397a 100644 --- a/src/Encoder_Vorbis.cpp +++ b/src/Encoder_Vorbis.cpp @@ -97,6 +97,7 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta bool bTimeout = false; bool bAborted = false; + int prevProgress = -1; QRegExp regExp("\\[.*(\\d+)[.,](\\d+)%\\]"); @@ -126,7 +127,11 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta { bool ok = false; int progress = regExp.cap(1).toInt(&ok); - if(ok) emit statusUpdated(progress); + if(ok && (progress > prevProgress)) + { + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); + } } else if(!text.isEmpty()) { diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index 716f79af..2a6a1a3d 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -209,6 +209,8 @@ void ProcessThread::processFile() bSuccess = fileInfo.exists() && fileInfo.isFile() && (fileInfo.size() > 0); } + QThread::msleep(500); + //Report result emit processStateChanged(m_jobId, (bSuccess ? tr("Done.") : (m_aborted ? tr("Aborted!") : tr("Failed!"))), (bSuccess ? ProgressModel::JobComplete : ProgressModel::JobFailed)); emit processStateFinished(m_jobId, outFileName, bSuccess); @@ -222,6 +224,8 @@ void ProcessThread::processFile() void ProcessThread::handleUpdate(int progress) { + //printf("Progress: %d\n", progress); + switch(m_currentStep) { case EncodingStep: @@ -433,4 +437,4 @@ void ProcessThread::setRenamePattern(const QString &pattern) // EVENTS //////////////////////////////////////////////////////////// -/*NONE*/ +/*NONE*/ \ No newline at end of file