Updated FAAD decoder to v2.7 from CVS in order to include latest libFAAD fixes (2016-11-11).

This commit is contained in:
LoRd_MuldeR 2017-03-26 17:27:08 +02:00
parent 010e88965c
commit f5e0cefc9b
14 changed files with 678 additions and 24 deletions

View File

@ -411,7 +411,8 @@ copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\i
<ClCompile Include="tmp\LameXP\QRC_Tools.avs2wav.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.dcaenc.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.elevator.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.faad.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.faad-i386.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.faad-sse2.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.flac-x64-avx.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.flac-x64-sse2.cpp" />
<ClCompile Include="tmp\LameXP\QRC_Tools.flac-x86-i386.cpp" />
@ -1281,18 +1282,6 @@ copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\i
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="res\Tools.faad.qrc">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="res\Tools.flac-x64-avx.qrc">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
@ -1833,6 +1822,30 @@ copy /Y "$(SolutionDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\i
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="res\Tools.faad-i386.qrc">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="res\Tools.faad-sse2.qrc">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp" -no-compress -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LameXP.rc">

View File

@ -415,9 +415,6 @@
<ClCompile Include="tmp\LameXP\QRC_Tools.elevator.cpp">
<Filter>Generated Files\QRC</Filter>
</ClCompile>
<ClCompile Include="tmp\LameXP\QRC_Tools.faad.cpp">
<Filter>Generated Files\QRC</Filter>
</ClCompile>
<ClCompile Include="tmp\LameXP\QRC_Tools.flac-x64-avx.cpp">
<Filter>Generated Files\QRC</Filter>
</ClCompile>
@ -553,6 +550,12 @@
<ClCompile Include="tmp\LameXP\QRC_Tools.wvunpack-x64.cpp">
<Filter>Generated Files\QRC</Filter>
</ClCompile>
<ClCompile Include="tmp\LameXP\QRC_Tools.faad-i386.cpp">
<Filter>Generated Files\QRC</Filter>
</ClCompile>
<ClCompile Include="tmp\LameXP\QRC_Tools.faad-sse2.cpp">
<Filter>Generated Files\QRC</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Config.h">
@ -902,9 +905,6 @@
<CustomBuild Include="res\Tools.elevator.qrc">
<Filter>Resources</Filter>
</CustomBuild>
<CustomBuild Include="res\Tools.faad.qrc">
<Filter>Resources</Filter>
</CustomBuild>
<CustomBuild Include="res\Tools.flac-x64-avx.qrc">
<Filter>Resources</Filter>
</CustomBuild>
@ -1043,6 +1043,12 @@
<None Include="res\MainIcon.ico">
<Filter>Miscellaneous</Filter>
</None>
<None Include="res\Tools.faad-i386.qrc">
<Filter>Resources</Filter>
</None>
<None Include="res\Tools.faad-sse2.qrc">
<Filter>Resources</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,7 @@ LameXP Audio-Encoder Front-End &ndash; Changelog
* Some improvements for "high DPI" screens: Adjust initial window size according to DPI setting
* Updated Opus encoder/decoder libraries to v1.2-alpha2 (2017-03-03) and Opus-Tools to v0.1.10 (2017-02-22)
* Updated MediaInfo to v0.7.93 (2017-02-28), compiled with ICL 17.0 and MSVC 12.0
* Updated FAAD decoder to v2.7 from CVS in order to include latest libFAAD fixes (2016-11-11)
## LameXP v4.14 [2016-11-19] ## {-}

View File

