mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-29 08:44:32 +01:00
commit
6ef7776de3
@ -190,7 +190,7 @@ int ffmpeg_make_riff_xma1(uint8_t * buf, size_t buf_size, size_t sample_count, s
|
|||||||
put_32bitLE(buf+off+0x08, 0); /* loop start */
|
put_32bitLE(buf+off+0x08, 0); /* loop start */
|
||||||
put_32bitLE(buf+off+0x0c, 0); /* loop end */
|
put_32bitLE(buf+off+0x0c, 0); /* loop end */
|
||||||
put_8bit (buf+off+0x10, 0); /* loop subframe */
|
put_8bit (buf+off+0x10, 0); /* loop subframe */
|
||||||
put_8bit (buf+off+0x11, channels);
|
put_8bit (buf+off+0x11, stream_channels);
|
||||||
put_16bitLE(buf+off+0x12, speakers);
|
put_16bitLE(buf+off+0x12, speakers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +274,7 @@ static const char* extension_list[] = {
|
|||||||
"rwsd",
|
"rwsd",
|
||||||
"rwx",
|
"rwx",
|
||||||
"rxw",
|
"rxw",
|
||||||
|
"rxx", //txth/reserved [Full Auto (X360)]
|
||||||
|
|
||||||
"s14",
|
"s14",
|
||||||
"sab",
|
"sab",
|
||||||
@ -1012,6 +1013,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_OPUS_PPP, "AT9 OPUS header"},
|
{meta_OPUS_PPP, "AT9 OPUS header"},
|
||||||
{meta_UBI_BAO, "Ubisoft BAO header"},
|
{meta_UBI_BAO, "Ubisoft BAO header"},
|
||||||
{meta_DSP_SWITCH_AUDIO, "UE4 Switch Audio header"},
|
{meta_DSP_SWITCH_AUDIO, "UE4 Switch Audio header"},
|
||||||
|
{meta_TA_AAC_VITA, "tri-Ace AAC (Vita) header"},
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
{meta_FFmpeg, "FFmpeg supported file format"},
|
{meta_FFmpeg, "FFmpeg supported file format"},
|
||||||
|
@ -647,6 +647,7 @@ VGMSTREAM * init_vgmstream_ta_aac_x360(STREAMFILE *streamFile);
|
|||||||
VGMSTREAM * init_vgmstream_ta_aac_ps3(STREAMFILE *streamFile);
|
VGMSTREAM * init_vgmstream_ta_aac_ps3(STREAMFILE *streamFile);
|
||||||
VGMSTREAM * init_vgmstream_ta_aac_mobile(STREAMFILE *streamFile);
|
VGMSTREAM * init_vgmstream_ta_aac_mobile(STREAMFILE *streamFile);
|
||||||
VGMSTREAM * init_vgmstream_ta_aac_mobile_vorbis(STREAMFILE *streamFile);
|
VGMSTREAM * init_vgmstream_ta_aac_mobile_vorbis(STREAMFILE *streamFile);
|
||||||
|
VGMSTREAM * init_vgmstream_ta_aac_vita(STREAMFILE *streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps3_mta2(STREAMFILE *streamFile);
|
VGMSTREAM * init_vgmstream_ps3_mta2(STREAMFILE *streamFile);
|
||||||
|
|
||||||
|
@ -261,8 +261,8 @@ VGMSTREAM * init_vgmstream_ta_aac_mobile(STREAMFILE *streamFile) {
|
|||||||
|
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
/* check extension, case insensitive */
|
||||||
/* .aac: expected, .laac/ace: for players to avoid hijacking MP4/AAC */
|
/* .aac: expected, .laac: for players to avoid hijacking MP4/AAC */
|
||||||
if (!check_extensions(streamFile, "aac,laac,ace"))
|
if (!check_extensions(streamFile, "aac,laac"))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (read_32bitLE(0x00, streamFile) != 0x41414320) /* "AAC " */
|
if (read_32bitLE(0x00, streamFile) != 0x41414320) /* "AAC " */
|
||||||
@ -297,8 +297,8 @@ VGMSTREAM * init_vgmstream_ta_aac_mobile(STREAMFILE *streamFile) {
|
|||||||
vgmstream->layout_type = layout_none;
|
vgmstream->layout_type = layout_none;
|
||||||
|
|
||||||
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, channel_count);
|
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, channel_count);
|
||||||
vgmstream->loop_start_sample = yamaha_bytes_to_samples(read_32bitLE(0x130, streamFile), channel_count);;
|
vgmstream->loop_start_sample = yamaha_bytes_to_samples(read_32bitLE(0x130, streamFile), channel_count);
|
||||||
vgmstream->loop_end_sample = yamaha_bytes_to_samples(read_32bitLE(0x134, streamFile), channel_count);;
|
vgmstream->loop_end_sample = yamaha_bytes_to_samples(read_32bitLE(0x134, streamFile), channel_count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -313,3 +313,66 @@ fail:
|
|||||||
close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Vita variants [Judas Code (Vita)] */
|
||||||
|
VGMSTREAM * init_vgmstream_ta_aac_vita(STREAMFILE *streamFile) {
|
||||||
|
VGMSTREAM * vgmstream = NULL;
|
||||||
|
off_t start_offset;
|
||||||
|
int channel_count, loop_flag;
|
||||||
|
|
||||||
|
|
||||||
|
/* check extension, case insensitive */
|
||||||
|
/* .aac: expected, .laac: for players to avoid hijacking MP4/AAC */
|
||||||
|
if (!check_extensions(streamFile, "aac,laac"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (read_32bitLE(0x00, streamFile) != 0x41414320) /* "AAC " */
|
||||||
|
goto fail;
|
||||||
|
if (read_32bitLE(0x14, streamFile) != 0x56495441) /* "VITA" */
|
||||||
|
goto fail;
|
||||||
|
if (read_32bitLE(0x10d0, streamFile) != 0x57415645) /* "WAVE" */
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* there is a bunch of chunks but we simplify */
|
||||||
|
|
||||||
|
/* 0x10E4: codec 0x08? */
|
||||||
|
channel_count = read_8bit(0x10E5, streamFile);
|
||||||
|
start_offset = read_32bitLE(0x1100, streamFile);
|
||||||
|
loop_flag = (read_32bitLE(0x1114, streamFile) > 0);
|
||||||
|
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
vgmstream->sample_rate = read_32bitLE(0x10e8, streamFile);
|
||||||
|
vgmstream->meta_type = meta_TA_AAC_VITA;
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
{
|
||||||
|
atrac9_config cfg = {0};
|
||||||
|
|
||||||
|
cfg.channels = vgmstream->channels;
|
||||||
|
cfg.encoder_delay = read_32bitLE(0x1124,streamFile);
|
||||||
|
cfg.config_data = read_32bitBE(0x1128,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 = atrac9_bytes_to_samples(read_32bitLE(0x10EC, streamFile), vgmstream->codec_data);
|
||||||
|
vgmstream->num_samples -= cfg.encoder_delay;
|
||||||
|
vgmstream->loop_start_sample = atrac9_bytes_to_samples(read_32bitLE(0x1110, streamFile), vgmstream->codec_data);
|
||||||
|
vgmstream->loop_end_sample = atrac9_bytes_to_samples(read_32bitLE(0x1114, streamFile), vgmstream->codec_data);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||||
|
goto fail;
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -63,6 +63,8 @@ typedef struct {
|
|||||||
uint32_t coef_big_endian;
|
uint32_t coef_big_endian;
|
||||||
uint32_t coef_mode;
|
uint32_t coef_mode;
|
||||||
|
|
||||||
|
int num_samples_data_size;
|
||||||
|
|
||||||
} txth_header;
|
} txth_header;
|
||||||
|
|
||||||
static STREAMFILE * open_txth(STREAMFILE * streamFile);
|
static STREAMFILE * open_txth(STREAMFILE * streamFile);
|
||||||
@ -343,25 +345,29 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
if (txth.sample_type_bytes && (txth.codec == XMA1 || txth.codec == XMA2)) {
|
if ((txth.sample_type_bytes || txth.num_samples_data_size) && (txth.codec == XMA1 || txth.codec == XMA2)) {
|
||||||
/* manually find sample offsets */
|
/* manually find sample offsets */
|
||||||
ms_sample_data msd;
|
ms_sample_data msd = {0};
|
||||||
memset(&msd,0,sizeof(ms_sample_data));
|
|
||||||
|
|
||||||
msd.xma_version = 1;
|
msd.xma_version = 1;
|
||||||
msd.channels = txth.channels;
|
msd.channels = txth.channels;
|
||||||
msd.data_offset = txth.start_offset;
|
msd.data_offset = txth.start_offset;
|
||||||
msd.data_size = txth.data_size;
|
msd.data_size = txth.data_size;
|
||||||
|
if (txth.sample_type_bytes) {
|
||||||
msd.loop_flag = txth.loop_flag;
|
msd.loop_flag = txth.loop_flag;
|
||||||
msd.loop_start_b = txth.loop_start_sample;
|
msd.loop_start_b = txth.loop_start_sample;
|
||||||
msd.loop_end_b = txth.loop_end_sample;
|
msd.loop_end_b = txth.loop_end_sample;
|
||||||
msd.loop_start_subframe = txth.loop_adjust & 0xF; /* lower 4b: subframe where the loop starts, 0..4 */
|
msd.loop_start_subframe = txth.loop_adjust & 0xF; /* lower 4b: subframe where the loop starts, 0..4 */
|
||||||
msd.loop_end_subframe = txth.loop_adjust >> 4; /* upper 4b: subframe where the loop ends, 0..3 */
|
msd.loop_end_subframe = txth.loop_adjust >> 4; /* upper 4b: subframe where the loop ends, 0..3 */
|
||||||
|
}
|
||||||
|
|
||||||
xma_get_samples(&msd, streamFile);
|
xma_get_samples(&msd, streamFile);
|
||||||
|
|
||||||
vgmstream->num_samples = msd.num_samples;
|
vgmstream->num_samples = msd.num_samples;
|
||||||
|
if (txth.sample_type_bytes) {
|
||||||
vgmstream->loop_start_sample = msd.loop_start_sample;
|
vgmstream->loop_start_sample = msd.loop_start_sample;
|
||||||
vgmstream->loop_end_sample = msd.loop_end_sample;
|
vgmstream->loop_end_sample = msd.loop_end_sample;
|
||||||
|
}
|
||||||
//skip_samples = msd.skip_samples; //todo add skip samples
|
//skip_samples = msd.skip_samples; //todo add skip samples
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -524,6 +530,7 @@ static int parse_keyval(STREAMFILE * streamFile, STREAMFILE * streamText, txth_h
|
|||||||
else if (0==strcmp(key,"num_samples")) {
|
else if (0==strcmp(key,"num_samples")) {
|
||||||
if (0==strcmp(val,"data_size")) {
|
if (0==strcmp(val,"data_size")) {
|
||||||
txth->num_samples = get_bytes_to_samples(txth, txth->data_size);
|
txth->num_samples = get_bytes_to_samples(txth, txth->data_size);
|
||||||
|
txth->num_samples_data_size = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!parse_num(streamFile,val, &txth->num_samples)) goto fail;
|
if (!parse_num(streamFile,val, &txth->num_samples)) goto fail;
|
||||||
|
@ -353,6 +353,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
|||||||
init_vgmstream_ta_aac_ps3,
|
init_vgmstream_ta_aac_ps3,
|
||||||
init_vgmstream_ta_aac_mobile,
|
init_vgmstream_ta_aac_mobile,
|
||||||
init_vgmstream_ta_aac_mobile_vorbis,
|
init_vgmstream_ta_aac_mobile_vorbis,
|
||||||
|
init_vgmstream_ta_aac_vita,
|
||||||
init_vgmstream_ps3_mta2,
|
init_vgmstream_ps3_mta2,
|
||||||
init_vgmstream_ngc_ulw,
|
init_vgmstream_ngc_ulw,
|
||||||
init_vgmstream_pc_xa30,
|
init_vgmstream_pc_xa30,
|
||||||
|
@ -675,6 +675,7 @@ typedef enum {
|
|||||||
meta_OPUS_PPP, /* .at9 Opus [Penny-Punching Princess (Switch)] */
|
meta_OPUS_PPP, /* .at9 Opus [Penny-Punching Princess (Switch)] */
|
||||||
meta_UBI_BAO, /* Ubisoft BAO */
|
meta_UBI_BAO, /* Ubisoft BAO */
|
||||||
meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */
|
meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */
|
||||||
|
meta_TA_AAC_VITA, /* tri-Ace AAC (Judas Code) */
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
meta_FFmpeg,
|
meta_FFmpeg,
|
||||||
|
Loading…
Reference in New Issue
Block a user