2012-08-30 14:35:12 +02:00
|
|
|
#include "meta.h"
|
2017-05-19 17:21:22 +02:00
|
|
|
#include "../coding/coding.h"
|
2022-07-23 14:49:47 +02:00
|
|
|
#include "sqex_streamfile.h"
|
|
|
|
|
2012-08-30 14:35:12 +02:00
|
|
|
|
2013-06-14 02:42:24 +02:00
|
|
|
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
|
2017-02-12 14:42:02 +01:00
|
|
|
/* AKB (AAC only) - found in SQEX iOS games */
|
2021-07-29 23:20:43 +02:00
|
|
|
VGMSTREAM * init_vgmstream_akb_mp4(STREAMFILE *sf) {
|
2012-08-30 14:35:12 +02:00
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
|
|
|
|
size_t filesize;
|
|
|
|
uint32_t loop_start, loop_end;
|
|
|
|
|
2021-07-29 23:20:43 +02:00
|
|
|
if ((uint32_t)read_32bitBE(0, sf) != 0x414b4220) goto fail;
|
2012-08-30 14:35:12 +02:00
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
loop_start = read_s32le(0x14, sf);
|
|
|
|
loop_end = read_s32le(0x18, sf);
|
2012-08-30 14:35:12 +02:00
|
|
|
|
2021-07-29 23:20:43 +02:00
|
|
|
filesize = get_streamfile_size( sf );
|
2012-08-30 14:35:12 +02:00
|
|
|
|
2021-07-29 23:20:43 +02:00
|
|
|
vgmstream = init_vgmstream_mp4_aac_offset( sf, 0x20, filesize - 0x20 );
|
2012-08-30 14:35:12 +02:00
|
|
|
if ( !vgmstream ) goto fail;
|
|
|
|
|
|
|
|
if ( loop_start || loop_end ) {
|
|
|
|
vgmstream->loop_flag = 1;
|
|
|
|
vgmstream->loop_start_sample = loop_start;
|
|
|
|
vgmstream->loop_end_sample = loop_end;
|
|
|
|
}
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
return NULL;
|
2013-06-14 02:42:24 +02:00
|
|
|
}
|
|
|
|
#endif
|
2017-02-12 14:42:02 +01:00
|
|
|
|
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
/* AKB - found in SQEX 'sdlib' iOS/Android games */
|
|
|
|
VGMSTREAM* init_vgmstream_akb(STREAMFILE* sf) {
|
|
|
|
VGMSTREAM* vgmstream = NULL;
|
2018-03-24 15:40:01 +01:00
|
|
|
off_t start_offset, extradata_offset = 0;
|
|
|
|
size_t stream_size, header_size, subheader_size = 0, extradata_size = 0;
|
2022-07-23 14:49:47 +02:00
|
|
|
int loop_flag = 0, channels, codec, sample_rate, version, flags = 0;
|
2018-03-24 15:40:01 +01:00
|
|
|
int num_samples, loop_start, loop_end;
|
2017-02-12 14:42:02 +01:00
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
|
|
|
|
/* checks */
|
2022-07-23 14:49:47 +02:00
|
|
|
if (!is_id32be(0x00,sf, "AKB "))
|
2017-02-12 14:42:02 +01:00
|
|
|
goto fail;
|
2022-07-23 14:49:47 +02:00
|
|
|
|
|
|
|
if (!check_extensions(sf, "akb"))
|
2018-03-24 15:40:01 +01:00
|
|
|
goto fail;
|
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
version = read_u8(0x04,sf); /* 00=TWEWY, 02=DQs, 03=FFAgito */
|
|
|
|
/* 0x05(1); unused? */
|
|
|
|
header_size = read_u16le(0x06,sf);
|
|
|
|
if (read_u32le(0x08,sf) != get_streamfile_size(sf))
|
|
|
|
goto fail;
|
2017-02-12 14:42:02 +01:00
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
/* material info, though can only hold 1 */
|
|
|
|
codec = read_u8(0x0c,sf);
|
|
|
|
channels = read_u8(0x0d,sf);
|
|
|
|
sample_rate = read_u16le(0x0e,sf);
|
|
|
|
num_samples = read_s32le(0x10,sf);
|
|
|
|
loop_start = read_s32le(0x14,sf);
|
|
|
|
loop_end = read_s32le(0x18,sf);
|
2018-03-24 15:40:01 +01:00
|
|
|
|
|
|
|
/* possibly more complex, see AKB2 */
|
2018-11-17 15:50:20 +01:00
|
|
|
if (header_size >= 0x44) { /* v2+ */
|
2022-07-23 14:49:47 +02:00
|
|
|
extradata_size = read_u16le(0x1c,sf);
|
2018-11-17 15:50:20 +01:00
|
|
|
/* 0x20+: config? (pan, volume) */
|
2022-07-23 14:49:47 +02:00
|
|
|
subheader_size = read_u16le(0x28,sf);
|
2018-11-17 15:50:20 +01:00
|
|
|
/* 0x24: file_id? */
|
2022-07-23 14:49:47 +02:00
|
|
|
/* 0x28: */
|
|
|
|
/* 0x29: */
|
|
|
|
/* 0x2a: */
|
|
|
|
|
|
|
|
/* flags:
|
|
|
|
* 1: (v2+) enable random volume
|
|
|
|
* 2: (v2+) enable random pitch
|
|
|
|
* 4: (v2+) enable random pan
|
|
|
|
* 8: (v3+) encryption (for MS-ADPCM / Ogg) [Final Fantasy Agito (Android)-ogg bgm only, other sounds don't use AKB] */
|
|
|
|
flags = read_u8(0x2B,sf);
|
|
|
|
/* 0x2c: max random volume */
|
|
|
|
/* 0x30: min random volume */
|
|
|
|
/* 0x34: max random pitch */
|
|
|
|
/* 0x38: min random pitch */
|
|
|
|
/* 0x3c: max random pan */
|
|
|
|
/* 0x40: min random pan */
|
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
extradata_offset = header_size + subheader_size;
|
|
|
|
start_offset = extradata_offset + extradata_size;
|
|
|
|
}
|
|
|
|
else { /* v0 */
|
|
|
|
start_offset = header_size;
|
|
|
|
}
|
|
|
|
|
2021-07-29 23:20:43 +02:00
|
|
|
stream_size = get_streamfile_size(sf) - start_offset;
|
2018-11-17 15:50:20 +01:00
|
|
|
loop_flag = (loop_end > loop_start);
|
2017-02-12 14:42:02 +01:00
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
|
2017-02-12 14:42:02 +01:00
|
|
|
/* build the VGMSTREAM */
|
2022-07-23 14:49:47 +02:00
|
|
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
2017-02-12 14:42:02 +01:00
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
vgmstream->meta_type = meta_AKB;
|
2022-07-23 14:49:47 +02:00
|
|
|
vgmstream->sample_rate = sample_rate;
|
2017-04-28 20:10:18 +02:00
|
|
|
|
2017-02-12 14:42:02 +01:00
|
|
|
switch (codec) {
|
2018-11-17 15:50:20 +01:00
|
|
|
case 0x02: { /* MSADPCM [Dragon Quest II (iOS) sfx] */
|
2017-04-28 20:10:18 +02:00
|
|
|
vgmstream->coding_type = coding_MSADPCM;
|
|
|
|
vgmstream->layout_type = layout_none;
|
2022-07-23 14:49:47 +02:00
|
|
|
vgmstream->frame_size = read_u16le(extradata_offset + 0x02,sf);
|
|
|
|
|
|
|
|
/* encryption, untested but should be the same as Ogg */
|
|
|
|
if (version >= 3 && (flags & 8))
|
|
|
|
goto fail;
|
2017-04-28 20:10:18 +02:00
|
|
|
|
2018-11-17 15:50:20 +01:00
|
|
|
/* adjusted samples; bigger or smaller than base samples, akb lib uses these fields instead
|
2017-04-29 16:54:13 +02:00
|
|
|
* (base samples may have more than possible and read over file size otherwise, very strange)
|
|
|
|
* loop_end seems to exist even with loop disabled */
|
2022-07-23 14:49:47 +02:00
|
|
|
vgmstream->num_samples = read_s32le(extradata_offset + 0x04, sf);
|
|
|
|
vgmstream->loop_start_sample = read_s32le(extradata_offset + 0x08, sf);
|
|
|
|
vgmstream->loop_end_sample = read_s32le(extradata_offset + 0x0c, sf);
|
2017-02-12 14:42:02 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
#ifdef VGM_USE_VORBIS
|
2018-03-24 15:40:41 +01:00
|
|
|
case 0x05: { /* Ogg Vorbis [Final Fantasy VI (iOS), Dragon Quest II-VI (iOS)] */
|
2022-07-23 14:49:47 +02:00
|
|
|
STREAMFILE* temp_sf;
|
2018-03-24 15:40:01 +01:00
|
|
|
VGMSTREAM *ogg_vgmstream = NULL;
|
|
|
|
ogg_vorbis_meta_info_t ovmi = {0};
|
|
|
|
|
|
|
|
ovmi.meta_type = vgmstream->meta_type;
|
|
|
|
ovmi.stream_size = stream_size;
|
2018-11-17 15:50:20 +01:00
|
|
|
/* extradata + 0x04: Ogg loop start offset */
|
|
|
|
/* oggs have loop info in the comments */
|
2018-03-24 15:40:01 +01:00
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
/* enable encryption */
|
|
|
|
if (version >= 3 && (flags & 8)) {
|
|
|
|
temp_sf = setup_sqex_streamfile(sf, start_offset, stream_size, 1, 0x00, 0x00, "ogg");
|
|
|
|
if (!temp_sf) goto fail;
|
|
|
|
|
|
|
|
ogg_vgmstream = init_vgmstream_ogg_vorbis_config(temp_sf, 0x00, &ovmi);
|
|
|
|
close_streamfile(temp_sf);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ogg_vgmstream = init_vgmstream_ogg_vorbis_config(sf, start_offset, &ovmi);
|
|
|
|
}
|
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
if (ogg_vgmstream) {
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return ogg_vgmstream;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
#elif defined(VGM_USE_FFMPEG)
|
|
|
|
/* Alt decoding without libvorbis (minor number of beginning samples difference).
|
|
|
|
* Otherwise same output with (inaudible) +-1 lower byte differences due to rounding. */
|
2018-03-24 15:40:41 +01:00
|
|
|
case 0x05: { /* Ogg Vorbis [Final Fantasy VI (iOS), Dragon Quest II-VI (iOS)] */
|
2021-07-29 23:20:43 +02:00
|
|
|
vgmstream->codec_data = init_ffmpeg_offset(sf, start_offset,stream_size);
|
2020-07-16 23:16:52 +02:00
|
|
|
if (!vgmstream->codec_data) goto fail;
|
2017-02-12 14:42:02 +01:00
|
|
|
vgmstream->coding_type = coding_FFmpeg;
|
|
|
|
vgmstream->layout_type = layout_none;
|
|
|
|
/* These oggs have loop info in the comments, too */
|
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
vgmstream->num_samples = num_samples;
|
|
|
|
vgmstream->loop_start_sample = loop_start;
|
|
|
|
vgmstream->loop_end_sample = loop_end;
|
|
|
|
|
2017-02-12 14:42:02 +01:00
|
|
|
break;
|
|
|
|
}
|
2018-03-24 15:40:01 +01:00
|
|
|
#endif
|
2017-02-12 14:42:02 +01:00
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
#ifdef VGM_USE_FFMPEG
|
2018-11-17 15:50:20 +01:00
|
|
|
case 0x06: { /* M4A with AAC [The World Ends with You (iPad)] */
|
2018-03-24 14:22:37 +01:00
|
|
|
/* init_vgmstream_akb_mp4 above has priority, but this works fine too */
|
2021-07-29 23:20:43 +02:00
|
|
|
vgmstream->codec_data = init_ffmpeg_offset(sf, start_offset,stream_size-start_offset);
|
2020-07-16 23:16:52 +02:00
|
|
|
if (!vgmstream->codec_data) goto fail;
|
2017-02-12 14:42:02 +01:00
|
|
|
vgmstream->coding_type = coding_FFmpeg;
|
|
|
|
vgmstream->layout_type = layout_none;
|
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
vgmstream->num_samples = num_samples;
|
|
|
|
vgmstream->loop_start_sample = loop_start;
|
|
|
|
vgmstream->loop_end_sample = loop_end;
|
2018-11-17 15:50:20 +01:00
|
|
|
/* bad total samples (some kind of duration? probably should be loop_end though) */
|
|
|
|
if (loop_flag)
|
|
|
|
vgmstream->num_samples = loop_end+1;
|
2018-03-24 15:40:01 +01:00
|
|
|
|
2018-11-17 15:50:20 +01:00
|
|
|
/* loops are pre-adjusted with 2112 encoder delay (ex. TWEWY B04's loop_start=45) */
|
2017-02-12 14:42:02 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
case 0x01: /* PCM16LE (from debugging, not seen) */
|
2017-02-12 14:42:02 +01:00
|
|
|
default:
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* open the file for reading */
|
2022-07-23 14:49:47 +02:00
|
|
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
2017-02-12 14:42:02 +01:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
/* AKB2 - found in later SQEX 'sdlib' iOS/Android games */
|
|
|
|
VGMSTREAM* init_vgmstream_akb2(STREAMFILE* sf) {
|
|
|
|
VGMSTREAM* vgmstream = NULL;
|
2018-03-24 14:22:37 +01:00
|
|
|
off_t start_offset, material_offset, extradata_offset;
|
|
|
|
size_t material_size, extradata_size, stream_size;
|
2022-07-23 14:49:47 +02:00
|
|
|
int loop_flag = 0, channel_count, flags, codec, sample_rate, num_samples, loop_start, loop_end;
|
2021-07-29 23:20:43 +02:00
|
|
|
int total_subsongs, target_subsong = sf->stream_index;
|
2017-02-12 14:42:02 +01:00
|
|
|
|
|
|
|
|
2018-03-24 14:22:37 +01:00
|
|
|
/* checks */
|
2022-07-23 14:49:47 +02:00
|
|
|
if (!is_id32be(0x00,sf, "AKB2"))
|
2017-02-12 14:42:02 +01:00
|
|
|
goto fail;
|
2022-07-23 14:49:47 +02:00
|
|
|
|
|
|
|
if (!check_extensions(sf, "akb"))
|
2018-03-24 14:22:37 +01:00
|
|
|
goto fail;
|
2022-07-23 14:49:47 +02:00
|
|
|
|
2018-11-17 15:50:20 +01:00
|
|
|
/* 0x04: version */
|
2022-07-23 14:49:47 +02:00
|
|
|
if (read_u32le(0x08,sf) != get_streamfile_size(sf))
|
|
|
|
goto fail;
|
2018-03-24 14:22:37 +01:00
|
|
|
|
|
|
|
/* parse tables */
|
|
|
|
{
|
|
|
|
off_t table_offset;
|
|
|
|
size_t table_size, entry_size;
|
2022-07-23 14:49:47 +02:00
|
|
|
off_t akb_header_size = read_u16le(0x06, sf);
|
|
|
|
int table_count = read_u8(0x0c, sf);
|
2018-03-24 14:22:37 +01:00
|
|
|
|
|
|
|
/* probably each table has its type somewhere, but only seen last table = sound table */
|
|
|
|
if (table_count > 2) /* 2 only seen in some Mobius FF sound banks */
|
|
|
|
goto fail;
|
|
|
|
entry_size = 0x10; /* technically every entry/table has its own size but to simplify... */
|
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
table_offset = read_u32le(akb_header_size + (table_count-1)*entry_size + 0x04, sf);
|
|
|
|
table_size = read_u16le(table_offset + 0x02, sf);
|
2018-03-24 14:22:37 +01:00
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
total_subsongs = read_u8(table_offset + 0x0f, sf); /* can contain 0 entries too */
|
2018-03-24 14:22:37 +01:00
|
|
|
if (target_subsong == 0) target_subsong = 1;
|
|
|
|
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
|
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
material_offset = table_offset + read_u32le(table_offset + table_size + (target_subsong-1)*entry_size + 0x04, sf);
|
2018-03-24 14:22:37 +01:00
|
|
|
}
|
|
|
|
|
2018-11-17 15:50:20 +01:00
|
|
|
/** stream header (material) **/
|
2018-03-24 14:22:37 +01:00
|
|
|
/* 0x00: 0? */
|
2022-07-23 14:49:47 +02:00
|
|
|
codec = read_u8(material_offset+0x01,sf);
|
|
|
|
channel_count = read_u8(material_offset+0x02,sf);
|
|
|
|
flags = read_u8(material_offset+0x03,sf);
|
|
|
|
material_size = read_u16le(material_offset+0x04,sf);
|
|
|
|
sample_rate = read_u16le(material_offset+0x06,sf);
|
|
|
|
stream_size = read_u32le(material_offset+0x08,sf);
|
|
|
|
num_samples = read_s32le(material_offset+0x0c,sf);
|
|
|
|
|
|
|
|
loop_start = read_s32le(material_offset+0x10,sf);
|
|
|
|
loop_end = read_s32le(material_offset+0x14,sf);
|
|
|
|
extradata_size = read_u32le(material_offset+0x18,sf);
|
|
|
|
/* rest: ? (empty, floats or 0x3f80) */
|
2017-04-20 21:21:51 +02:00
|
|
|
|
2018-11-17 15:50:20 +01:00
|
|
|
loop_flag = (loop_end > loop_start);
|
2018-03-24 14:22:37 +01:00
|
|
|
extradata_offset = material_offset + material_size;
|
|
|
|
start_offset = material_offset + material_size + extradata_size;
|
2017-02-12 15:43:57 +01:00
|
|
|
|
2022-07-23 14:49:47 +02:00
|
|
|
/* encrypted, not seen (see AKB flags) */
|
|
|
|
if (flags & 0x08)
|
2018-11-17 15:50:20 +01:00
|
|
|
goto fail;
|
|
|
|
|
2017-02-12 14:42:02 +01:00
|
|
|
|
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
2018-03-24 14:22:37 +01:00
|
|
|
vgmstream->sample_rate = sample_rate;
|
|
|
|
vgmstream->num_streams = total_subsongs;
|
|
|
|
vgmstream->stream_size = stream_size;
|
2017-02-12 14:42:02 +01:00
|
|
|
|
|
|
|
vgmstream->meta_type = meta_AKB;
|
|
|
|
|
|
|
|
switch (codec) {
|
2019-03-30 02:14:18 +01:00
|
|
|
case 0x01: /* PCM16LE [Mobius: Final Fantasy (Android)] */
|
|
|
|
vgmstream->coding_type = coding_PCM16LE;
|
|
|
|
vgmstream->layout_type = layout_interleave;
|
|
|
|
vgmstream->interleave_block_size = 0x02;
|
|
|
|
|
|
|
|
vgmstream->num_samples = num_samples;
|
|
|
|
vgmstream->loop_start_sample = loop_start;
|
|
|
|
vgmstream->loop_end_sample = loop_end;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2018-03-24 14:22:37 +01:00
|
|
|
case 0x02: { /* MSADPCM [The Irregular at Magic High School Lost Zero (Android)] */
|
2017-04-20 21:21:51 +02:00
|
|
|
vgmstream->coding_type = coding_MSADPCM;
|
|
|
|
vgmstream->layout_type = layout_none;
|
2022-07-23 14:49:47 +02:00
|
|
|
vgmstream->frame_size = read_u16le(extradata_offset + 0x02, sf);
|
2017-04-29 16:54:13 +02:00
|
|
|
|
2018-11-17 15:50:20 +01:00
|
|
|
/* adjusted samples; bigger or smaller than base samples, akb lib uses these fields instead
|
2017-04-29 16:54:13 +02:00
|
|
|
* (base samples may have more than possible and read over file size otherwise, very strange)
|
|
|
|
* loop_end seems to exist even with loop disabled */
|
2022-07-23 14:49:47 +02:00
|
|
|
vgmstream->num_samples = read_s32le(extradata_offset + 0x04, sf);
|
|
|
|
vgmstream->loop_start_sample = read_s32le(extradata_offset + 0x08, sf);
|
|
|
|
vgmstream->loop_end_sample = read_s32le(extradata_offset + 0x0c, sf);
|
2017-04-20 21:21:51 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-03-24 15:40:01 +01:00
|
|
|
#ifdef VGM_USE_VORBIS
|
|
|
|
case 0x05: { /* Ogg Vorbis [The World Ends with You (iOS / latest update)] */
|
|
|
|
VGMSTREAM *ogg_vgmstream = NULL;
|
|
|
|
ogg_vorbis_meta_info_t ovmi = {0};
|
|
|
|
|
|
|
|
ovmi.meta_type = vgmstream->meta_type;
|
|
|
|
ovmi.total_subsongs = total_subsongs;
|
|
|
|
ovmi.stream_size = stream_size;
|
|
|
|
|
2021-07-29 23:20:43 +02:00
|
|
|
ogg_vgmstream = init_vgmstream_ogg_vorbis_config(sf, start_offset, &ovmi);
|
2018-03-24 15:40:01 +01:00
|
|
|
if (ogg_vgmstream) {
|
|
|
|
ogg_vgmstream->num_streams = vgmstream->num_streams;
|
|
|
|
ogg_vgmstream->stream_size = vgmstream->stream_size;
|
|
|
|
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return ogg_vgmstream;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
#elif defined(VGM_USE_FFMPEG)
|
|
|
|
/* Alt decoding without libvorbis (minor number of beginning samples difference).
|
|
|
|
* Otherwise same output with (inaudible) +-1 lower byte differences due to rounding. */
|
2018-03-24 14:22:37 +01:00
|
|
|
case 0x05: { /* Ogg Vorbis [The World Ends with You (iOS / latest update)] */
|
2017-02-12 14:42:02 +01:00
|
|
|
ffmpeg_codec_data *ffmpeg_data;
|
|
|
|
|
2021-07-29 23:20:43 +02:00
|
|
|
ffmpeg_data = init_ffmpeg_offset(sf, start_offset,stream_size);
|
2017-02-12 14:42:02 +01:00
|
|
|
if ( !ffmpeg_data ) goto fail;
|
|
|
|
|
|
|
|
vgmstream->codec_data = ffmpeg_data;
|
|
|
|
vgmstream->coding_type = coding_FFmpeg;
|
|
|
|
vgmstream->layout_type = layout_none;
|
|
|
|
|
2018-03-24 14:22:37 +01:00
|
|
|
/* When loop_flag num_samples may be much larger than real num_samples (it's fine when looping is off)
|
|
|
|
* Actual num_samples would be loop_end_sample+1, but more testing is needed */
|
2022-07-23 14:49:47 +02:00
|
|
|
vgmstream->num_samples = read_s32le(material_offset+0x0c,sf);//num_samples;
|
|
|
|
vgmstream->loop_start_sample = read_s32le(material_offset+0x10,sf);//loop_start;
|
2018-03-24 14:22:37 +01:00
|
|
|
vgmstream->loop_end_sample = loop_end;
|
2017-02-12 14:42:02 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* open the file for reading */
|
2021-07-29 23:20:43 +02:00
|
|
|
if ( !vgmstream_open_stream(vgmstream, sf, start_offset) )
|
2017-02-12 14:42:02 +01:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|