Implemented MP4 AAC support for iOS AKB format

This commit is contained in:
Chris Moeller 2012-08-30 05:35:12 -07:00
parent 469799ef5d
commit f560539e56
7 changed files with 37 additions and 6 deletions

View File

@ -62,7 +62,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../ext_includes;..\..\foobar\foobar2000\SDK;..\..\foobar\foobar2000\helpers;..\..\foobar\foobar2000\ATLHelpers;..\..\foobar\foobar2000\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../ext_includes;..\..\foobar\foobar2000\SDK;..\..\foobar\foobar2000\helpers;..\..\foobar\foobar2000\ATLHelpers;..\..\foobar\foobar2000\shared;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -81,7 +81,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../ext_includes;..\..\foobar\foobar2000\SDK;..\..\foobar\foobar2000\helpers;..\..\foobar\foobar2000\ATLHelpers;..\..\foobar\foobar2000\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../ext_includes;..\..\foobar\foobar2000\SDK;..\..\foobar\foobar2000\helpers;..\..\foobar\foobar2000\ATLHelpers;..\..\foobar\foobar2000\shared;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
@ -114,6 +114,9 @@
<ClCompile Include="in_vgmstream.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\fdk-aac\msvc\fdk-aac.vcxproj">
<Project>{308e2ad5-be31-4770-9441-a8d50f56895c}</Project>
</ProjectReference>
<ProjectReference Include="..\..\foobar\foobar2000\ATLHelpers\foobar2000_ATL_helpers.vcxproj">
<Project>{622e8b19-8109-4717-bd4d-9657aa78363e}</Project>
</ProjectReference>
@ -129,6 +132,9 @@
<ProjectReference Include="..\..\foobar\pfc\pfc.vcxproj">
<Project>{ebfffb4e-261d-44d3-b89c-957b31a0bf9c}</Project>
</ProjectReference>
<ProjectReference Include="..\..\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>

View File

@ -1 +1 @@
#define VERSION "r995"
#define VERSION "r995-1"

View File

@ -53,7 +53,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../ext_includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -67,7 +67,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../ext_includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
@ -90,16 +90,19 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="coding\lsf_decoder.c" />
<ClCompile Include="coding\mp4_aac_decoder.c" />
<ClCompile Include="coding\mtaf_decoder.c" />
<ClCompile Include="layout\ps2_iab_blocked.c" />
<ClCompile Include="layout\ps2_strlr_blocked.c" />
<ClCompile Include="layout\scd_int_layout.c" />
<ClCompile Include="layout\tra_blocked.c" />
<ClCompile Include="meta\akb.c" />
<ClCompile Include="meta\excitebots.c" />
<ClCompile Include="meta\ios_psnd.c" />
<ClCompile Include="meta\lsf.c" />
<ClCompile Include="meta\mattel_hyperscan.c" />
<ClCompile Include="meta\mn_str.c" />
<ClCompile Include="meta\mp4.c" />
<ClCompile Include="meta\ngca.c" />
<ClCompile Include="meta\nub.c" />
<ClCompile Include="meta\pc_adp.c" />

View File

@ -937,5 +937,14 @@
<ClCompile Include="meta\ps3_ivag.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\mp4.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="coding\mp4_aac_decoder.c">
<Filter>coding\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\akb.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -91,12 +91,18 @@ VGMSTREAM * init_vgmstream_mp4_aac_offset(STREAMFILE *streamFile, uint64_t start
aacDecoder_SetParam( aac_file->h_aacdecoder, AAC_PCM_OUTPUT_CHANNELS, 2 );
<<<<<<< HEAD
MP4GetTrackESConfiguration( aac_file->h_mp4file, aac_file->track_id, (uint8_t**)(&buffer), (uint32_t*)(&buffer_size));
ubuffer_size = buffer_size;
if ( aacDecoder_ConfigRaw( aac_file->h_aacdecoder, &buffer, &ubuffer_size ) ) goto fail;
free( buffer ); buffer = NULL;
=======
MP4GetTrackESConfiguration( aac_file->h_mp4file, aac_file->track_id, (uint8_t**)(&aac_file->codec_init_data), (uint32_t*)(&aac_file->codec_init_data_size));
if ( aacDecoder_ConfigRaw( aac_file->h_aacdecoder, &aac_file->codec_init_data, &aac_file->codec_init_data_size ) ) goto fail;
>>>>>>> Implemented MP4 AAC support for iOS AKB format
aac_file->sampleId = 1;
aac_file->numSamples = MP4GetTrackNumberOfSamples( aac_file->h_mp4file, aac_file->track_id );
@ -145,6 +151,7 @@ fail:
if ( aac_file ) {
if ( aac_file->h_aacdecoder ) aacDecoder_Close( aac_file->h_aacdecoder );
if ( aac_file->h_mp4file ) MP4Close( aac_file->h_mp4file, 0 );
if ( aac_file->codec_init_data ) free( aac_file->codec_init_data );
free( aac_file );
}
return NULL;

View File

@ -420,7 +420,7 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
#endif
if (vgmstream->coding_type==coding_MP4_AAC) {
mp4_aac_codec_data *data = vgmstream->codec_data;
data->sampleId = 0;
data->sampleId = 1;
data->sample_ptr = data->samples_per_frame;
data->samples_discard = 0;
}
@ -592,6 +592,7 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
if (data->h_aacdecoder) aacDecoder_Close(data->h_aacdecoder);
if (data->h_mp4file) MP4Close(data->h_mp4file, 0);
if (data->if_file.streamfile) close_streamfile(data->if_file.streamfile);
if (data->codec_init_data) free(data->codec_init_data);
free(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
@ -1579,6 +1580,10 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
data->sampleId = 0;
data->sample_ptr = data->samples_per_frame;
data->samples_discard = vgmstream->loop_sample;
aacDecoder_Close(data->h_aacdecoder);
data->h_aacdecoder = aacDecoder_Open( TT_MP4_RAW, 1 );
aacDecoder_SetParam( data->h_aacdecoder, AAC_PCM_OUTPUT_CHANNELS, 2 );
aacDecoder_ConfigRaw( data->h_aacdecoder, &data->codec_init_data, &data->codec_init_data_size );
}
#ifdef VGM_USE_MPEG
/* won't work for fake MPEG */

View File

@ -772,6 +772,7 @@ typedef struct {
MP4FileHandle h_mp4file;
MP4TrackId track_id;
unsigned long sampleId, numSamples;
uint8_t * codec_init_data;
UINT codec_init_data_size;
HANDLE_AACDECODER h_aacdecoder;
unsigned int sample_ptr, samples_per_frame, samples_discard;