Merge remote-tracking branch 'upstream/master' into ea-mpf

# Conflicts:
#	src/meta/ea_schl.c
This commit is contained in:
NicknineTheEagle 2019-11-15 22:36:29 +03:00
commit b4cc120e4c
31 changed files with 9543 additions and 8973 deletions

View File

@ -1,204 +1,204 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="test"
ProjectGUID="{AF7D88A0-3CB1-4CD8-BAD1-0305EB996D69}"
RootNamespace="test"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(SolutionDir)version.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\ext_libs\Getopt;..\ext_includes"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
ForcedIncludeFiles="$(SolutionDir)VERSION.H"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libg719_decode.lib libg7221_decode.lib libmpg123-0.lib libvorbis.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="..\ext_libs"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(SolutionDir)version.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\ext_libs\Getopt;..\ext_includes"
PreprocessorDefinitions="WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_G7221;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)VERSION.H"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libg719_decode.lib libg7221_decode.lib libmpg123-0.lib libvorbis.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="..\ext_libs"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\vgmstream_cli.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="test"
ProjectGUID="{AF7D88A0-3CB1-4CD8-BAD1-0305EB996D69}"
RootNamespace="test"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(SolutionDir)version.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\ext_libs\Getopt;..\ext_includes"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
ForcedIncludeFiles="$(SolutionDir)VERSION.H"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libg719_decode.lib libg7221_decode.lib libmpg123-0.lib libvorbis.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="..\ext_libs"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(SolutionDir)version.bat"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\ext_libs\Getopt;..\ext_includes"
PreprocessorDefinitions="WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_G7221;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)VERSION.H"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libg719_decode.lib libg7221_decode.lib libmpg123-0.lib libvorbis.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="..\ext_libs"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\vgmstream_cli.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,148 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Template|Win32">
<Configuration>Template</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{AF7D88A0-3CB1-4CD8-BAD1-0305EB996D69}</ProjectGuid>
<RootNamespace>test</RootNamespace>
<Keyword>Win32Proj</Keyword>
<SccProjectName>
</SccProjectName>
<SccAuxPath>
</SccAuxPath>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<TargetName>test</TargetName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<DependenciesDir>../dependencies</DependenciesDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;NDEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="vgmstream_cli.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>
<ProjectReference Include="..\ext_libs\Getopt\getopt.vcxproj">
<Project>{330b53ae-4fae-46da-8785-9016db4e3e23}</Project>
</ProjectReference>
<ProjectReference Include="..\src\libvgmstream.vcxproj">
<Project>{54a6ad11-5369-4895-a06f-e255abb99b11}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Template|Win32">
<Configuration>Template</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{AF7D88A0-3CB1-4CD8-BAD1-0305EB996D69}</ProjectGuid>
<RootNamespace>test</RootNamespace>
<Keyword>Win32Proj</Keyword>
<SccProjectName>
</SccProjectName>
<SccAuxPath>
</SccAuxPath>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<TargetName>test</TargetName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<DependenciesDir>../dependencies</DependenciesDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;../ext_libs/Getopt;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;NDEBUG;_WINDOWS;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="vgmstream_cli.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>
<ProjectReference Include="..\ext_libs\Getopt\getopt.vcxproj">
<Project>{330b53ae-4fae-46da-8785-9016db4e3e23}</Project>
</ProjectReference>
<ProjectReference Include="..\src\libvgmstream.vcxproj">
<Project>{54a6ad11-5369-4895-a06f-e255abb99b11}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="vgmstream_cli.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="vgmstream_cli.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">

View File