@ -0,0 +1,631 @@
frontend/audio.c | 11 +++++-
frontend/faad.sln | 16 ++++----
frontend/main.c | 89 ++++++++++++++++++++++++++++++++---------
frontend/unicode_support.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++
frontend/unicode_support.h | 21 ++++++++++
include/neaacdec.h | 6 +--
libfaad/common.h | 4 +-
libfaad/decoder.c | 6 +--
libfaad/lt_predict.c | 2 +-
libfaad/output.c | 36 ++++++++---------
10 files changed, 233 insertions(+), 56 deletions(-)
diff --git a/frontend/audio.c b/frontend/audio.c
index 9ab7a2a..20f92a2 100644
--- a/frontend/audio.c
+++ b/frontend/audio.c
@@ -39,11 +39,14 @@
#include <stdint.h>
#include "audio.h"
+#include "unicode_support.h"
audio_file *open_audio_file(char *infile, int samplerate, int channels,
int outputFormat, int fileType, long channelMask)
{
+ wchar_t *fileNameW;
+
audio_file *aufile = malloc(sizeof(audio_file));
aufile->outputFormat = outputFormat;
@@ -80,7 +83,13 @@ audio_file *open_audio_file(char *infile, int samplerate, int channels,
aufile->toStdio = 1;
} else {
aufile->toStdio = 0;
- aufile->sndfile = fopen(infile, "wb");
+ aufile->sndfile = NULL;
+ fileNameW = utf8_to_utf16(infile);
+ if(fileNameW)
+ {
+ aufile->sndfile = _wfopen(fileNameW, L"wb");
+ free(fileNameW);
+ }
}
if (aufile->sndfile == NULL)
diff --git a/frontend/faad.sln b/frontend/faad.sln
index a47200b..ddbea6d 100644
--- a/frontend/faad.sln
+++ b/frontend/faad.sln
@@ -1,15 +1,13 @@

-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faad", "faad.vcproj", "{2BD8CBB3-DFC9-4A6A-9B7A-07ED749BED58}"
- ProjectSection(ProjectDependencies) = postProject
- {F470BB4A-7675-4D6A-B310-41F33AC6F987} = {F470BB4A-7675-4D6A-B310-41F33AC6F987}
- {BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114} = {BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}
- EndProjectSection
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "faad", "faad.vcxproj", "{2BD8CBB3-DFC9-4A6A-9B7A-07ED749BED58}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\libfaad\libfaad.vcproj", "{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\libfaad\libfaad.vcxproj", "{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4ff", "..\common\mp4ff\mp4ff.vcproj", "{F470BB4A-7675-4D6A-B310-41F33AC6F987}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4ff", "..\common\mp4ff\mp4ff.vcxproj", "{F470BB4A-7675-4D6A-B310-41F33AC6F987}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/frontend/main.c b/frontend/main.c
index f943d9d..e4294d0 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -44,11 +44,13 @@
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
+#include <io.h>
#include <neaacdec.h>
#include <mp4ff.h>
#include "audio.h"
+#include "unicode_support.h"
#ifndef min
#define min(a,b) ( (a) < (b) ? (a) : (b) )
@@ -71,6 +73,8 @@ static void faad_fprintf(FILE *stream, const char *fmt, ...)
vfprintf(stream, fmt, ap);
va_end(ap);
+
+ fflush(stream);
}
}
@@ -450,7 +454,7 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
NeAACDecFrameInfo frameInfo;
NeAACDecConfigurationPtr config;
- char percents[200];
+ char percents[300];
int percent, old_percent = -1;
int bread, fileread;
int header_type = 0;
@@ -463,11 +467,19 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
aac_buffer b;
+ wchar_t *fileNameW;
+
memset(&b, 0, sizeof(aac_buffer));
if (adts_out)
{
- adtsFile = fopen(adts_fn, "wb");
+ adtsFile = NULL;
+ fileNameW = utf8_to_utf16(adts_fn);
+ if(fileNameW)
+ {
+ adtsFile = _wfopen(fileNameW, L"wb");
+ free(fileNameW);
+ }
if (adtsFile == NULL)
{
faad_fprintf(stderr, "Error opening file: %s\n", adts_fn);
@@ -477,20 +489,26 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
if (0 == strcmp(aacfile, "-"))
{
- b.infile = stdin;
+ b.infile = stdin;
#ifdef _WIN32
setmode(fileno(stdin), O_BINARY);
#endif
-
- } else
+ }
+ else
{
- b.infile = fopen(aacfile, "rb");
- if (b.infile == NULL)
- {
- /* unable to open file */
- faad_fprintf(stderr, "Error opening file: %s\n", aacfile);
- return 1;
- }
+ b.infile = NULL;
+ fileNameW = utf8_to_utf16(aacfile);
+ if(fileNameW)
+ {
+ b.infile = _wfopen(fileNameW, L"rb");
+ free(fileNameW);
+ }
+ if (b.infile == NULL)
+ {
+ /* unable to open file */
+ faad_fprintf(stderr, "Error opening file: %s\n", aacfile);
+ return 1;
+ }
}
retval = fseek(b.infile, 0, SEEK_END);
@@ -715,7 +733,7 @@ static int decodeAACfile(char *aacfile, char *sndfile, char *adts_fn, int to_std
if (percent > old_percent)
{
old_percent = percent;
- sprintf(percents, "%d%% decoding %s.", percent, aacfile);
+ _snprintf_s(percents, 300, _TRUNCATE, "[%d%%] decoding %s.", percent, aacfile);
faad_fprintf(stderr, "%s\r", percents);
#ifdef _WIN32
SetConsoleTitle(percents);
@@ -817,7 +835,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
unsigned char *buffer;
int buffer_size;
- char percents[200];
+ char percents[300];
int percent, old_percent = -1;
int first_time = 1;
@@ -828,6 +846,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
unsigned int framesize;
unsigned long timescale;
+ wchar_t *fileNameW;
/* initialise the callback structure */
mp4ff_callback_t *mp4cb = malloc(sizeof(mp4ff_callback_t));
@@ -837,7 +856,14 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
return 1;
}
- mp4File = fopen(mp4file, "rb");
+ mp4File = NULL;
+ fileNameW = utf8_to_utf16(mp4file);
+ if(fileNameW)
+ {
+ mp4File = _wfopen(fileNameW, L"rb");
+ free(fileNameW);
+ }
+
mp4cb->read = read_callback;
mp4cb->seek = seek_callback;
mp4cb->user_data = mp4File;
@@ -854,7 +880,13 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
if (adts_out)
{
- adtsFile = fopen(adts_fn, "wb");
+ adtsFile = NULL;
+ fileNameW = utf8_to_utf16(adts_fn);
+ if(fileNameW)
+ {
+ adtsFile = _wfopen(fileNameW, L"wb");
+ free(fileNameW);
+ }
if (adtsFile == NULL)
{
faad_fprintf(stderr, "Error opening file: %s\n", adts_fn);
@@ -1060,7 +1092,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
if (percent > old_percent)
{
old_percent = percent;
- sprintf(percents, "%d%% decoding %s.", percent, mp4file);
+ _snprintf_s(percents, 300, _TRUNCATE, "[%d%%] decoding %s.", percent, mp4file);
faad_fprintf(stderr, "%s\r", percents);
#ifdef _WIN32
SetConsoleTitle(percents);
@@ -1098,7 +1130,7 @@ static int decodeMP4file(char *mp4file, char *sndfile, char *adts_fn, int to_std
return frameInfo.error;
}
-int main(int argc, char *argv[])
+int faad_main(int argc, char *argv[])
{
int result;
int infoOnly = 0;
@@ -1122,6 +1154,7 @@ int main(int argc, char *argv[])
unsigned char header[8];
float length = 0;
FILE *hMP4File;
+ wchar_t *fileNameW;
/* System dependant types */
#ifdef _WIN32
@@ -1352,7 +1385,13 @@ int main(int argc, char *argv[])
} else {
mp4file = 0;
- hMP4File = fopen(aacFileName, "rb");
+ hMP4File = NULL;
+ fileNameW = utf8_to_utf16(aacFileName);
+ if(fileNameW)
+ {
+ hMP4File = _wfopen(fileNameW, L"rb");
+ free(fileNameW);
+ }
if (!hMP4File)
{
faad_fprintf(stderr, "Error opening file: %s\n", aacFileName);
@@ -1415,3 +1454,15 @@ int main(int argc, char *argv[])
return 0;
}
+
+int wmain(int argc, wchar_t **argv_utf16)
+{
+ int result = 0;
+ char **argv_utf8 = NULL;
+
+ init_commandline_arguments_utf8(argc, &argv_utf8, argv_utf16);
+ result = faad_main(argc, argv_utf8);
+ free_commandline_arguments_utf8(argc, &argv_utf8);
+
+ return result;
+}
diff --git a/frontend/unicode_support.c b/frontend/unicode_support.c
new file mode 100644
index 0000000..21ecd5c
--- /dev/null
+++ b/frontend/unicode_support.c
@@ -0,0 +1,98 @@
+#include "unicode_support.h"
+
+#include <stdio.h>
+#include <windows.h>
+
+char *utf16_to_utf8(const wchar_t *input)
+{
+ char *Buffer;
+ int BuffSize, Result;
+
+ BuffSize = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
+ Buffer = (char*) malloc(sizeof(char) * BuffSize);
+
+ if(!Buffer)
+ {
+ fprintf(stderr, "Error in utf16_to_utf8: Memory allocation failed!\n");
+ return NULL;
+ }
+
+ Result = WideCharToMultiByte(CP_UTF8, 0, input, -1, Buffer, BuffSize, NULL, NULL);
+ return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
+}
+
+wchar_t *utf8_to_utf16(const char *input)
+{
+ wchar_t *Buffer;
+ int BuffSize, Result;
+
+ BuffSize = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);
+ Buffer = (wchar_t*) malloc(sizeof(wchar_t) * BuffSize);
+
+ if(!Buffer)
+ {
+ fprintf(stderr, "Error in utf8_to_utf16: Memory allocation failed!\n");
+ return NULL;
+ }
+
+ Result = MultiByteToWideChar(CP_UTF8, 0, input, -1, Buffer, BuffSize);
+ return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
+}
+
+void init_commandline_arguments_utf8(int argc, char ***argv_utf8, wchar_t **argv_utf16)
+{
+ int i = 0;
+
+ *argv_utf8 = (char**) malloc(argc * sizeof(char*));
+ if(!(*argv_utf8))
+ {
+ fprintf(stderr, "Error in init_commandline_arguments_utf8: Memory allocation failed!\n");
+ exit(-1);
+ }
+
+ for(i = 0; i < argc; i++)
+ {
+ (*argv_utf8)[i] = utf16_to_utf8(argv_utf16[i]);
+ if(!(*argv_utf8)[i])
+ {
+ fprintf(stderr, "Error in init_commandline_arguments_utf8: Memory allocation failed!\n");
+ exit(-1);
+ }
+ }
+}
+
+void free_commandline_arguments_utf8(int argc, char ***argv_utf8)
+{
+ int i = 0;
+
+ if(*argv_utf8 != NULL)
+ {
+ for(i = 0; i < argc; i++)
+ {
+ if((*argv_utf8)[i] != NULL)
+ {
+ free((*argv_utf8)[i]);
+ (*argv_utf8)[i] = NULL;
+ }
+ }
+ free(*argv_utf8);
+ *argv_utf8 = NULL;
+ }
+}
+
+FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8)
+{
+ FILE *ret = NULL;
+ wchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);
+ wchar_t *mode_utf16 = utf8_to_utf16(mode_utf8);
+
+ if(filename_utf16 && mode_utf16)
+ {
+ ret = _wfopen(filename_utf16, mode_utf16);
+ }
+
+ if(filename_utf16) free(filename_utf16);
+ if(mode_utf16) free(mode_utf16);
+
+ return ret;
+}
diff --git a/frontend/unicode_support.h b/frontend/unicode_support.h
new file mode 100644
index 0000000..cc13fd9
--- /dev/null
+++ b/frontend/unicode_support.h
@@ -0,0 +1,21 @@
+#ifndef UNICODE_SUPPORT_H_INCLUDED
+#define UNICODE_SUPPORT_H_INCLUDED
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *utf16_to_utf8(const wchar_t *input);
+wchar_t *utf8_to_utf16(const char *input);
+void init_commandline_arguments_utf8(int argc, char ***argv_utf8, wchar_t **argv_utf16);
+void free_commandline_arguments_utf8(int argc, char ***argv_utf8);
+FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/include/neaacdec.h b/include/neaacdec.h
index 610a00b..7904175 100644
--- a/include/neaacdec.h
+++ b/include/neaacdec.h
@@ -202,7 +202,7 @@ typedef struct NeAACDecFrameInfo
unsigned char ps;
} NeAACDecFrameInfo;
-char NEAACDECAPI *NeAACDecGetErrorMessage(unsigned char errcode);
+char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
@@ -235,12 +235,12 @@ void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
-void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hDecoder,
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size);
-void NEAACDECAPI *NeAACDecDecode2(NeAACDecHandle hDecoder,
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
diff --git a/libfaad/common.h b/libfaad/common.h
index 897a0f0..74f4a56 100644
--- a/libfaad/common.h
+++ b/libfaad/common.h
@@ -316,7 +316,7 @@ char *strchr(), *strrchr();
#if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
#ifndef HAVE_LRINTF
#define HAS_LRINTF
- static INLINE int lrintf(float f)
+ static INLINE int FAAD_lrintf(float f)
{
int i;
__asm
@@ -332,7 +332,7 @@ char *strchr(), *strrchr();
#ifndef HAVE_LRINTF
#define HAS_LRINTF
// from http://www.stereopsis.com/FPU.html
- static INLINE int lrintf(float f)
+ static INLINE int FAAD_lrintf(float f)
{
int i;
__asm__ __volatile__ (
diff --git a/libfaad/decoder.c b/libfaad/decoder.c
index 42bbc84..67feb9d 100644
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -64,7 +64,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder,
NeAACDecFrameInfo *hInfo);
-char NEAACDECAPI *NeAACDecGetErrorMessage(unsigned char errcode)
+char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode)
{
if (errcode >= NUM_ERROR_MESSAGES)
return NULL;
@@ -790,7 +790,7 @@ static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *h
}
}
-void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hpDecoder,
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hpDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size)
@@ -799,7 +799,7 @@ void NEAACDECAPI *NeAACDecDecode(NeAACDecHandle hpDecoder,
return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0);
}
-void NEAACDECAPI *NeAACDecDecode2(NeAACDecHandle hpDecoder,
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
diff --git a/libfaad/lt_predict.c b/libfaad/lt_predict.c
index 2be18ae..aa02fb0 100644
--- a/libfaad/lt_predict.c
+++ b/libfaad/lt_predict.c
@@ -166,7 +166,7 @@ static INLINE int16_t real_to_int16(real_t sig_in)
return -32768;
}
- return lrintf(sig_in);
+ return FAAD_lrintf(sig_in);
}
#endif
diff --git a/libfaad/output.c b/libfaad/output.c
index 4245627..1aeb747 100644
--- a/libfaad/output.c
+++ b/libfaad/output.c
@@ -103,7 +103,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
CLIP(inp, 32767.0f, -32768.0f);
- (*sample_buffer)[i] = (int16_t)lrintf(inp);
+ (*sample_buffer)[i] = (int16_t)FAAD_lrintf(inp);
}
break;
case CONV(2,0):
@@ -116,8 +116,8 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
CLIP(inp0, 32767.0f, -32768.0f);
- (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
- (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+0] = (int16_t)FAAD_lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int16_t)FAAD_lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
@@ -130,8 +130,8 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
CLIP(inp0, 32767.0f, -32768.0f);
CLIP(inp1, 32767.0f, -32768.0f);
- (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
- (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+ (*sample_buffer)[(i*2)+0] = (int16_t)FAAD_lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int16_t)FAAD_lrintf(inp1);
}
}
break;
@@ -144,7 +144,7 @@ static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
CLIP(inp, 32767.0f, -32768.0f);
- (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp);
+ (*sample_buffer)[(i*channels)+ch] = (int16_t)FAAD_lrintf(inp);
}
}
break;
@@ -169,7 +169,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
inp *= 256.0f;
CLIP(inp, 8388607.0f, -8388608.0f);
- (*sample_buffer)[i] = (int32_t)lrintf(inp);
+ (*sample_buffer)[i] = (int32_t)FAAD_lrintf(inp);
}
break;
case CONV(2,0):
@@ -183,8 +183,8 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
inp0 *= 256.0f;
CLIP(inp0, 8388607.0f, -8388608.0f);
- (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
- (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
@@ -199,8 +199,8 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
CLIP(inp0, 8388607.0f, -8388608.0f);
CLIP(inp1, 8388607.0f, -8388608.0f);
- (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
- (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+ (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp1);
}
}
break;
@@ -214,7 +214,7 @@ static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
inp *= 256.0f;
CLIP(inp, 8388607.0f, -8388608.0f);
- (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+ (*sample_buffer)[(i*channels)+ch] = (int32_t)FAAD_lrintf(inp);
}
}
break;
@@ -239,7 +239,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
inp *= 65536.0f;
CLIP(inp, 2147483647.0f, -2147483648.0f);
- (*sample_buffer)[i] = (int32_t)lrintf(inp);
+ (*sample_buffer)[i] = (int32_t)FAAD_lrintf(inp);
}
break;
case CONV(2,0):
@@ -253,8 +253,8 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
inp0 *= 65536.0f;
CLIP(inp0, 2147483647.0f, -2147483648.0f);
- (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
- (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
@@ -269,8 +269,8 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
CLIP(inp0, 2147483647.0f, -2147483648.0f);
CLIP(inp1, 2147483647.0f, -2147483648.0f);
- (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
- (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+ (*sample_buffer)[(i*2)+0] = (int32_t)FAAD_lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)FAAD_lrintf(inp1);
}
}
break;
@@ -284,7 +284,7 @@ static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
inp *= 65536.0f;
CLIP(inp, 2147483647.0f, -2147483648.0f);
- (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+ (*sample_buffer)[(i*channels)+ch] = (int32_t)FAAD_lrintf(inp);
}
}
break;

