Remove layout_ogg and cleanup

Layout was not actually needed, remove to simplify. Rename
vgm_vorbis_info_t to ogg_vorbis_meta_info_t to clarify it's only for
meta, also don't pass filename to init ogg (not useful even as an
optimization since getting the name is a minuscule part in parsing a
meta)
This commit is contained in:
bnnm 2018-03-23 16:34:48 +01:00
parent ea72cb6f7b
commit e2a3590158
12 changed files with 125 additions and 156 deletions

View File

@ -585,9 +585,6 @@ static const layout_info layout_info_list[] = {
{layout_blocked_vgs, "blocked (VGS)"},
{layout_blocked_vawx, "blocked (VAWX)"},
{layout_blocked_xvag_subsong, "blocked (XVAG subsong)"},
#ifdef VGM_USE_VORBIS
{layout_ogg_vorbis, "Ogg"},
#endif
};
static const meta_info meta_info_list[] = {

View File

@ -95,7 +95,6 @@ typedef struct {
int loop_end_found;
int32_t loop_end;
meta_t meta_type;
layout_t layout_type;
off_t stream_size;
int total_subsongs;
@ -106,9 +105,9 @@ typedef struct {
off_t scd_xor_length;
uint32_t sngw_xor;
} vgm_vorbis_info_t;
} ogg_vorbis_meta_info_t;
VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, const char * filename, ov_callbacks *callbacks, off_t other_header_bytes, const vgm_vorbis_info_t *vgm_inf);
VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, ov_callbacks *callbacks, off_t other_header_bytes, const ogg_vorbis_meta_info_t *ovmi);
VGMSTREAM * init_vgmstream_sli_ogg(STREAMFILE * streamFile);
#endif

View File

@ -1,9 +1,9 @@
/*
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.)
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
-bxaimc
*/
#include "meta.h"
@ -12,31 +12,28 @@
/* 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;
off_t start_offset;
/* check extension, case insensitive */
streamFile->get_name(streamFile, filename, sizeof(filename));
if (strcasecmp("mogg", filename_extension(filename))) goto fail;
/* checks */
if (!check_extensions(streamFile, "mogg"))
goto fail;
{
vgm_vorbis_info_t inf;
VGMSTREAM * result = NULL;
{
ogg_vorbis_meta_info_t ovmi = {0};
VGMSTREAM * result = NULL;
memset(&inf, 0, sizeof(inf));
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = meta_MOGG;
ovmi.meta_type = meta_MOGG;
start_offset = read_32bitLE(0x04, streamFile);
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);
start_offset = read_32bitLE(0x04, streamFile);
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
if (result != NULL) {
return result;
}
}
if (result != NULL) {
return result;
}
}
fail:
/* clean up anything we may have opened */
/* clean up anything we may have opened */
#endif
return NULL;
}
return NULL;
}

View File

