diff --git a/LameXP_VS2017.vcxproj b/LameXP_VS2017.vcxproj index 9a955624..f400aa9e 100644 --- a/LameXP_VS2017.vcxproj +++ b/LameXP_VS2017.vcxproj @@ -2040,34 +2040,6 @@ copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\i true true - - Document - "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" - RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" - $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" - RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" - $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" - RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" - $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) - true - true - - - Document - "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" - RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" - $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" - RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" - $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) - "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" - RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" - $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) - true - true - Document "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" @@ -2193,6 +2165,54 @@ copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\i $(OutDir)LameXP.rcc;%(Outputs) true + + Document + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + + + Document + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + + + Document + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + + + Document + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs) + diff --git a/LameXP_VS2017.vcxproj.filters b/LameXP_VS2017.vcxproj.filters index 8f67d07b..760dc4ac 100644 --- a/LameXP_VS2017.vcxproj.filters +++ b/LameXP_VS2017.vcxproj.filters @@ -890,9 +890,6 @@ Header Files\Models - - Resources - Resources @@ -1031,9 +1028,6 @@ Resources - - Resources - Resources @@ -1064,6 +1058,18 @@ Miscellaneous + + Resources + + + Resources + + + Resources + + + Resources + diff --git a/etc/Patches/WavPack-5.1.0-FlushPipe.diff b/etc/Patches/WavPack-5.1.0-FlushPipe.diff new file mode 100644 index 00000000..f3283e23 --- /dev/null +++ b/etc/Patches/WavPack-5.1.0-FlushPipe.diff @@ -0,0 +1,647 @@ + cli/utils.c | 34 +++++++++++++++++++++++++--------- + cli/wavpack.c | 58 +++++++++++++++++++++++++++++++++++++--------------------- + cli/wvgain.c | 34 +++++++++++++++++++++++++--------- + cli/wvtag.c | 30 +++++++++++++++++++++++------- + cli/wvunpack.c | 46 +++++++++++++++++++++++++++++++--------------- + 5 files changed, 141 insertions(+), 61 deletions(-) + +diff --git a/cli/utils.c b/cli/utils.c +index d59bad0..8840032 100644 +--- a/cli/utils.c ++++ b/cli/utils.c +@@ -38,6 +38,22 @@ + #define remove(f) unlink_utf8(f) + #endif + ++#ifdef _MSC_VER ++static __inline void flush_pipe(FILE *const stream) ++{ ++ struct _stat stat; ++ if (!_fstat(_fileno(stream), &stat)) ++ { ++ if ((stat.st_mode & _S_IFMT) == _S_IFIFO) ++ { ++ fflush(stream); /*flush iff it is a pipe*/ ++ } ++ } ++} ++#else ++#define flush_pipe(X) ((void)0) ++#endif ++ + #ifdef _WIN32 + + int copy_timestamp (const char *src_filename, const char *dst_filename) +@@ -325,38 +341,38 @@ char yna (void) + else if (key == '\r' || key == '\n') { + if (choice) { + fprintf (stderr, "\r\n"); +- fflush (stderr); ++ flush_pipe (stderr); + break; + } + else { + fprintf (stderr, "%c", 7); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + else if (key == 'Y' || key == 'y') { + #ifdef _WIN32 + fprintf (stderr, "%c\b", key); +- fflush (stderr); ++ flush_pipe (stderr); + #endif + choice = 'y'; + } + else if (key == 'N' || key == 'n') { + #ifdef _WIN32 + fprintf (stderr, "%c\b", key); +- fflush (stderr); ++ flush_pipe (stderr); + #endif + choice = 'n'; + } + else if (key == 'A' || key == 'a') { + #ifdef _WIN32 + fprintf (stderr, "%c\b", key); +- fflush (stderr); ++ flush_pipe (stderr); + #endif + choice = 'a'; + } + else { + fprintf (stderr, "%c", 7); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + +@@ -557,7 +573,7 @@ void finish_line (void) + else + fprintf (stderr, " \n"); + +- fflush (stderr); ++ flush_pipe (stderr); + } + #else + ////////////////////////////////////////////////////////////////////////////// +@@ -568,7 +584,7 @@ void finish_line (void) + void finish_line (void) + { + fprintf (stderr, " \n"); +- fflush (stderr); ++ flush_pipe (stderr); + } + + ////////////////////////////////////////////////////////////////////////////// +@@ -763,7 +779,7 @@ void DoSetConsoleTitle (char *text) + void DoSetConsoleTitle (char *text) + { + fprintf (stderr, "\033]0;%s\007", text); +- fflush (stderr); ++ flush_pipe (stderr); + } + + #endif +diff --git a/cli/wavpack.c b/cli/wavpack.c +index 4d46aba..f33086f 100644 +--- a/cli/wavpack.c ++++ b/cli/wavpack.c +@@ -61,6 +61,22 @@ + #define stricmp strcasecmp + #endif + ++#ifdef _MSC_VER ++static __inline void flush_pipe(FILE *const stream) ++{ ++ struct _stat stat; ++ if (!_fstat(_fileno(stream), &stat)) ++ { ++ if ((stat.st_mode & _S_IFMT) == _S_IFIFO) ++ { ++ fflush(stream); /*flush iff it is a pipe*/ ++ } ++ } ++} ++#else ++#define flush_pipe(X) ((void)0) ++#endif ++ + ///////////////////////////// local variable storage ////////////////////////// + + static const char *sign_on = "\n" +@@ -882,11 +898,11 @@ int main (int argc, char **argv) + + if (strcmp (WavpackGetLibraryVersionString (), PACKAGE_VERSION)) { + fprintf (stderr, version_warning, WavpackGetLibraryVersionString (), PACKAGE_VERSION); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode && !error_count) { + fprintf (stderr, sign_on, VERSION_OS, WavpackGetLibraryVersionString ()); +- fflush (stderr); ++ flush_pipe (stderr); + } + + // Loop through any tag specification strings and check for file access, convert text +@@ -1004,7 +1020,7 @@ int main (int argc, char **argv) + + if (error_count) { + fprintf (stderr, "\ntype 'wavpack' for short help or 'wavpack --help' for full help\n"); +- fflush (stderr); ++ flush_pipe (stderr); + return 1; + } + +@@ -1261,7 +1277,7 @@ int main (int argc, char **argv) + + if (num_files > 1 && !quiet_mode) { + fprintf (stderr, "\n%s:\n", matches [file_index]); +- fflush (stderr); ++ flush_pipe (stderr); + } + + if (filespec_ext (matches [file_index]) && !stricmp (filespec_ext (matches [file_index]), ".wv")) +@@ -1295,11 +1311,11 @@ int main (int argc, char **argv) + if (num_files > 1) { + if (error_count) { + fprintf (stderr, "\n **** warning: errors occurred in %d of %d files! ****\n", error_count, num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode) { + fprintf (stderr, "\n **** %d files successfully processed ****\n", num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + +@@ -1350,7 +1366,7 @@ int main(int argc, char **argv) + + if (pause_mode) { + fprintf (stderr, "\nPress any key to continue . . . "); +- fflush (stderr); ++ flush_pipe (stderr); + while (!_kbhit ()); + _getch (); + fprintf (stderr, "\n"); +@@ -1604,7 +1620,7 @@ static int pack_file (char *infilename, char *outfilename, char *out2filename, c + + if (!overwrite_all) { + fprintf (stderr, "overwrite %s (yes/no/all)? ", FN_FIT (outfilename)); +- fflush (stderr); ++ flush_pipe (stderr); + + if (set_console_title) + DoSetConsoleTitle ("overwrite?"); +@@ -1629,7 +1645,7 @@ static int pack_file (char *infilename, char *outfilename, char *out2filename, c + + if (res == 1) { + fprintf (stderr, "overwrite %s (yes/no/all)? ", FN_FIT (out2filename)); +- fflush (stderr); ++ flush_pipe (stderr); + + if (set_console_title) + DoSetConsoleTitle ("overwrite?"); +@@ -1740,7 +1756,7 @@ static int pack_file (char *infilename, char *outfilename, char *out2filename, c + else + fprintf (stderr, "creating %s,", FN_FIT (outfilename)); + +- fflush (stderr); ++ flush_pipe (stderr); + } + + // for now, raw 1-bit PCM is only DSDIFF format +@@ -2364,7 +2380,7 @@ static int pack_audio (WavpackContext *wpc, FILE *infile, int qmode, unsigned ch + #else + fprintf (stderr, "\n"); + #endif +- fflush (stderr); ++ flush_pipe (stderr); + free (sample_buffer); + free (input_buffer); + return WAVPACK_SOFT_ERROR; +@@ -2380,7 +2396,7 @@ static int pack_audio (WavpackContext *wpc, FILE *infile, int qmode, unsigned ch + if (!quiet_mode) { + fprintf (stderr, "%s%3d%% done...", + nobs ? " " : "\b\b\b\b\b\b\b\b\b\b\b\b", (int) progress); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + } +@@ -2522,7 +2538,7 @@ static int pack_dsd_audio (WavpackContext *wpc, FILE *infile, int qmode, unsigne + #else + fprintf (stderr, "\n"); + #endif +- fflush (stderr); ++ flush_pipe (stderr); + free (sample_buffer); + free (input_buffer); + return WAVPACK_SOFT_ERROR; +@@ -2538,7 +2554,7 @@ static int pack_dsd_audio (WavpackContext *wpc, FILE *infile, int qmode, unsigne + if (!quiet_mode) { + fprintf (stderr, "%s%3d%% done...", + nobs ? " " : "\b\b\b\b\b\b\b\b\b\b\b\b", (int) progress); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + } +@@ -2637,7 +2653,7 @@ static int repack_file (char *infilename, char *outfilename, char *out2filename, + else + fprintf (stderr, "overwrite %s with lossy transcode (yes/no/all)? ", FN_FIT (outfilename)); + +- fflush (stderr); ++ flush_pipe (stderr); + + if (set_console_title) + DoSetConsoleTitle ("overwrite?"); +@@ -2657,7 +2673,7 @@ static int repack_file (char *infilename, char *outfilename, char *out2filename, + if (out2filename && !overwrite_all && (wvc_file.file = fopen (out2filename, "rb")) != NULL) { + DoCloseHandle (wvc_file.file); + fprintf (stderr, "overwrite %s (yes/no/all)? ", FN_FIT (out2filename)); +- fflush (stderr); ++ flush_pipe (stderr); + + if (set_console_title) + DoSetConsoleTitle ("overwrite?"); +@@ -2759,7 +2775,7 @@ static int repack_file (char *infilename, char *outfilename, char *out2filename, + else + fprintf (stderr, "creating %s,", FN_FIT (outfilename)); + +- fflush (stderr); ++ flush_pipe (stderr); + } + + WavpackSetFileInformation (outfile, WavpackGetFileExtension (infile), WavpackGetFileFormat (infile)); +@@ -3324,7 +3340,7 @@ static int repack_audio (WavpackContext *outfile, WavpackContext *infile, unsign + #else + fprintf (stderr, "\n"); + #endif +- fflush (stderr); ++ flush_pipe (stderr); + free (sample_buffer); + return WAVPACK_SOFT_ERROR; + } +@@ -3339,7 +3355,7 @@ static int repack_audio (WavpackContext *outfile, WavpackContext *infile, unsign + if (!quiet_mode) { + fprintf (stderr, "%s%3d%% done...", + nobs ? " " : "\b\b\b\b\b\b\b\b\b\b\b\b", (int) progress); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + } +@@ -3525,7 +3541,7 @@ static int verify_audio (char *infilename, unsigned char *md5_digest_source) + #else + fprintf (stderr, "\n"); + #endif +- fflush (stderr); ++ flush_pipe (stderr); + result = WAVPACK_SOFT_ERROR; + break; + } +@@ -3539,7 +3555,7 @@ static int verify_audio (char *infilename, unsigned char *md5_digest_source) + if (!quiet_mode) { + fprintf (stderr, "%s%3d%% done...", + "\b\b\b\b\b\b\b\b\b\b\b\b", (int) progress); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + } +diff --git a/cli/wvgain.c b/cli/wvgain.c +index 4e789ea..2603824 100644 +--- a/cli/wvgain.c ++++ b/cli/wvgain.c +@@ -57,6 +57,22 @@ + #define fopen(f,m) fopen_utf8(f,m) + #endif + ++#ifdef _MSC_VER ++static __inline void flush_pipe(FILE *const stream) ++{ ++ struct _stat stat; ++ if (!_fstat(_fileno(stream), &stat)) ++ { ++ if ((stat.st_mode & _S_IFMT) == _S_IFIFO) ++ { ++ fflush(stream); /*flush iff it is a pipe*/ ++ } ++ } ++} ++#else ++#define flush_pipe(X) ((void)0) ++#endif ++ + ///////////////////////////// local variable storage ////////////////////////// + + static const char *sign_on = "\n" +@@ -258,11 +274,11 @@ int main(int argc, char **argv) + + if (strcmp (WavpackGetLibraryVersionString (), PACKAGE_VERSION)) { + fprintf (stderr, version_warning, WavpackGetLibraryVersionString (), PACKAGE_VERSION); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode && !error_count) { + fprintf (stderr, sign_on, VERSION_OS, WavpackGetLibraryVersionString ()); +- fflush (stderr); ++ flush_pipe (stderr); + } + + if (!num_files) { +@@ -407,7 +423,7 @@ int main(int argc, char **argv) + + if (num_files > 1 && !quiet_mode) { + fprintf (stderr, "\n%s:\n", matches [file_index]); +- fflush (stderr); ++ flush_pipe (stderr); + } + + if (new_mode) { +@@ -496,7 +512,7 @@ int main(int argc, char **argv) + + if (num_files > 1 && !quiet_mode) { + fprintf (stderr, "\n%s:\n", matches [file_index]); +- fflush (stderr); ++ flush_pipe (stderr); + } + + if (show_mode) +@@ -517,11 +533,11 @@ int main(int argc, char **argv) + if (num_files > 1) { + if (error_count) { + fprintf (stderr, "\n **** warning: errors occurred in %d of %d files! ****\n", error_count, num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode) { + fprintf (stderr, "\n **** %d files successfully processed ****\n", num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + +@@ -624,7 +640,7 @@ static int analyze_file (char *infilename, uint32_t *histogram, float *peak) + if (!quiet_mode) { + fprintf (stderr, "analyzing %s%s,", *infilename == '-' ? "stdin" : + FN_FIT (infilename), wvc_mode ? " (+.wvc)" : ""); +- fflush (stderr); ++ flush_pipe (stderr); + } + + sample_rate = WavpackGetSampleRate (wpc); +@@ -711,7 +727,7 @@ static int analyze_file (char *infilename, uint32_t *histogram, float *peak) + #else + fprintf (stderr, "\n"); + #endif +- fflush (stderr); ++ flush_pipe (stderr); + result = WAVPACK_HARD_ERROR; + break; + } +@@ -727,7 +743,7 @@ static int analyze_file (char *infilename, uint32_t *histogram, float *peak) + if (!quiet_mode) { + fprintf (stderr, "%s%3d%% done...", + nobs ? " " : "\b\b\b\b\b\b\b\b\b\b\b\b", (int) progress); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + } +diff --git a/cli/wvtag.c b/cli/wvtag.c +index 6e6512a..33f3526 100644 +--- a/cli/wvtag.c ++++ b/cli/wvtag.c +@@ -60,6 +60,22 @@ + #define stricmp strcasecmp + #endif + ++#ifdef _MSC_VER ++static __inline void flush_pipe(FILE *const stream) ++{ ++ struct _stat stat; ++ if (!_fstat(_fileno(stream), &stat)) ++ { ++ if ((stat.st_mode & _S_IFMT) == _S_IFIFO) ++ { ++ fflush(stream); /*flush iff it is a pipe*/ ++ } ++ } ++} ++#else ++#define flush_pipe(X) ((void)0) ++#endif ++ + ///////////////////////////// local variable storage ////////////////////////// + + static const char *sign_on = "\n" +@@ -408,11 +424,11 @@ int main (int argc, char **argv) + + if (strcmp (WavpackGetLibraryVersionString (), PACKAGE_VERSION)) { + fprintf (stderr, version_warning, WavpackGetLibraryVersionString (), PACKAGE_VERSION); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode && !error_count) { + fprintf (stderr, sign_on, VERSION_OS, WavpackGetLibraryVersionString ()); +- fflush (stderr); ++ flush_pipe (stderr); + } + + // Loop through any tag specification strings and check for file access, convert text +@@ -653,7 +669,7 @@ int main (int argc, char **argv) + + if (num_files > 1 && !quiet_mode) { + fprintf (stderr, "\n%s:\n", matches [file_index]); +- fflush (stderr); ++ flush_pipe (stderr); + } + + result = process_file (matches [file_index]); +@@ -672,11 +688,11 @@ int main (int argc, char **argv) + if (num_files > 1) { + if (error_count) { + fprintf (stderr, "\n **** warning: errors occurred in %d of %d files! ****\n", error_count, num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode) { + fprintf (stderr, "\n **** %d files successfully processed ****\n", num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + +@@ -721,7 +737,7 @@ int main(int argc, char **argv) + + if (pause_mode) { + fprintf (stderr, "\nPress any key to continue . . . "); +- fflush (stderr); ++ flush_pipe (stderr); + while (!_kbhit ()); + _getch (); + fprintf (stderr, "\n"); +@@ -995,7 +1011,7 @@ static int do_tag_extractions (WavpackContext *wpc, char *outfilename) + if (!overwrite_all && (outfile = fopen (full_filename, "r")) != NULL) { + DoCloseHandle (outfile); + fprintf (stderr, "overwrite %s (yes/no/all)? ", FN_FIT (full_filename)); +- fflush (stderr); ++ flush_pipe (stderr); + + switch (yna ()) { + +diff --git a/cli/wvunpack.c b/cli/wvunpack.c +index 2db1cb3..c0a3c87 100644 +--- a/cli/wvunpack.c ++++ b/cli/wvunpack.c +@@ -58,6 +58,22 @@ + #define strdup(x) _strdup(x) + #endif + ++#ifdef _MSC_VER ++static __inline void flush_pipe(FILE *const stream) ++{ ++ struct _stat stat; ++ if (!_fstat(_fileno(stream), &stat)) ++ { ++ if ((stat.st_mode & _S_IFMT) == _S_IFIFO) ++ { ++ fflush(stream); /*flush iff it is a pipe*/ ++ } ++ } ++} ++#else ++#define flush_pipe(X) ((void)0) ++#endif ++ + ///////////////////////////// local variable storage ////////////////////////// + + static const char *sign_on = "\n" +@@ -549,11 +565,11 @@ int main(int argc, char **argv) + + if (strcmp (WavpackGetLibraryVersionString (), PACKAGE_VERSION)) { + fprintf (stderr, version_warning, WavpackGetLibraryVersionString (), PACKAGE_VERSION); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode && !error_count) { + fprintf (stderr, sign_on, VERSION_OS, WavpackGetLibraryVersionString ()); +- fflush (stderr); ++ flush_pipe (stderr); + } + + if (!num_files) { +@@ -763,7 +779,7 @@ int main(int argc, char **argv) + + if (num_files > 1 && !quiet_mode) { + fprintf (stderr, "\n%s:\n", matches [file_index]); +- fflush (stderr); ++ flush_pipe (stderr); + } + + result = unpack_file (matches [file_index], verify_only ? NULL : outfilename, add_extension); +@@ -789,11 +805,11 @@ int main(int argc, char **argv) + if (num_files > 1) { + if (error_count) { + fprintf (stderr, "\n **** warning: errors occurred in %d of %d files! ****\n", error_count, num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + else if (!quiet_mode) { + fprintf (stderr, "\n **** %d files successfully processed ****\n", num_files); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + +@@ -844,7 +860,7 @@ int main(int argc, char **argv) + + if (pause_mode) { + fprintf (stderr, "\nPress any key to continue . . . "); +- fflush (stderr); ++ flush_pipe (stderr); + while (!_kbhit ()); + _getch (); + fprintf (stderr, "\n"); +@@ -931,7 +947,7 @@ static FILE *open_output_file (char *filename, char **tempfilename) + + if (!overwrite_all) { + fprintf (stderr, "overwrite %s (yes/no/all)? ", FN_FIT (filename)); +- fflush (stderr); ++ flush_pipe (stderr); + + if (set_console_title) + DoSetConsoleTitle ("overwrite?"); +@@ -1235,12 +1251,12 @@ static int unpack_file (char *infilename, char *outfilename, int add_extension) + if (!quiet_mode) { + fprintf (stderr, "unpacking %s%s to stdout,", *infilename == '-' ? + "stdin" : FN_FIT (infilename), wvc_mode ? " (+.wvc)" : ""); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + else if (!quiet_mode) { + fprintf (stderr, "restoring %s,", FN_FIT (outfilename)); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + else { // in verify only mode we don't worry about headers +@@ -1249,7 +1265,7 @@ static int unpack_file (char *infilename, char *outfilename, int add_extension) + if (!quiet_mode) { + fprintf (stderr, "verifying %s%s,", *infilename == '-' ? "stdin" : + FN_FIT (infilename), wvc_mode ? " (+.wvc)" : ""); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + +@@ -1607,7 +1623,7 @@ static int unpack_audio (WavpackContext *wpc, FILE *outfile, int qmode, unsigned + #else + fprintf (stderr, "\n"); + #endif +- fflush (stderr); ++ flush_pipe (stderr); + DoTruncateFile (outfile); + result = WAVPACK_SOFT_ERROR; + break; +@@ -1624,7 +1640,7 @@ static int unpack_audio (WavpackContext *wpc, FILE *outfile, int qmode, unsigned + if (!quiet_mode) { + fprintf (stderr, "%s%3d%% done...", + nobs ? " " : "\b\b\b\b\b\b\b\b\b\b\b\b", (int) progress); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + } +@@ -1762,7 +1778,7 @@ static int unpack_dsd_audio (WavpackContext *wpc, FILE *outfile, int qmode, unsi + #else + fprintf (stderr, "\n"); + #endif +- fflush (stderr); ++ flush_pipe (stderr); + DoTruncateFile (outfile); + result = WAVPACK_SOFT_ERROR; + break; +@@ -1779,7 +1795,7 @@ static int unpack_dsd_audio (WavpackContext *wpc, FILE *outfile, int qmode, unsi + if (!quiet_mode) { + fprintf (stderr, "%s%3d%% done...", + nobs ? " " : "\b\b\b\b\b\b\b\b\b\b\b\b", (int) progress); +- fflush (stderr); ++ flush_pipe (stderr); + } + } + } +@@ -1883,7 +1899,7 @@ static int do_tag_extractions (WavpackContext *wpc, char *outfilename) + if (!overwrite_all && (outfile = fopen (full_filename, "r")) != NULL) { + DoCloseHandle (outfile); + fprintf (stderr, "overwrite %s (yes/no/all)? ", FN_FIT (full_filename)); +- fflush (stderr); ++ flush_pipe (stderr); + + if (set_console_title) + DoSetConsoleTitle ("overwrite?"); diff --git a/etc/Patches/WavPack-4.80.0-FlushPipe.diff b/etc/Patches/deprecated/WavPack-4.80.0-FlushPipe.diff similarity index 100% rename from etc/Patches/WavPack-4.80.0-FlushPipe.diff rename to etc/Patches/deprecated/WavPack-4.80.0-FlushPipe.diff diff --git a/res/Tools.wvunpack-i686.qrc b/res/Tools.wvunpack-i686.qrc deleted file mode 100644 index 5af5ef1a..00000000 --- a/res/Tools.wvunpack-i686.qrc +++ /dev/null @@ -1,2 +0,0 @@ - -tools/wvunpack.i686.exe diff --git a/res/Tools.wvunpack-x64-avx.qrc b/res/Tools.wvunpack-x64-avx.qrc new file mode 100644 index 00000000..53a5536c --- /dev/null +++ b/res/Tools.wvunpack-x64-avx.qrc @@ -0,0 +1,2 @@ + +tools/wvunpack.x64-avx.exe diff --git a/res/Tools.wvunpack-x64-sse2.qrc b/res/Tools.wvunpack-x64-sse2.qrc new file mode 100644 index 00000000..6c5d9a6e --- /dev/null +++ b/res/Tools.wvunpack-x64-sse2.qrc @@ -0,0 +1,2 @@ + +tools/wvunpack.x64-sse2.exe diff --git a/res/Tools.wvunpack-x64.qrc b/res/Tools.wvunpack-x64.qrc deleted file mode 100644 index a80a1518..00000000 --- a/res/Tools.wvunpack-x64.qrc +++ /dev/null @@ -1,2 +0,0 @@ - -tools/wvunpack.x64.exe diff --git a/res/Tools.wvunpack-x86-i686.qrc b/res/Tools.wvunpack-x86-i686.qrc new file mode 100644 index 00000000..024fdad8 --- /dev/null +++ b/res/Tools.wvunpack-x86-i686.qrc @@ -0,0 +1,2 @@ + +tools/wvunpack.x86-i686.exe diff --git a/res/Tools.wvunpack-x86-sse2.qrc b/res/Tools.wvunpack-x86-sse2.qrc new file mode 100644 index 00000000..dadd4ccf --- /dev/null +++ b/res/Tools.wvunpack-x86-sse2.qrc @@ -0,0 +1,2 @@ + +tools/wvunpack.x86-sse2.exe diff --git a/res/_ALL.qrc b/res/_ALL.qrc index dfe2f347..d0b827a3 100644 --- a/res/_ALL.qrc +++ b/res/_ALL.qrc @@ -265,7 +265,9 @@ tools/wget.exe tools/wma2wav.exe tools/wupdate.exe - tools/wvunpack.i686.exe - tools/wvunpack.x64.exe + tools/wvunpack.x64-avx.exe + tools/wvunpack.x64-sse2.exe + tools/wvunpack.x86-i686.exe + tools/wvunpack.x86-sse2.exe \ No newline at end of file diff --git a/res/tools/wvunpack.i686.exe b/res/tools/wvunpack.i686.exe deleted file mode 100644 index 61888a66..00000000 Binary files a/res/tools/wvunpack.i686.exe and /dev/null differ diff --git a/res/tools/wvunpack.x64-avx.exe b/res/tools/wvunpack.x64-avx.exe new file mode 100644 index 00000000..be2f3b1a Binary files /dev/null and b/res/tools/wvunpack.x64-avx.exe differ diff --git a/res/tools/wvunpack.x64-sse2.exe b/res/tools/wvunpack.x64-sse2.exe new file mode 100644 index 00000000..85abc5dd Binary files /dev/null and b/res/tools/wvunpack.x64-sse2.exe differ diff --git a/res/tools/wvunpack.x64.exe b/res/tools/wvunpack.x64.exe deleted file mode 100644 index bdb9712c..00000000 Binary files a/res/tools/wvunpack.x64.exe and /dev/null differ diff --git a/res/tools/wvunpack.x86-i686.exe b/res/tools/wvunpack.x86-i686.exe new file mode 100644 index 00000000..2c9aad89 Binary files /dev/null and b/res/tools/wvunpack.x86-i686.exe differ diff --git a/res/tools/wvunpack.x86-sse2.exe b/res/tools/wvunpack.x86-sse2.exe new file mode 100644 index 00000000..bb410016 Binary files /dev/null and b/res/tools/wvunpack.x86-sse2.exe differ diff --git a/src/Config.h b/src/Config.h index de56a70c..5309c3e7 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 6 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 1 -#define VER_LAMEXP_BUILD 2072 +#define VER_LAMEXP_BUILD 2073 #define VER_LAMEXP_CONFG 2002 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Decoder_WavPack.cpp b/src/Decoder_WavPack.cpp index e07f75bd..800d6ec1 100644 --- a/src/Decoder_WavPack.cpp +++ b/src/Decoder_WavPack.cpp @@ -62,14 +62,14 @@ bool WavPackDecoder::decode(const QString &sourceFile, const QString &outputFile } int prevProgress = -1; - QRegExp regExp("(\\s|\b)(\\d+)%\\s+done"); + QRegExp regExp("\\b(\\d+)%\\s+done"); const result_t result = awaitProcess(process, abortFlag, [this, &prevProgress, ®Exp](const QString &text) { if (regExp.lastIndexIn(text) >= 0) { qint32 newProgress; - if (MUtils::regexp_parse_int32(regExp, newProgress, 2U)) + if (MUtils::regexp_parse_int32(regExp, newProgress)) { if (newProgress > prevProgress) { diff --git a/src/Tools.h b/src/Tools.h index 1461e9fb..d52021cd 100644 --- a/src/Tools.h +++ b/src/Tools.h @@ -118,8 +118,10 @@ g_lamexp_tools[] = {"0a2c8afb50aac35b80f34be2e2286bbb4f0876c1ad53fed8dc2f679786671eafdc1a244378abcc2c229fc110bb5cdf79", CPU_TYPE_ALL_ALL, "wget.exe", 1180, ""}, {"572b9448bf4a338ecb9727951fdfcc5a219cc69896695cc96b9f6b083690e339910e41558968264a38992e45f2be152c", CPU_TYPE_ALL_ALL, "wma2wav.exe", 20111001, ""}, {"5ef85aa6c6521161e19fc9eadd30bac82c3d0eee2374fd6ac543022181f7846ec2198ebe8bc84667e9b92a4a85d07fbb", CPU_TYPE_ALL_ALL, "wupdate.exe", 20171002, ""}, - {"9c742cff64c726b6d9abafcf222c24a7e41d4fa0e44ea962917a91e09c15e52aebc859c1ea028c1c1806702850460e2c", CPU_TYPE_X86_ALL, "wvunpack.i686.exe", 4800, ""}, - {"70382b0a9431ec35f419126a5561252e7d5bc05a8a7912c49c54382a3642309372374977ef9186ccd9b733c64a3428bd", CPU_TYPE_X64_ALL, "wvunpack.x64.exe", 4800, ""}, + {"6021b938769b09d05617c7e91e0cb6cc5f9e40c50cb470455afc21d466b37183b8675822b8797cbf98950a5262ec07a6", CPU_TYPE_X86_GEN, "wvunpack.x86-i686.exe", 5010, ""}, + {"fa322e127679ac6b5e833e120b590480b3ffc7ffa875705c04ed698f155dc23b40c8922d2f5f78ad1cc9342306289141", CPU_TYPE_X86_SSX, "wvunpack.x86-sse2.exe", 5010, ""}, + {"d4ca3085aae70160beab778a46a27643f1415bd803ddfecb2791fe964e4bff49ac5a891ef1852f26e867c42ddd6f8806", CPU_TYPE_X64_NVX, "wvunpack.x64-sse2.exe", 5010, ""}, + {"e2c32a765cbec41cc6e662447a1d70d8261753f2c93aca666bafddcc420c4eaee550d3c730123a84565cf43fffa26c35", CPU_TYPE_X64_AVX, "wvunpack.x64-avx.exe", 5010, ""}, {NULL, NULL, NULL, NULL, NULL} };