diff --git a/etc/Patches/OpusTools-Git20120724-Progress.diff b/etc/Patches/OpusTools-Git20120724-Progress.diff new file mode 100644 index 00000000..60a01ddc --- /dev/null +++ b/etc/Patches/OpusTools-Git20120724-Progress.diff @@ -0,0 +1,85 @@ + src/opusdec.c | 17 +++++++++++++++-- + src/opusenc.c | 8 ++++++-- + 2 files changed, 21 insertions(+), 4 deletions(-) + +diff --git a/src/opusdec.c b/src/opusdec.c +index 5c35242..da23c97 100644 +--- a/src/opusdec.c ++++ b/src/opusdec.c +@@ -57,6 +57,7 @@ + # include + # include + # define I64FORMAT "I64d" ++# define ftello64(_x) _ftelli64((_x)) + #else + # define I64FORMAT "lld" + # define fopen_utf8(_x,_y) fopen((_x),(_y)) +@@ -645,6 +646,7 @@ int main(int argc, char **argv) + int close_in=0; + int eos=0; + ogg_int64_t audio_size=0; ++ ogg_int64_t input_size=0; + double last_coded_seconds=0; + float loss_percent=-1; + float manual_gain=0; +@@ -789,6 +791,16 @@ int main(int argc, char **argv) + close_in=1; + } + ++ /*detect input size*/ ++ if(fin != stdin) ++ { ++ struct _stat64 info; ++ if(_fstati64(_fileno(fin), &info) == 0) ++ { ++ input_size = info.st_size; ++ } ++ } ++ + /*Init Ogg data struct*/ + ogg_sync_init(&oy); + +@@ -911,10 +923,11 @@ int main(int argc, char **argv) + if(!quiet){ + static const char spinner[]="|/-\\"; + double coded_seconds = (double)audio_size/(channels*rate*sizeof(short)); ++ double percent = (input_size>0) ? ((double)ftello64(fin))/((double)input_size) : 0.0; + if(coded_seconds>=last_coded_seconds+1){ +- fprintf(stderr,"\r[%c] %02d:%02d:%02d", spinner[last_spin&3], ++ fprintf(stderr,"\r[%c] %02d:%02d:%02d (%.f%%)", spinner[last_spin&3], + (int)(coded_seconds/3600),(int)(coded_seconds/60)%60, +- (int)(coded_seconds)%60); ++ (int)(coded_seconds)%60,percent*100.0); + fflush(stderr); + last_spin++; + last_coded_seconds=coded_seconds; +diff --git a/src/opusenc.c b/src/opusenc.c +index f6cc762..a34b340 100644 +--- a/src/opusenc.c ++++ b/src/opusenc.c +@@ -895,6 +895,7 @@ int main(int argc, char **argv) + double estbitrate; + double coded_seconds=nb_encoded/(double)coding_rate; + double wall_time=(stop_time-start_time)+1e-6; ++ double percent = 0.0; + char sbuf[55]; + static const char spinner[]="|/-\\"; + if(!with_hard_cbr){ +@@ -909,12 +910,15 @@ int main(int argc, char **argv) + }else{ + snprintf(sbuf,54,"\r[%c] ",spinner[last_spin&3]); + } ++ if(inopt.total_samples_per_channel>0){ ++ percent = ((double)nb_encoded) / ((double)inopt.total_samples_per_channel); ++ } + last_spin_len=strlen(sbuf); + snprintf(sbuf+last_spin_len,54-last_spin_len, +- "%02d:%02d:%02d.%02d %4.3gx realtime, %5.4gkbit/s\r", ++ "%02d:%02d:%02d.%02d (%.f%%) %4.3gx realtime, %5.4gkbit/s\r", + (int)(coded_seconds/3600),(int)(coded_seconds/60)%60, + (int)(coded_seconds)%60,(int)(coded_seconds*100)%100, +- coded_seconds/wall_time, ++ percent*100.0,coded_seconds/wall_time, + estbitrate/1000.); + fprintf(stderr,"%s",sbuf); + fflush(stderr); diff --git a/res/Tools_Decd.qrc b/res/Tools_Decd.qrc index 3be5c232..c63d7e43 100644 --- a/res/Tools_Decd.qrc +++ b/res/Tools_Decd.qrc @@ -8,7 +8,8 @@ tools/mpcdec.exe tools/mpg123.exe tools/oggdec.exe - tools/opusdec.exe + tools/opusdec.i386.exe + tools/opusdec.sse2.exe tools/shorten.exe tools/speexdec.exe tools/tta.exe diff --git a/res/Tools_Encd.qrc b/res/Tools_Encd.qrc index 80fed1ed..01b2bd64 100644 --- a/res/Tools_Encd.qrc +++ b/res/Tools_Encd.qrc @@ -11,6 +11,7 @@ tools/oggenc2.i386.exe tools/oggenc2.sse2.exe tools/oggenc2.x64.exe - tools/opusenc.exe + tools/opusenc.i386.exe + tools/opusenc.sse2.exe diff --git a/res/tools/opusdec.exe b/res/tools/opusdec.exe deleted file mode 100644 index eab797ab..00000000 Binary files a/res/tools/opusdec.exe and /dev/null differ diff --git a/res/tools/opusdec.i386.exe b/res/tools/opusdec.i386.exe new file mode 100644 index 00000000..e5a3f3cd Binary files /dev/null and b/res/tools/opusdec.i386.exe differ diff --git a/res/tools/opusdec.sse2.exe b/res/tools/opusdec.sse2.exe new file mode 100644 index 00000000..da26d21f Binary files /dev/null and b/res/tools/opusdec.sse2.exe differ diff --git a/res/tools/opusenc.exe b/res/tools/opusenc.exe deleted file mode 100644 index 813997ef..00000000 Binary files a/res/tools/opusenc.exe and /dev/null differ diff --git a/res/tools/opusenc.i386.exe b/res/tools/opusenc.i386.exe new file mode 100644 index 00000000..6f9eb98d Binary files /dev/null and b/res/tools/opusenc.i386.exe differ diff --git a/res/tools/opusenc.sse2.exe b/res/tools/opusenc.sse2.exe new file mode 100644 index 00000000..8d8da86c Binary files /dev/null and b/res/tools/opusenc.sse2.exe differ diff --git a/src/Config.h b/src/Config.h index 8bd703f3..6d38303c 100644 --- a/src/Config.h +++ b/src/Config.h @@ -29,8 +29,8 @@ #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 5 #define VER_LAMEXP_TYPE Alpha -#define VER_LAMEXP_PATCH 9 -#define VER_LAMEXP_BUILD 1056 +#define VER_LAMEXP_PATCH 10 +#define VER_LAMEXP_BUILD 1058 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Decoder_Opus.cpp b/src/Decoder_Opus.cpp index 8736c592..25f2f594 100644 --- a/src/Decoder_Opus.cpp +++ b/src/Decoder_Opus.cpp @@ -59,11 +59,8 @@ bool OpusDecoder::decode(const QString &sourceFile, const QString &outputFile, v bool bAborted = false; int prevProgress = -1; - QRegExp regExp("\\[(-|\\\\|/|\\|)\\]"); + QRegExp regExp("\\((\\d+)%\\)"); - //The ALAC Decoder doesn't actually send any status updates :-[ - emit statusUpdated(20 + (QUuid::createUuid().data1 % 60)); - while(process.state() != QProcess::NotRunning) { if(*abortFlag) @@ -88,27 +85,13 @@ bool OpusDecoder::decode(const QString &sourceFile, const QString &outputFile, v QString text = QString::fromUtf8(line.constData()).simplified(); if(regExp.lastIndexIn(text) >= 0) { - __noop; - /* - int values[6]; - for(int i = 0; i < 6; i++) + bool ok = false; + int progress = regExp.cap(1).toInt(&ok); + if(ok && (progress > prevProgress)) { - bool ok = false; - int temp = regExp.cap(i+1).toInt(&ok); - values[i] = (ok ? temp : 0); + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); } - int timeDone = (60 * values[0]) + values[1]; - int timeLeft = (60 * values[3]) + values[4]; - if(timeDone > 0 || timeLeft > 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/Encoder_Opus.cpp b/src/Encoder_Opus.cpp index 5fbe5794..d6f91cd6 100644 --- a/src/Encoder_Opus.cpp +++ b/src/Encoder_Opus.cpp @@ -127,7 +127,7 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn bool bAborted = false; int prevProgress = -1; - QRegExp regExp("\\[(-|\\\\|/|\\|)\\]\\s*(\\d+):(\\d+):(\\d+)"); + QRegExp regExp("\\((\\d+)%\\)"); while(process.state() != QProcess::NotRunning) { @@ -153,19 +153,12 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn QString text = QString::fromUtf8(line.constData()).simplified(); if(regExp.lastIndexIn(text) >= 0) { - bool ok[3] = {false, false, false}; - int h = regExp.cap(2).toInt(&ok[0]); - int m = regExp.cap(3).toInt(&ok[1]); - int s = regExp.cap(4).toInt(&ok[2]); - if(ok[0] && ok[1] && ok[2] && (fileDuration > 0)) + bool ok = false; + int progress = regExp.cap(1).toInt(&ok); + if(ok && (progress > prevProgress)) { - int filePosition = (h * 3600) + (m * 60) + s; - int newProgress = qRound((static_cast(filePosition) / static_cast(fileDuration)) * 100.0); - if(newProgress > prevProgress) - { - emit statusUpdated(newProgress); - prevProgress = qMin(newProgress + 2, 99); - } + emit statusUpdated(progress); + prevProgress = qMin(progress + 2, 99); } } else if(!text.isEmpty()) diff --git a/src/Tools.h b/src/Tools.h index 2135cfc1..76aad519 100644 --- a/src/Tools.h +++ b/src/Tools.h @@ -73,8 +73,10 @@ g_lamexp_tools[] = {"0c019e13450dc664987e21f4e5489d182be7d6d0d81efbbaaf1c78693dfe3e38e0355b93", CPU_TYPE_X86_GEN, "oggenc2.i386.exe", 287603}, {"693dd6f779df70a047c15c2c79350855db38d5b0cd7e529b6877b7c821cfe6addfdd50a4", CPU_TYPE_X86_SSE, "oggenc2.sse2.exe", 287603}, {"291cedb6a1b213330a9cb508f975ee7132a25aa26770ab91cade50109b4ffb81c9bdd09a", CPU_TYPE_X64_ALL, "oggenc2.x64.exe", 287603}, - {"73379e0d0d99a0faf0b061aa782ca807b4e6c11ad759e0662c10e197fe79a03f3bc8cbe4", CPU_TYPE_ALL_ALL, "opusdec.exe", 20120721}, - {"7573a9e4b3d9c9a7e774bc6b2dceb939e097f1175a3afa8f8fe8cd7ee33afdd51d020443", CPU_TYPE_ALL_ALL, "opusenc.exe", 20120721}, + {"2418fdda62798ffcfd1dabf26e0ef512ab378c254cf0f3d8a5b6b9f2fe16a757653c090e", CPU_TYPE_ALL_GEN, "opusdec.i386.exe", 20120724}, + {"b3b9c24835ccb7cb44961fa1a3fcc48524faeda8f8fcc18802adea5d4b3634b86d57e43c", CPU_TYPE_ALL_SSE, "opusdec.sse2.exe", 20120724}, + {"7663fc4ec2d081745eeadbc128aca6543067df7ed764896e5ce70c2f8a54d88fede80ffb", CPU_TYPE_ALL_GEN, "opusenc.i386.exe", 20120724}, + {"8dd6fa8281000f485c5e842c82cac20f109c928c852d3beaf581a962b859a0f448799efa", CPU_TYPE_ALL_SSE, "opusenc.sse2.exe", 20120724}, {"58c2b8bcff8f27bfa8fab8172b80f5da731221d072c7dba4dd3a3d7d6423490a25dc6760", CPU_TYPE_ALL_ALL, "shorten.exe", 361}, {"017a0f613a962af0620618019b015d5c54bb3c07cf1023e5fdb9502b652367ebbfaaebbc", CPU_TYPE_ALL_ALL, "sox.exe", 1440}, {"48e7f81c024cd17dac0eaeab253aad6b223e72dc80688f7576276b0563209514ff0bb9c8", CPU_TYPE_ALL_ALL, "speexdec.exe", 12},