1 tools/unicode_support.cpp | 86 ++++++++++++++++++
2 tools/unicode_support.h | 21 +++++
3 tools/valdec.cpp | 180 ++++++++++++++++++++++++--------------
4 tools/valdec.sln | 50 +++++++----
5 tools/valdec.vcproj | 61 +++++++------
6 valib/lib/valib.vcproj | 19 ++++-
7 valib/valib/auto_file.cpp | 3 +-
8 valib/valib/sink/sink_dsound.cpp | 4 +-
9 valib/valib/sink/sink_stdout.h | 93 ++++++++++++++++++++
10 9 files changed, 402 insertions(+), 115 deletions(-)
12 diff --git a/tools/unicode_support.cpp b/tools/unicode_support.cpp
14 index 0000000..13f89ba
16 +++ b/tools/unicode_support.cpp
18 +#include "unicode_support.h"
22 +char *utf16_to_utf8(const wchar_t *input)
25 + int BuffSize, Result;
27 + BuffSize = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
28 + Buffer = new char[BuffSize]; //(char*) malloc(sizeof(char) * BuffSize);
29 + Result = WideCharToMultiByte(CP_UTF8, 0, input, -1, Buffer, BuffSize, NULL, NULL);
31 + return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
34 +wchar_t *utf8_to_utf16(const char *input)
37 + int BuffSize, Result;
39 + BuffSize = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);
40 + Buffer = new wchar_t[BuffSize]; //(wchar_t*) malloc(sizeof(wchar_t) * BuffSize);
41 + Result = MultiByteToWideChar(CP_UTF8, 0, input, -1, Buffer, BuffSize);
43 + return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
46 +void init_commandline_arguments_utf8(int *argc, char ***argv)
51 + szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
53 + if(NULL == szArglist)
55 + fprintf(stderr, "\nFATAL: CommandLineToArgvW failed\n\n");
59 + *argv = new char*[nArgs]; //malloc(sizeof(char*) * nArgs);
62 + for(i = 0; i < nArgs; i++)
64 + (*argv)[i] = utf16_to_utf8(szArglist[i]);
67 + LocalFree(szArglist);
70 +void free_commandline_arguments_utf8(int *argc, char ***argv)
74 + for(int i = 0; i < *argc; i++)
76 + if((*argv)[i] != NULL)
78 + delete [] ((*argv)[i]);
87 +FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8)
91 + wchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);
92 + wchar_t *mode_utf16 = utf8_to_utf16(mode_utf8);
94 + if(filename_utf16 && mode_utf16)
96 + ret = _wfopen(filename_utf16, mode_utf16);
99 + if(filename_utf16) delete [] filename_utf16;
100 + if(mode_utf16) delete [] mode_utf16;
104 diff --git a/tools/unicode_support.h b/tools/unicode_support.h
106 index 0000000..9ad3173
108 +++ b/tools/unicode_support.h
110 +#ifndef UNICODE_SUPPORT_H_INCLUDED
111 +#define UNICODE_SUPPORT_H_INCLUDED
121 +char *utf16_to_utf8(const wchar_t *input);
122 +wchar_t *utf8_to_utf16(const char *input);
123 +void init_commandline_arguments_utf8(int *argc, char ***argv);
124 +void free_commandline_arguments_utf8(int *argc, char ***argv);
125 +FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8);
131 diff --git a/tools/valdec.cpp b/tools/valdec.cpp
132 index 6b24ecf..b5fe15d 100644
133 --- a/tools/valdec.cpp
134 +++ b/tools/valdec.cpp
136 #include "sink\sink_raw.h"
137 #include "sink\sink_wav.h"
138 #include "sink\sink_dsound.h"
139 +#include "sink\sink_stdout.h"
142 #include "filters\dvd_graph.h"
145 #include "win32\cpu.h"
147 +#include "unicode_support.h"
150 #define bool2str(v) ((v)? "true": "false")
151 @@ -65,7 +67,7 @@ const sample_t level_tbl[] =
155 -int main(int argc, char *argv[])
156 +int valdec_main(int argc, char *argv[])
160 @@ -77,6 +79,7 @@ int main(int argc, char *argv[])
162 "This utility is a part of AC3Filter project (http://ac3filter.net)\n"
163 "Copyright (c) 2006-2009 by Alexander Vigovsky\n"
164 +"Support for Unicode file names and STDOUT output added by LoRd_MuldeR\n"
167 " valdec some_file [options]\n"
168 @@ -91,6 +94,7 @@ int main(int argc, char *argv[])
169 " -r[aw] file.raw - decode to RAW file\n"
170 " -w[av] file.wav - decode to WAV file\n"
171 " -n[othing] - do nothing (to be used with -i option)\n"
172 +" -s[td] - decode to RAW and write to STDOUT\n"
175 //" -spdif - spdif output (no other options will work in this mode)\n"
176 @@ -184,12 +188,13 @@ int main(int argc, char *argv[])
177 /////////////////////////////////////////////////////////
180 - enum { mode_undefined, mode_nothing, mode_play, mode_raw, mode_wav, mode_decode } mode = mode_undefined;
181 + enum { mode_undefined, mode_nothing, mode_play, mode_raw, mode_wav, mode_decode, mode_stdout } mode = mode_undefined;
182 const char *out_filename = 0;
191 @@ -216,7 +221,7 @@ int main(int argc, char *argv[])
195 - printf("-ac3 : ambigous parser\n");
196 + fprintf(stderr, "-ac3 : ambigous parser\n");
200 @@ -229,7 +234,7 @@ int main(int argc, char *argv[])
204 - printf("-dts : ambigous parser\n");
205 + fprintf(stderr, "-dts : ambigous parser\n");
209 @@ -242,7 +247,7 @@ int main(int argc, char *argv[])
213 - printf("-mpa : ambigous parser\n");
214 + fprintf(stderr, "-mpa : ambigous parser\n");
218 @@ -268,7 +273,7 @@ int main(int argc, char *argv[])
220 if (imask < 0 || imask > array_size(mask_tbl))
222 - printf("-spk : incorrect speaker configuration\n");
223 + fprintf(stderr, "-spk : incorrect speaker configuration\n");
227 @@ -280,7 +285,7 @@ int main(int argc, char *argv[])
228 iformat = int(arg_num(argv[iarg]));
229 if (iformat < 0 || iformat > array_size(format_tbl))
231 - printf("-fmt : incorrect sample format");
232 + fprintf(stderr, "-fmt : incorrect sample format");
236 @@ -296,7 +301,7 @@ int main(int argc, char *argv[])
240 - printf("-decode : ambigous output mode\n");
241 + fprintf(stderr, "-decode : ambigous output mode\n");
245 @@ -312,7 +317,7 @@ int main(int argc, char *argv[])
249 - printf("-play : ambigous output mode\n");
250 + fprintf(stderr, "-play : ambigous output mode\n");
254 @@ -328,12 +333,12 @@ int main(int argc, char *argv[])
258 - printf("-raw : ambigous output mode\n");
259 + fprintf(stderr, "-raw : ambigous output mode\n");
264 - printf("-raw : specify a file name\n");
265 + fprintf(stderr, "-raw : specify a file name\n");
269 @@ -343,19 +348,40 @@ int main(int argc, char *argv[])
274 + // -s[td] - RAW output to STDOUT
275 + if (is_arg(argv[iarg], "s", argt_exist) ||
276 + is_arg(argv[iarg], "std", argt_exist))
280 + fprintf(stderr, "-std : ambigous output mode\n");
283 + if (argc - iarg < 1)
285 + fprintf(stderr, "-std : specify a file name\n");
289 + //out_filename = argv[++iarg];
292 + mode = mode_stdout;
295 // -w[av] - WAV output
296 if (is_arg(argv[iarg], "w", argt_exist) ||
297 is_arg(argv[iarg], "wav", argt_exist))
301 - printf("-wav : ambigous output mode\n");
302 + fprintf(stderr, "-wav : ambigous output mode\n");
307 - printf("-wav : specify a file name\n");
308 + fprintf(stderr, "-wav : specify a file name\n");
312 @@ -372,7 +398,7 @@ int main(int argc, char *argv[])
316 - printf("-nothing : ambigous output mode\n");
317 + fprintf(stderr, "-nothing : ambigous output mode\n");
321 @@ -614,7 +640,7 @@ int main(int argc, char *argv[])
325 - printf("Error: unknown option: %s\n", argv[iarg]);
326 + fprintf(stderr, "Error: unknown option: %s\n", argv[iarg]);
330 @@ -627,13 +653,13 @@ int main(int argc, char *argv[])
332 if (!file.open(input_filename, parser, 1000000))
334 - printf("Error: Cannot open file '%s'\n", input_filename);
335 + fprintf(stderr, "Error: Cannot open file '%s'\n", input_filename);
341 - printf("Error: Cannot detect input file format\n", input_filename);
342 + fprintf(stderr, "Error: Cannot detect input file format\n", input_filename);
346 @@ -643,7 +669,7 @@ int main(int argc, char *argv[])
348 if (!file.is_frame_loaded())
350 - printf("Error: Cannot load the first frame\n");
351 + fprintf(stderr, "Error: Cannot load the first frame\n");
355 @@ -655,9 +681,9 @@ int main(int argc, char *argv[])
358 file.file_info(info, sizeof(info));
359 - printf("%s\n", info);
360 + fprintf(stderr, "%s\n", info);
361 file.stream_info(info, sizeof(info));
362 - printf("%s", info);
363 + fprintf(stderr, "%s", info);
366 if (mode == mode_nothing)
367 @@ -678,7 +704,7 @@ int main(int argc, char *argv[])
368 Speakers user_spk(format_tbl[iformat], mask_tbl[imask], 0, level_tbl[iformat]);
369 if (!dvd_graph.set_user(user_spk))
371 - printf("Error: unsupported user format (%s %s %i)\n",
372 + fprintf(stderr, "Error: unsupported user format (%s %s %i)\n",
373 user_spk.format_text(), user_spk.mode_text(), user_spk.sample_rate);
376 @@ -686,7 +712,7 @@ int main(int argc, char *argv[])
377 Speakers in_spk = file.get_spk();
378 if (!dvd_graph.set_input(in_spk))
380 - printf("Error: unsupported input format (%s %s %i)\n",
381 + fprintf(stderr, "Error: unsupported input format (%s %s %i)\n",
382 in_spk.format_text(), in_spk.mode_text(), in_spk.sample_rate);
385 @@ -718,10 +744,18 @@ int main(int argc, char *argv[])
390 + if (!stdsnk.is_open())
392 + fprintf(stderr, "Error: failed to open standard output handle.\n");
398 if (!out_filename || !raw.open(out_filename))
400 - printf("Error: failed to open output file '%s'\n", out_filename);
401 + fprintf(stderr, "Error: failed to open output file '%s'\n", out_filename);
405 @@ -729,7 +763,7 @@ int main(int argc, char *argv[])
407 if (!out_filename || !wav.open(out_filename))
409 - printf("Error: failed to open output file '%s'\n", out_filename);
410 + fprintf(stderr, "Error: failed to open output file '%s'\n", out_filename);
414 @@ -737,7 +771,7 @@ int main(int argc, char *argv[])
416 if (!dsound.open_dsound(0))
418 - printf("Error: failed to init DirectSound\n");
419 + fprintf(stderr, "Error: failed to init DirectSound\n");
423 @@ -765,27 +799,28 @@ int main(int argc, char *argv[])
427 -// fprintf(stderr, " 0.0%% Frs: 0 Err: 0 Time: 0:00.000i Level: 0dB FPS: 0 CPU: 0%%\r");
428 +// ffprintf(stderr, stderr, " 0.0%% Frs: 0 Err: 0 Time: 0:00.000i Level: 0dB FPS: 0 CPU: 0%%\r");
432 - #define PRINT_STAT \
436 - dvd_graph.proc.get_output_levels(control->get_playback_time(), levels); \
437 - level = levels[0]; \
438 - for (i = 1; i < NCHANNELS; i++) \
439 - if (levels[i] > level) \
440 - level = levels[i]; \
442 - fprintf(stderr, "%4.1f%% Frs: %-6i Err: %-i Time: %3i:%02i.%03i Level: %-4idB FPS: %-4i CPU: %.1f%% \r", \
443 - file.get_pos(file.relative) * 100, \
444 - file.get_frames(), dvd_graph.dec.get_errors(), \
445 - int(time/60), int(time) % 60, int(time * 1000) % 1000, \
446 - int(value2db(level)), \
447 - int(file.get_frames() / time), \
448 - cpu_current.usage() * 100); \
449 + #define PRINT_STAT \
453 + dvd_graph.proc.get_output_levels(control->get_playback_time(), levels); \
454 + level = levels[0]; \
455 + for (i = 1; i < NCHANNELS; i++) \
456 + if (levels[i] > level) \
457 + level = levels[i]; \
459 + fprintf(stderr, "[%4.1f%%] Frs: %-6i Err: %-i Time: %3i:%02i.%03i Level: %-4idB FPS: %-4i CPU: %.1f%% \r", \
460 + file.get_pos(file.relative) * 100, \
461 + file.get_frames(), dvd_graph.dec.get_errors(), \
462 + int(time/60), int(time) % 60, int(time * 1000) % 1000, \
463 + int(value2db(level)), \
464 + int(file.get_frames() / time), \
465 + cpu_current.usage() * 100); \
470 @@ -811,7 +846,7 @@ int main(int argc, char *argv[])
473 file.stream_info(info, sizeof(info));
474 - printf("\n\n%s", info);
475 + fprintf(stderr, "\n\n%s", info);
479 @@ -825,7 +860,7 @@ int main(int argc, char *argv[])
480 chunk.set_rawdata(file.get_spk(), file.get_frame(), file.get_frame_size());
481 if (!dvd_graph.process(&chunk))
483 - printf("\nError in dvd_graph.process()\n");
484 + fprintf(stderr, "\nError in dvd_graph.process()\n");
488 @@ -833,7 +868,7 @@ int main(int argc, char *argv[])
490 if (!dvd_graph.get_chunk(&chunk))
492 - printf("\nError in dvd_graph.get_chunk()\n");
493 + fprintf(stderr, "\nError in dvd_graph.get_chunk()\n");
497 @@ -847,12 +882,12 @@ int main(int argc, char *argv[])
498 if (sink->query_input(chunk.spk))
501 - printf("Opening audio output %s %s %i...\n",
502 + fprintf(stderr, "Opening audio output %s %s %i...\n",
503 chunk.spk.format_text(), chunk.spk.mode_text(), chunk.spk.sample_rate);
507 - printf("\nOutput format %s %s %i is unsupported\n",
508 + fprintf(stderr, "\nOutput format %s %s %i is unsupported\n",
509 chunk.spk.format_text(), chunk.spk.mode_text(), chunk.spk.sample_rate);
512 @@ -860,7 +895,7 @@ int main(int argc, char *argv[])
514 if (!sink->process(&chunk))
516 - printf("\nError in sink->process()\n");
517 + fprintf(stderr, "\nError in sink->process()\n");
521 @@ -893,7 +928,7 @@ int main(int argc, char *argv[])
523 if (!dvd_graph.process_to(&chunk, sink))
525 - printf("\nProcessing error!\n");
526 + fprintf(stderr, "\nProcessing error!\n");
530 @@ -907,13 +942,13 @@ int main(int argc, char *argv[])
534 - printf("\n---------------------------------------\n");
535 + fprintf(stderr, "\n---------------------------------------\n");
537 - printf("Streams found: %i\n", streams);
538 - printf("Frames/errors: %i/%i\n", file.get_frames(), dvd_graph.dec.get_errors());
539 - printf("System time: %ims\n", int(cpu_total.get_system_time() * 1000));
540 - printf("Process time: %ims\n", int(cpu_total.get_thread_time() * 1000 ));
541 - printf("Approx. %.2f%% realtime CPU usage\n", double(cpu_total.get_thread_time() * 100) / file.get_size(file.time));
542 + fprintf(stderr, "Streams found: %i\n", streams);
543 + fprintf(stderr, "Frames/errors: %i/%i\n", file.get_frames(), dvd_graph.dec.get_errors());
544 + fprintf(stderr, "System time: %ims\n", int(cpu_total.get_system_time() * 1000));
545 + fprintf(stderr, "Process time: %ims\n", int(cpu_total.get_thread_time() * 1000 ));
546 + fprintf(stderr, "Approx. %.2f%% realtime CPU usage\n", double(cpu_total.get_thread_time() * 100) / file.get_size(file.time));
548 /////////////////////////////////////////////////////////
549 // Print levels histogram
550 @@ -930,22 +965,35 @@ int main(int argc, char *argv[])
551 max_level = dvd_graph.proc.get_max_level();
552 dbpb = dvd_graph.proc.get_dbpb();
554 - printf("\nHistogram:\n");
555 - printf("------------------------------------------------------------------------------\n");
556 + fprintf(stderr, "\nHistogram:\n");
557 + fprintf(stderr, "------------------------------------------------------------------------------\n");
558 for (i = 0; i*dbpb < 100 && i < MAX_HISTOGRAM; i++)
560 - printf("%2idB: %4.1f ", i * dbpb, hist[i] * 100);
561 + fprintf(stderr, "%2idB: %4.1f ", i * dbpb, hist[i] * 100);
562 for (j = 0; j < 67 && j < hist[i] * 67; j++)
565 + fprintf(stderr, "*");
566 + fprintf(stderr, "\n");
568 - printf("------------------------------------------------------------------------------\n");
569 - printf("max_level;%f\ndbpb;%i\nhistogram;", max_level, dbpb);
570 + fprintf(stderr, "------------------------------------------------------------------------------\n");
571 + fprintf(stderr, "max_level;%f\ndbpb;%i\nhistogram;", max_level, dbpb);
572 for (i = 0; i < MAX_HISTOGRAM; i++)
573 - printf("%.4f;", hist[i]);
575 - printf("------------------------------------------------------------------------------\n");
576 + fprintf(stderr, "%.4f;", hist[i]);
577 + fprintf(stderr, "\n");
578 + fprintf(stderr, "------------------------------------------------------------------------------\n");
584 +int main(int argc, char *argv[])
590 + init_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
591 + exit_code = valdec_main(argc_utf8, argv_utf8);
592 + free_commandline_arguments_utf8(&argc_utf8, &argv_utf8);
596 diff --git a/tools/valdec.sln b/tools/valdec.sln
597 index 9120b95..8b0cf39 100644
598 --- a/tools/valdec.sln
599 +++ b/tools/valdec.sln
602 Microsoft Visual Studio Solution File, Format Version 10.00
604 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "valdec", "valdec.vcproj", "{871889DF-6EF7-461F-AC1B-7DA682CB79A0}"
605 +Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "valdec", "valdec.icproj", "{EB870031-881E-455A-A1E2-5FD222F92D61}"
606 ProjectSection(ProjectDependencies) = postProject
607 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C} = {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}
608 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1} = {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}
611 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "valib", "..\valib\lib\valib.vcproj", "{30FCD216-1CAD-48FD-BF4B-337572F7EC9C}"
612 +Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "valib", "..\valib\lib\valib.icproj", "{C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}"
615 GlobalSection(SolutionConfigurationPlatforms) = preSolution
616 @@ -16,22 +16,38 @@ Global
617 Release|x64 = Release|x64
619 GlobalSection(ProjectConfigurationPlatforms) = postSolution
620 - {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|Win32.ActiveCfg = Debug|Win32
621 - {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|Win32.Build.0 = Debug|Win32
622 - {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|x64.ActiveCfg = Debug|x64
623 - {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|x64.Build.0 = Debug|x64
624 - {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Release|Win32.ActiveCfg = Release|Win32
625 - {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Release|Win32.Build.0 = Release|Win32
626 - {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Release|x64.ActiveCfg = Release|x64
627 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Debug|Win32.ActiveCfg = Debug|Win32
628 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Debug|Win32.Build.0 = Debug|Win32
629 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Debug|x64.ActiveCfg = Debug|x64
630 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Debug|x64.Build.0 = Debug|x64
631 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Release|Win32.ActiveCfg = Release|Win32
632 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Release|Win32.Build.0 = Release|Win32
633 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Release|x64.ActiveCfg = Release|x64
634 + {EB870031-881E-455A-A1E2-5FD222F92D61}.Release|x64.Build.0 = Release|x64
635 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Debug|Win32.ActiveCfg = Debug|Win32
636 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Debug|Win32.Build.0 = Debug|Win32
637 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Debug|x64.ActiveCfg = Debug|x64
638 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Debug|x64.Build.0 = Debug|x64
639 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Release|Win32.ActiveCfg = Release|Win32
640 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Release|Win32.Build.0 = Release|Win32
641 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Release|x64.ActiveCfg = Release|x64
642 + {C9AE46F3-AA5D-421B-99DF-3BBA26AEF6B1}.Release|x64.Build.0 = Release|x64
643 {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Release|x64.Build.0 = Release|x64
644 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|Win32.ActiveCfg = Debug|Win32
645 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|Win32.Build.0 = Debug|Win32
646 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|x64.ActiveCfg = Debug|x64
647 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|x64.Build.0 = Debug|x64
648 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Release|Win32.ActiveCfg = Release|Win32
649 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Release|Win32.Build.0 = Release|Win32
650 - {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Release|x64.ActiveCfg = Release|x64
651 + {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Release|x64.ActiveCfg = Release|x64
652 + {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Release|Win32.Build.0 = Release|Win32
653 + {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Release|Win32.ActiveCfg = Release|Win32
654 + {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|x64.Build.0 = Debug|x64
655 + {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|x64.ActiveCfg = Debug|x64
656 + {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|Win32.Build.0 = Debug|Win32
657 + {871889DF-6EF7-461F-AC1B-7DA682CB79A0}.Debug|Win32.ActiveCfg = Debug|Win32
658 {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Release|x64.Build.0 = Release|x64
659 + {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Release|x64.ActiveCfg = Release|x64
660 + {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Release|Win32.Build.0 = Release|Win32
661 + {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Release|Win32.ActiveCfg = Release|Win32
662 + {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|x64.Build.0 = Debug|x64
663 + {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|x64.ActiveCfg = Debug|x64
664 + {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|Win32.Build.0 = Debug|Win32
665 + {30FCD216-1CAD-48FD-BF4B-337572F7EC9C}.Debug|Win32.ActiveCfg = Debug|Win32
667 GlobalSection(SolutionProperties) = preSolution
668 HideSolutionNode = FALSE
669 diff --git a/tools/valdec.vcproj b/tools/valdec.vcproj
670 index d6a6b98..4d3056b 100644
671 --- a/tools/valdec.vcproj
672 +++ b/tools/valdec.vcproj
674 <?xml version="1.0" encoding="windows-1251"?>
676 ProjectType="Visual C++"
680 ProjectGUID="{871889DF-6EF7-461F-AC1B-7DA682CB79A0}"
681 RootNamespace="valdec"
686 - Name="Release|Win32"
687 - OutputDirectory="$(SolutionDir)$(ConfigurationName)"
688 - IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
690 + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
691 + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
692 ConfigurationType="1"
694 - WholeProgramOptimization="1"
697 Name="VCPreBuildEventTool"
698 @@ -114,15 +113,16 @@
702 + TargetEnvironment="3"
705 Name="VCCLCompilerTool"
707 - EnableIntrinsicFunctions="true"
709 AdditionalIncludeDirectories="..\valib\valib"
710 - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
712 - EnableFunctionLevelLinking="true"
713 + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
714 + MinimalRebuild="true"
715 + BasicRuntimeChecks="3"
717 UsePrecompiledHeader="0"
719 DebugInformationFormat="3"
720 @@ -139,12 +139,10 @@
723 AdditionalDependencies="dsound.lib"
724 - LinkIncremental="1"
725 + LinkIncremental="2"
726 GenerateDebugInformation="true"
728 - OptimizeReferences="2"
729 - EnableCOMDATFolding="2"
735 @@ -169,11 +167,12 @@
740 - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
741 - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
742 + Name="Release|Win32"
743 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
744 + IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
745 ConfigurationType="1"
747 + WholeProgramOptimization="1"
750 Name="VCPreBuildEventTool"
751 @@ -189,19 +188,21 @@
755 - TargetEnvironment="3"
758 Name="VCCLCompilerTool"
761 + InlineFunctionExpansion="2"
762 + EnableIntrinsicFunctions="true"
763 + FavorSizeOrSpeed="1"
764 AdditionalIncludeDirectories="..\valib\valib"
765 - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
766 - MinimalRebuild="true"
767 - BasicRuntimeChecks="3"
769 + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
771 + EnableFunctionLevelLinking="true"
772 + EnableEnhancedInstructionSet="0"
773 UsePrecompiledHeader="0"
775 - DebugInformationFormat="3"
776 + DebugInformationFormat="0"
779 Name="VCManagedResourceCompilerTool"
780 @@ -214,11 +215,13 @@
784 - AdditionalDependencies="dsound.lib"
785 - LinkIncremental="2"
786 + AdditionalDependencies="LIBIOMP5MT.lib"
787 + LinkIncremental="1"
788 GenerateDebugInformation="true"
791 + OptimizeReferences="2"
792 + EnableCOMDATFolding="2"
801 + RelativePath=".\unicode_support.cpp"
805 RelativePath=".\valdec.cpp"
808 diff --git a/valib/lib/valib.vcproj b/valib/lib/valib.vcproj
809 index a30826e..3b04d9f 100644
810 --- a/valib/lib/valib.vcproj
811 +++ b/valib/lib/valib.vcproj
813 <?xml version="1.0" encoding="windows-1251"?>
815 ProjectType="Visual C++"
819 ProjectGUID="{30FCD216-1CAD-48FD-BF4B-337572F7EC9C}"
820 RootNamespace="valib"
821 @@ -164,12 +164,15 @@
823 Name="VCCLCompilerTool"
825 + InlineFunctionExpansion="2"
826 EnableIntrinsicFunctions="true"
827 + FavorSizeOrSpeed="1"
828 PreprocessorDefinitions="NDEBUG"
830 EnableFunctionLevelLinking="true"
831 + EnableEnhancedInstructionSet="0"
833 - DebugInformationFormat="3"
834 + DebugInformationFormat="0"
837 Name="VCManagedResourceCompilerTool"
840 RelativePath="..\valib\sink\sink_dshow.cpp"
843 + Name="Release|Win32"
844 + ExcludedFromBuild="true"
847 + Name="VCCLCompilerTool"
849 + </FileConfiguration>
852 RelativePath="..\valib\sink\sink_dshow.h"
857 + RelativePath="..\valib\sink\sink_stdout.h"
861 RelativePath="..\valib\sink\sink_wav.cpp"
864 diff --git a/valib/valib/auto_file.cpp b/valib/valib/auto_file.cpp
865 index 235ad1d..8d99c91 100644
866 --- a/valib/valib/auto_file.cpp
867 +++ b/valib/valib/auto_file.cpp
870 #include "auto_file.h"
871 +#include "..\..\tools\unicode_support.h"
873 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
875 @@ -40,7 +41,7 @@ AutoFile::open(const char *filename, const char *mode)
879 - f = fopen(filename, mode);
880 + f = fopen_utf8(filename, mode);
883 if (portable_seek(f, 0, SEEK_END) == 0)
884 diff --git a/valib/valib/sink/sink_dsound.cpp b/valib/valib/sink/sink_dsound.cpp
885 index 542d31f..c5aa132 100644
886 --- a/valib/valib/sink/sink_dsound.cpp
887 +++ b/valib/valib/sink/sink_dsound.cpp
888 @@ -47,8 +47,8 @@ DSoundSink::open_dsound(HWND _hwnd, int _buf_size_ms, int _preload_ms, LPCGUID _
892 - if FAILED(DirectSoundCreate(_device, &ds, 0))
894 + //if FAILED(DirectSoundCreate(_device, &ds, 0))
897 if (!_hwnd) _hwnd = GetForegroundWindow();
898 if (!_hwnd) _hwnd = GetDesktopWindow();
899 diff --git a/valib/valib/sink/sink_stdout.h b/valib/valib/sink/sink_stdout.h
901 index 0000000..3112531
903 +++ b/valib/valib/sink/sink_stdout.h
906 + RAW file output audio renderer
909 +#ifndef VALIB_SINK_STDOUT_H
910 +#define VALIB_SINK_STDOUT_H
913 +#include "auto_file.h"
915 +class StdOutSink : public Sink
924 + h(GetStdHandle(STD_OUTPUT_HANDLE))
927 + StdOutSink(const char *_filename):
928 + h(GetStdHandle(STD_OUTPUT_HANDLE))
931 + StdOutSink(FILE *_f):
932 + h(GetStdHandle(STD_OUTPUT_HANDLE))
935 + /////////////////////////////////////////////////////////
936 + // RAWSink interface
938 + bool open(const char *_filename)
940 + return true; //f.open(_filename, "wb");
943 + bool open(FILE *_f)
945 + return true; //f.open(_f);
954 + bool is_open() const
956 + return ((h != INVALID_HANDLE_VALUE) && (h != 0)); //f.is_open();
959 + /////////////////////////////////////////////////////////
962 + virtual bool query_input(Speakers _spk) const
964 + // cannot write linear format
965 + return /*f.is_open() &&*/ _spk.format != FORMAT_LINEAR;
968 + virtual bool set_input(Speakers _spk)
970 + if (!query_input(_spk))
977 + virtual Speakers get_input() const
983 + virtual bool process(const Chunk *_chunk)
985 + if (_chunk->is_dummy())
988 + if (spk != _chunk->spk)
989 + if (!set_input(_chunk->spk))
992 + DWORD bytesWritten = 0;
993 + return WriteFile(h, _chunk->rawdata, _chunk->size, &bytesWritten, NULL); //f.write(_chunk->rawdata, _chunk->size) == _chunk->size;