shithub: aacdec

Download patch

ref: 01d7657d7b3b3e010299e773d9d048b0c3132d65
parent: 5e500e977f018a9b61ea4624d61b3fcb774aad0f
parent: ce72f5808b085c0c3525cc8869c42e9503184b77
author: Krzysztof Nikiel <[email protected]>
date: Sun Dec 17 12:15:41 EST 2017

Merge pull request #5 from lordmulder/master

MSVC build fix

diff: cannot open b/utils/win32//null: file does not exist: 'b/utils/win32//null' diff: cannot open b/utils//null: file does not exist: 'b/utils//null'
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@
 project/msvc/.vs/
 project/msvc/bin/
 project/msvc/intermediate/
+libfaad/win32_ver.h
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -1349,7 +1349,7 @@
 
 int main(int argc, char *argv[])
 {
-#ifdef _WIN32
+#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
 	int argc_utf8, exit_code;
 	char **argv_utf8;
 	init_console_utf8(stderr);
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -53,6 +53,10 @@
 uint16_t dbg_count;
 #endif
 
+#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
+#include "win32_ver.h"
+#endif
+
 /* static function declarations */
 static void* aac_frame_decode(NeAACDecStruct *hDecoder,
                               NeAACDecFrameInfo *hInfo,
--- a/project/msvc/aacinfo.vcxproj
+++ b/project/msvc/aacinfo.vcxproj
@@ -12,7 +12,7 @@
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{FE985E4D-79DB-4DD3-BFED-824B4677A161}</ProjectGuid>
-    <WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@@ -59,7 +59,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_DEBUG;WIN32;_CONSOLE;TEST;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;WIN32;_CONSOLE;TEST;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <PrecompiledHeader />
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <PreprocessorDefinitions>NDEBUG;WIN32;_CONSOLE;TEST;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;WIN32;_CONSOLE;TEST;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
--- a/project/msvc/faad.vcxproj
+++ b/project/msvc/faad.vcxproj
@@ -59,7 +59,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>../../include;../../common/mp4ff;../../frontend;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <PrecompiledHeader />
@@ -85,7 +85,7 @@
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <AdditionalIncludeDirectories>../../include;../../common/mp4ff;../../frontend;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -104,14 +104,13 @@
     <ClCompile Include="..\..\frontend\audio.c" />
     <ClCompile Include="..\..\frontend\main.c" />
     <ClCompile Include="..\..\frontend\mp4read.c" />
+    <ClCompile Include="..\..\frontend\unicode_support.c" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\frontend\getopt.h" />
-    <ClInclude Include="..\..\common\mp4v2\mp4.h" />
-    <ClInclude Include="..\..\common\mp4v2\mpeg4ip.h" />
-    <ClInclude Include="..\..\common\mp4v2\systems.h" />
     <ClInclude Include="..\..\common\mp4v2\win32_ver.h" />
     <ClInclude Include="..\..\frontend\mp4read.h" />
+    <ClInclude Include="..\..\frontend\unicode_support.h" />
     <ClInclude Include="..\..\include\neaacdec.h" />
     <ClInclude Include="..\..\frontend\audio.h" />
   </ItemGroup>
--- a/project/msvc/faad.vcxproj.filters
+++ b/project/msvc/faad.vcxproj.filters
@@ -20,6 +20,9 @@
     <ClCompile Include="..\..\frontend\mp4read.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\frontend\unicode_support.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\frontend\audio.h">
@@ -28,22 +31,16 @@
     <ClInclude Include="..\..\frontend\getopt.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\common\mp4v2\mp4.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\common\mp4v2\mpeg4ip.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\include\neaacdec.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\common\mp4v2\systems.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\common\mp4v2\win32_ver.h">
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="..\..\frontend\mp4read.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\frontend\unicode_support.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>
--- a/project/msvc/libfaad.vcxproj
+++ b/project/msvc/libfaad.vcxproj
@@ -55,7 +55,7 @@
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>NDEBUG;WIN32;_LIB;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;WIN32;_LIB;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
@@ -67,12 +67,18 @@
       <Culture>0x0413</Culture>
     </ResourceCompile>
     <Lib />
+    <PreBuildEvent>
+      <Command>"$(SolutionDir)..\..\utils\win32\ac2ver.exe" "faad2" "$(SolutionDir)..\..\configure.ac" &gt; "$(SolutionDir)..\..\libfaad\win32_ver.h"</Command>
+    </PreBuildEvent>
+    <PreBuildEvent>
+      <Message>Retrieving package version...</Message>
+    </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_DEBUG;WIN32;_LIB;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;WIN32;_LIB;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <PrecompiledHeader />
@@ -84,6 +90,12 @@
       <Culture>0x0413</Culture>
     </ResourceCompile>
     <Lib />
+    <PreBuildEvent>
+      <Command>"$(SolutionDir)..\..\utils\win32\ac2ver.exe" "faad2" "$(SolutionDir)..\..\configure.ac" &gt; "$(SolutionDir)..\..\libfaad\win32_ver.h"</Command>
+    </PreBuildEvent>
+    <PreBuildEvent>
+      <Message>Retrieving package version...</Message>
+    </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\..\libfaad\bits.c" />
--- a/project/msvc/libfaad2_dll.vcxproj
+++ b/project/msvc/libfaad2_dll.vcxproj
@@ -63,7 +63,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <PrecompiledHeader />
@@ -92,7 +92,7 @@
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_LRINTF;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
--- /dev/null
+++ b/utils/win32/ac2ver.c
@@ -1,0 +1,103 @@
+/*
+** AC2VER - extract version number from AC_INIT macro (configure.ac)
+** Copyright (C) 2017 LoRd_MuldeR <[email protected]>
+**  
+** This software is released under the CC0 1.0 Universal [CC0 1.0] licence!
+** https://creativecommons.org/publicdomain/zero/1.0/legalcode
+**/
+
+#define BUFF_SIZE 4096
+#define _CRT_SECURE_NO_WARNINGS 1
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+static int clean_string(char *const str)
+{
+	size_t i = 0, j = 0;
+	while(str[i])
+	{
+		if(isalnum(str[i]) || strchr("._-", str[i]))
+		{
+			if(i != j)
+			{
+				str[j] = str[i];
+			}
+			++j;
+		}
+		++i;
+	}
+	str[j] = '\0';
+	return !!j;
+}
+
+static int parse_version(FILE *const input, const char *const format, char *const version)
+{
+	char buffer[BUFF_SIZE];
+
+	while(!(feof(input) || ferror(input)))
+	{
+		const char *line = fgets(buffer, BUFF_SIZE, input);
+		if(line)
+		{
+			while((*line) && (isspace(*line)))
+			{
+				++line; /*skip space*/
+			}
+			if(sscanf(line, format, version) == 1)
+			{
+				if(clean_string(version))
+				{
+					return 1; /*found!*/
+				}
+			}
+		}
+	}
+
+	version[0] = '\0';
+	return 0;
+}
+
+static int get_version(const wchar_t *const lib_name, const wchar_t *const file_name)
+{
+	char format[128], version[BUFF_SIZE];
+
+	FILE *const input = _wfopen(file_name, L"r");
+	if(!input)
+	{
+		fprintf(stderr, "Error: Failed to open input file!\n%S\n\n", file_name);
+		return 0;
+	}
+
+	_snprintf(format, 128, "AC_INIT ( %S , %%s", lib_name);
+	//printf("<%s>\n", format);
+
+	if(parse_version(input, format, version))
+	{
+		printf("#define PACKAGE_VERSION \"%s\"\n", version);
+		fclose(input);
+		return 1;
+	}
+	else
+	{
+		fprintf(stderr, "Error: Version string could not be found!\n\n");
+		fclose(input);
+		return 0;
+	}
+}
+
+int wmain(int argc, wchar_t* argv[])
+{
+	if((argc != 3) || (!argv[1][0]) || (!argv[2][0]))
+	{
+		wchar_t file_name[_MAX_FNAME], file_ext[_MAX_EXT];
+		_wsplitpath(argv[0], NULL, NULL, file_name, file_ext);
+		fprintf(stderr, "AC2VER [%s]\n\n", __DATE__);
+		fprintf(stderr, "Usage: %S%S <lib_name> <path/to/configure.ac>\n\n", file_name, file_ext);
+		return EXIT_FAILURE;
+	}
+
+	return get_version(argv[1], argv[2]) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
binary files /dev/null b/utils/win32/ac2ver.exe differ