@ -1,47 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="foo_vgmstream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="foo_prefs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="foo_filetypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="foo_input_vgmstream.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="foo_prefs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="foo_streamfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="foo_vgmstream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="foo_vgmstream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="foo_prefs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="foo_filetypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="foo_input_vgmstream.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="foo_prefs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="foo_streamfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="foo_vgmstream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,278 +1,278 @@
#include "coding.h"
#ifdef VGM_USE_ATRAC9
#include "libatrac9.h"
/* opaque struct */
struct atrac9_codec_data {
uint8_t *data_buffer;
size_t data_buffer_size;
sample_t *sample_buffer;
size_t samples_filled; /* number of samples in the buffer */
size_t samples_used; /* number of samples extracted from the buffer */
int samples_to_discard;
atrac9_config config;
void *handle; /* decoder handle */
Atrac9CodecInfo info; /* decoder info */
};
atrac9_codec_data *init_atrac9(atrac9_config *cfg) {
int status;
uint8_t config_data[4];
atrac9_codec_data *data = NULL;
data = calloc(1, sizeof(atrac9_codec_data));
if (!data) goto fail;
data->handle = Atrac9GetHandle();
if (!data->handle) goto fail;
put_32bitBE(config_data, cfg->config_data);
status = Atrac9InitDecoder(data->handle, config_data);
if (status < 0) goto fail;
status = Atrac9GetCodecInfo(data->handle, &data->info);
if (status < 0) goto fail;
//;VGM_LOG("ATRAC9: config=%x, sf-size=%x, sub-frames=%i x %i samples\n", cfg->config_data, data->info.superframeSize, data->info.framesInSuperframe, data->info.frameSamples);
if (cfg->channels && cfg->channels != data->info.channels) {
VGM_LOG("ATRAC9: channels in header %i vs config %i don't match\n", cfg->channels, data->info.channels);
goto fail; /* unknown multichannel layout */
}
/* must hold at least one superframe and its samples */
data->data_buffer_size = data->info.superframeSize;
/* extra leeway as Atrac9Decode seems to overread ~2 bytes (doesn't affect decoding though) */
data->data_buffer = calloc(sizeof(uint8_t), data->data_buffer_size + 0x10);
/* while ATRAC9 uses float internally, Sony's API only return PCM16 */
data->sample_buffer = calloc(sizeof(sample_t), data->info.channels * data->info.frameSamples * data->info.framesInSuperframe);
data->samples_to_discard = cfg->encoder_delay;
memcpy(&data->config, cfg, sizeof(atrac9_config));
return data;
fail:
free_atrac9(data);
return NULL;
}
void decode_atrac9(VGMSTREAM *vgmstream, sample_t * outbuf, int32_t samples_to_do, int channels) {
VGMSTREAMCHANNEL *stream = &vgmstream->ch[0];
atrac9_codec_data * data = vgmstream->codec_data;
int samples_done = 0;
while (samples_done < samples_to_do) {
if (data->samples_filled) { /* consume samples */
int samples_to_get = data->samples_filled;
if (data->samples_to_discard) {
/* discard samples for looping */
if (samples_to_get > data->samples_to_discard)
samples_to_get = data->samples_to_discard;
data->samples_to_discard -= samples_to_get;
}
else {
/* get max samples and copy */
if (samples_to_get > samples_to_do - samples_done)
samples_to_get = samples_to_do - samples_done;
memcpy(outbuf + samples_done*channels,
data->sample_buffer + data->samples_used*channels,
samples_to_get*channels * sizeof(sample));
samples_done += samples_to_get;
}
/* mark consumed samples */
data->samples_used += samples_to_get;
data->samples_filled -= samples_to_get;
}
else { /* decode data */
int iframe, status;
int bytes_used = 0;
uint8_t *buffer = data->data_buffer;
size_t bytes;
data->samples_used = 0;
/* ATRAC9 is made of decodable superframes with several sub-frames. AT9 config data gives
* superframe size, number of frames and samples (~100-200 bytes and ~256/1024 samples). */
/* read one raw block (superframe) and advance offsets */
bytes = read_streamfile(data->data_buffer,stream->offset, data->info.superframeSize,stream->streamfile);
if (bytes != data->data_buffer_size) goto decode_fail;
stream->offset += bytes;
/* decode all frames in the superframe block */
for (iframe = 0; iframe < data->info.framesInSuperframe; iframe++) {
status = Atrac9Decode(data->handle, buffer, data->sample_buffer + data->samples_filled*channels, &bytes_used);
if (status < 0) goto decode_fail;
buffer += bytes_used;
data->samples_filled += data->info.frameSamples;
}
}
}
return;
decode_fail:
/* on error just put some 0 samples */
VGM_LOG("ATRAC9: decode fail at %x, missing %i samples\n", (uint32_t)stream->offset, (samples_to_do - samples_done));
memset(outbuf + samples_done * channels, 0, (samples_to_do - samples_done) * sizeof(sample) * channels);
}
void reset_atrac9(VGMSTREAM *vgmstream) {
atrac9_codec_data *data = vgmstream->codec_data;
if (!data) return;
if (!data->handle)
goto fail;
#if 0
/* reopen/flush, not needed as superframes decode separatedly and there is no carried state */
{
int status;
uint8_t config_data[4];
Atrac9ReleaseHandle(data->handle);
data->handle = Atrac9GetHandle();
if (!data->handle) goto fail;
put_32bitBE(config_data, data->config.config_data);
status = Atrac9InitDecoder(data->handle, config_data);
if (status < 0) goto fail;
}
#endif
data->samples_used = 0;
data->samples_filled = 0;
data->samples_to_discard = data->config.encoder_delay;
return;
fail:
return; /* decode calls should fail... */
}
void seek_atrac9(VGMSTREAM *vgmstream, int32_t num_sample) {
atrac9_codec_data *data = vgmstream->codec_data;
if (!data) return;
reset_atrac9(vgmstream);
/* find closest offset to desired sample, and samples to discard after that offset to reach loop */
{
int32_t seek_sample = data->config.encoder_delay + num_sample;
off_t seek_offset;
int32_t seek_discard;
int32_t superframe_samples = data->info.frameSamples * data->info.framesInSuperframe;
size_t superframe_number, superframe_back;
superframe_number = (seek_sample / superframe_samples); /* closest */
/* decoded frames affect each other slightly, so move offset back to make PCM stable
* and equivalent to a full discard loop */
superframe_back = 1; /* 1 seems enough (even when only 1 subframe in superframe) */
if (superframe_back > superframe_number)
superframe_back = superframe_number;
seek_discard = (seek_sample % superframe_samples) + (superframe_back * superframe_samples);
seek_offset = (superframe_number - superframe_back) * data->info.superframeSize;
data->samples_to_discard = seek_discard; /* already includes encoder delay */
if (vgmstream->loop_ch)
vgmstream->loop_ch[0].offset = vgmstream->loop_ch[0].channel_start_offset + seek_offset;
}
#if 0
//old full discard loop
{
data->samples_to_discard = num_sample;
data->samples_to_discard += data->config.encoder_delay;
/* loop offsets are set during decode; force them to stream start so discard works */
if (vgmstream->loop_ch)
vgmstream->loop_ch[0].offset = vgmstream->loop_ch[0].channel_start_offset;
}
#endif
}
void free_atrac9(atrac9_codec_data *data) {
if (!data) return;
if (data->handle) Atrac9ReleaseHandle(data->handle);
free(data->data_buffer);
free(data->sample_buffer);
free(data);
}
static int atrac9_parse_config(uint32_t atrac9_config, int *out_sample_rate, int *out_channels, size_t *out_frame_size, size_t *out_samples_per_frame) {
static const int sample_rate_table[16] = {
11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000,
44100, 48000, 64000, 88200, 96000,128000,176400,192000
};
static const int samples_power_table[16] = {
6, 6, 7, 7, 7, 8, 8, 8,
6, 6, 7, 7, 7, 8, 8, 8
};
static const int channel_table[8] = {
1, 2, 2, 6, 8, 4, 0, 0
};
int superframe_size, frames_per_superframe, samples_per_frame, samples_per_superframe;
uint32_t sync = (atrac9_config >> 24) & 0xff; /* 8b */
uint8_t sample_rate_index = (atrac9_config >> 20) & 0x0f; /* 4b */
uint8_t channels_index = (atrac9_config >> 17) & 0x07; /* 3b */
/* uint8_t validation bit = (atrac9_config >> 16) & 0x01; */ /* 1b */
size_t frame_size = (atrac9_config >> 5) & 0x7FF; /* 11b */
size_t superframe_index = (atrac9_config >> 3) & 0x3; /* 2b */
/* uint8_t unused = (atrac9_config >> 0) & 0x7);*/ /* 3b */
superframe_size = ((frame_size+1) << superframe_index);
frames_per_superframe = (1 << superframe_index);
samples_per_frame = 1 << samples_power_table[sample_rate_index];
samples_per_superframe = samples_per_frame * frames_per_superframe;
if (sync != 0xFE)
goto fail;
if (out_sample_rate)
*out_sample_rate = sample_rate_table[sample_rate_index];
if (out_channels)
*out_channels = channel_table[channels_index];
if (out_frame_size)
*out_frame_size = superframe_size;
if (out_samples_per_frame)
*out_samples_per_frame = samples_per_superframe;
return 1;
fail:
return 0;
}
size_t atrac9_bytes_to_samples(size_t bytes, atrac9_codec_data *data) {
return bytes / data->info.superframeSize * (data->info.frameSamples * data->info.framesInSuperframe);
}
size_t atrac9_bytes_to_samples_cfg(size_t bytes, uint32_t atrac9_config) {
size_t frame_size, samples_per_frame;
if (!atrac9_parse_config(atrac9_config, NULL, NULL, &frame_size, &samples_per_frame))
return 0;
return bytes / frame_size * samples_per_frame;
}
#endif
#include "coding.h"
#ifdef VGM_USE_ATRAC9
#include "libatrac9.h"
/* opaque struct */
struct atrac9_codec_data {
uint8_t *data_buffer;
size_t data_buffer_size;
sample_t *sample_buffer;
size_t samples_filled; /* number of samples in the buffer */
size_t samples_used; /* number of samples extracted from the buffer */
int samples_to_discard;
atrac9_config config;
void *handle; /* decoder handle */
Atrac9CodecInfo info; /* decoder info */
};
atrac9_codec_data *init_atrac9(atrac9_config *cfg) {
int status;
uint8_t config_data[4];
atrac9_codec_data *data = NULL;
data = calloc(1, sizeof(atrac9_codec_data));
if (!data) goto fail;
data->handle = Atrac9GetHandle();
if (!data->handle) goto fail;
put_32bitBE(config_data, cfg->config_data);
status = Atrac9InitDecoder(data->handle, config_data);
if (status < 0) goto fail;
status = Atrac9GetCodecInfo(data->handle, &data->info);
if (status < 0) goto fail;
//;VGM_LOG("ATRAC9: config=%x, sf-size=%x, sub-frames=%i x %i samples\n", cfg->config_data, data->info.superframeSize, data->info.framesInSuperframe, data->info.frameSamples);
if (cfg->channels && cfg->channels != data->info.channels) {
VGM_LOG("ATRAC9: channels in header %i vs config %i don't match\n", cfg->channels, data->info.channels);
goto fail; /* unknown multichannel layout */
}
/* must hold at least one superframe and its samples */
data->data_buffer_size = data->info.superframeSize;
/* extra leeway as Atrac9Decode seems to overread ~2 bytes (doesn't affect decoding though) */
data->data_buffer = calloc(sizeof(uint8_t), data->data_buffer_size + 0x10);
/* while ATRAC9 uses float internally, Sony's API only return PCM16 */
data->sample_buffer = calloc(sizeof(sample_t), data->info.channels * data->info.frameSamples * data->info.framesInSuperframe);
data->samples_to_discard = cfg->encoder_delay;
memcpy(&data->config, cfg, sizeof(atrac9_config));
return data;
fail:
free_atrac9(data);
return NULL;
}
void decode_atrac9(VGMSTREAM *vgmstream, sample_t * outbuf, int32_t samples_to_do, int channels) {
VGMSTREAMCHANNEL *stream = &vgmstream->ch[0];
atrac9_codec_data * data = vgmstream->codec_data;
int samples_done = 0;
while (samples_done < samples_to_do) {
if (data->samples_filled) { /* consume samples */
int samples_to_get = data->samples_filled;
if (data->samples_to_discard) {
/* discard samples for looping */
if (samples_to_get > data->samples_to_discard)
samples_to_get = data->samples_to_discard;
data->samples_to_discard -= samples_to_get;
}
else {
/* get max samples and copy */
if (samples_to_get > samples_to_do - samples_done)
samples_to_get = samples_to_do - samples_done;
memcpy(outbuf + samples_done*channels,
data->sample_buffer + data->samples_used*channels,
samples_to_get*channels * sizeof(sample));
samples_done += samples_to_get;
}
/* mark consumed samples */
data->samples_used += samples_to_get;
data->samples_filled -= samples_to_get;
}
else { /* decode data */
int iframe, status;
int bytes_used = 0;
uint8_t *buffer = data->data_buffer;
size_t bytes;
data->samples_used = 0;
/* ATRAC9 is made of decodable superframes with several sub-frames. AT9 config data gives
* superframe size, number of frames and samples (~100-200 bytes and ~256/1024 samples). */
/* read one raw block (superframe) and advance offsets */
bytes = read_streamfile(data->data_buffer,stream->offset, data->info.superframeSize,stream->streamfile);
if (bytes != data->data_buffer_size) goto decode_fail;
stream->offset += bytes;
/* decode all frames in the superframe block */
for (iframe = 0; iframe < data->info.framesInSuperframe; iframe++) {
status = Atrac9Decode(data->handle, buffer, data->sample_buffer + data->samples_filled*channels, &bytes_used);
if (status < 0) goto decode_fail;
buffer += bytes_used;
data->samples_filled += data->info.frameSamples;
}
}
}
return;
decode_fail:
/* on error just put some 0 samples */
VGM_LOG("ATRAC9: decode fail at %x, missing %i samples\n", (uint32_t)stream->offset, (samples_to_do - samples_done));
memset(outbuf + samples_done * channels, 0, (samples_to_do - samples_done) * sizeof(sample) * channels);
}
void reset_atrac9(VGMSTREAM *vgmstream) {
atrac9_codec_data *data = vgmstream->codec_data;
if (!data) return;
if (!data->handle)
goto fail;
#if 0
/* reopen/flush, not needed as superframes decode separatedly and there is no carried state */
{
int status;
uint8_t config_data[4];
Atrac9ReleaseHandle(data->handle);
data->handle = Atrac9GetHandle();
if (!data->handle) goto fail;
put_32bitBE(config_data, data->config.config_data);
status = Atrac9InitDecoder(data->handle, config_data);
if (status < 0) goto fail;
}
#endif
data->samples_used = 0;
data->samples_filled = 0;
data->samples_to_discard = data->config.encoder_delay;
return;
fail:
return; /* decode calls should fail... */
}
void seek_atrac9(VGMSTREAM *vgmstream, int32_t num_sample) {
atrac9_codec_data *data = vgmstream->codec_data;
if (!data) return;
reset_atrac9(vgmstream);
/* find closest offset to desired sample, and samples to discard after that offset to reach loop */
{
int32_t seek_sample = data->config.encoder_delay + num_sample;
off_t seek_offset;
int32_t seek_discard;
int32_t superframe_samples = data->info.frameSamples * data->info.framesInSuperframe;
size_t superframe_number, superframe_back;
superframe_number = (seek_sample / superframe_samples); /* closest */
/* decoded frames affect each other slightly, so move offset back to make PCM stable
* and equivalent to a full discard loop */
superframe_back = 1; /* 1 seems enough (even when only 1 subframe in superframe) */
if (superframe_back > superframe_number)
superframe_back = superframe_number;
seek_discard = (seek_sample % superframe_samples) + (superframe_back * superframe_samples);
seek_offset = (superframe_number - superframe_back) * data->info.superframeSize;
data->samples_to_discard = seek_discard; /* already includes encoder delay */
if (vgmstream->loop_ch)
vgmstream->loop_ch[0].offset = vgmstream->loop_ch[0].channel_start_offset + seek_offset;
}
#if 0
//old full discard loop
{
data->samples_to_discard = num_sample;
data->samples_to_discard += data->config.encoder_delay;
/* loop offsets are set during decode; force them to stream start so discard works */
if (vgmstream->loop_ch)
vgmstream->loop_ch[0].offset = vgmstream->loop_ch[0].channel_start_offset;
}
#endif
}
void free_atrac9(atrac9_codec_data *data) {
if (!data) return;
if (data->handle) Atrac9ReleaseHandle(data->handle);
free(data->data_buffer);
free(data->sample_buffer);
free(data);
}
static int atrac9_parse_config(uint32_t atrac9_config, int *out_sample_rate, int *out_channels, size_t *out_frame_size, size_t *out_samples_per_frame) {
static const int sample_rate_table[16] = {
11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000,
44100, 48000, 64000, 88200, 96000,128000,176400,192000
};
static const int samples_power_table[16] = {
6, 6, 7, 7, 7, 8, 8, 8,
6, 6, 7, 7, 7, 8, 8, 8
};
static const int channel_table[8] = {
1, 2, 2, 6, 8, 4, 0, 0
};
int superframe_size, frames_per_superframe, samples_per_frame, samples_per_superframe;
uint32_t sync = (atrac9_config >> 24) & 0xff; /* 8b */
uint8_t sample_rate_index = (atrac9_config >> 20) & 0x0f; /* 4b */
uint8_t channels_index = (atrac9_config >> 17) & 0x07; /* 3b */
/* uint8_t validation bit = (atrac9_config >> 16) & 0x01; */ /* 1b */
size_t frame_size = (atrac9_config >> 5) & 0x7FF; /* 11b */
size_t superframe_index = (atrac9_config >> 3) & 0x3; /* 2b */
/* uint8_t unused = (atrac9_config >> 0) & 0x7);*/ /* 3b */
superframe_size = ((frame_size+1) << superframe_index);
frames_per_superframe = (1 << superframe_index);
samples_per_frame = 1 << samples_power_table[sample_rate_index];
samples_per_superframe = samples_per_frame * frames_per_superframe;
if (sync != 0xFE)
goto fail;
if (out_sample_rate)
*out_sample_rate = sample_rate_table[sample_rate_index];
if (out_channels)
*out_channels = channel_table[channels_index];
if (out_frame_size)
*out_frame_size = superframe_size;
if (out_samples_per_frame)
*out_samples_per_frame = samples_per_superframe;
return 1;
fail:
return 0;
}
size_t atrac9_bytes_to_samples(size_t bytes, atrac9_codec_data *data) {
return bytes / data->info.superframeSize * (data->info.frameSamples * data->info.framesInSuperframe);
}
size_t atrac9_bytes_to_samples_cfg(size_t bytes, uint32_t atrac9_config) {
size_t frame_size, samples_per_frame;
if (!atrac9_parse_config(atrac9_config, NULL, NULL, &frame_size, &samples_per_frame))
return 0;
return bytes / frame_size * samples_per_frame;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,114 +1,114 @@
#include "mpeg_decoder.h"
#ifdef VGM_USE_MPEG
#define MPEG_AHX_EXPECTED_FRAME_SIZE 0x414
static int ahx_decrypt_type08(uint8_t * buffer, mpeg_custom_config *config);
/* writes data to the buffer and moves offsets, transforming AHX frames as needed */
int mpeg_custom_parse_frame_ahx(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream) {
mpeg_custom_stream *ms = data->streams[num_stream];
size_t current_data_size = 0;
size_t file_size = get_streamfile_size(stream->streamfile);
/* AHX has a 0xFFF5E0C0 header with frame size 0x414 (160kbps, 22050Hz) but they actually are much shorter */
/* read supposed frame size first (to minimize reads) */
ms->bytes_in_buffer = read_streamfile(ms->buffer, stream->offset, MPEG_AHX_EXPECTED_FRAME_SIZE, stream->streamfile);
/* find actual frame size by looking for the next frame header */
{
uint32_t current_header = get_u32be(ms->buffer);
int next_pos = 0x04;
while (next_pos <= MPEG_AHX_EXPECTED_FRAME_SIZE) {
uint32_t next_header = get_u32be(ms->buffer + next_pos);
if (current_header == next_header) {
current_data_size = next_pos;
break;
}
/* AHXs end in a 0x0c footer (0x41485845 28632943 52490000 / "AHXE(c)CRI\0\0") */
if (stream->offset + next_pos + 0x0c >= file_size) {
current_data_size = next_pos;
break;
}
next_pos++;
}
}
if (current_data_size == 0 || current_data_size > ms->buffer_size || current_data_size > MPEG_AHX_EXPECTED_FRAME_SIZE) {
VGM_LOG("MPEG AHX: incorrect data_size 0x%x\n", current_data_size);
goto fail;
}
/* 0-fill up to expected size to keep mpg123 happy */
memset(ms->buffer + current_data_size, 0, MPEG_AHX_EXPECTED_FRAME_SIZE - current_data_size);
ms->bytes_in_buffer = MPEG_AHX_EXPECTED_FRAME_SIZE;
/* decrypt if needed */
switch(data->config.encryption) {
case 0x00: break;
case 0x08: ahx_decrypt_type08(ms->buffer, &data->config); break;
default:
VGM_LOG("MPEG AHX: unknown encryption 0x%x\n", data->config.encryption);
break; /* garbled frame */
}
/* update offsets */
stream->offset += current_data_size;
if (stream->offset + 0x0c >= file_size)
stream->offset = file_size; /* skip 0x0c footer to reach EOF (shouldn't happen normally) */
return 1;
fail:
return 0;
}
/* Decrypts an AHX type 0x08 (keystring) encrypted frame. Algorithm by Thealexbarney */
static int ahx_decrypt_type08(uint8_t * buffer, mpeg_custom_config *config) {
int i, index, encrypted_bits;
uint32_t value;
uint16_t current_key;
/* encryption 0x08 modifies a few bits every frame, here we decrypt and write to data buffer */
/* derive keystring to 3 primes, using the type 0x08 method, and assign each an index of 1/2/3 (0=no key) */
/* (externally done for now, see: https://github.com/Thealexbarney/VGAudio/blob/2.0/src/VGAudio/Codecs/CriAdx/CriAdxKey.cs) */
/* read 2b from a bitstream offset to decrypt, and use it as an index to get the key.
* AHX encrypted bitstream starts at 107b (0x0d*8+3), every frame, and seem to always use index 2 */
value = get_u32be(buffer + 0x0d);
index = (value >> (32-3-2)) & 0x03;
switch(index) {
case 0: current_key = 0; break;
case 1: current_key = config->cri_key1; break;
case 2: current_key = config->cri_key2; break;
case 3: current_key = config->cri_key3; break;
default: goto fail;
}
/* AHX for DC: 16b, normal: 6b (no idea, probably some Layer II field) */
encrypted_bits = config->cri_type == 0x10 ? 16 : 6;
/* decrypt next bitstream 2b pairs, up to 16b (max key size):
* - read 2b from bitstream (from higher to lower)
* - read 2b from key (from lower to higher)
* - XOR them to decrypt */
for (i = 0; i < encrypted_bits; i+=2) {
uint32_t xor_2b = (current_key >> i) & 0x03;
value ^= ((xor_2b << (32-3-2-2)) >> i);
}
/* write output */
put_32bitBE(buffer + 0x0d, value);
return 1;
fail:
return 0;
}
#endif
#include "mpeg_decoder.h"
#ifdef VGM_USE_MPEG
#define MPEG_AHX_EXPECTED_FRAME_SIZE 0x414
static int ahx_decrypt_type08(uint8_t * buffer, mpeg_custom_config *config);
/* writes data to the buffer and moves offsets, transforming AHX frames as needed */
int mpeg_custom_parse_frame_ahx(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream) {
mpeg_custom_stream *ms = data->streams[num_stream];
size_t current_data_size = 0;
size_t file_size = get_streamfile_size(stream->streamfile);
/* AHX has a 0xFFF5E0C0 header with frame size 0x414 (160kbps, 22050Hz) but they actually are much shorter */
/* read supposed frame size first (to minimize reads) */
ms->bytes_in_buffer = read_streamfile(ms->buffer, stream->offset, MPEG_AHX_EXPECTED_FRAME_SIZE, stream->streamfile);
/* find actual frame size by looking for the next frame header */
{
uint32_t current_header = get_u32be(ms->buffer);
int next_pos = 0x04;
while (next_pos <= MPEG_AHX_EXPECTED_FRAME_SIZE) {
uint32_t next_header = get_u32be(ms->buffer + next_pos);
if (current_header == next_header) {
current_data_size = next_pos;
break;
}
/* AHXs end in a 0x0c footer (0x41485845 28632943 52490000 / "AHXE(c)CRI\0\0") */
if (stream->offset + next_pos + 0x0c >= file_size) {
current_data_size = next_pos;
break;
}
next_pos++;
}
}
if (current_data_size == 0 || current_data_size > ms->buffer_size || current_data_size > MPEG_AHX_EXPECTED_FRAME_SIZE) {
VGM_LOG("MPEG AHX: incorrect data_size 0x%x\n", current_data_size);
goto fail;
}
/* 0-fill up to expected size to keep mpg123 happy */
memset(ms->buffer + current_data_size, 0, MPEG_AHX_EXPECTED_FRAME_SIZE - current_data_size);
ms->bytes_in_buffer = MPEG_AHX_EXPECTED_FRAME_SIZE;
/* decrypt if needed */
switch(data->config.encryption) {
case 0x00: break;
case 0x08: ahx_decrypt_type08(ms->buffer, &data->config); break;
default:
VGM_LOG("MPEG AHX: unknown encryption 0x%x\n", data->config.encryption);
break; /* garbled frame */
}
/* update offsets */
stream->offset += current_data_size;
if (stream->offset + 0x0c >= file_size)
stream->offset = file_size; /* skip 0x0c footer to reach EOF (shouldn't happen normally) */
return 1;
fail:
return 0;
}
/* Decrypts an AHX type 0x08 (keystring) encrypted frame. Algorithm by Thealexbarney */
static int ahx_decrypt_type08(uint8_t * buffer, mpeg_custom_config *config) {
int i, index, encrypted_bits;
uint32_t value;
uint16_t current_key;
/* encryption 0x08 modifies a few bits every frame, here we decrypt and write to data buffer */
/* derive keystring to 3 primes, using the type 0x08 method, and assign each an index of 1/2/3 (0=no key) */
/* (externally done for now, see: https://github.com/Thealexbarney/VGAudio/blob/2.0/src/VGAudio/Codecs/CriAdx/CriAdxKey.cs) */
/* read 2b from a bitstream offset to decrypt, and use it as an index to get the key.
* AHX encrypted bitstream starts at 107b (0x0d*8+3), every frame, and seem to always use index 2 */
value = get_u32be(buffer + 0x0d);
index = (value >> (32-3-2)) & 0x03;
switch(index) {
case 0: current_key = 0; break;
case 1: current_key = config->cri_key1; break;
case 2: current_key = config->cri_key2; break;
case 3: current_key = config->cri_key3; break;
default: goto fail;
}
/* AHX for DC: 16b, normal: 6b (no idea, probably some Layer II field) */
encrypted_bits = config->cri_type == 0x10 ? 16 : 6;
/* decrypt next bitstream 2b pairs, up to 16b (max key size):
* - read 2b from bitstream (from higher to lower)
* - read 2b from key (from lower to higher)
* - XOR them to decrypt */
for (i = 0; i < encrypted_bits; i+=2) {
uint32_t xor_2b = (current_key >> i) & 0x03;
value ^= ((xor_2b << (32-3-2-2)) >> i);
}
/* write output */
put_32bitBE(buffer + 0x0d, value);
return 1;
fail:
return 0;
}
#endif

View File

@ -1,176 +1,176 @@
#include "mpeg_decoder.h"
#ifdef VGM_USE_MPEG
/* parsed info from a single EAMP3 frame */
typedef struct {
uint32_t extended_flag;
uint32_t stereo_flag; /* assumed */
uint32_t unknown_flag; /* unused? */
uint32_t frame_size; /* full size including headers and pcm block */
uint32_t pcm_number; /* samples in the PCM block (typically 1 MPEG frame, 1152) */
uint32_t pre_size; /* size of the header part */
uint32_t mpeg_size; /* size of the MPEG part */
uint32_t pcm_size; /* size of the PCM block */
} eamp3_frame_info;
static int eamp3_parse_frame(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, eamp3_frame_info * eaf);
static int eamp3_write_pcm_block(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, eamp3_frame_info * eaf);
static int eamp3_skip_data(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, int at_start);
/* init config and validate */
int mpeg_custom_setup_init_eamp3(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type) {
mpeg_frame_info info;
uint16_t frame_header;
size_t header_size;
/* test unknown stuff */
frame_header = (uint16_t)read_16bitLE(start_offset+0x00, streamFile);
if (frame_header & 0x2000) {
VGM_LOG("EAMP3: found unknown bit 13\n");
goto fail;
}
if ((frame_header & 0x8000) && (uint32_t)read_32bitLE(start_offset+0x02, streamFile) > 0xFFFF) {
VGM_LOG("EAMP3: found big PCM block\n");
goto fail;
}
/* get frame info at offset */
header_size = (frame_header & 0x8000) ? 0x06 : 0x02;
if (!mpeg_get_frame_info(streamFile, start_offset+header_size, &info))
goto fail;
switch(info.layer) {
case 1: *coding_type = coding_MPEG_layer1; break;
case 2: *coding_type = coding_MPEG_layer2; break;
case 3: *coding_type = coding_MPEG_layer3; break;
default: goto fail;
}
data->channels_per_frame = info.channels;
data->samples_per_frame = info.frame_samples;
data->bitrate_per_frame = info.bit_rate;
data->sample_rate_per_frame = info.sample_rate;
return 1;
fail:
return 0;
}
/* reads custom frame header + MPEG data + (optional) PCM block */
int mpeg_custom_parse_frame_eamp3(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream) {
mpeg_custom_stream *ms = data->streams[num_stream];
eamp3_frame_info eaf;
int ok;
if (!eamp3_skip_data(stream, data, num_stream, 1))
goto fail;
ok = eamp3_parse_frame(stream, data, &eaf);
if (!ok) goto fail;
ms->bytes_in_buffer = read_streamfile(ms->buffer, stream->offset + eaf.pre_size, eaf.mpeg_size, stream->streamfile);
ok = eamp3_write_pcm_block(stream, data, num_stream, &eaf);
if (!ok) goto fail;
stream->offset += eaf.frame_size;
if (!eamp3_skip_data(stream, data, num_stream, 0))
goto fail;
return 1;
fail:
return 0;
}
static int eamp3_parse_frame(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, eamp3_frame_info * eaf) {
uint16_t current_header = (uint16_t)read_16bitLE(stream->offset+0x00, stream->streamfile);
eaf->extended_flag = (current_header & 0x8000);
eaf->stereo_flag = (current_header & 0x4000);
eaf->unknown_flag = (current_header & 0x2000);
eaf->frame_size = (current_header & 0x1FFF); /* full size including PCM block */
eaf->pcm_number = 0;
if (eaf->extended_flag > 0) {
eaf->pcm_number = (uint32_t)read_32bitLE(stream->offset+0x02, stream->streamfile);
eaf->pcm_size = sizeof(sample) * eaf->pcm_number * data->channels_per_frame;
eaf->pre_size = 0x06;
eaf->mpeg_size = eaf->frame_size - eaf->pre_size - eaf->pcm_size;
if (eaf->frame_size < eaf->pre_size + eaf->pcm_size) {
VGM_LOG("EAMP3: bad pcm size at %x\n", (uint32_t)stream->offset);
goto fail;
}
}
else {
eaf->pcm_size = 0;
eaf->pre_size = 0x02;
eaf->mpeg_size = eaf->frame_size - eaf->pre_size;
}
return 1;
fail:
return 0;
}
/* write PCM block directly to sample buffer and setup decode discard (see EALayer3). */
static int eamp3_write_pcm_block(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, eamp3_frame_info * eaf) {
mpeg_custom_stream *ms = data->streams[num_stream];
size_t bytes_filled;
int i;
bytes_filled = sizeof(sample) * ms->samples_filled * data->channels_per_frame;
if (bytes_filled + eaf->pcm_size > ms->output_buffer_size) {
VGM_LOG("EAMP3: can't fill the sample buffer with 0x%x\n", eaf->pcm_size);
goto fail;
}
if (eaf->pcm_number) {
/* read + write PCM block samples (always LE) */
for (i = 0; i < eaf->pcm_number * data->channels_per_frame; i++) {
off_t pcm_offset = stream->offset + eaf->pre_size + eaf->mpeg_size + sizeof(sample)*i;
int16_t pcm_sample = read_16bitLE(pcm_offset,stream->streamfile);
put_16bitLE(ms->output_buffer + bytes_filled + sizeof(sample)*i, pcm_sample);
}
ms->samples_filled += eaf->pcm_number;
/* modify decoded samples */
{
size_t decode_to_discard = eaf->pcm_number; //todo guessed
ms->decode_to_discard += decode_to_discard;
}
}
return 1;
fail:
return 0;
}
/* Skip EA-frames from other streams for .sns/sps multichannel (see EALayer3). */
static int eamp3_skip_data(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, int at_start) {
int ok, i;
eamp3_frame_info eaf;
int skips = at_start ? num_stream : data->streams_size - 1 - num_stream;
for (i = 0; i < skips; i++) {
ok = eamp3_parse_frame(stream, data, &eaf);
if (!ok) goto fail;
//;VGM_LOG("s%i: skipping %x, now at %lx\n", num_stream,eaf.frame_size,stream->offset);
stream->offset += eaf.frame_size;
}
//;VGM_LOG("s%i: skipped %i frames, now at %lx\n", num_stream,skips,stream->offset);
return 1;
fail:
return 0;
}
#endif
#include "mpeg_decoder.h"
#ifdef VGM_USE_MPEG
/* parsed info from a single EAMP3 frame */
typedef struct {
uint32_t extended_flag;
uint32_t stereo_flag; /* assumed */
uint32_t unknown_flag; /* unused? */
uint32_t frame_size; /* full size including headers and pcm block */
uint32_t pcm_number; /* samples in the PCM block (typically 1 MPEG frame, 1152) */
uint32_t pre_size; /* size of the header part */
uint32_t mpeg_size; /* size of the MPEG part */
uint32_t pcm_size; /* size of the PCM block */
} eamp3_frame_info;
static int eamp3_parse_frame(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, eamp3_frame_info * eaf);
static int eamp3_write_pcm_block(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, eamp3_frame_info * eaf);
static int eamp3_skip_data(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, int at_start);
/* init config and validate */
int mpeg_custom_setup_init_eamp3(STREAMFILE *streamFile, off_t start_offset, mpeg_codec_data *data, coding_t *coding_type) {
mpeg_frame_info info;
uint16_t frame_header;
size_t header_size;
/* test unknown stuff */
frame_header = (uint16_t)read_16bitLE(start_offset+0x00, streamFile);
if (frame_header & 0x2000) {
VGM_LOG("EAMP3: found unknown bit 13\n");
goto fail;
}
if ((frame_header & 0x8000) && (uint32_t)read_32bitLE(start_offset+0x02, streamFile) > 0xFFFF) {
VGM_LOG("EAMP3: found big PCM block\n");
goto fail;
}
/* get frame info at offset */
header_size = (frame_header & 0x8000) ? 0x06 : 0x02;
if (!mpeg_get_frame_info(streamFile, start_offset+header_size, &info))
goto fail;
switch(info.layer) {
case 1: *coding_type = coding_MPEG_layer1; break;
case 2: *coding_type = coding_MPEG_layer2; break;
case 3: *coding_type = coding_MPEG_layer3; break;
default: goto fail;
}
data->channels_per_frame = info.channels;
data->samples_per_frame = info.frame_samples;
data->bitrate_per_frame = info.bit_rate;
data->sample_rate_per_frame = info.sample_rate;
return 1;
fail:
return 0;
}
/* reads custom frame header + MPEG data + (optional) PCM block */
int mpeg_custom_parse_frame_eamp3(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream) {
mpeg_custom_stream *ms = data->streams[num_stream];
eamp3_frame_info eaf;
int ok;
if (!eamp3_skip_data(stream, data, num_stream, 1))
goto fail;
ok = eamp3_parse_frame(stream, data, &eaf);
if (!ok) goto fail;
ms->bytes_in_buffer = read_streamfile(ms->buffer, stream->offset + eaf.pre_size, eaf.mpeg_size, stream->streamfile);
ok = eamp3_write_pcm_block(stream, data, num_stream, &eaf);
if (!ok) goto fail;
stream->offset += eaf.frame_size;
if (!eamp3_skip_data(stream, data, num_stream, 0))
goto fail;
return 1;
fail:
return 0;
}
static int eamp3_parse_frame(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, eamp3_frame_info * eaf) {
uint16_t current_header = (uint16_t)read_16bitLE(stream->offset+0x00, stream->streamfile);
eaf->extended_flag = (current_header & 0x8000);
eaf->stereo_flag = (current_header & 0x4000);
eaf->unknown_flag = (current_header & 0x2000);
eaf->frame_size = (current_header & 0x1FFF); /* full size including PCM block */
eaf->pcm_number = 0;
if (eaf->extended_flag > 0) {
eaf->pcm_number = (uint32_t)read_32bitLE(stream->offset+0x02, stream->streamfile);
eaf->pcm_size = sizeof(sample) * eaf->pcm_number * data->channels_per_frame;
eaf->pre_size = 0x06;
eaf->mpeg_size = eaf->frame_size - eaf->pre_size - eaf->pcm_size;
if (eaf->frame_size < eaf->pre_size + eaf->pcm_size) {
VGM_LOG("EAMP3: bad pcm size at %x\n", (uint32_t)stream->offset);
goto fail;
}
}
else {
eaf->pcm_size = 0;
eaf->pre_size = 0x02;
eaf->mpeg_size = eaf->frame_size - eaf->pre_size;
}
return 1;
fail:
return 0;
}
/* write PCM block directly to sample buffer and setup decode discard (see EALayer3). */
static int eamp3_write_pcm_block(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, eamp3_frame_info * eaf) {
mpeg_custom_stream *ms = data->streams[num_stream];
size_t bytes_filled;
int i;
bytes_filled = sizeof(sample) * ms->samples_filled * data->channels_per_frame;
if (bytes_filled + eaf->pcm_size > ms->output_buffer_size) {
VGM_LOG("EAMP3: can't fill the sample buffer with 0x%x\n", eaf->pcm_size);
goto fail;
}
if (eaf->pcm_number) {
/* read + write PCM block samples (always LE) */
for (i = 0; i < eaf->pcm_number * data->channels_per_frame; i++) {
off_t pcm_offset = stream->offset + eaf->pre_size + eaf->mpeg_size + sizeof(sample)*i;
int16_t pcm_sample = read_16bitLE(pcm_offset,stream->streamfile);
put_16bitLE(ms->output_buffer + bytes_filled + sizeof(sample)*i, pcm_sample);
}
ms->samples_filled += eaf->pcm_number;
/* modify decoded samples */
{
size_t decode_to_discard = eaf->pcm_number; //todo guessed
ms->decode_to_discard += decode_to_discard;
}
}
return 1;
fail:
return 0;
}
/* Skip EA-frames from other streams for .sns/sps multichannel (see EALayer3). */
static int eamp3_skip_data(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, int num_stream, int at_start) {
int ok, i;
eamp3_frame_info eaf;
int skips = at_start ? num_stream : data->streams_size - 1 - num_stream;
for (i = 0; i < skips; i++) {
ok = eamp3_parse_frame(stream, data, &eaf);
if (!ok) goto fail;
//;VGM_LOG("s%i: skipping %x, now at %lx\n", num_stream,eaf.frame_size,stream->offset);
stream->offset += eaf.frame_size;
}
//;VGM_LOG("s%i: skipped %i frames, now at %lx\n", num_stream,skips,stream->offset);
return 1;
fail:
return 0;
}
#endif

View File

@ -1248,6 +1248,7 @@ static const meta_info meta_info_list[] = {
{meta_UBI_HX, "Ubisoft HXx header"},
{meta_BMP_KONAMI, "Konami BMP header"},
{meta_ISB, "Creative ISACT header"},
{meta_XSSB, "Artoon XSSB header"},
};

View File

@ -43,6 +43,7 @@ void block_update_ea_schl(off_t block_offset, VGMSTREAM * vgmstream) {
block_samples = 0; /* layout ignores this */
}
#ifdef VGM_USE_MPEG
/* "SCHl" start block, when decoding multi files pasted together */
if (block_id == 0x5343486C) {
switch(vgmstream->coding_type) {
@ -58,7 +59,7 @@ void block_update_ea_schl(off_t block_offset, VGMSTREAM * vgmstream) {
break;
}
}
#endif
/* padding between "SCEl" and next "SCHl" (when subfiles exist) */
if (block_id == 0x00000000)
block_size = 0x04;

View File

@ -2,7 +2,7 @@
#include "../vgmstream.h"
#include "../mixing.h"
#define VGMSTREAM_MAX_SEGMENTS 512
#define VGMSTREAM_MAX_SEGMENTS 1024
#define VGMSTREAM_SEGMENT_SAMPLE_BUFFER 8192

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1475,19 +1475,18 @@ static layered_layout_data* build_layered_eaaudiocore(STREAMFILE *sf_data, eaac_
size_t data_size;
/* We'll remove EA blocks and pass raw data to FFmpeg Opus decoder */
temp_sf = setup_eaac_streamfile(sf_data, eaac->version, eaac->codec, eaac->streamed,0,0, eaac->stream_offset);
temp_sf = setup_eaac_streamfile(sf_data, eaac->version, eaac->codec, eaac->streamed,i,layers, eaac->stream_offset);
if (!temp_sf) goto fail;
//TODO: setup opus frame deinterleave (1 frame per 2ch stream, only seen 4ch and 6ch tho)
skip = ea_opus_get_encoder_delay(0x00, temp_sf);
data_size = get_streamfile_size(temp_sf);
data->layers[i]->codec_data = init_ffmpeg_ea_opus(temp_sf, 0x00,data_size, eaac->channels, skip, eaac->sample_rate);
data->layers[i]->codec_data = init_ffmpeg_ea_opus(temp_sf, 0x00,data_size, layer_channels, skip, eaac->sample_rate);
if (!data->layers[i]->codec_data) goto fail;
data->layers[i]->coding_type = coding_FFmpeg;
data->layers[i]->layout_type = layout_none;
//TODO: 6ch channel layout seems L C R BL BR LFE, not sure about other EAAC
break;
}

View File

@ -0,0 +1,242 @@
#ifndef _EA_EAAC_OPUS_STREAMFILE_H_
#define _EA_EAAC_OPUS_STREAMFILE_H_
#include "../streamfile.h"
typedef struct deblock_config_t deblock_config_t;
typedef struct deblock_io_data deblock_io_data;
struct deblock_config_t {
/* config (all optional) */
size_t logical_size; /* pre-calculated size for performance (otherwise has to read the whole thing) */
off_t stream_start; /* data start */
size_t stream_size; /* data max */
size_t chunk_size; /* some size like a constant interleave */
size_t skip_size; /* same */
int codec; /* codec or type variations */
int channels;
int big_endian;
uint32_t config; /* some non-standard config value */
/* read=blocks from out stream to read) and "steps" (blocks from other streams to skip) */
int step_start; /* initial step_count at stream start (often 0) */
int step_count; /* number of blocks to step over from other streams */
int read_count; /* number of blocks to read from this stream, after steps */
size_t track_size;
int track_number;
int track_count;
size_t interleave_count;
size_t interleave_last_count;
/* callback that setups deblock_io_data state, normally block_size and data_size */
void (*block_callback)(STREAMFILE *sf, off_t offset, deblock_io_data *data);
} ;
struct deblock_io_data{
/* initial config */
deblock_config_t cfg;
/* state */
off_t logical_offset; /* fake deblocked offset */
off_t physical_offset; /* actual file offset */
off_t block_size; /* current block (added to physical offset) */
off_t skip_size; /* data to skip from block start to reach data (like a header) */
off_t data_size; /* usable data in a block (added to logical offset) */
//todo head/foot?
int step_count; /* number of blocks to step over */
int read_count; /* number of blocks to read */
size_t logical_size;
size_t physical_size;
off_t physical_end;
} ;
static void block_callback_default(STREAMFILE *sf, off_t offset, deblock_io_data *data) {
data->block_size = data->cfg.chunk_size;
data->skip_size = data->cfg.skip_size;
data->data_size = data->block_size - data->skip_size;
}
static size_t deblock_io_read(STREAMFILE *sf, uint8_t *dest, off_t offset, size_t length, deblock_io_data* data) {
size_t total_read = 0;
/* re-start when previous offset (can't map logical<>physical offsets) */
if (data->logical_offset < 0 || offset < data->logical_offset) {
;VGM_LOG("DEBLOCK: restart offset=%lx + %x, po=%lx, lo=%lx\n", offset, length, data->physical_offset, data->logical_offset);
data->physical_offset = data->cfg.stream_start;
data->logical_offset = 0x00;
data->block_size = 0;
data->data_size = 0;
data->skip_size = 0;
data->step_count = data->cfg.step_start;
data->read_count = data->cfg.read_count;
}
/* read blocks */
while (length > 0) {
/* ignore EOF */
if (offset < 0 ||
(data->physical_offset >= data->cfg.stream_start + data->physical_size) ||
(data->logical_size > 0 && offset > data->logical_size)) {
break;
}
/* process new block */
if (data->data_size <= 0) {
data->cfg.block_callback(sf, offset, data);
if (data->block_size <= 0) {
VGM_LOG("DEBLOCK: block size not set at %lx\n", data->physical_offset);
break;
}
}
#if 1
if (data->step_count > 0) {
data->step_count--;
data->physical_offset += data->block_size;
data->data_size = 0;
continue;
}
#else
/* handle blocks from multiple streams */
{
if (data->step_count > 0) {
data->step_count--;
data->data_size = 0; /* step over this block */
}
else if (data->read_count) {//must detect when blocks has been read
data->read_count--; /* read this block */
/* reset */
if (data->step_count == 0 && data->read_count == 0) {
data->step_count = data->cfg.step_count;
data->read_count = data->cfg.read_count;
}
}
}
#endif
/* move to next block */
if (data->data_size == 0 || offset >= data->logical_offset + data->data_size) {
data->physical_offset += data->block_size;
data->logical_offset += data->data_size;
data->data_size = 0;
data->step_count = data->cfg.step_count;
//VGM_LOG("ignore at %lx + %lx, skips=%i, reads=%i\n", data->physical_offset, data->block_size, data->step_count, data->read_count);
continue;
}
//VGM_LOG("accept at %lx + %lx, skips=%i, reads=%i\n", data->physical_offset, data->block_size, data->step_count, data->read_count);
/* read block data */
{
size_t bytes_consumed, bytes_done, to_read;
bytes_consumed = offset - data->logical_offset;
to_read = data->data_size - bytes_consumed;
if (to_read > length)
to_read = length;
bytes_done = read_streamfile(dest, data->physical_offset + data->skip_size + bytes_consumed, to_read, sf);
total_read += bytes_done;
dest += bytes_done;
offset += bytes_done;
length -= bytes_done;
if (bytes_done != to_read || bytes_done == 0) {
break; /* error/EOF */
}
}
}
return total_read;
}
static size_t deblock_io_size(STREAMFILE *streamfile, deblock_io_data* data) {
uint8_t buf[0x04];
if (data->logical_size)
return data->logical_size;
if (data->cfg.logical_size) {
data->logical_size = data->cfg.logical_size;
return data->logical_size;
}
/* force a fake read at max offset, to get max logical_offset (will be reset next read) */
deblock_io_read(streamfile, buf, 0x7FFFFFFF, 1, data);
data->logical_size = data->logical_offset;
return data->logical_size;
}
/* generic "de-blocker" helper for streams divided in blocks that have weird interleaves, their
* decoder can't easily use blocked layout, or some other weird feature. Must pass a
* deblock_config_t with setup and a callback that sets sizes of a single block. */
static STREAMFILE* open_io_deblocker_streamfile_f(STREAMFILE *sf, deblock_config_t *cfg) {
STREAMFILE *new_sf = NULL;
deblock_io_data io_data = {0};
/* prepare data */
io_data.cfg = *cfg; /* memcpy */
if (io_data.cfg.block_callback == NULL)
io_data.cfg.block_callback = block_callback_default;
if (io_data.cfg.stream_start < 0)
goto fail;
if (io_data.cfg.step_start < 0 || io_data.cfg.step_count < 0)
goto fail;
if (io_data.cfg.read_count == 0)
io_data.cfg.read_count = 1;
io_data.physical_size = io_data.cfg.stream_size;
if (io_data.physical_size > get_streamfile_size(sf) + io_data.cfg.stream_start || io_data.physical_size == 0)
io_data.physical_size = get_streamfile_size(sf) - io_data.cfg.stream_start;
io_data.physical_end = io_data.cfg.stream_start + io_data.physical_size;
VGM_LOG("ps=%x, pe=%lx\n", io_data.physical_size, io_data.physical_end);
io_data.logical_offset = -1; /* read reset */
//TODO: other validations
/* setup subfile */
new_sf = open_io_streamfile_f(sf, &io_data, sizeof(deblock_io_data), deblock_io_read, deblock_io_size);
return new_sf;
fail:
VGM_LOG("DEBLOCK: bad init\n");
close_streamfile(sf);
return NULL;
}
/*****************************************************/
static void block_callback(STREAMFILE *sf, off_t offset, deblock_io_data *data) {
/* read the whole block, will be skipped for unwanted sub-streams */
data->block_size = 0x02 + read_u16be(data->physical_offset, sf);
data->data_size = data->block_size;
//VGM_LOG("read at %lx + %lx, skips=%i, reads=%i\n", data->physical_offset, data->block_size, data->step_count, data->read_count);
}
static STREAMFILE* open_io_eaac_opus_streamfile_f(STREAMFILE *new_sf, int stream_number, int stream_count) {
deblock_config_t cfg = {0};
cfg.step_start = stream_number;
cfg.step_count = stream_count - 1;
cfg.block_callback = block_callback;
/* starts from 0 since new_sf is pre-deblocked */
/* setup subfile */
//new_sf = open_wrap_streamfile(sf); /* to be used with others */
new_sf = open_io_deblocker_streamfile_f(new_sf, &cfg);
return new_sf;
}
#endif /* _EA_EAAC_OPUS_STREAMFILE_H_ */

View File

@ -1,6 +1,7 @@
#ifndef _EA_EAAC_STREAMFILE_H_
#define _EA_EAAC_STREAMFILE_H_
#include "../streamfile.h"
#include "ea_eaac_opus_streamfile.h"
#define XMA_FRAME_SIZE 0x800
@ -261,6 +262,8 @@ static STREAMFILE* setup_eaac_streamfile(STREAMFILE *sf, int version, int codec,
new_sf = open_wrap_streamfile(sf);
new_sf = open_io_streamfile_f(new_sf, &io_data, sizeof(eaac_io_data), eaac_io_read, eaac_io_size);
new_sf = open_buffer_streamfile_f(new_sf, 0); /* EA-XMA and multichannel EALayer3 benefit from this */
if (codec == 0x0c && stream_count > 1) /* multichannel opus */
new_sf = open_io_eaac_opus_streamfile_f(new_sf, stream_number, stream_count);
return new_sf;
}

View File

@ -82,7 +82,7 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) {
/* find target stream header and data offset, and read all needed values for later use
* (reads one by one as the size of a single stream header is variable) */
for (i = 1; i <= fsb5.total_subsongs; i++) {
for (i = 0; i < fsb5.total_subsongs; i++) {
size_t stream_header_size = 0;
off_t data_offset = 0;
uint32_t sample_mode1, sample_mode2; /* maybe one uint64? */
@ -138,77 +138,83 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) {
extraflag_size = (extraflag >> 1) & 0xFFFFFF; /* bits 25..1 (24)*/
extraflag_end = (extraflag & 0x01); /* bit 0 (1) */
switch(extraflag_type) {
case 0x01: /* channels */
fsb5.channels = read_8bit(extraflag_offset+0x04,streamFile);
break;
case 0x02: /* sample rate */
fsb5.sample_rate = read_32bitLE(extraflag_offset+0x04,streamFile);
break;
case 0x03: /* loop info */
fsb5.loop_start = read_32bitLE(extraflag_offset+0x04,streamFile);
if (extraflag_size > 0x04) { /* probably not needed */
fsb5.loop_end = read_32bitLE(extraflag_offset+0x08,streamFile);
fsb5.loop_end += 1; /* correct compared to FMOD's tools */
}
/* autodetect unwanted loops */
{
/* like FSB4 jingles/sfx/music do full loops for no reason, but happens a lot less.
* Most songs loop normally now with proper values [ex. Shantae, FFX] */
int full_loop, ajurika_loops;
/* could use the same checks as FSB4 but simplified (ex. Sonic Boom Fire & Ice jingles) */
full_loop = fsb5.loop_start != 0x00;
/* wrong values in some files [Pac-Man CE2 Plus (Switch) pce2p_bgm_ajurika_*.fsb] */
ajurika_loops = fsb5.loop_start == 0x3c && fsb5.loop_end == 0x007F007F &&
fsb5.num_samples > fsb5.loop_end + 100000; /* arbitrary limit */
//;VGM_LOG("FSB5: loop start=%i, loop end=%i, samples=%i\n", fsb5.loop_start, fsb5.loop_end, fsb5.num_samples);
fsb5.loop_flag = 1;
if (!full_loop || ajurika_loops) {
VGM_LOG("FSB5: disabled unwanted loop\n");
fsb5.loop_flag = 0;
/* parse target only, as flags change between subsongs */
if (i + 1 == target_subsong) {
switch(extraflag_type) {
case 0x01: /* channels */
fsb5.channels = read_8bit(extraflag_offset+0x04,streamFile);
break;
case 0x02: /* sample rate */
fsb5.sample_rate = read_32bitLE(extraflag_offset+0x04,streamFile);
break;
case 0x03: /* loop info */
fsb5.loop_start = read_32bitLE(extraflag_offset+0x04,streamFile);
if (extraflag_size > 0x04) { /* probably not needed */
fsb5.loop_end = read_32bitLE(extraflag_offset+0x08,streamFile);
fsb5.loop_end += 1; /* correct compared to FMOD's tools */
}
}
break;
case 0x04: /* free comment, or maybe SFX info */
break;
case 0x05: /* unknown 32b */ //todo multistream marker?
/* found in Tearaway Vita, value 0, first stream only */
VGM_LOG("FSB5: flag %x with value %08x\n", extraflag_type, read_32bitLE(extraflag_offset+0x04,streamFile));
break;
case 0x06: /* XMA seek table */
/* no need for it */
break;
case 0x07: /* DSP coefs */
fsb5.extradata_offset = extraflag_offset + 0x04;
break;
case 0x09: /* ATRAC9 config */
fsb5.extradata_offset = extraflag_offset + 0x04;
fsb5.extradata_size = extraflag_size;
break;
case 0x0a: /* XWMA config */
fsb5.extradata_offset = extraflag_offset + 0x04;
break;
case 0x0b: /* Vorbis setup ID and seek table */
fsb5.extradata_offset = extraflag_offset + 0x04;
/* seek table format:
* 0x08: table_size (total_entries = seek_table_size / (4+4)), not counting this value; can be 0
* 0x0C: sample number (only some samples are saved in the table)
* 0x10: offset within data, pointing to a FSB vorbis block (with the 16b block size header)
* (xN entries)
*/
break;
case 0x0d: /* unknown 32b (config? usually 0x3fnnnn00 BE) */
/* found in some XMA2/Vorbis/FADPCM */
VGM_LOG("FSB5: flag %x with value %08x\n", extraflag_type, read_32bitLE(extraflag_offset+0x04,streamFile));
break;
default:
VGM_LOG("FSB5: unknown extraflag 0x%x at %x + 0x04 (size 0x%x)\n", extraflag_type, (uint32_t)extraflag_offset, extraflag_size);
break;
//;VGM_LOG("FSB5: stream %i loop start=%i, loop end=%i, samples=%i\n", i, fsb5.loop_start, fsb5.loop_end, fsb5.num_samples);
/* autodetect unwanted loops */
{
/* like FSB4 jingles/sfx/music do full loops for no reason, but happens a lot less.
* Most songs loop normally now with proper values [ex. Shantae, FFX] */
int full_loop, ajurika_loops, is_small;
/* disable some jingles, it's even possible one jingle (StingerA Var1) to not have loops
* and next one (StingerA Var2) do [Sonic Boom Fire & Ice (3DS)] */
full_loop = fsb5.loop_start == 0 && fsb5.loop_end + 20 >= fsb5.num_samples; /* around ~15 samples less */
/* a few longer Sonic songs shouldn't repeat, may add if other games need it */
is_small = 0; //fsb5.num_samples < 20 * fsb5.sample_rate;
/* wrong values in some files [Pac-Man CE2 Plus (Switch) pce2p_bgm_ajurika_*.fsb] */
ajurika_loops = fsb5.loop_start == 0x3c && fsb5.loop_end == 0x007F007F &&
fsb5.num_samples > fsb5.loop_end + 10000; /* arbitrary test in case some game does have those */
fsb5.loop_flag = 1;
if ((full_loop && is_small) || ajurika_loops) {
VGM_LOG("FSB5: stream %i disabled unwanted loop ls=%i, le=%i, ns=%i\n", i, fsb5.loop_start, fsb5.loop_end, fsb5.num_samples);
fsb5.loop_flag = 0;
}
}
break;
case 0x04: /* free comment, or maybe SFX info */
break;
case 0x05: /* unknown 32b */
/* rare, found in Tearaway (Vita) with value 0 in first stream and
* Shantae and the Seven Sirens (Mobile) with value 0x0003bd72 BE in #44 (Arena Town) */
VGM_LOG("FSB5: stream %i flag %x with value %08x\n", i, extraflag_type, read_32bitLE(extraflag_offset+0x04,streamFile));
break;
case 0x06: /* XMA seek table */
/* no need for it */
break;
case 0x07: /* DSP coefs */
fsb5.extradata_offset = extraflag_offset + 0x04;
break;
case 0x09: /* ATRAC9 config */
fsb5.extradata_offset = extraflag_offset + 0x04;
fsb5.extradata_size = extraflag_size;
break;
case 0x0a: /* XWMA config */
fsb5.extradata_offset = extraflag_offset + 0x04;
break;
case 0x0b: /* Vorbis setup ID and seek table */
fsb5.extradata_offset = extraflag_offset + 0x04;
/* seek table format:
* 0x08: table_size (total_entries = seek_table_size / (4+4)), not counting this value; can be 0
* 0x0C: sample number (only some samples are saved in the table)
* 0x10: offset within data, pointing to a FSB vorbis block (with the 16b block size header)
* (xN entries)
*/
break;
case 0x0d: /* unknown 32b (config? usually 0x3fnnnn00 BE and sometimes 0x3dnnnn00 BE) */
/* found in some XMA2/Vorbis/FADPCM */
VGM_LOG("FSB5: stream %i flag %x with value %08x\n", i, extraflag_type, read_32bitLE(extraflag_offset+0x04,streamFile));
break;
default:
VGM_LOG("FSB5: stream %i unknown flag 0x%x at %x + 0x04 (size 0x%x)\n", i, extraflag_type, (uint32_t)extraflag_offset, extraflag_size);
break;
}
}
extraflag_offset += 0x04 + extraflag_size;
@ -216,12 +222,12 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) {
} while (extraflag_end != 0x00);
}
/* stream found */
if (i == target_subsong) {
/* target found */
if (i + 1 == target_subsong) {
fsb5.stream_offset = fsb5.base_header_size + fsb5.sample_header_size + fsb5.name_table_size + data_offset;
/* get stream size from next stream offset or full size if there is only one */
if (i == fsb5.total_subsongs) {
if (i + 1 == fsb5.total_subsongs) {
fsb5.stream_size = fsb5.sample_data_size - data_offset;
}
else {
@ -237,7 +243,7 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) {
break;
}
/* continue searching */
/* continue searching target */
fsb5.sample_header_offset += stream_header_size;
}
/* target stream not found*/

View File

@ -870,4 +870,6 @@ VGMSTREAM * init_vgmstream_bmp_konami(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_isb(STREAMFILE * streamFile);
VGMSTREAM* init_vgmstream_xssb(STREAMFILE *sf);
#endif /*_META_H*/

140
src/meta/xssb.c Normal file
View File

@ -0,0 +1,140 @@
#include "meta.h"
#include "../coding/coding.h"
//todo test and rethink usefulness/viability of globally using this
/* generic helper with a usable fields to describe static header values */
typedef struct {
int codec;
int type;
int channels;
int sample_rate;
int loop_flag;
int loop_start;
int loop_end;
int total_subsongs;
int target_subsong;
size_t file_size;
off_t info_start;
off_t header_start;
size_t header_entry;
off_t header_offset;
off_t data_start;
size_t data_size;
off_t stream_start;
size_t stream_size;
} header_t;
/* XSSB - from Artoon games [Blinx (Xbox), Blinx 2 (Xbox)] */
VGMSTREAM* init_vgmstream_xssb(STREAMFILE *sf) {
VGMSTREAM *vgmstream = NULL;
//off_t start_offset, header_offset, data_start, info_start, header_start;
//size_t header_size, stream_size;
//int loop_flag, channel_count, sample_rate, codec, loop_start, loop_end;
//int total_subsongs, target_subsong = streamFile->stream_index;
header_t h;
/* checks */
/* .bin: from named files inside .ipk bigfiles */
if (!check_extensions(sf, "bin,lbin"))
goto fail;
if (read_u32be(0x00, sf) != 0x58535342) /* "XSSB" */
goto fail;
/* 0x04: null */
/* 0x08: date-version ('20011217' in hex) */
/* 0x0c: null */
h.info_start = read_s32le(0x10, sf);
h.header_start = read_s32le(0x14, sf);
h.data_start = read_s32le(0x18, sf);
/* 0x1c: null */
h.header_entry = read_s16le(h.info_start + 0x00, sf);
/* 0x02: always 127 */
/* get subsongs from header entries */
{
off_t offset = h.header_start;
h.total_subsongs = 0;
h.target_subsong = sf->stream_index <= 0 ? 1 : sf->stream_index;
h.header_offset = 0;
while (offset < h.data_start) {
/* headers are just pasted together and then padding */
if (read_u32be(offset, sf) == 0)
break;
h.total_subsongs++;
if (h.target_subsong == h.total_subsongs) {
h.header_offset = offset;
}
offset += h.header_entry;
}
if (h.header_offset == 0)
goto fail;
if (h.target_subsong > h.total_subsongs || h.total_subsongs < 1)
goto fail;
}
/* read header */
h.codec = read_s16le(h.header_offset + 0x00, sf);
h.channels = read_s16le(h.header_offset + 0x02, sf);
h.sample_rate = read_u16le(h.header_offset + 0x04, sf);
/* 0x08: bitrate */
/* 0x0c: block align/bps */
/* 0x10: 0=PCM, 2=XBOX-IMA? */
h.stream_start = read_s32le(h.header_offset + 0x14, sf) + h.data_start;
h.stream_size = read_s32le(h.header_offset + 0x18, sf);
h.loop_start = read_s32le(h.header_offset + 0x1c, sf);
h.loop_end = read_s32le(h.header_offset + 0x20, sf);
/* others: unknown and mostly fixed values */
h.loop_flag = (h.loop_end > 0);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(h.channels, h.loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_XSSB;
vgmstream->sample_rate = h.sample_rate;
vgmstream->loop_start_sample = h.loop_start;
vgmstream->loop_end_sample = h.loop_end;
vgmstream->num_streams = h.total_subsongs;
vgmstream->stream_size = h.stream_size;
switch(h.codec) {
case 0x01:
vgmstream->coding_type = coding_PCM16LE;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x01;
vgmstream->num_samples = pcm_bytes_to_samples(h.stream_size, h.channels, 16);
break;
case 0x69:
vgmstream->coding_type = coding_XBOX_IMA;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = xbox_ima_bytes_to_samples(h.stream_size, h.channels);
break;
}
if (!vgmstream_open_stream(vgmstream, sf, h.stream_start))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +1,42 @@
#ifndef _MIXING_H_
#define _MIXING_H_
#include "vgmstream.h"
/* Applies mixing commands to the sample buffer. Mixing must be externally enabled and
* outbuf must big enough to hold output_channels*samples_to_do */
void mix_vgmstream(sample_t *outbuf, int32_t sample_count, VGMSTREAM* vgmstream);
/* internal mixing pre-setup for vgmstream (doesn't imply usage).
* If init somehow fails next calls are ignored. */
void mixing_init(VGMSTREAM* vgmstream);
void mixing_close(VGMSTREAM* vgmstream);
void mixing_update_channel(VGMSTREAM* vgmstream);
/* Call to let vgmstream apply mixing, which must handle input/output_channels.
* Once mixing is active any new mixes are ignored (to avoid the possibility
* of down/upmixing without querying input/output_channels). */
void mixing_setup(VGMSTREAM * vgmstream, int32_t max_sample_count);
/* gets current mixing info */
void mixing_info(VGMSTREAM * vgmstream, int *input_channels, int *output_channels);
/* adds mixes filtering and optimizing if needed */
void mixing_push_swap(VGMSTREAM* vgmstream, int ch_dst, int ch_src);
void mixing_push_add(VGMSTREAM* vgmstream, int ch_dst, int ch_src, double volume);
void mixing_push_volume(VGMSTREAM* vgmstream, int ch_dst, double volume);
void mixing_push_limit(VGMSTREAM* vgmstream, int ch_dst, double volume);
void mixing_push_upmix(VGMSTREAM* vgmstream, int ch_dst);
void mixing_push_downmix(VGMSTREAM* vgmstream, int ch_dst);
void mixing_push_killmix(VGMSTREAM* vgmstream, int ch_dst);
void mixing_push_fade(VGMSTREAM* vgmstream, int ch_dst, double vol_start, double vol_end, char shape, int32_t time_pre, int32_t time_start, int32_t time_end, int32_t time_post);
void mixing_macro_volume(VGMSTREAM* vgmstream, double volume, uint32_t mask);
void mixing_macro_track(VGMSTREAM* vgmstream, uint32_t mask);
void mixing_macro_layer(VGMSTREAM* vgmstream, int max, uint32_t mask, char mode);
void mixing_macro_crosstrack(VGMSTREAM* vgmstream, int max);
void mixing_macro_crosslayer(VGMSTREAM* vgmstream, int max, char mode);
void mixing_macro_downmix(VGMSTREAM* vgmstream, int max /*, mapping_t output_mapping*/);
#endif /* _MIXING_H_ */
#ifndef _MIXING_H_
#define _MIXING_H_
#include "vgmstream.h"
/* Applies mixing commands to the sample buffer. Mixing must be externally enabled and
* outbuf must big enough to hold output_channels*samples_to_do */
void mix_vgmstream(sample_t *outbuf, int32_t sample_count, VGMSTREAM* vgmstream);
/* internal mixing pre-setup for vgmstream (doesn't imply usage).
* If init somehow fails next calls are ignored. */
void mixing_init(VGMSTREAM* vgmstream);
void mixing_close(VGMSTREAM* vgmstream);
void mixing_update_channel(VGMSTREAM* vgmstream);
/* Call to let vgmstream apply mixing, which must handle input/output_channels.
* Once mixing is active any new mixes are ignored (to avoid the possibility
* of down/upmixing without querying input/output_channels). */
void mixing_setup(VGMSTREAM * vgmstream, int32_t max_sample_count);
/* gets current mixing info */
void mixing_info(VGMSTREAM * vgmstream, int *input_channels, int *output_channels);
/* adds mixes filtering and optimizing if needed */
void mixing_push_swap(VGMSTREAM* vgmstream, int ch_dst, int ch_src);
void mixing_push_add(VGMSTREAM* vgmstream, int ch_dst, int ch_src, double volume);
void mixing_push_volume(VGMSTREAM* vgmstream, int ch_dst, double volume);
void mixing_push_limit(VGMSTREAM* vgmstream, int ch_dst, double volume);
void mixing_push_upmix(VGMSTREAM* vgmstream, int ch_dst);
void mixing_push_downmix(VGMSTREAM* vgmstream, int ch_dst);
void mixing_push_killmix(VGMSTREAM* vgmstream, int ch_dst);
void mixing_push_fade(VGMSTREAM* vgmstream, int ch_dst, double vol_start, double vol_end, char shape, int32_t time_pre, int32_t time_start, int32_t time_end, int32_t time_post);
void mixing_macro_volume(VGMSTREAM* vgmstream, double volume, uint32_t mask);
void mixing_macro_track(VGMSTREAM* vgmstream, uint32_t mask);
void mixing_macro_layer(VGMSTREAM* vgmstream, int max, uint32_t mask, char mode);
void mixing_macro_crosstrack(VGMSTREAM* vgmstream, int max);
void mixing_macro_crosslayer(VGMSTREAM* vgmstream, int max, char mode);
void mixing_macro_downmix(VGMSTREAM* vgmstream, int max /*, mapping_t output_mapping*/);
#endif /* _MIXING_H_ */

View File

@ -1,344 +1,344 @@
#include "vgmstream.h"
#include "plugins.h"
#include "mixing.h"
/* ****************************************** */
/* CONTEXT: simplifies plugin code */
/* ****************************************** */
int vgmstream_ctx_is_valid(const char* filename, vgmstream_ctx_valid_cfg *cfg) {
const char ** extension_list;
size_t extension_list_len;
const char *extension;
int i;
if (cfg->is_extension) {
extension = filename;
} else {
extension = filename_extension(filename);
}
/* some metas accept extensionless files */
if (strlen(extension) <= 0) {
return !cfg->reject_extensionless;
}
/* try in default list */
if (!cfg->skip_standard) {
extension_list = vgmstream_get_formats(&extension_list_len);
for (i = 0; i < extension_list_len; i++) {
if (strcasecmp(extension, extension_list[i]) == 0) {
return 1;
}
}
}
/* try in common extensions */
if (cfg->accept_common) {
extension_list = vgmstream_get_common_formats(&extension_list_len);
for (i = 0; i < extension_list_len; i++) {
if (strcasecmp(extension, extension_list[i]) == 0)
return 1;
}
}
/* allow anything not in the normal list but not in common extensions */
if (cfg->accept_unknown) {
int is_common = 0;
extension_list = vgmstream_get_common_formats(&extension_list_len);
for (i = 0; i < extension_list_len; i++) {
if (strcasecmp(extension, extension_list[i]) == 0) {
is_common = 1;
break;
}
}
if (!is_common)
return 1;
}
return 0;
}
/* ****************************************** */
/* TAGS: loads key=val tags from a file */
/* ****************************************** */
#define VGMSTREAM_TAGS_LINE_MAX 2048
/* opaque tag state */
struct VGMSTREAM_TAGS {
/* extracted output */
char key[VGMSTREAM_TAGS_LINE_MAX];
char val[VGMSTREAM_TAGS_LINE_MAX];
/* file to find tags for */
int targetname_len;
char targetname[VGMSTREAM_TAGS_LINE_MAX];
/* path of targetname */
char targetpath[VGMSTREAM_TAGS_LINE_MAX];
/* tag section for filename (see comments below) */
int section_found;
off_t section_start;
off_t section_end;
off_t offset;
/* commands */
int autotrack_on;
int autotrack_written;
int track_count;
int autoalbum_on;
int autoalbum_written;
};
static void tags_clean(VGMSTREAM_TAGS* tag) {
int i;
int val_len = strlen(tag->val);
/* remove trailing spaces */
for (i = val_len - 1; i > 0; i--) {
if (tag->val[i] != ' ')
break;
tag->val[i] = '\0';
}
}
VGMSTREAM_TAGS* vgmstream_tags_init(const char* *tag_key, const char* *tag_val) {
VGMSTREAM_TAGS* tags = malloc(sizeof(VGMSTREAM_TAGS));
if (!tags) goto fail;
*tag_key = tags->key;
*tag_val = tags->val;
return tags;
fail:
return NULL;
}
void vgmstream_tags_close(VGMSTREAM_TAGS *tags) {
free(tags);
}
/* Find next tag and return 1 if found.
*
* Tags can be "global" @TAGS, "command" $TAGS, and "file" %TAGS for a target filename.
* To extract tags we must find either global tags, or the filename's tag "section"
* where tags apply: (# @TAGS ) .. (other_filename) ..(# %TAGS section).. (target_filename).
* When a new "other_filename" is found that offset is marked as section_start, and when
* target_filename is found it's marked as section_end. Then we can begin extracting tags
* within that section, until all tags are exhausted. Global tags are extracted as found,
* so they always go first, also meaning any tags after file's section are ignored.
* Command tags have special meanings and are output after all section tags. */
int vgmstream_tags_next_tag(VGMSTREAM_TAGS* tags, STREAMFILE* tagfile) {
off_t file_size = get_streamfile_size(tagfile);
char currentname[VGMSTREAM_TAGS_LINE_MAX] = {0};
char line[VGMSTREAM_TAGS_LINE_MAX];
int ok, bytes_read, line_ok, n1,n2;
if (!tags)
return 0;
/* prepare file start and skip BOM if needed */
if (tags->offset == 0) {
if ((uint16_t)read_16bitLE(0x00, tagfile) == 0xFFFE ||
(uint16_t)read_16bitLE(0x00, tagfile) == 0xFEFF) {
tags->offset = 0x02;
if (tags->section_start == 0)
tags->section_start = 0x02;
}
else if (((uint32_t)read_32bitBE(0x00, tagfile) & 0xFFFFFF00) == 0xEFBBBF00) {
tags->offset = 0x03;
if (tags->section_start == 0)
tags->section_start = 0x03;
}
}
/* read lines */
while (tags->offset <= file_size) {
/* after section: no more tags to extract */
if (tags->section_found && tags->offset >= tags->section_end) {
/* write extra tags after all regular tags */
if (tags->autotrack_on && !tags->autotrack_written) {
sprintf(tags->key, "%s", "TRACK");
sprintf(tags->val, "%i", tags->track_count);
tags->autotrack_written = 1;
return 1;
}
if (tags->autoalbum_on && !tags->autoalbum_written && tags->targetpath[0] != '\0') {
const char* path;
path = strrchr(tags->targetpath,'\\');
if (!path) {
path = strrchr(tags->targetpath,'/');
}
if (!path) {
path = tags->targetpath;
}
sprintf(tags->key, "%s", "ALBUM");
sprintf(tags->val, "%s", path+1);
tags->autoalbum_written = 1;
return 1;
}
goto fail;
}
bytes_read = read_line(line, sizeof(line), tags->offset, tagfile, &line_ok);
if (!line_ok || bytes_read == 0) goto fail;
tags->offset += bytes_read;
if (tags->section_found) {
/* find possible file tag */
ok = sscanf(line, "# %%%[^ \t] %[^\r\n] ", tags->key,tags->val);
if (ok == 2) {
tags_clean(tags);
return 1;
}
}
else {
if (line[0] == '#') {
/* find possible global command */
ok = sscanf(line, "# $%[^ \t] %[^\r\n]", tags->key,tags->val);
if (ok == 1 || ok == 2) {
if (strcasecmp(tags->key,"AUTOTRACK") == 0) {
tags->autotrack_on = 1;
}
else if (strcasecmp(tags->key,"AUTOALBUM") == 0) {
tags->autoalbum_on = 1;
}
continue; /* not an actual tag */
}
/* find possible global tag */
ok = sscanf(line, "# @%[^ \t] %[^\r\n]", tags->key,tags->val);
if (ok == 2) {
tags_clean(tags);
return 1;
}
continue; /* next line */
}
/* find possible filename and section start/end
* (.m3u seem to allow filenames with whitespaces before, make sure to trim) */
ok = sscanf(line, " %n%[^\r\n]%n ", &n1, currentname, &n2);
if (ok == 1) {
int currentname_len = n2 - n1;
int filename_found = 0;
/* we want to find file with the same name (case insensitive), OR a virtual .txtp with
* the filename inside (so 'file.adx' gets tags from 'file.adx#i.txtp', reading
* tags even if we don't open !tags.m3u with virtual .txtp directly) */
/* strcasecmp works ok even for UTF-8 */
if (currentname_len >= tags->targetname_len && /* starts with targetname */
strncasecmp(currentname, tags->targetname, tags->targetname_len) == 0) {
if (currentname_len == tags->targetname_len) { /* exact match */
filename_found = 1;
}
else if (vgmstream_is_virtual_filename(currentname)) { /* ends with .txth */
char c = currentname[tags->targetname_len];
/* tell apart the unlikely case of having both 'bgm01.ad.txtp' and 'bgm01.adp.txtp' */
filename_found = (c==' ' || c == '.' || c == '#');
}
}
if (filename_found) {
/* section ok, start would be set before this (or be 0) */
tags->section_end = tags->offset;
tags->section_found = 1;
tags->offset = tags->section_start;
}
else {
/* mark new possible section */
tags->section_start = tags->offset;
}
tags->track_count++; /* new track found (target filename or not) */
continue;
}
/* empty/bad line, probably */
}
}
/* may reach here if read up to file_size but no section was found */
fail:
tags->key[0] = '\0';
tags->val[0] = '\0';
return 0;
}
void vgmstream_tags_reset(VGMSTREAM_TAGS* tags, const char* target_filename) {
char *path;
if (!tags)
return;
memset(tags, 0, sizeof(VGMSTREAM_TAGS));
//todo validate sizes and copy sensible max
/* get base name */
strcpy(tags->targetpath, target_filename);
/* Windows CMD accepts both \\ and /, and maybe plugin uses either */
path = strrchr(tags->targetpath,'\\');
if (!path) {
path = strrchr(tags->targetpath,'/');
}
if (path != NULL) {
path[0] = '\0'; /* leave targetpath with path only */
path = path+1;
}
if (path) {
strcpy(tags->targetname, path);
} else {
tags->targetpath[0] = '\0';
strcpy(tags->targetname, target_filename);
}
tags->targetname_len = strlen(tags->targetname);
}
/* ****************************************** */
/* MIXING: modifies vgmstream output */
/* ****************************************** */
void vgmstream_mixing_enable(VGMSTREAM* vgmstream, int32_t max_sample_count, int *input_channels, int *output_channels) {
mixing_setup(vgmstream, max_sample_count);
mixing_info(vgmstream, input_channels, output_channels);
}
void vgmstream_mixing_autodownmix(VGMSTREAM *vgmstream, int max_channels) {
if (max_channels <= 0)
return;
/* guess mixing the best we can, using standard downmixing if possible
* (without mapping we can't be sure if format is using a standard layout) */
if (vgmstream->channel_layout && max_channels <= 2) {
mixing_macro_downmix(vgmstream, max_channels);
}
else {
mixing_macro_layer(vgmstream, max_channels, 0, 'e');
}
return;
}
#include "vgmstream.h"
#include "plugins.h"
#include "mixing.h"
/* ****************************************** */
/* CONTEXT: simplifies plugin code */
/* ****************************************** */
int vgmstream_ctx_is_valid(const char* filename, vgmstream_ctx_valid_cfg *cfg) {
const char ** extension_list;
size_t extension_list_len;
const char *extension;
int i;
if (cfg->is_extension) {
extension = filename;
} else {
extension = filename_extension(filename);
}
/* some metas accept extensionless files */
if (strlen(extension) <= 0) {
return !cfg->reject_extensionless;
}
/* try in default list */
if (!cfg->skip_standard) {
extension_list = vgmstream_get_formats(&extension_list_len);
for (i = 0; i < extension_list_len; i++) {
if (strcasecmp(extension, extension_list[i]) == 0) {
return 1;
}
}
}
/* try in common extensions */
if (cfg->accept_common) {
extension_list = vgmstream_get_common_formats(&extension_list_len);
for (i = 0; i < extension_list_len; i++) {
if (strcasecmp(extension, extension_list[i]) == 0)
return 1;
}
}
/* allow anything not in the normal list but not in common extensions */
if (cfg->accept_unknown) {
int is_common = 0;
extension_list = vgmstream_get_common_formats(&extension_list_len);
for (i = 0; i < extension_list_len; i++) {
if (strcasecmp(extension, extension_list[i]) == 0) {
is_common = 1;
break;
}
}
if (!is_common)
return 1;
}
return 0;
}
/* ****************************************** */
/* TAGS: loads key=val tags from a file */
/* ****************************************** */
#define VGMSTREAM_TAGS_LINE_MAX 2048
/* opaque tag state */
struct VGMSTREAM_TAGS {
/* extracted output */
char key[VGMSTREAM_TAGS_LINE_MAX];
char val[VGMSTREAM_TAGS_LINE_MAX];
/* file to find tags for */
int targetname_len;
char targetname[VGMSTREAM_TAGS_LINE_MAX];
/* path of targetname */
char targetpath[VGMSTREAM_TAGS_LINE_MAX];
/* tag section for filename (see comments below) */
int section_found;
off_t section_start;
off_t section_end;
off_t offset;
/* commands */
int autotrack_on;
int autotrack_written;
int track_count;
int autoalbum_on;
int autoalbum_written;
};
static void tags_clean(VGMSTREAM_TAGS* tag) {
int i;
int val_len = strlen(tag->val);
/* remove trailing spaces */
for (i = val_len - 1; i > 0; i--) {
if (tag->val[i] != ' ')
break;
tag->val[i] = '\0';
}
}
VGMSTREAM_TAGS* vgmstream_tags_init(const char* *tag_key, const char* *tag_val) {
VGMSTREAM_TAGS* tags = malloc(sizeof(VGMSTREAM_TAGS));
if (!tags) goto fail;
*tag_key = tags->key;
*tag_val = tags->val;
return tags;
fail:
return NULL;
}
void vgmstream_tags_close(VGMSTREAM_TAGS *tags) {
free(tags);
}
/* Find next tag and return 1 if found.
*
* Tags can be "global" @TAGS, "command" $TAGS, and "file" %TAGS for a target filename.
* To extract tags we must find either global tags, or the filename's tag "section"
* where tags apply: (# @TAGS ) .. (other_filename) ..(# %TAGS section).. (target_filename).
* When a new "other_filename" is found that offset is marked as section_start, and when
* target_filename is found it's marked as section_end. Then we can begin extracting tags
* within that section, until all tags are exhausted. Global tags are extracted as found,
* so they always go first, also meaning any tags after file's section are ignored.
* Command tags have special meanings and are output after all section tags. */
int vgmstream_tags_next_tag(VGMSTREAM_TAGS* tags, STREAMFILE* tagfile) {
off_t file_size = get_streamfile_size(tagfile);
char currentname[VGMSTREAM_TAGS_LINE_MAX] = {0};
char line[VGMSTREAM_TAGS_LINE_MAX];
int ok, bytes_read, line_ok, n1,n2;
if (!tags)
return 0;
/* prepare file start and skip BOM if needed */
if (tags->offset == 0) {
if ((uint16_t)read_16bitLE(0x00, tagfile) == 0xFFFE ||
(uint16_t)read_16bitLE(0x00, tagfile) == 0xFEFF) {
tags->offset = 0x02;
if (tags->section_start == 0)
tags->section_start = 0x02;
}
else if (((uint32_t)read_32bitBE(0x00, tagfile) & 0xFFFFFF00) == 0xEFBBBF00) {
tags->offset = 0x03;
if (tags->section_start == 0)
tags->section_start = 0x03;
}
}
/* read lines */
while (tags->offset <= file_size) {
/* after section: no more tags to extract */
if (tags->section_found && tags->offset >= tags->section_end) {
/* write extra tags after all regular tags */
if (tags->autotrack_on && !tags->autotrack_written) {
sprintf(tags->key, "%s", "TRACK");
sprintf(tags->val, "%i", tags->track_count);
tags->autotrack_written = 1;
return 1;
}
if (tags->autoalbum_on && !tags->autoalbum_written && tags->targetpath[0] != '\0') {
const char* path;
path = strrchr(tags->targetpath,'\\');
if (!path) {
path = strrchr(tags->targetpath,'/');
}
if (!path) {
path = tags->targetpath;
}
sprintf(tags->key, "%s", "ALBUM");
sprintf(tags->val, "%s", path+1);
tags->autoalbum_written = 1;
return 1;
}
goto fail;
}
bytes_read = read_line(line, sizeof(line), tags->offset, tagfile, &line_ok);
if (!line_ok || bytes_read == 0) goto fail;
tags->offset += bytes_read;
if (tags->section_found) {
/* find possible file tag */
ok = sscanf(line, "# %%%[^ \t] %[^\r\n] ", tags->key,tags->val);
if (ok == 2) {
tags_clean(tags);
return 1;
}
}
else {
if (line[0] == '#') {
/* find possible global command */
ok = sscanf(line, "# $%[^ \t] %[^\r\n]", tags->key,tags->val);
if (ok == 1 || ok == 2) {
if (strcasecmp(tags->key,"AUTOTRACK") == 0) {
tags->autotrack_on = 1;
}
else if (strcasecmp(tags->key,"AUTOALBUM") == 0) {
tags->autoalbum_on = 1;
}
continue; /* not an actual tag */
}
/* find possible global tag */
ok = sscanf(line, "# @%[^ \t] %[^\r\n]", tags->key,tags->val);
if (ok == 2) {
tags_clean(tags);
return 1;
}
continue; /* next line */
}
/* find possible filename and section start/end
* (.m3u seem to allow filenames with whitespaces before, make sure to trim) */
ok = sscanf(line, " %n%[^\r\n]%n ", &n1, currentname, &n2);
if (ok == 1) {
int currentname_len = n2 - n1;
int filename_found = 0;
/* we want to find file with the same name (case insensitive), OR a virtual .txtp with
* the filename inside (so 'file.adx' gets tags from 'file.adx#i.txtp', reading
* tags even if we don't open !tags.m3u with virtual .txtp directly) */
/* strcasecmp works ok even for UTF-8 */
if (currentname_len >= tags->targetname_len && /* starts with targetname */
strncasecmp(currentname, tags->targetname, tags->targetname_len) == 0) {
if (currentname_len == tags->targetname_len) { /* exact match */
filename_found = 1;
}
else if (vgmstream_is_virtual_filename(currentname)) { /* ends with .txth */
char c = currentname[tags->targetname_len];
/* tell apart the unlikely case of having both 'bgm01.ad.txtp' and 'bgm01.adp.txtp' */
filename_found = (c==' ' || c == '.' || c == '#');
}
}
if (filename_found) {
/* section ok, start would be set before this (or be 0) */
tags->section_end = tags->offset;
tags->section_found = 1;
tags->offset = tags->section_start;
}
else {
/* mark new possible section */
tags->section_start = tags->offset;
}
tags->track_count++; /* new track found (target filename or not) */
continue;
}
/* empty/bad line, probably */
}
}
/* may reach here if read up to file_size but no section was found */
fail:
tags->key[0] = '\0';
tags->val[0] = '\0';
return 0;
}
void vgmstream_tags_reset(VGMSTREAM_TAGS* tags, const char* target_filename) {
char *path;
if (!tags)
return;
memset(tags, 0, sizeof(VGMSTREAM_TAGS));
//todo validate sizes and copy sensible max
/* get base name */
strcpy(tags->targetpath, target_filename);
/* Windows CMD accepts both \\ and /, and maybe plugin uses either */
path = strrchr(tags->targetpath,'\\');
if (!path) {
path = strrchr(tags->targetpath,'/');
}
if (path != NULL) {
path[0] = '\0'; /* leave targetpath with path only */
path = path+1;
}
if (path) {
strcpy(tags->targetname, path);
} else {
tags->targetpath[0] = '\0';
strcpy(tags->targetname, target_filename);
}
tags->targetname_len = strlen(tags->targetname);
}
/* ****************************************** */
/* MIXING: modifies vgmstream output */
/* ****************************************** */
void vgmstream_mixing_enable(VGMSTREAM* vgmstream, int32_t max_sample_count, int *input_channels, int *output_channels) {
mixing_setup(vgmstream, max_sample_count);
mixing_info(vgmstream, input_channels, output_channels);
}
void vgmstream_mixing_autodownmix(VGMSTREAM *vgmstream, int max_channels) {
if (max_channels <= 0)
return;
/* guess mixing the best we can, using standard downmixing if possible
* (without mapping we can't be sure if format is using a standard layout) */
if (vgmstream->channel_layout && max_channels <= 2) {
mixing_macro_downmix(vgmstream, max_channels);
}
else {
mixing_macro_layer(vgmstream, max_channels, 0, 'e');
}
return;
}

View File

@ -1,106 +1,106 @@
/*
* plugins.h - helper for plugins
*/
#ifndef _PLUGINS_H_
#define _PLUGINS_H_
#include "streamfile.h"
/* ****************************************** */
/* CONTEXT: simplifies plugin code */
/* ****************************************** */
typedef struct {
int is_extension; /* set if filename is already an extension */
int skip_standard; /* set if shouldn't check standard formats */
int reject_extensionless; /* set if player can't play extensionless files */
int accept_unknown; /* set to allow any extension (for txth) */
int accept_common; /* set to allow known-but-common extension (when player has plugin priority) */
} vgmstream_ctx_valid_cfg;
/* returns if vgmstream can parse file by extension */
int vgmstream_ctx_is_valid(const char* filename, vgmstream_ctx_valid_cfg *cfg);
#if 0
/* opaque player state */
typedef struct VGMSTREAM_CTX VGMSTREAM_CTX;
typedef struct {
//...
} VGMSTREAM_CTX_INFO;
VGMSTREAM_CTX* vgmstream_ctx_init(...);
VGMSTREAM_CTX* vgmstream_ctx_format_check(...);
VGMSTREAM_CTX* vgmstream_ctx_set_format_whilelist(...);
VGMSTREAM_CTX* vgmstream_ctx_set_format_blacklist(...);
VGMSTREAM_CTX* vgmstream_ctx_set_file(...);
VGMSTREAM_CTX* vgmstream_ctx_get_config(...);
VGMSTREAM_CTX* vgmstream_ctx_set_config(...);
VGMSTREAM_CTX* vgmstream_ctx_get_buffer(...);
VGMSTREAM_CTX* vgmstream_ctx_get_info(...);
VGMSTREAM_CTX* vgmstream_ctx_describe(...);
VGMSTREAM_CTX* vgmstream_ctx_get_title(...);
VGMSTREAM_CTX* vgmstream_ctx_get_tagfile(...);
VGMSTREAM_CTX* vgmstream_ctx_play(...);
VGMSTREAM_CTX* vgmstream_ctx_seek(...);
VGMSTREAM_CTX* vgmstream_ctx_close(...);
#endif
/* ****************************************** */
/* TAGS: loads key=val tags from a file */
/* ****************************************** */
/* opaque tag state */
typedef struct VGMSTREAM_TAGS VGMSTREAM_TAGS;
/* Initializes TAGS and returns pointers to extracted strings (always valid but change
* on every vgmstream_tags_next_tag call). Next functions are safe to call even if this fails (validate NULL).
* ex.: const char *tag_key, *tag_val; tags=vgmstream_tags_init(&tag_key, &tag_val); */
VGMSTREAM_TAGS* vgmstream_tags_init(const char* *tag_key, const char* *tag_val);
/* Resets tagfile to restart reading from the beginning for a new filename.
* Must be called first before extracting tags. */
void vgmstream_tags_reset(VGMSTREAM_TAGS* tags, const char* target_filename);
/* Extracts next valid tag in tagfile to *tag. Returns 0 if no more tags are found (meant to be
* called repeatedly until 0). Key/values are trimmed and values can be in UTF-8. */
int vgmstream_tags_next_tag(VGMSTREAM_TAGS* tags, STREAMFILE* tagfile);
/* Closes tag file */
void vgmstream_tags_close(VGMSTREAM_TAGS* tags);
/* ****************************************** */
/* MIXING: modifies vgmstream output */
/* ****************************************** */
/* Enables mixing effects, with max outbuf samples as a hint. Once active, plugin
* must use returned input_channels to create outbuf and output_channels to output audio.
* max_sample_count may be 0 if you only need to query values and not actually enable it.
* Needs to be enabled last after adding effects. */
void vgmstream_mixing_enable(VGMSTREAM* vgmstream, int32_t max_sample_count, int *input_channels, int *output_channels);
/* sets automatic downmixing if vgmstream's channels are higher than max_channels */
void vgmstream_mixing_autodownmix(VGMSTREAM *vgmstream, int max_channels);
/* sets a fadeout */
//void vgmstream_mixing_fadeout(VGMSTREAM *vgmstream, float start_second, float duration_seconds);
#endif /* _PLUGINS_H_ */
/*
* plugins.h - helper for plugins
*/
#ifndef _PLUGINS_H_
#define _PLUGINS_H_
#include "streamfile.h"
/* ****************************************** */
/* CONTEXT: simplifies plugin code */
/* ****************************************** */
typedef struct {
int is_extension; /* set if filename is already an extension */
int skip_standard; /* set if shouldn't check standard formats */
int reject_extensionless; /* set if player can't play extensionless files */
int accept_unknown; /* set to allow any extension (for txth) */
int accept_common; /* set to allow known-but-common extension (when player has plugin priority) */
} vgmstream_ctx_valid_cfg;
/* returns if vgmstream can parse file by extension */
int vgmstream_ctx_is_valid(const char* filename, vgmstream_ctx_valid_cfg *cfg);
#if 0
/* opaque player state */
typedef struct VGMSTREAM_CTX VGMSTREAM_CTX;
typedef struct {
//...
} VGMSTREAM_CTX_INFO;
VGMSTREAM_CTX* vgmstream_ctx_init(...);
VGMSTREAM_CTX* vgmstream_ctx_format_check(...);
VGMSTREAM_CTX* vgmstream_ctx_set_format_whilelist(...);
VGMSTREAM_CTX* vgmstream_ctx_set_format_blacklist(...);
VGMSTREAM_CTX* vgmstream_ctx_set_file(...);
VGMSTREAM_CTX* vgmstream_ctx_get_config(...);
VGMSTREAM_CTX* vgmstream_ctx_set_config(...);
VGMSTREAM_CTX* vgmstream_ctx_get_buffer(...);
VGMSTREAM_CTX* vgmstream_ctx_get_info(...);
VGMSTREAM_CTX* vgmstream_ctx_describe(...);
VGMSTREAM_CTX* vgmstream_ctx_get_title(...);
VGMSTREAM_CTX* vgmstream_ctx_get_tagfile(...);
VGMSTREAM_CTX* vgmstream_ctx_play(...);
VGMSTREAM_CTX* vgmstream_ctx_seek(...);
VGMSTREAM_CTX* vgmstream_ctx_close(...);
#endif
/* ****************************************** */
/* TAGS: loads key=val tags from a file */
/* ****************************************** */
/* opaque tag state */
typedef struct VGMSTREAM_TAGS VGMSTREAM_TAGS;
/* Initializes TAGS and returns pointers to extracted strings (always valid but change
* on every vgmstream_tags_next_tag call). Next functions are safe to call even if this fails (validate NULL).
* ex.: const char *tag_key, *tag_val; tags=vgmstream_tags_init(&tag_key, &tag_val); */
VGMSTREAM_TAGS* vgmstream_tags_init(const char* *tag_key, const char* *tag_val);
/* Resets tagfile to restart reading from the beginning for a new filename.
* Must be called first before extracting tags. */
void vgmstream_tags_reset(VGMSTREAM_TAGS* tags, const char* target_filename);
/* Extracts next valid tag in tagfile to *tag. Returns 0 if no more tags are found (meant to be
* called repeatedly until 0). Key/values are trimmed and values can be in UTF-8. */
int vgmstream_tags_next_tag(VGMSTREAM_TAGS* tags, STREAMFILE* tagfile);
/* Closes tag file */
void vgmstream_tags_close(VGMSTREAM_TAGS* tags);
/* ****************************************** */
/* MIXING: modifies vgmstream output */
/* ****************************************** */
/* Enables mixing effects, with max outbuf samples as a hint. Once active, plugin
* must use returned input_channels to create outbuf and output_channels to output audio.
* max_sample_count may be 0 if you only need to query values and not actually enable it.
* Needs to be enabled last after adding effects. */
void vgmstream_mixing_enable(VGMSTREAM* vgmstream, int32_t max_sample_count, int *input_channels, int *output_channels);
/* sets automatic downmixing if vgmstream's channels are higher than max_channels */
void vgmstream_mixing_autodownmix(VGMSTREAM *vgmstream, int max_channels);
/* sets a fadeout */
//void vgmstream_mixing_fadeout(VGMSTREAM *vgmstream, float start_second, float duration_seconds);
#endif /* _PLUGINS_H_ */

View File

@ -482,6 +482,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_opus_opusnx,
init_vgmstream_opus_sqex,
init_vgmstream_isb,
init_vgmstream_xssb,
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */

View File

@ -715,6 +715,7 @@ typedef enum {
meta_UBI_HX,
meta_BMP_KONAMI,
meta_ISB,
meta_XSSB,
} meta_t;

View File

@ -1,154 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Template|Win32">
<Configuration>Template</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42D86561-8CE4-40F5-86CE-58C986B77502}</ProjectGuid>
<RootNamespace>in_vgmstream</RootNamespace>
<Keyword>Win32Proj</Keyword>
<SccProjectName>
</SccProjectName>
<SccAuxPath>
</SccAuxPath>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<DependenciesDir>../dependencies</DependenciesDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="in_vgmstream.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>
<ProjectReference Include="..\src\libvgmstream.vcxproj">
<Project>{54a6ad11-5369-4895-a06f-e255abb99b11}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Template|Win32">
<Configuration>Template</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{42D86561-8CE4-40F5-86CE-58C986B77502}</ProjectGuid>
<RootNamespace>in_vgmstream</RootNamespace>
<Keyword>Win32Proj</Keyword>
<SccProjectName>
</SccProjectName>
<SccAuxPath>
</SccAuxPath>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<DependenciesDir>../dependencies</DependenciesDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..;../ext_includes;$(DependenciesDir)/qaac/mp4v2/include;$(DependenciesDir)/fdk-aac/libSYS/include;$(DependenciesDir)/fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_VORBIS;VGM_USE_MPEG;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_ATRAC9;VGM_USE_CELT;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;VGM_WINAMP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PreBuildEvent>
<Command>"$(ProjectDir)..\version.bat" "$(ProjectDir)..\version.h" VERSION</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Generating version.h</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="in_vgmstream.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(DependenciesDir)/fdk-aac/msvc/fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="$(DependenciesDir)/qaac/vcproject/mp4v2/mp4v2.vcxproj">
<Project>{86a064e2-c81b-4eee-8be0-a39a2e7c7c76}</Project>
</ProjectReference>
<ProjectReference Include="..\ext_libs\ext_libs.vcxproj">
<Project>{10e6bfc6-1e5b-46e4-ba42-f04dfbd0abff}</Project>
</ProjectReference>
<ProjectReference Include="..\src\libvgmstream.vcxproj">
<Project>{54a6ad11-5369-4895-a06f-e255abb99b11}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="in_vgmstream.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="in_vgmstream.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">