mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +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);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->loop_flag = loop_flag;
|
||||
vgmstream->codec_data = data;
|
||||
vgmstream->channels = data->channels;
|
||||
vgmstream->sample_rate = data->sampleRate;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->meta_type = meta_FFmpeg;
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->codec_data = data;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
if (!num_samples) {
|
||||
num_samples = data->totalSamples;
|
||||
@ -64,11 +62,10 @@ VGMSTREAM * init_vgmstream_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start,
|
||||
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)
|
||||
goto fail;
|
||||
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
|
@ -589,7 +589,6 @@ VGMSTREAM * init_vgmstream_ogg_vorbis_callbacks(STREAMFILE *streamFile, ov_callb
|
||||
vgmstream->loop_end_sample = loop_end;
|
||||
else
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
vgmstream->loop_flag = loop_flag;
|
||||
|
||||
if (vgmstream->loop_end_sample > vgmstream->num_samples)
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
|
@ -3,39 +3,39 @@
|
||||
#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 * vgmstream = NULL;
|
||||
off_t start_offset, data_size;
|
||||
int loop_flag = 0, channel_count, codec;
|
||||
|
||||
int loop_flag = 0, channel_count, type;
|
||||
|
||||
/* check extensions */
|
||||
if ( !check_extensions(streamFile, "vawx,xwv") )
|
||||
/* checks */
|
||||
/* .xwv: actual extension [Moon Diver (PS3/X360)]
|
||||
* .vawx: header id */
|
||||
if ( !check_extensions(streamFile, "xwv,vawx") )
|
||||
goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x56415758) /* "VAWX" */
|
||||
goto fail;
|
||||
|
||||
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 */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* 0x04: filesize */
|
||||
start_offset = 0x800; /* ? read_32bitLE(0x0c,streamFile); */
|
||||
vgmstream->channels = channel_count;
|
||||
/* 0x16: file id */
|
||||
type = read_8bit(0x36,streamFile); /* could be at 0x38 too */
|
||||
vgmstream->num_samples = read_32bitBE(0x3c,streamFile);
|
||||
vgmstream->sample_rate = read_32bitBE(0x40,streamFile);
|
||||
|
||||
vgmstream->meta_type = meta_VAWX;
|
||||
|
||||
switch(type) {
|
||||
switch(codec) {
|
||||
case 2: /* VAG */
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
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 */
|
||||
|
||||
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);
|
||||
if ( !ffmpeg_data ) goto fail;
|
||||
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 */
|
||||
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);
|
||||
if (!vgmstream->codec_data) goto fail;
|
||||
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) )
|
||||
goto fail;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user