Updated German translation. Includes suggestions by "tablerocker" <tablerocker@web...
[LameXP.git] / etc / Patches / deprecated / AC3Filter-valdec-v0.31b-UTF8+STDOUT+Flush.V1.diff
blob800f02f497cfea5ab0db380f1bea7cd10645c20a
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
13 new file mode 100644
14 index 0000000..13f89ba
15 --- /dev/null
16 +++ b/tools/unicode_support.cpp
17 @@ -0,0 +1,86 @@
18 +#include "unicode_support.h"
20 +#include <windows.h>
22 +char *utf16_to_utf8(const wchar_t *input)
24 + char *Buffer;
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)
36 + wchar_t *Buffer;
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)
48 + int i, nArgs;
49 + LPWSTR *szArglist;
51 + szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
53 + if(NULL == szArglist)
54 + {
55 + fprintf(stderr, "\nFATAL: CommandLineToArgvW failed\n\n");
56 + exit(-1);
57 + }
59 + *argv = new char*[nArgs]; //malloc(sizeof(char*) * nArgs);
60 + *argc = nArgs;
62 + for(i = 0; i < nArgs; i++)
63 + {
64 + (*argv)[i] = utf16_to_utf8(szArglist[i]);
65 + }
67 + LocalFree(szArglist);
70 +void free_commandline_arguments_utf8(int *argc, char ***argv)
72 + if(*argv != NULL)
73 + {
74 + for(int i = 0; i < *argc; i++)
75 + {
76 + if((*argv)[i] != NULL)
77 + {
78 + delete [] ((*argv)[i]);
79 + (*argv)[i] = NULL;
80 + }
81 + }
82 + delete [] (*argv);
83 + *argv = NULL;
84 + }
87 +FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8)
89 + FILE *ret = NULL;
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)
95 + {
96 + ret = _wfopen(filename_utf16, mode_utf16);
97 + }
99 + if(filename_utf16) delete [] filename_utf16;
100 + if(mode_utf16) delete [] mode_utf16;
102 + return ret;
104 diff --git a/tools/unicode_support.h b/tools/unicode_support.h
105 new file mode 100644
106 index 0000000..9ad3173
107 --- /dev/null
108 +++ b/tools/unicode_support.h
109 @@ -0,0 +1,21 @@
110 +#ifndef UNICODE_SUPPORT_H_INCLUDED
111 +#define UNICODE_SUPPORT_H_INCLUDED
113 +#include <ctype.h>
114 +#include <stdio.h>
115 +#include <stdlib.h>
117 +#ifdef __cplusplus
118 +extern "C" {
119 +#endif
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);
127 +#ifdef __cplusplus
129 +#endif
130 +#endif
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
135 @@ -15,6 +15,7 @@
136 #include "sink\sink_raw.h"
137 #include "sink\sink_wav.h"
138 #include "sink\sink_dsound.h"
139 +#include "sink\sink_stdout.h"
141 // filters
142 #include "filters\dvd_graph.h"
143 @@ -22,6 +23,7 @@
144 // other
145 #include "win32\cpu.h"
146 #include "vargs.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[])
158 if (argc < 2)
160 @@ -77,6 +79,7 @@ int main(int argc, char *argv[])
161 "\n"
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"
165 "\n"
166 "Usage:\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"
173 " \n"
174 " output options:\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 /////////////////////////////////////////////////////////
178 // Sinks
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;
184 RAWSink raw;
185 WAVSink wav;
186 DSoundSink dsound;
187 + StdOutSink stdsnk;
188 NullSink null;
190 Sink *sink = 0;
191 @@ -216,7 +221,7 @@ int main(int argc, char *argv[])
193 if (parser)
195 - printf("-ac3 : ambigous parser\n");
196 + fprintf(stderr, "-ac3 : ambigous parser\n");
197 return 1;
200 @@ -229,7 +234,7 @@ int main(int argc, char *argv[])
202 if (parser)
204 - printf("-dts : ambigous parser\n");
205 + fprintf(stderr, "-dts : ambigous parser\n");
206 return 1;
209 @@ -242,7 +247,7 @@ int main(int argc, char *argv[])
211 if (parser)
213 - printf("-mpa : ambigous parser\n");
214 + fprintf(stderr, "-mpa : ambigous parser\n");
215 return 1;
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");
224 return 1;
226 continue;
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");
233 return 1;
235 continue;
236 @@ -296,7 +301,7 @@ int main(int argc, char *argv[])
238 if (sink)
240 - printf("-decode : ambigous output mode\n");
241 + fprintf(stderr, "-decode : ambigous output mode\n");
242 return 1;
245 @@ -312,7 +317,7 @@ int main(int argc, char *argv[])
247 if (sink)
249 - printf("-play : ambigous output mode\n");
250 + fprintf(stderr, "-play : ambigous output mode\n");
251 return 1;
254 @@ -328,12 +333,12 @@ int main(int argc, char *argv[])
256 if (sink)
258 - printf("-raw : ambigous output mode\n");
259 + fprintf(stderr, "-raw : ambigous output mode\n");
260 return 1;
262 if (argc - iarg < 1)
264 - printf("-raw : specify a file name\n");
265 + fprintf(stderr, "-raw : specify a file name\n");
266 return 1;
269 @@ -343,19 +348,40 @@ int main(int argc, char *argv[])
270 mode = mode_raw;
271 continue;
274 + // -s[td] - RAW output to STDOUT
275 + if (is_arg(argv[iarg], "s", argt_exist) ||
276 + is_arg(argv[iarg], "std", argt_exist))
278 + if (sink)
280 + fprintf(stderr, "-std : ambigous output mode\n");
281 + return 1;
283 + if (argc - iarg < 1)
285 + fprintf(stderr, "-std : specify a file name\n");
286 + return 1;
289 + //out_filename = argv[++iarg];
290 + sink = &stdsnk;
291 + control = 0;
292 + mode = mode_stdout;
293 + continue;
295 // -w[av] - WAV output
296 if (is_arg(argv[iarg], "w", argt_exist) ||
297 is_arg(argv[iarg], "wav", argt_exist))
299 if (sink)
301 - printf("-wav : ambigous output mode\n");
302 + fprintf(stderr, "-wav : ambigous output mode\n");
303 return 1;
305 if (argc - iarg < 1)
307 - printf("-wav : specify a file name\n");
308 + fprintf(stderr, "-wav : specify a file name\n");
309 return 1;
312 @@ -372,7 +398,7 @@ int main(int argc, char *argv[])
314 if (sink)
316 - printf("-nothing : ambigous output mode\n");
317 + fprintf(stderr, "-nothing : ambigous output mode\n");
318 return 1;
321 @@ -614,7 +640,7 @@ int main(int argc, char *argv[])
322 continue;
325 - printf("Error: unknown option: %s\n", argv[iarg]);
326 + fprintf(stderr, "Error: unknown option: %s\n", argv[iarg]);
327 return 1;
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);
336 return 1;
339 if (!file.stats())
341 - printf("Error: Cannot detect input file format\n", input_filename);
342 + fprintf(stderr, "Error: Cannot detect input file format\n", input_filename);
343 return 1;
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");
352 return 1;
355 @@ -655,9 +681,9 @@ int main(int argc, char *argv[])
357 char info[1024];
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);
374 return 1;
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);
383 return 1;
385 @@ -718,10 +744,18 @@ int main(int argc, char *argv[])
387 switch (mode)
389 + case mode_stdout:
390 + if (!stdsnk.is_open())
392 + fprintf(stderr, "Error: failed to open standard output handle.\n");
393 + return 1;
395 + break;
397 case mode_raw:
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);
402 return 1;
404 break;
405 @@ -729,7 +763,7 @@ int main(int argc, char *argv[])
406 case mode_wav:
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);
411 return 1;
413 break;
414 @@ -737,7 +771,7 @@ int main(int argc, char *argv[])
415 case mode_play:
416 if (!dsound.open_dsound(0))
418 - printf("Error: failed to init DirectSound\n");
419 + fprintf(stderr, "Error: failed to init DirectSound\n");
420 return 1;
422 break;
423 @@ -765,27 +799,28 @@ int main(int argc, char *argv[])
425 int streams = 0;
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");
430 file.seek(0);
432 - #define PRINT_STAT \
433 - { \
434 - if (control) \
435 - { \
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]; \
441 - } \
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 \
450 + { \
451 + if (control) \
452 + { \
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]; \
458 + } \
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); \
466 + fflush(stderr); \
469 #define DROP_STAT \
470 @@ -811,7 +846,7 @@ int main(int argc, char *argv[])
472 char info[1024];
473 file.stream_info(info, sizeof(info));
474 - printf("\n\n%s", info);
475 + fprintf(stderr, "\n\n%s", info);
478 streams++;
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");
485 return 1;
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");
494 return 1;
497 @@ -847,12 +882,12 @@ int main(int argc, char *argv[])
498 if (sink->query_input(chunk.spk))
500 DROP_STAT;
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);
505 else
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);
510 return 1;
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");
518 return 1;
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");
527 return 1;
530 @@ -907,13 +942,13 @@ int main(int argc, char *argv[])
531 // Final statistics
533 PRINT_STAT;
534 - printf("\n---------------------------------------\n");
535 + fprintf(stderr, "\n---------------------------------------\n");
536 if (streams > 1)
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++)
563 - printf("*");
564 - printf("\n");
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]);
574 - printf("\n");
575 - printf("------------------------------------------------------------------------------\n");
576 + fprintf(stderr, "%.4f;", hist[i]);
577 + fprintf(stderr, "\n");
578 + fprintf(stderr, "------------------------------------------------------------------------------\n");
581 return 0;
584 +int main(int argc, char *argv[])
586 + int argc_utf8;
587 + char **argv_utf8;
588 + int exit_code;
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);
594 + return exit_code;
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
600 @@ -1,12 +1,12 @@
601 
602 Microsoft Visual Studio Solution File, Format Version 10.00
603 # Visual Studio 2008
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}
609 EndProjectSection
610 EndProject
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}"
613 EndProject
614 Global
615 GlobalSection(SolutionConfigurationPlatforms) = preSolution
616 @@ -16,22 +16,38 @@ Global
617 Release|x64 = Release|x64
618 EndGlobalSection
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
666 EndGlobalSection
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
673 @@ -1,7 +1,7 @@
674 <?xml version="1.0" encoding="windows-1251"?>
675 <VisualStudioProject
676 ProjectType="Visual C++"
677 - Version="9.00"
678 + Version="9,00"
679 Name="valdec"
680 ProjectGUID="{871889DF-6EF7-461F-AC1B-7DA682CB79A0}"
681 RootNamespace="valdec"
682 @@ -93,12 +93,11 @@
684 </Configuration>
685 <Configuration
686 - Name="Release|Win32"
687 - OutputDirectory="$(SolutionDir)$(ConfigurationName)"
688 - IntermediateDirectory="$(ConfigurationName)\$(ProjectName)"
689 + Name="Debug|x64"
690 + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
691 + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
692 ConfigurationType="1"
693 CharacterSet="1"
694 - WholeProgramOptimization="1"
696 <Tool
697 Name="VCPreBuildEventTool"
698 @@ -114,15 +113,16 @@
700 <Tool
701 Name="VCMIDLTool"
702 + TargetEnvironment="3"
704 <Tool
705 Name="VCCLCompilerTool"
706 - Optimization="2"
707 - EnableIntrinsicFunctions="true"
708 + Optimization="0"
709 AdditionalIncludeDirectories="..\valib\valib"
710 - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
711 - RuntimeLibrary="0"
712 - EnableFunctionLevelLinking="true"
713 + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
714 + MinimalRebuild="true"
715 + BasicRuntimeChecks="3"
716 + RuntimeLibrary="1"
717 UsePrecompiledHeader="0"
718 WarningLevel="3"
719 DebugInformationFormat="3"
720 @@ -139,12 +139,10 @@
721 <Tool
722 Name="VCLinkerTool"
723 AdditionalDependencies="dsound.lib"
724 - LinkIncremental="1"
725 + LinkIncremental="2"
726 GenerateDebugInformation="true"
727 SubSystem="1"
728 - OptimizeReferences="2"
729 - EnableCOMDATFolding="2"
730 - TargetMachine="1"
731 + TargetMachine="17"
733 <Tool
734 Name="VCALinkTool"
735 @@ -169,11 +167,12 @@
737 </Configuration>
738 <Configuration
739 - Name="Debug|x64"
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"
746 CharacterSet="1"
747 + WholeProgramOptimization="1"
749 <Tool
750 Name="VCPreBuildEventTool"
751 @@ -189,19 +188,21 @@
753 <Tool
754 Name="VCMIDLTool"
755 - TargetEnvironment="3"
757 <Tool
758 Name="VCCLCompilerTool"
759 - Optimization="0"
760 + Optimization="2"
761 + InlineFunctionExpansion="2"
762 + EnableIntrinsicFunctions="true"
763 + FavorSizeOrSpeed="1"
764 AdditionalIncludeDirectories="..\valib\valib"
765 - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
766 - MinimalRebuild="true"
767 - BasicRuntimeChecks="3"
768 - RuntimeLibrary="1"
769 + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
770 + RuntimeLibrary="0"
771 + EnableFunctionLevelLinking="true"
772 + EnableEnhancedInstructionSet="0"
773 UsePrecompiledHeader="0"
774 WarningLevel="3"
775 - DebugInformationFormat="3"
776 + DebugInformationFormat="0"
778 <Tool
779 Name="VCManagedResourceCompilerTool"
780 @@ -214,11 +215,13 @@
782 <Tool
783 Name="VCLinkerTool"
784 - AdditionalDependencies="dsound.lib"
785 - LinkIncremental="2"
786 + AdditionalDependencies="LIBIOMP5MT.lib"
787 + LinkIncremental="1"
788 GenerateDebugInformation="true"
789 SubSystem="1"
790 - TargetMachine="17"
791 + OptimizeReferences="2"
792 + EnableCOMDATFolding="2"
793 + TargetMachine="1"
795 <Tool
796 Name="VCALinkTool"
797 @@ -324,6 +327,10 @@
798 </References>
799 <Files>
800 <File
801 + RelativePath=".\unicode_support.cpp"
803 + </File>
804 + <File
805 RelativePath=".\valdec.cpp"
807 </File>
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
812 @@ -1,7 +1,7 @@
813 <?xml version="1.0" encoding="windows-1251"?>
814 <VisualStudioProject
815 ProjectType="Visual C++"
816 - Version="9.00"
817 + Version="9,00"
818 Name="valib"
819 ProjectGUID="{30FCD216-1CAD-48FD-BF4B-337572F7EC9C}"
820 RootNamespace="valib"
821 @@ -164,12 +164,15 @@
822 <Tool
823 Name="VCCLCompilerTool"
824 Optimization="2"
825 + InlineFunctionExpansion="2"
826 EnableIntrinsicFunctions="true"
827 + FavorSizeOrSpeed="1"
828 PreprocessorDefinitions="NDEBUG"
829 RuntimeLibrary="0"
830 EnableFunctionLevelLinking="true"
831 + EnableEnhancedInstructionSet="0"
832 WarningLevel="3"
833 - DebugInformationFormat="3"
834 + DebugInformationFormat="0"
836 <Tool
837 Name="VCManagedResourceCompilerTool"
838 @@ -939,6 +942,14 @@
839 <File
840 RelativePath="..\valib\sink\sink_dshow.cpp"
842 + <FileConfiguration
843 + Name="Release|Win32"
844 + ExcludedFromBuild="true"
846 + <Tool
847 + Name="VCCLCompilerTool"
848 + />
849 + </FileConfiguration>
850 </File>
851 <File
852 RelativePath="..\valib\sink\sink_dshow.h"
853 @@ -957,6 +968,10 @@
855 </File>
856 <File
857 + RelativePath="..\valib\sink\sink_stdout.h"
859 + </File>
860 + <File
861 RelativePath="..\valib\sink\sink_wav.cpp"
863 </File>
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
868 @@ -1,5 +1,6 @@
869 #include <limits.h>
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)
877 if (f) close();
878 filesize = max_size;
879 - f = fopen(filename, mode);
880 + f = fopen_utf8(filename, mode);
881 if (f)
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 _
890 // Open DirectSound
892 - if FAILED(DirectSoundCreate(_device, &ds, 0))
893 - return false;
894 + //if FAILED(DirectSoundCreate(_device, &ds, 0))
895 + return false;
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
900 new file mode 100644
901 index 0000000..3112531
902 --- /dev/null
903 +++ b/valib/valib/sink/sink_stdout.h
904 @@ -0,0 +1,93 @@
906 + RAW file output audio renderer
909 +#ifndef VALIB_SINK_STDOUT_H
910 +#define VALIB_SINK_STDOUT_H
912 +#include "filter.h"
913 +#include "auto_file.h"
915 +class StdOutSink : public Sink
917 +protected:
918 + Speakers spk;
919 + HANDLE h;
920 + //AutoFile f;
922 +public:
923 + StdOutSink():
924 + h(GetStdHandle(STD_OUTPUT_HANDLE))
925 + {}
927 + StdOutSink(const char *_filename):
928 + h(GetStdHandle(STD_OUTPUT_HANDLE))
929 + {}
931 + StdOutSink(FILE *_f):
932 + h(GetStdHandle(STD_OUTPUT_HANDLE))
933 + {}
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);
948 + void close()
950 + //f.close();
951 + spk = spk_unknown;
954 + bool is_open() const
956 + return ((h != INVALID_HANDLE_VALUE) && (h != 0)); //f.is_open();
959 + /////////////////////////////////////////////////////////
960 + // Sink interface
962 + virtual bool query_input(Speakers _spk) const
963 + {
964 + // cannot write linear format
965 + return /*f.is_open() &&*/ _spk.format != FORMAT_LINEAR;
968 + virtual bool set_input(Speakers _spk)
969 + {
970 + if (!query_input(_spk))
971 + return false;
973 + spk = _spk;
974 + return true;
977 + virtual Speakers get_input() const
979 + return spk;
982 + // data write
983 + virtual bool process(const Chunk *_chunk)
985 + if (_chunk->is_dummy())
986 + return true;
988 + if (spk != _chunk->spk)
989 + if (!set_input(_chunk->spk))
990 + return false;
992 + DWORD bytesWritten = 0;
993 + return WriteFile(h, _chunk->rawdata, _chunk->size, &bytesWritten, NULL); //f.write(_chunk->rawdata, _chunk->size) == _chunk->size;
997 +#endif