Merge pull request #156 from bxaimc/master

Add Harmonix Music Systems MOGG Vorbis
This commit is contained in:
Christopher Snowhill 2017-12-10 18:16:25 -08:00 committed by GitHub
commit 037ba2e2d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 0 deletions

View File

@ -180,6 +180,7 @@ static const char* extension_list[] = {
"mic",
"mihb",
"mnstr",
"mogg",
//"mp4", //common
//"mpc", //FFmpeg, not parsed (musepack) //common
"mpdsp",
@ -924,6 +925,7 @@ static const meta_info meta_info_list[] = {
{meta_EA_SPS, "Electronic Arts SPS header"},
{meta_NGC_VID1, "Neversoft VID1 header"},
{meta_PC_FLX, "Ultima IX .FLX header"},
{meta_MOGG, "Harmonix Music Systems MOGG Vorbis "},
#ifdef VGM_USE_VORBIS

View File

@ -500,6 +500,10 @@
RelativePath=".\meta\mn_str.c"
>
</File>
<File
RelativePath=".\meta\mogg.c"
>
</File>
<File
RelativePath=".\meta\msvp.c"
>

View File

@ -161,6 +161,7 @@
<ClCompile Include="meta\lsf.c" />
<ClCompile Include="meta\mattel_hyperscan.c" />
<ClCompile Include="meta\mn_str.c" />
<ClCompile Include="meta\mogg.c" />
<ClCompile Include="meta\mp4.c" />
<ClCompile Include="meta\ngca.c" />
<ClCompile Include="meta\nsw_opus.c" />

View File

@ -1240,5 +1240,8 @@
<ClCompile Include="meta\ezw.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\mogg.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -686,4 +686,6 @@ VGMSTREAM * init_vgmstream_ngc_vid1(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_flx(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_mogg(STREAMFILE * streamFile);
#endif /*_META_H*/

42
src/meta/mogg.c Normal file
View File

@ -0,0 +1,42 @@
/*
2017-12-10: Preliminary MOGG Support. As long as the stream is unencrypted, this should be fine.
This will also work on unconventional 5 channel Vorbis streams but some sound cards might not like it.
TODO (Eventually): Add decryption for encrypted MOGG types (Rock Band, etc.)
-bxaimc
*/
#include "meta.h"
#include "../coding/coding.h"
/* MOGG - Harmonix Music Systems (Guitar Hero)[Unencrypted Type] */
VGMSTREAM * init_vgmstream_mogg(STREAMFILE *streamFile) {
#ifdef VGM_USE_VORBIS
char filename[PATH_LIMIT];
off_t start_offset;
/* check extension, case insensitive */
streamFile->get_name(streamFile, filename, sizeof(filename));
if (strcasecmp("mogg", filename_extension(filename))) goto fail;
{
vgm_vorbis_info_t inf;
VGMSTREAM * result = NULL;
memset(&inf, 0, sizeof(inf));
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = meta_MOGG;
start_offset = read_32bitLE(0x04, streamFile);
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);
if (result != NULL) {
return result;
}
}
fail:
/* clean up anything we may have opened */
#endif
return NULL;
}

View File

@ -370,6 +370,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_ea_sps,
init_vgmstream_ngc_vid1,
init_vgmstream_flx,
init_vgmstream_mogg,
init_vgmstream_txth, /* should go at the end (lower priority) */
#ifdef VGM_USE_FFMPEG

View File

@ -637,6 +637,7 @@ typedef enum {
meta_EA_SPS, /* Electronic Arts SPS (Burnout Crash) */
meta_NGC_VID1, /* Neversoft .ogg (Gun GC) */
meta_PC_FLX, /* Ultima IX PC */
meta_MOGG, /* Harmonix Music Systems MOGG Vorbis */
#ifdef VGM_USE_VORBIS
meta_OGG_VORBIS, /* Ogg Vorbis */