mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Cleanup
This commit is contained in:
parent
e208e0c0ec
commit
b083042704
@ -46,13 +46,11 @@ VGMSTREAM * init_vgmstream_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start,
|
|||||||
vgmstream = allocate_vgmstream(data->channels, loop_flag);
|
vgmstream = allocate_vgmstream(data->channels, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
vgmstream->loop_flag = loop_flag;
|
|
||||||
vgmstream->codec_data = data;
|
|
||||||
vgmstream->channels = data->channels;
|
|
||||||
vgmstream->sample_rate = data->sampleRate;
|
vgmstream->sample_rate = data->sampleRate;
|
||||||
vgmstream->coding_type = coding_FFmpeg;
|
|
||||||
vgmstream->layout_type = layout_none;
|
|
||||||
vgmstream->meta_type = meta_FFmpeg;
|
vgmstream->meta_type = meta_FFmpeg;
|
||||||
|
vgmstream->coding_type = coding_FFmpeg;
|
||||||
|
vgmstream->codec_data = data;
|
||||||
|
vgmstream->layout_type = layout_none;
|
||||||
|
|
||||||
if (!num_samples) {
|
if (!num_samples) {
|
||||||
num_samples = data->totalSamples;
|
num_samples = data->totalSamples;
|
||||||
@ -64,11 +62,10 @@ VGMSTREAM * init_vgmstream_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start,
|
|||||||
vgmstream->loop_end_sample = loop_end;
|
vgmstream->loop_end_sample = loop_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this may happen for some streams if FFmpeg can't determine it */
|
/* this may happen for some streams if FFmpeg can't determine it (ex. AAC) */
|
||||||
if (vgmstream->num_samples <= 0)
|
if (vgmstream->num_samples <= 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
@ -589,7 +589,6 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, ov_callb
|
|||||||
vgmstream->loop_end_sample = loop_end;
|
vgmstream->loop_end_sample = loop_end;
|
||||||
else
|
else
|
||||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
vgmstream->loop_flag = loop_flag;
|
|
||||||
|
|
||||||
if (vgmstream->loop_end_sample > vgmstream->num_samples)
|
if (vgmstream->loop_end_sample > vgmstream->num_samples)
|
||||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
|
@ -3,39 +3,39 @@
|
|||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
|
|
||||||
/* VAWX - found in feelplus games (No More Heroes Heroes Paradise, Moon Diver) */
|
/* VAWX - found in feelplus games [No More Heroes: Heroes Paradise (PS3/X360), Moon Diver (PS3/X360)] */
|
||||||
VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
off_t start_offset, data_size;
|
off_t start_offset, data_size;
|
||||||
|
int loop_flag = 0, channel_count, codec;
|
||||||
|
|
||||||
int loop_flag = 0, channel_count, type;
|
|
||||||
|
|
||||||
/* check extensions */
|
/* checks */
|
||||||
if ( !check_extensions(streamFile, "vawx,xwv") )
|
/* .xwv: actual extension [Moon Diver (PS3/X360)]
|
||||||
|
* .vawx: header id */
|
||||||
|
if ( !check_extensions(streamFile, "xwv,vawx") )
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* check header */
|
|
||||||
if (read_32bitBE(0x00,streamFile) != 0x56415758) /* "VAWX" */
|
if (read_32bitBE(0x00,streamFile) != 0x56415758) /* "VAWX" */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
loop_flag = read_8bit(0x37,streamFile);
|
loop_flag = read_8bit(0x37,streamFile);
|
||||||
channel_count = read_8bit(0x39,streamFile);;
|
channel_count = read_8bit(0x39,streamFile);
|
||||||
|
start_offset = 0x800; /* ? read_32bitLE(0x0c,streamFile); */
|
||||||
|
codec = read_8bit(0x36,streamFile); /* could be at 0x38 too */
|
||||||
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
/* 0x04: filesize */
|
/* 0x04: filesize */
|
||||||
start_offset = 0x800; /* ? read_32bitLE(0x0c,streamFile); */
|
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
/* 0x16: file id */
|
/* 0x16: file id */
|
||||||
type = read_8bit(0x36,streamFile); /* could be at 0x38 too */
|
|
||||||
vgmstream->num_samples = read_32bitBE(0x3c,streamFile);
|
vgmstream->num_samples = read_32bitBE(0x3c,streamFile);
|
||||||
vgmstream->sample_rate = read_32bitBE(0x40,streamFile);
|
vgmstream->sample_rate = read_32bitBE(0x40,streamFile);
|
||||||
|
|
||||||
vgmstream->meta_type = meta_VAWX;
|
vgmstream->meta_type = meta_VAWX;
|
||||||
|
|
||||||
switch(type) {
|
switch(codec) {
|
||||||
case 2: /* VAG */
|
case 2: /* VAG */
|
||||||
vgmstream->coding_type = coding_PSX;
|
vgmstream->coding_type = coding_PSX;
|
||||||
vgmstream->layout_type = channel_count == 6 ? layout_blocked_vawx : layout_interleave ;
|
vgmstream->layout_type = channel_count == 6 ? layout_blocked_vawx : layout_interleave ;
|
||||||
@ -57,8 +57,6 @@ VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
|
|||||||
block_count = (uint16_t)read_16bitBE(0x3A, streamFile); /* also at 0x56 */
|
block_count = (uint16_t)read_16bitBE(0x3A, streamFile); /* also at 0x56 */
|
||||||
|
|
||||||
bytes = ffmpeg_make_riff_xma2(buf,0x100, vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
|
bytes = ffmpeg_make_riff_xma2(buf,0x100, vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
|
||||||
if (bytes <= 0) goto fail;
|
|
||||||
|
|
||||||
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
|
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
|
||||||
if ( !ffmpeg_data ) goto fail;
|
if ( !ffmpeg_data ) goto fail;
|
||||||
vgmstream->codec_data = ffmpeg_data;
|
vgmstream->codec_data = ffmpeg_data;
|
||||||
@ -84,9 +82,6 @@ VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
|
|||||||
|
|
||||||
/* make a fake riff so FFmpeg can parse the ATRAC3 */
|
/* make a fake riff so FFmpeg can parse the ATRAC3 */
|
||||||
bytes = ffmpeg_make_riff_atrac3(buf,0x100, vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_size, joint_stereo, encoder_delay);
|
bytes = ffmpeg_make_riff_atrac3(buf,0x100, vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_size, joint_stereo, encoder_delay);
|
||||||
if (bytes <= 0)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
vgmstream->codec_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
|
vgmstream->codec_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
|
||||||
if (!vgmstream->codec_data) goto fail;
|
if (!vgmstream->codec_data) goto fail;
|
||||||
vgmstream->coding_type = coding_FFmpeg;
|
vgmstream->coding_type = coding_FFmpeg;
|
||||||
@ -106,7 +101,6 @@ VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* open the file for reading */
|
|
||||||
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user