@ -179,8 +179,7 @@ static void l2sd_ogg_decryption_callback(void *ptr, size_t size, size_t nmemb, v
/* Ogg Vorbis, by way of libvorbisfile; may contain loop comments */
VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
char filename[PATH_LIMIT];
vgm_vorbis_info_t inf = {0};
ogg_vorbis_meta_info_t ovmi = {0};
off_t start_offset = 0;
int is_ogg = 0;
@ -210,7 +209,6 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
} else {
goto fail;
}
streamFile->get_name(streamFile,filename,sizeof(filename));
/* check standard Ogg Vorbis */
if (is_ogg) {
@ -218,11 +216,11 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
/* check Psychic Software obfuscation (Darkwind: War on Wheels PC) */
if (read_32bitBE(0x00,streamFile) == 0x2c444430) {
is_psychic = 1;
inf.decryption_callback = psychic_ogg_decryption_callback;
ovmi.decryption_callback = psychic_ogg_decryption_callback;
}
else if (read_32bitBE(0x00,streamFile) == 0x4C325344) { /* "L2SD" [Lineage II Chronicle 4 (PC)] */
is_l2sd = 1;
inf.decryption_callback = l2sd_ogg_decryption_callback;
ovmi.decryption_callback = l2sd_ogg_decryption_callback;
}
else if (read_32bitBE(0x00,streamFile) != 0x4f676753) { /* "OggS" */
goto fail; /* not known (ex. Wwise) */
@ -232,7 +230,7 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
/* check "Ultramarine3" (???), may be encrypted */
if (is_um3) {
if (read_32bitBE(0x00,streamFile) != 0x4f676753) { /* "OggS" */
inf.decryption_callback = um3_ogg_decryption_callback;
ovmi.decryption_callback = um3_ogg_decryption_callback;
}
}
@ -241,9 +239,9 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
if (read_32bitBE(0x00,streamFile) != 0x4b4f5653) { /* "KOVS" */
goto fail;
}
inf.loop_start = read_32bitLE(0x08,streamFile);
inf.loop_flag = (inf.loop_start != 0);
inf.decryption_callback = kovs_ogg_decryption_callback;
ovmi.loop_start = read_32bitLE(0x08,streamFile);
ovmi.loop_flag = (ovmi.loop_start != 0);
ovmi.decryption_callback = kovs_ogg_decryption_callback;
start_offset = 0x20;
}
@ -251,14 +249,14 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
/* check SNGW (Capcom's MT Framework PC games), may be encrypted */
if (is_sngw) {
if (read_32bitBE(0x00,streamFile) != 0x4f676753) { /* "OggS" */
inf.sngw_xor = read_32bitBE(0x00,streamFile);
inf.decryption_callback = sngw_ogg_decryption_callback;
ovmi.sngw_xor = read_32bitBE(0x00,streamFile);
ovmi.decryption_callback = sngw_ogg_decryption_callback;
}
}
/* check ISD (Gunvolt PC) */
if (is_isd) {
inf.decryption_callback = isd_ogg_decryption_callback;
ovmi.decryption_callback = isd_ogg_decryption_callback;
//todo looping unknown, not in Ogg comments
// game has sound/GV_steam.* files with info about sound/stream/*.isd
@ -271,42 +269,41 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
if (is_um3) {
inf.meta_type = meta_OGG_UM3;
ovmi.meta_type = meta_OGG_UM3;
} else if (is_kovs) {
inf.meta_type = meta_OGG_KOVS;
ovmi.meta_type = meta_OGG_KOVS;
} else if (is_psychic) {
inf.meta_type = meta_OGG_PSYCHIC;
ovmi.meta_type = meta_OGG_PSYCHIC;
} else if (is_sngw) {
inf.meta_type = meta_OGG_SNGW;
ovmi.meta_type = meta_OGG_SNGW;
} else if (is_isd) {
inf.meta_type = meta_OGG_ISD;
ovmi.meta_type = meta_OGG_ISD;
} else if (is_l2sd) {
inf.meta_type = meta_OGG_L2SD;
ovmi.meta_type = meta_OGG_L2SD;
} else {
inf.meta_type = meta_OGG_VORBIS;
ovmi.meta_type = meta_OGG_VORBIS;
}
inf.layout_type = layout_ogg_vorbis;
return init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);
return init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
fail:
return NULL;
}
VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, const char * filename, ov_callbacks *callbacks_p, off_t start, const vgm_vorbis_info_t *vgm_inf) {
VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, ov_callbacks *callbacks_p, off_t start, const ogg_vorbis_meta_info_t *ovmi) {
VGMSTREAM * vgmstream = NULL;
ogg_vorbis_codec_data * data = NULL;
OggVorbis_File *ovf = NULL;
vorbis_info *vi;
int loop_flag = vgm_inf->loop_flag;
int32_t loop_start = vgm_inf->loop_start;
int loop_length_found = vgm_inf->loop_length_found;
int32_t loop_length = vgm_inf->loop_length;
int loop_end_found = vgm_inf->loop_end_found;
int32_t loop_end = vgm_inf->loop_end;
size_t stream_size = vgm_inf->stream_size ?
vgm_inf->stream_size :
int loop_flag = ovmi->loop_flag;
int32_t loop_start = ovmi->loop_start;
int loop_length_found = ovmi->loop_length_found;
int32_t loop_length = ovmi->loop_length;
int loop_end_found = ovmi->loop_end_found;
int32_t loop_end = ovmi->loop_end;
size_t stream_size = ovmi->stream_size ?
ovmi->stream_size :
get_streamfile_size(streamFile) - start;
ov_callbacks default_callbacks;
@ -331,10 +328,10 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, const ch
temp_streamfile.offset = 0;
temp_streamfile.size = stream_size;
temp_streamfile.decryption_callback = vgm_inf->decryption_callback;
temp_streamfile.scd_xor = vgm_inf->scd_xor;
temp_streamfile.scd_xor_length = vgm_inf->scd_xor_length;
temp_streamfile.sngw_xor = vgm_inf->sngw_xor;
temp_streamfile.decryption_callback = ovmi->decryption_callback;
temp_streamfile.scd_xor = ovmi->scd_xor;
temp_streamfile.scd_xor_length = ovmi->scd_xor_length;
temp_streamfile.sngw_xor = ovmi->sngw_xor;
/* open the ogg vorbis file for testing */
memset(&temp_ovf, 0, sizeof(temp_ovf));
@ -348,9 +345,12 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, const ch
/* proceed to init codec_data and reopen a STREAMFILE for this stream */
{
char filename[PATH_LIMIT];
data = calloc(1,sizeof(ogg_vorbis_codec_data));
if (!data) goto fail;
streamFile->get_name(streamFile,filename,sizeof(filename));
data->ov_streamfile.streamfile = streamFile->open(streamFile,filename, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!data->ov_streamfile.streamfile) goto fail;
@ -358,10 +358,10 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, const ch
data->ov_streamfile.offset = 0;
data->ov_streamfile.size = stream_size;
data->ov_streamfile.decryption_callback = vgm_inf->decryption_callback;
data->ov_streamfile.scd_xor = vgm_inf->scd_xor;
data->ov_streamfile.scd_xor_length = vgm_inf->scd_xor_length;
data->ov_streamfile.sngw_xor = vgm_inf->sngw_xor;
data->ov_streamfile.decryption_callback = ovmi->decryption_callback;
data->ov_streamfile.scd_xor = ovmi->scd_xor;
data->ov_streamfile.scd_xor_length = ovmi->scd_xor_length;
data->ov_streamfile.sngw_xor = ovmi->sngw_xor;
/* open the ogg vorbis file for real */
if (ov_open_callbacks(&data->ov_streamfile, &data->ogg_vorbis_file, NULL, 0, *callbacks_p))
@ -441,7 +441,7 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, const ch
vgmstream->codec_data = data; /* store our fun extra datas */
vgmstream->channels = vi->channels;
vgmstream->sample_rate = vi->rate;
vgmstream->num_streams = vgm_inf->total_subsongs;
vgmstream->num_streams = ovmi->total_subsongs;
vgmstream->stream_size = stream_size;
vgmstream->num_samples = ov_pcm_total(ovf,-1); /* let libvorbisfile find total samples */
@ -460,8 +460,8 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, const ch
}
vgmstream->coding_type = coding_OGG_VORBIS;
vgmstream->layout_type = vgm_inf->layout_type;
vgmstream->meta_type = vgm_inf->meta_type;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = ovmi->meta_type;
return vgmstream;

View File

@ -838,15 +838,13 @@ static VGMSTREAM *parse_riff_ogg(STREAMFILE * streamFile, off_t start_offset, si
{
VGMSTREAM *vgmstream = NULL;
STREAMFILE *custom_streamFile = NULL;
char filename[PATH_LIMIT];
vgm_vorbis_info_t inf = {0};
ogg_vorbis_meta_info_t ovmi = {0};
riff_ogg_io_data io_data = {0};
size_t io_data_size = sizeof(riff_ogg_io_data);
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = meta_RIFF_WAVE;
inf.stream_size = real_size;
ovmi.meta_type = meta_RIFF_WAVE;
ovmi.stream_size = real_size;
//inf.loop_flag = 0; /* not observed */
io_data.patch_offset = patch_offset;
@ -854,8 +852,7 @@ static VGMSTREAM *parse_riff_ogg(STREAMFILE * streamFile, off_t start_offset, si
custom_streamFile = open_io_streamfile(open_wrap_streamfile(streamFile), &io_data,io_data_size, riff_ogg_io_read);
if (!custom_streamFile) return NULL;
streamFile->get_name(streamFile,filename,sizeof(filename));
vgmstream = init_vgmstream_ogg_vorbis_callbacks(custom_streamFile, filename, NULL, start_offset, &inf);
vgmstream = init_vgmstream_ogg_vorbis_callbacks(custom_streamFile, NULL, start_offset, &ovmi);
close_streamfile(custom_streamFile);

View File

@ -903,12 +903,11 @@ fail:
/* RSD6OGG */
VGMSTREAM * init_vgmstream_rsd6oogv(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("rsd",filename_extension(filename))) goto fail;
/* check extension */
if (!check_extensions(streamFile, "rsd"))
goto fail;
/* check header */
if (read_32bitBE(0x0,streamFile) != 0x52534436) /* RSD6 */
@ -917,15 +916,13 @@ VGMSTREAM * init_vgmstream_rsd6oogv(STREAMFILE *streamFile) {
goto fail;
{
vgm_vorbis_info_t inf;
ogg_vorbis_meta_info_t ovmi = {0};
VGMSTREAM * result = NULL;
memset(&inf, 0, sizeof(inf));
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = meta_RSD6OOGV;
ovmi.meta_type = meta_RSD6OOGV;
start_offset = 0x800;
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
if (result != NULL) {
return result;

View File

@ -12,8 +12,8 @@ static void scd_ogg_v3_decryption_callback(void *ptr, size_t size, size_t nmemb,
VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset, tables_offset, meta_offset, post_meta_offset, name_offset = 0;
int32_t stream_size, subheader_size, loop_start, loop_end;
off_t start_offset, tables_offset, meta_offset, extradata_offset, name_offset = 0;
int32_t stream_size, extradata_size, loop_start, loop_end;
int loop_flag = 0, channel_count, codec, sample_rate;
int version, target_entry, aux_chunk_count;
@ -113,13 +113,13 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
loop_start = read_32bit(meta_offset+0x10,streamFile);
loop_end = read_32bit(meta_offset+0x14,streamFile);
subheader_size = read_32bit(meta_offset+0x18,streamFile);
extradata_size = read_32bit(meta_offset+0x18,streamFile);
aux_chunk_count = read_32bit(meta_offset+0x1c,streamFile);
/* 0x01e(2): unknown, seen in some FF XIV sfx (MSADPCM) */
loop_flag = (loop_end > 0);
post_meta_offset = meta_offset + 0x20;
start_offset = post_meta_offset + subheader_size;
extradata_offset = meta_offset + 0x20;
start_offset = extradata_offset + extradata_size;
/* only "MARK" chunk is known (some FF XIV PS3 have "STBL" but it's not counted) */
if (aux_chunk_count > 1 && aux_chunk_count < 0xFFFF) { /* some FF XIV Heavensward IMA sfx have 0x01000000 */
@ -128,8 +128,8 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
}
/* skips aux chunks, sometimes needed (Lightning Returns X360, FF XIV PC) */
if (aux_chunk_count && read_32bitBE(post_meta_offset, streamFile) == 0x4D41524B) { /* "MARK" */
post_meta_offset += read_32bit(post_meta_offset+0x04, streamFile);
if (aux_chunk_count && read_32bitBE(extradata_offset, streamFile) == 0x4D41524B) { /* "MARK" */
extradata_offset += read_32bit(extradata_offset+0x04, streamFile);
}
/* find name if possible */
@ -151,41 +151,40 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
if (codec == 0x06) {
VGMSTREAM *ogg_vgmstream;
uint8_t ogg_version, ogg_byte;
vgm_vorbis_info_t inf = {0};
ogg_vorbis_meta_info_t ovmi = {0};
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = meta_SQEX_SCD;
inf.total_subsongs = total_subsongs;
ovmi.meta_type = meta_SQEX_SCD;
ovmi.total_subsongs = total_subsongs;
/* loop values are in bytes, let init_vgmstream_ogg_vorbis find loop comments instead */
ogg_version = read_8bit(post_meta_offset + 0x00, streamFile);
ogg_version = read_8bit(extradata_offset + 0x00, streamFile);
/* 0x01(1): 0x20 in v2/3, this ogg miniheader size? */
ogg_byte = read_8bit(post_meta_offset + 0x02, streamFile);
ogg_byte = read_8bit(extradata_offset + 0x02, streamFile);
/* 0x03(1): ? in v3 */
if (ogg_version == 0) { /* 0x10? header, then custom Vorbis header before regular Ogg (FF XIV PC v1) */
inf.stream_size = stream_size;
ovmi.stream_size = stream_size;
}
else { /* 0x20 header, then seek table */
size_t seek_table_size = read_32bit(post_meta_offset+0x10, streamFile);
size_t vorb_header_size = read_32bit(post_meta_offset+0x14, streamFile);
size_t seek_table_size = read_32bit(extradata_offset+0x10, streamFile);
size_t vorb_header_size = read_32bit(extradata_offset+0x14, streamFile);
/* 0x18(4): ? (can be 0) */
if ((post_meta_offset-meta_offset) + seek_table_size + vorb_header_size != subheader_size)
if ((extradata_offset-meta_offset) + seek_table_size + vorb_header_size != extradata_size)
goto fail;
inf.stream_size = vorb_header_size + stream_size;
start_offset = post_meta_offset + 0x20 + seek_table_size; /* subheader_size skips vorb_header */
ovmi.stream_size = vorb_header_size + stream_size;
start_offset = extradata_offset + 0x20 + seek_table_size; /* extradata_size skips vorb_header */
if (ogg_version == 2) { /* header is XOR'ed using byte (FF XIV PC) */
inf.decryption_callback = scd_ogg_v2_decryption_callback;
inf.scd_xor = ogg_byte;
inf.scd_xor_length = vorb_header_size;
ovmi.decryption_callback = scd_ogg_v2_decryption_callback;
ovmi.scd_xor = ogg_byte;
ovmi.scd_xor_length = vorb_header_size;
}
else if (ogg_version == 3) { /* file is XOR'ed using table (FF XIV Heavensward PC) */
inf.decryption_callback = scd_ogg_v3_decryption_callback;
inf.scd_xor = stream_size & 0xFF; /* ogg_byte not used? */
inf.scd_xor_length = vorb_header_size + stream_size;
ovmi.decryption_callback = scd_ogg_v3_decryption_callback;
ovmi.scd_xor = stream_size & 0xFF; /* ogg_byte not used? */
ovmi.scd_xor_length = vorb_header_size + stream_size;
}
else {
VGM_LOG("SCD: unknown ogg_version 0x%x\n", ogg_version);
@ -193,7 +192,7 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
}
/* actual Ogg init */
ogg_vgmstream = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);
ogg_vgmstream = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
if (ogg_vgmstream && name_offset)
read_string(ogg_vgmstream->stream_name, PATH_LIMIT, name_offset, streamFile);
return ogg_vgmstream;
@ -270,8 +269,8 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
case 0x0C: /* MS ADPCM [Final Fantasy XIV (PC) sfx] */
vgmstream->coding_type = coding_MSADPCM;
vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = read_16bit(post_meta_offset+0x0c,streamFile);
/* in post_meta_offset is a WAVEFORMATEX (including coefs and all) */
vgmstream->interleave_block_size = read_16bit(extradata_offset+0x0c,streamFile);
/* in extradata_offset is a WAVEFORMATEX (including coefs and all) */
vgmstream->num_samples = msadpcm_bytes_to_samples(stream_size, vgmstream->interleave_block_size, vgmstream->channels);
if (loop_flag) {
@ -346,8 +345,8 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
uint8_t buf[200];
int32_t bytes;
/* post_meta_offset+0x00: fmt0x166 header (BE), post_meta_offset+0x34: seek table */
bytes = ffmpeg_make_riff_xma_from_fmt_chunk(buf,200, post_meta_offset,0x34, stream_size, streamFile, 1);
/* extradata_offset+0x00: fmt0x166 header (BE), extradata_offset+0x34: seek table */
bytes = ffmpeg_make_riff_xma_from_fmt_chunk(buf,200, extradata_offset,0x34, stream_size, streamFile, 1);
if (bytes <= 0) goto fail;
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,stream_size);
@ -365,7 +364,7 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
case 0x0E: { /* ATRAC3/ATRAC3plus [Lord of Arcana (PSP), Final Fantasy Type-0] */
ffmpeg_codec_data *ffmpeg_data = NULL;
/* full RIFF header at start_offset/post_meta_offset (same) */
/* full RIFF header at start_offset/extradata_offset (same) */
ffmpeg_data = init_ffmpeg_offset(streamFile, start_offset,stream_size);
if (!ffmpeg_data) goto fail;
vgmstream->codec_data = ffmpeg_data;
@ -401,17 +400,17 @@ VGMSTREAM * init_vgmstream_sqex_scd(STREAMFILE *streamFile) {
/* post header has various typical ATRAC9 values */
cfg.channels = vgmstream->channels;
cfg.config_data = read_32bit(post_meta_offset+0x0c,streamFile);
cfg.encoder_delay = read_32bit(post_meta_offset+0x18,streamFile);
cfg.config_data = read_32bit(extradata_offset+0x0c,streamFile);
cfg.encoder_delay = read_32bit(extradata_offset+0x18,streamFile);
vgmstream->codec_data = init_atrac9(&cfg);
if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_ATRAC9;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = read_32bit(post_meta_offset+0x10,streamFile); /* loop values above are also weird and ignored */
vgmstream->loop_start_sample = read_32bit(post_meta_offset+0x20, streamFile) - (loop_flag ? cfg.encoder_delay : 0); //loop_start
vgmstream->loop_end_sample = read_32bit(post_meta_offset+0x24, streamFile) - (loop_flag ? cfg.encoder_delay : 0); //loop_end
vgmstream->num_samples = read_32bit(extradata_offset+0x10,streamFile); /* loop values above are also weird and ignored */
vgmstream->loop_start_sample = read_32bit(extradata_offset+0x20, streamFile) - (loop_flag ? cfg.encoder_delay : 0); //loop_start
vgmstream->loop_end_sample = read_32bit(extradata_offset+0x24, streamFile) - (loop_flag ? cfg.encoder_delay : 0); //loop_end
break;
}
#endif

View File

@ -187,19 +187,15 @@ VGMSTREAM * init_vgmstream_sqex_sead(STREAMFILE * streamFile) {
#ifdef VGM_USE_VORBIS
case 0x03: { /* OGG [Final Fantasy XV Benchmark sfx (PC)] */
VGMSTREAM *ogg_vgmstream = NULL;
vgm_vorbis_info_t inf = {0};
ogg_vorbis_meta_info_t ovmi = {0};
off_t subfile_offset = extradata_offset + extradata_size;
char filename[PATH_LIMIT];
streamFile->get_name(streamFile,filename,sizeof(filename));
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = vgmstream->meta_type;
inf.total_subsongs = total_subsongs;
inf.stream_size = stream_size;
ovmi.meta_type = vgmstream->meta_type;
ovmi.total_subsongs = total_subsongs;
ovmi.stream_size = stream_size;
/* post header has some kind of repeated values, config/table? */
ogg_vgmstream = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, subfile_offset, &inf);
ogg_vgmstream = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, subfile_offset, &ovmi);
if (ogg_vgmstream) {
ogg_vgmstream->num_streams = vgmstream->num_streams;
ogg_vgmstream->stream_size = vgmstream->stream_size;

View File

@ -213,10 +213,8 @@ fail:
VGMSTREAM * init_vgmstream_ta_aac_mobile(STREAMFILE *streamFile) {
#ifdef VGM_USE_VORBIS
off_t start_offset;
char filename[PATH_LIMIT];
int8_t codec_id;
streamFile->get_name(streamFile, filename, sizeof(filename));
/* check extension, case insensitive */
/* .aac: expected, .laac/ace: for players to avoid hijacking MP4/AAC */
if (!check_extensions(streamFile, "aac,laac,ace"))
@ -231,19 +229,17 @@ VGMSTREAM * init_vgmstream_ta_aac_mobile(STREAMFILE *streamFile) {
codec_id = read_8bit(0x104, streamFile);
if (codec_id == 0xe) /* Vorbis */
{
vgm_vorbis_info_t inf;
ogg_vorbis_meta_info_t ovmi = {0};
VGMSTREAM * result = NULL;
memset(&inf, 0, sizeof(inf));
inf.layout_type = layout_ogg_vorbis;
inf.meta_type = meta_TA_AAC_VORBIS;
inf.loop_start = read_32bitLE(0x140, streamFile);
inf.loop_end = read_32bitLE(0x144, streamFile);
inf.loop_flag = inf.loop_end > inf.loop_start;
inf.loop_end_found = inf.loop_flag;
ovmi.meta_type = meta_TA_AAC_VORBIS;
ovmi.loop_start = read_32bitLE(0x140, streamFile);
ovmi.loop_end = read_32bitLE(0x144, streamFile);
ovmi.loop_flag = ovmi.loop_end > ovmi.loop_start;
ovmi.loop_end_found = ovmi.loop_flag;
start_offset = read_32bitLE(0x120, streamFile);
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);
result = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, start_offset, &ovmi);
if (result != NULL) {
return result;

View File

@ -4,7 +4,7 @@
#define MAX_SEGMENTS 4
/* .WAVE - WayForward "EngineBlack" games, segmented [Shantae and the Pirate's Curse (PC/3DS), TMNT: Danger of the Ooze (PS3/3DS)] */
/* .WAVE - "EngineBlack" games, segmented [Shantae and the Pirate's Curse (PC/3DS), TMNT: Danger of the Ooze (PS3/3DS)] */
VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t segments_offset;
@ -135,18 +135,15 @@ VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE *streamFile) {
}
case 0x04: { /* "vorbis" */
char filename[PATH_LIMIT];
vgm_vorbis_info_t ovi = {0};
ogg_vorbis_meta_info_t ovmi = {0};
segment_offset = read_32bit(table_offset, streamFile);
segment_size = read_32bitBE(segment_offset, streamFile); /* always BE */
ovi.layout_type = layout_ogg_vorbis;
ovi.meta_type = meta_WAVE;
ovi.stream_size = segment_size;
ovmi.meta_type = meta_WAVE;
ovmi.stream_size = segment_size;
streamFile->get_name(streamFile,filename,sizeof(filename));
data->segments[i] = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, segment_offset+0x04, &ovi);
data->segments[i] = init_vgmstream_ogg_vorbis_callbacks(streamFile, NULL, segment_offset+0x04, &ovmi);
if (!data->segments[i]) goto fail;
if (data->segments[i]->num_samples != segment_samples) {

View File

@ -887,9 +887,6 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_interleave_shortblock:
render_vgmstream_interleave(buffer,sample_count,vgmstream);
break;
#ifdef VGM_USE_VORBIS
case layout_ogg_vorbis:
#endif
case layout_none:
render_vgmstream_nolayout(buffer,sample_count,vgmstream);
break;

View File

@ -254,9 +254,6 @@ typedef enum {
layout_segmented, /* song divided in segments, each a complete VGMSTREAM */
layout_scd_int, /* deinterleave done by the SCDINTSTREAMFILE */
#ifdef VGM_USE_VORBIS
layout_ogg_vorbis, /* ogg vorbis file */
#endif
} layout_t;
/* The meta type specifies how we know what we know about the file.