2017-08-20 02:18:48 +02:00
|
|
|
#include "meta.h"
|
|
|
|
#include "../layout/layout.h"
|
2017-09-24 18:52:09 +02:00
|
|
|
#include "../coding/coding.h"
|
2018-04-19 22:26:46 +02:00
|
|
|
#include "ea_eaac_streamfile.h"
|
2017-08-20 02:18:48 +02:00
|
|
|
|
2017-12-03 17:27:13 +01:00
|
|
|
/* EAAudioCore formats, EA's current audio middleware */
|
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
static VGMSTREAM * init_vgmstream_eaaudiocore_header(STREAMFILE * streamHead, STREAMFILE * streamData, off_t header_offset, off_t start_offset, meta_t meta_type);
|
2017-09-24 18:52:09 +02:00
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
/* .SNR+SNS - from EA latest games (~2008-2013), v0 header */
|
|
|
|
VGMSTREAM * init_vgmstream_ea_snr_sns(STREAMFILE * streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
STREAMFILE * streamData = NULL;
|
|
|
|
|
|
|
|
/* check extension, case insensitive */
|
|
|
|
if (!check_extensions(streamFile,"snr"))
|
|
|
|
goto fail;
|
|
|
|
|
2018-02-03 17:19:38 +01:00
|
|
|
/* SNR headers normally need an external SNS file, but some have data [Burnout Paradise, NFL2013 (iOS)] */
|
2017-12-02 02:56:37 +01:00
|
|
|
if (get_streamfile_size(streamFile) > 0x10) {
|
2018-02-03 17:19:38 +01:00
|
|
|
off_t start_offset;
|
|
|
|
|
|
|
|
switch(read_8bit(0x04,streamFile)) { /* flags */
|
|
|
|
case 0x60: start_offset = 0x10; break;
|
|
|
|
case 0x20: start_offset = 0x0c; break;
|
|
|
|
default: start_offset = 0x08; break;
|
|
|
|
}
|
2017-12-02 02:56:37 +01:00
|
|
|
|
|
|
|
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamFile, 0x00, start_offset, meta_EA_SNR_SNS);
|
2017-12-01 17:27:49 +01:00
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
}
|
|
|
|
else {
|
2018-03-29 22:34:21 +02:00
|
|
|
streamData = open_streamfile_by_ext(streamFile,"sns");
|
2017-12-01 17:27:49 +01:00
|
|
|
if (!streamData) goto fail;
|
|
|
|
|
|
|
|
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamData, 0x00, 0x00, meta_EA_SNR_SNS);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
}
|
|
|
|
|
2018-02-03 17:19:38 +01:00
|
|
|
close_streamfile(streamData);
|
2017-12-01 17:27:49 +01:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2018-02-03 17:19:38 +01:00
|
|
|
close_streamfile(streamData);
|
2017-12-01 17:27:49 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* .SPS - from EA latest games (~2014), v1 header */
|
|
|
|
VGMSTREAM * init_vgmstream_ea_sps(STREAMFILE * streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
off_t start_offset;
|
|
|
|
|
|
|
|
/* check extension, case insensitive */
|
|
|
|
if (!check_extensions(streamFile,"sps"))
|
|
|
|
goto fail;
|
|
|
|
|
2017-12-17 17:38:54 +01:00
|
|
|
/* SPS block start: 0x00(1): block flag (header=0x48); 0x01(3): block size (usually 0x0c-0x14) */
|
|
|
|
if (read_8bit(0x00, streamFile) != 0x48)
|
2017-12-01 17:27:49 +01:00
|
|
|
goto fail;
|
2017-12-17 17:38:54 +01:00
|
|
|
start_offset = read_32bitBE(0x00, streamFile) & 0x00FFFFFF;
|
2017-12-01 17:27:49 +01:00
|
|
|
|
|
|
|
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamFile, 0x04, start_offset, meta_EA_SPS);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* .SNU - from EA Redwood Shores/Visceral games (Dead Space, Dante's Inferno, The Godfather 2), v0 header */
|
2017-08-20 02:18:48 +02:00
|
|
|
VGMSTREAM * init_vgmstream_ea_snu(STREAMFILE *streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
2017-11-26 01:25:27 +01:00
|
|
|
off_t start_offset, header_offset;
|
2017-09-24 18:52:09 +02:00
|
|
|
int32_t (*read_32bit)(off_t,STREAMFILE*) = NULL;
|
2017-08-20 02:18:48 +02:00
|
|
|
|
|
|
|
/* check extension, case insensitive */
|
|
|
|
if (!check_extensions(streamFile,"snu"))
|
|
|
|
goto fail;
|
|
|
|
|
2017-11-26 01:25:27 +01:00
|
|
|
/* EA SNU header (BE/LE depending on platform) */
|
2017-09-24 18:52:09 +02:00
|
|
|
/* 0x00(1): related to sample rate? (03=48000)
|
2017-09-29 23:28:27 +02:00
|
|
|
* 0x01(1): flags/count? (when set has extra block data before start_offset)
|
2017-09-24 18:52:09 +02:00
|
|
|
* 0x02(1): always 0?
|
|
|
|
* 0x03(1): channels? (usually matches but rarely may be 0)
|
|
|
|
* 0x04(4): some size, maybe >>2 ~= number of frames
|
|
|
|
* 0x08(4): start offset
|
2017-09-29 23:28:27 +02:00
|
|
|
* 0x0c(4): some sub-offset? (0x20, found when @0x01 is set) */
|
2017-09-24 18:52:09 +02:00
|
|
|
|
2017-09-29 23:28:27 +02:00
|
|
|
/* use start_offset as endianness flag */
|
2018-07-17 22:54:24 +02:00
|
|
|
if (guess_endianness32bit(0x08,streamFile)) {
|
2017-09-24 18:52:09 +02:00
|
|
|
read_32bit = read_32bitBE;
|
|
|
|
} else {
|
|
|
|
read_32bit = read_32bitLE;
|
|
|
|
}
|
2017-08-20 02:18:48 +02:00
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
header_offset = 0x10; /* SNR header */
|
|
|
|
start_offset = read_32bit(0x08,streamFile); /* SPS blocks */
|
|
|
|
|
|
|
|
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamFile, header_offset, start_offset, meta_EA_SNU);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|
2017-11-26 01:25:27 +01:00
|
|
|
|
2018-07-06 21:04:27 +02:00
|
|
|
/* .SPS - from Frostbite engine games, v1 header */
|
2018-04-20 00:22:40 +02:00
|
|
|
VGMSTREAM * init_vgmstream_ea_sps_fb(STREAMFILE *streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
off_t start_offset = 0, header_offset = 0, sps_offset, max_offset;
|
|
|
|
|
|
|
|
/* checks */
|
2018-07-06 21:04:27 +02:00
|
|
|
/* should be .sps once extracted (filenames are hashed) */
|
2018-04-20 00:22:40 +02:00
|
|
|
if (!check_extensions(streamFile,"sps"))
|
|
|
|
goto fail;
|
2018-07-14 23:00:02 +02:00
|
|
|
if (read_32bitBE(0x00,streamFile) != 0x011006C0 && /* Need for Speed: The Run (PS3), Need for Speed: Rivals (PS4) */
|
|
|
|
read_32bitBE(0x00,streamFile) != 0x01100180 && /* Need for Speed: The Run (X360) */
|
2018-07-06 21:04:27 +02:00
|
|
|
read_32bitBE(0x00,streamFile) != 0x01100000) /* Need for Speed: The Run (PC) */
|
2018-04-20 00:22:40 +02:00
|
|
|
goto fail;
|
|
|
|
|
2018-07-06 21:04:27 +02:00
|
|
|
/* file has a Frostbite descriptor (SoundWaveAsset segments) data before actual .sps, exact size unknown.
|
|
|
|
* 0x00: segments/flags/sizes? 0x04: SegmentLength?, 0x08: SeekTableOffset?, 0x0c: mini SPS header
|
|
|
|
* rest: unknown fields? may be padded? (ex. 0x22 > 0x24, 0x1d > 0x20 */
|
2018-04-20 00:22:40 +02:00
|
|
|
|
2018-07-06 21:04:27 +02:00
|
|
|
/* actual offsets are probably somewhere but for now just manually search. */
|
|
|
|
sps_offset = read_32bitBE(0x08, streamFile); /* seek table, number of entries unknown */
|
2018-04-20 00:22:40 +02:00
|
|
|
max_offset = sps_offset + 0x3000;
|
|
|
|
if (max_offset > get_streamfile_size(streamFile))
|
|
|
|
max_offset = get_streamfile_size(streamFile);
|
|
|
|
|
|
|
|
/* find .sps start block */
|
|
|
|
while (sps_offset < max_offset) {
|
|
|
|
if ((read_32bitBE(sps_offset, streamFile) & 0xFFFFFF00) == 0x48000000) {
|
|
|
|
header_offset = sps_offset + 0x04;
|
|
|
|
start_offset = sps_offset + (read_32bitBE(sps_offset, streamFile) & 0x00FFFFFF);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sps_offset += 0x04;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!start_offset)
|
|
|
|
goto fail; /* not found */
|
|
|
|
|
|
|
|
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamFile, header_offset, start_offset, meta_EA_SPS);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|
2017-11-26 01:25:27 +01:00
|
|
|
|
2017-12-03 17:27:13 +01:00
|
|
|
/* EA newest header from RwAudioCore (RenderWare?) / EAAudioCore library (still generated by sx.exe).
|
2017-12-01 17:27:49 +01:00
|
|
|
* Audio "assets" come in separate RAM headers (.SNR/SPH) and raw blocked streams (.SNS/SPS),
|
|
|
|
* or together in pseudoformats (.SNU, .SBR+.SBS banks, .AEMS, .MUS, etc).
|
|
|
|
* Some .SNR include stream data, while .SPS have headers so .SPH is optional. */
|
|
|
|
static VGMSTREAM * init_vgmstream_eaaudiocore_header(STREAMFILE * streamHead, STREAMFILE * streamData, off_t header_offset, off_t start_offset, meta_t meta_type) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
2018-03-31 20:10:57 +02:00
|
|
|
STREAMFILE* temp_streamFile = NULL;
|
2017-12-01 17:27:49 +01:00
|
|
|
int channel_count, loop_flag = 0, version, codec, channel_config, sample_rate, flags;
|
|
|
|
uint32_t num_samples, loop_start = 0, loop_end = 0;
|
2017-11-26 01:25:27 +01:00
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
/* EA SNR/SPH header */
|
2018-04-19 22:40:47 +02:00
|
|
|
version = (read_8bit(header_offset + 0x00,streamHead) >> 4) & 0x0F;
|
|
|
|
codec = (read_8bit(header_offset + 0x00,streamHead) >> 0) & 0x0F;
|
|
|
|
channel_config = read_8bit(header_offset + 0x01,streamHead) & 0xFE;
|
|
|
|
sample_rate = read_32bitBE(header_offset + 0x00,streamHead) & 0x1FFFF; /* some Dead Space 2 (PC) uses 96000 */
|
2018-04-01 21:58:35 +02:00
|
|
|
flags = (uint8_t)read_8bit(header_offset + 0x04,streamHead) & 0xFE; //todo upper nibble only? (the first bit is part of size)
|
|
|
|
num_samples = (uint32_t)read_32bitBE(header_offset + 0x04,streamHead) & 0x01FFFFFF;
|
2018-02-03 17:19:38 +01:00
|
|
|
/* rest is optional, depends on flags header used (ex. SNU and SPS may have bigger headers):
|
|
|
|
* &0x20: 1 int (usually 0x00), &0x00/40: nothing, &0x60: 2 ints (usually 0x00 and 0x14) */
|
2017-11-26 01:25:27 +01:00
|
|
|
|
2018-07-06 21:04:27 +02:00
|
|
|
/* V0: SNR+SNS, V1: SPR+SPS (no apparent differences, other than the block flags used) */
|
2017-11-26 01:25:27 +01:00
|
|
|
if (version != 0 && version != 1) {
|
|
|
|
VGM_LOG("EA SNS/SPS: unknown version\n");
|
|
|
|
goto fail;
|
|
|
|
}
|
2017-08-20 02:18:48 +02:00
|
|
|
|
2018-04-01 21:58:35 +02:00
|
|
|
/* 0x40: stream asset, 0x20: full loop, 0x00: default/RAM asset */
|
2017-12-01 17:27:49 +01:00
|
|
|
if (flags != 0x60 && flags != 0x40 && flags != 0x20 && flags != 0x00) {
|
2017-11-26 01:25:27 +01:00
|
|
|
VGM_LOG("EA SNS/SPS: unknown flag 0x%02x\n", flags);
|
2018-04-01 21:58:35 +02:00
|
|
|
goto fail;
|
2017-08-20 02:18:48 +02:00
|
|
|
}
|
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
/* seen in sfx and Dead Space ambient tracks */
|
|
|
|
if (flags & 0x20) {
|
2017-08-20 02:18:48 +02:00
|
|
|
loop_flag = 1;
|
|
|
|
loop_start = 0;
|
|
|
|
loop_end = num_samples;
|
|
|
|
}
|
|
|
|
|
2017-11-26 01:25:27 +01:00
|
|
|
/* accepted channel configs only seem to be mono/stereo/quad/5.1/7.1 */
|
2017-12-01 17:27:49 +01:00
|
|
|
//channel_count = ((channel_config >> 2) & 0xf) + 1; /* likely, but better fail with unknown values */
|
2017-08-20 02:18:48 +02:00
|
|
|
switch(channel_config) {
|
|
|
|
case 0x00: channel_count = 1; break;
|
|
|
|
case 0x04: channel_count = 2; break;
|
|
|
|
case 0x0c: channel_count = 4; break;
|
|
|
|
case 0x14: channel_count = 6; break;
|
|
|
|
case 0x1c: channel_count = 8; break;
|
|
|
|
default:
|
2017-11-26 01:25:27 +01:00
|
|
|
VGM_LOG("EA SNS/SPS: unknown channel config 0x%02x\n", channel_config);
|
2017-08-20 02:18:48 +02:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
vgmstream->sample_rate = sample_rate;
|
|
|
|
vgmstream->num_samples = num_samples;
|
|
|
|
vgmstream->loop_start_sample = loop_start;
|
|
|
|
vgmstream->loop_end_sample = loop_end;
|
2017-12-01 17:27:49 +01:00
|
|
|
vgmstream->meta_type = meta_type;
|
2017-08-20 02:18:48 +02:00
|
|
|
|
2017-11-26 01:25:27 +01:00
|
|
|
/* EA decoder list and known internal FourCCs */
|
2017-08-20 02:18:48 +02:00
|
|
|
switch(codec) {
|
2017-09-24 18:52:09 +02:00
|
|
|
|
2018-02-03 17:19:38 +01:00
|
|
|
case 0x02: /* "P6B0": PCM16BE [NBA Jam (Wii)] */
|
2017-12-01 17:27:49 +01:00
|
|
|
vgmstream->coding_type = coding_PCM16_int;
|
|
|
|
vgmstream->codec_endian = 1;
|
2017-11-25 01:18:27 +01:00
|
|
|
vgmstream->layout_type = layout_blocked_ea_sns;
|
2017-09-24 18:52:09 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef VGM_USE_FFMPEG
|
2018-02-03 17:19:38 +01:00
|
|
|
case 0x03: { /* "EXm0": EA-XMA [Dante's Inferno (X360)] */
|
2017-09-24 18:52:09 +02:00
|
|
|
uint8_t buf[0x100];
|
|
|
|
int bytes, block_size, block_count;
|
|
|
|
size_t stream_size, virtual_size;
|
2017-12-01 17:27:49 +01:00
|
|
|
ffmpeg_custom_config cfg = {0};
|
2017-09-24 18:52:09 +02:00
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
stream_size = get_streamfile_size(streamData) - start_offset;
|
|
|
|
virtual_size = ffmpeg_get_eaxma_virtual_size(vgmstream->channels, start_offset,stream_size, streamData);
|
2017-09-29 23:28:27 +02:00
|
|
|
block_size = 0x10000; /* todo unused and not correctly done by the parser */
|
2017-09-24 18:52:09 +02:00
|
|
|
block_count = stream_size / block_size + (stream_size % block_size ? 1 : 0);
|
|
|
|
|
|
|
|
bytes = ffmpeg_make_riff_xma2(buf, 0x100, vgmstream->num_samples, virtual_size, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
|
|
|
|
if (bytes <= 0) goto fail;
|
|
|
|
|
|
|
|
cfg.type = FFMPEG_EA_XMA;
|
|
|
|
cfg.virtual_size = virtual_size;
|
2017-09-29 23:28:27 +02:00
|
|
|
cfg.channels = vgmstream->channels;
|
2017-09-24 18:52:09 +02:00
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
vgmstream->codec_data = init_ffmpeg_config(streamData, buf,bytes, start_offset,stream_size, &cfg);
|
2017-09-24 18:52:09 +02:00
|
|
|
if (!vgmstream->codec_data) goto fail;
|
|
|
|
|
|
|
|
vgmstream->coding_type = coding_FFmpeg;
|
|
|
|
vgmstream->layout_type = layout_none;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-02-03 17:19:38 +01:00
|
|
|
case 0x04: /* "Xas1": EA-XAS [Dead Space (PC/PS3)] */
|
2017-12-01 17:27:49 +01:00
|
|
|
vgmstream->coding_type = coding_EA_XAS;
|
|
|
|
vgmstream->layout_type = layout_blocked_ea_sns;
|
|
|
|
break;
|
2017-11-26 01:25:27 +01:00
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
#ifdef VGM_USE_MPEG
|
2018-02-03 17:19:38 +01:00
|
|
|
case 0x05: /* "EL31": EALayer3 v1 [Need for Speed: Hot Pursuit (PS3)] */
|
|
|
|
case 0x06: /* "L32P": EALayer3 v2 "PCM" [Battlefield 1943 (PS3)] */
|
|
|
|
case 0x07: { /* "L32S": EALayer3 v2 "Spike" [Dante's Inferno (PS3)] */
|
2017-12-01 17:27:49 +01:00
|
|
|
mpeg_custom_config cfg = {0};
|
|
|
|
mpeg_custom_t type = (codec == 0x05 ? MPEG_EAL31b : (codec == 0x06) ? MPEG_EAL32P : MPEG_EAL32S);
|
|
|
|
|
2018-04-19 22:26:46 +02:00
|
|
|
/* remove blocks on reads for some edge cases in L32P and to properly apply discard modes
|
|
|
|
* (otherwise, and removing discards, it'd work with layout_blocked_ea_sns) */
|
|
|
|
temp_streamFile = setup_eaac_streamfile(streamData, version, codec, start_offset, 0);
|
|
|
|
if (!temp_streamFile) goto fail;
|
|
|
|
|
|
|
|
start_offset = 0x00; /* must point to the custom streamfile's beginning */
|
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
/* layout is still blocks, but should work fine with the custom mpeg decoder */
|
2018-04-19 22:26:46 +02:00
|
|
|
vgmstream->codec_data = init_mpeg_custom(temp_streamFile, start_offset, &vgmstream->coding_type, vgmstream->channels, type, &cfg);
|
2017-12-01 17:27:49 +01:00
|
|
|
if (!vgmstream->codec_data) goto fail;
|
2018-04-19 22:26:46 +02:00
|
|
|
vgmstream->layout_type = layout_none;
|
2017-12-01 17:27:49 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2017-12-28 23:37:18 +01:00
|
|
|
|
2018-02-03 17:19:38 +01:00
|
|
|
case 0x08: /* "Gca0"?: DSP [Need for Speed: Nitro sfx (Wii)] */
|
|
|
|
vgmstream->coding_type = coding_NGC_DSP;
|
|
|
|
vgmstream->layout_type = layout_blocked_ea_sns;
|
|
|
|
/* DSP coefs are read in the blocks */
|
|
|
|
break;
|
|
|
|
|
2017-12-28 23:37:18 +01:00
|
|
|
#ifdef VGM_USE_ATRAC9
|
|
|
|
case 0x0a: { /* EATrax */
|
|
|
|
atrac9_config cfg = {0};
|
2018-03-31 20:10:57 +02:00
|
|
|
size_t total_size;
|
2017-12-28 23:37:18 +01:00
|
|
|
|
|
|
|
cfg.channels = vgmstream->channels;
|
|
|
|
cfg.config_data = read_32bitBE(header_offset + 0x08,streamHead);
|
2018-03-31 20:10:57 +02:00
|
|
|
/* 0x10: frame size? (same as config data?) */
|
|
|
|
total_size = read_32bitLE(header_offset + 0x0c,streamHead); /* actual data size without blocks, LE b/c why make sense */
|
2017-12-28 23:37:18 +01:00
|
|
|
|
|
|
|
vgmstream->codec_data = init_atrac9(&cfg);
|
|
|
|
if (!vgmstream->codec_data) goto fail;
|
|
|
|
vgmstream->coding_type = coding_ATRAC9;
|
2018-03-31 20:10:57 +02:00
|
|
|
vgmstream->layout_type = layout_none;
|
|
|
|
|
|
|
|
/* EATrax is "buffered" ATRAC9, uses custom IO since it's kind of complex to add to the decoder */
|
2018-04-19 22:26:46 +02:00
|
|
|
temp_streamFile = setup_eaac_streamfile(streamData, version, codec, start_offset, total_size);
|
2018-03-31 20:10:57 +02:00
|
|
|
if (!temp_streamFile) goto fail;
|
|
|
|
|
2018-04-19 22:26:46 +02:00
|
|
|
start_offset = 0x00; /* must point to the custom streamfile's beginning */
|
2017-12-28 23:37:18 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-12-01 17:27:49 +01:00
|
|
|
case 0x00: /* "NONE" (internal 'codec not set' flag) */
|
2018-02-03 17:19:38 +01:00
|
|
|
case 0x01: /* not used/reserved? /MP30/P6L0/P2B0/P2L0/P8S0/P8U0/PFN0? */
|
2017-12-01 17:27:49 +01:00
|
|
|
case 0x09: /* EASpeex (libspeex variant, base versions vary: 1.0.5, 1.2beta3) */
|
2017-11-26 01:25:27 +01:00
|
|
|
case 0x0b: /* ? */
|
2017-12-01 17:27:49 +01:00
|
|
|
case 0x0c: /* EAOpus (inside each SNS/SPS block is 16b frame size + standard? Opus packet) */
|
2017-11-26 01:25:27 +01:00
|
|
|
case 0x0d: /* ? */
|
|
|
|
case 0x0e: /* ? */
|
|
|
|
case 0x0f: /* ? */
|
2017-08-20 02:18:48 +02:00
|
|
|
default:
|
2017-11-26 01:25:27 +01:00
|
|
|
VGM_LOG("EA SNS/SPS: unknown codec 0x%02x\n", codec);
|
2017-08-20 02:18:48 +02:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-31 20:10:57 +02:00
|
|
|
if (!vgmstream_open_stream(vgmstream,temp_streamFile ? temp_streamFile : streamData,start_offset))
|
2017-08-20 02:18:48 +02:00
|
|
|
goto fail;
|
|
|
|
|
2017-11-25 01:18:27 +01:00
|
|
|
if (vgmstream->layout_type == layout_blocked_ea_sns)
|
|
|
|
block_update_ea_sns(start_offset, vgmstream);
|
2017-08-20 02:18:48 +02:00
|
|
|
|
2018-04-19 22:26:46 +02:00
|
|
|
close_streamfile(temp_streamFile);
|
2017-08-20 02:18:48 +02:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2018-03-31 20:10:57 +02:00
|
|
|
close_streamfile(temp_streamFile);
|
2017-08-20 02:18:48 +02:00
|
|
|
close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|