2
res/Tools.faad-i386.qrc Normal file
View File

@ -0,0 +1,2 @@
<!DOCTYPE RCC>
<RCC version="1.0"><qresource><file>tools/faad.i386.exe</file></qresource></RCC>

2
res/Tools.faad-sse2.qrc Normal file
View File

@ -0,0 +1,2 @@
<!DOCTYPE RCC>
<RCC version="1.0"><qresource><file>tools/faad.sse2.exe</file></qresource></RCC>

View File

@ -1,2 +0,0 @@
<!DOCTYPE RCC>
<RCC version="1.0"><qresource><file>tools/faad.exe</file></qresource></RCC>

Binary file not shown.

BIN
res/tools/faad.i386.exe Normal file

Binary file not shown.

BIN
res/tools/faad.sse2.exe Normal file

Binary file not shown.

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 5
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 1958
#define VER_LAMEXP_BUILD 1960
#define VER_LAMEXP_CONFG 1934
///////////////////////////////////////////////////////////////////////////////

View File

@ -71,7 +71,8 @@ g_lamexp_tools[] =
{"4558728999a05f12fe88566e8308cba0ada200814c2a1bfe2507f49faf8f3994b0d52a829148f5c6321d24faa2718439", CPU_TYPE_ALL_ALL, "avs2wav.exe", 13, ""},
{"07834b1b8ecac2f3db79ad048005eca3a284cb759e15d399eb1a560a403122e20db5f08e60319759b8463aeef2410d02", CPU_TYPE_ALL_ALL, "dcaenc.exe", 20120419, ""},
{"7c249f507b96967bedabdd7e631638807a7595ebff58eaaadf63530783d515eda9660bc2b1a0457fddae7e3eaef8a074", CPU_TYPE_ALL_ALL, "elevator.exe", UINT_MAX, ""},
{"bbc262cfe9c48633e5f1780d30347d7663075cfd7bdc76347cce3b1191d62f788d9b91bc63dffae2f66d1759d5849e92", CPU_TYPE_ALL_ALL, "faad.exe", 27, ""},
{"5c4a5cdd708b5857bcb064558be81a2dfb16401e796b296f6eee7c63042acbeae12e1e2f1f3d0fd096eaf73201b54e10", CPU_TYPE_ALL_GEN, "faad.i386.exe", 27, ""},
{"72447794cf411e1e4ce71facf5f60023f001d203894cf40185a0ee13e144e93d72ac99f2ed30a9168450ce5bf882f99f", CPU_TYPE_ALL_SSX, "faad.sse2.exe", 27, ""},
{"16146a44fc5de63b1fbe4f2ba0b063acb243af2dbb5ea4ec1556669a026400bec5ef176689d5eb2ac03d9daf6053d39d", CPU_TYPE_X86_GEN, "flac.x86-i386.exe", 131, ""},
{"4ffb7341498b18cc826407b3511598b65b612150eeb87fad328ed9cb0b0857b07b9e6a0977c2bd377360db709fb87eee", CPU_TYPE_X86_SSX, "flac.x86-sse2.exe", 131, ""},
{"d609529d82368c22c11cc1f3a9285d7cfab84568f45ccebd1bf94b3669acc15ee93220d39f23d38943fcbb9df85708a2", CPU_TYPE_X64_NVX, "flac.x64-sse2.exe", 131, ""},