mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Added MP3 codec to XMV parser
This commit is contained in:
parent
0fe6f3c31e
commit
0e6c188211
@ -1,7 +1,8 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* .360.WAV - from Valve games running on Source Engine [The Orange Box (X360)] */
|
/* .360.WAV - from Valve games running on Source Engine */
|
||||||
|
/* [The Orange Box (X360), Portal 2 (PS3/X360), Counter-Strike: Global Offsensive (PS3/X360)] */
|
||||||
VGMSTREAM* init_vgmstream_xmv_valve(STREAMFILE* streamFile) {
|
VGMSTREAM* init_vgmstream_xmv_valve(STREAMFILE* streamFile) {
|
||||||
VGMSTREAM* vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
int32_t loop_start;
|
int32_t loop_start;
|
||||||
@ -50,11 +51,11 @@ VGMSTREAM* init_vgmstream_xmv_valve(STREAMFILE* streamFile) {
|
|||||||
vgmstream->sample_rate = sample_rate;
|
vgmstream->sample_rate = sample_rate;
|
||||||
vgmstream->num_samples = num_samples;
|
vgmstream->num_samples = num_samples;
|
||||||
vgmstream->loop_start_sample = loop_start;
|
vgmstream->loop_start_sample = loop_start;
|
||||||
vgmstream->loop_end_sample = num_samples - loop_end_skip;
|
vgmstream->loop_end_sample = num_samples; /* always loops from the end */
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case 0x00: /* PCM */
|
case 0x00: /* PCM */
|
||||||
vgmstream->coding_type = coding_PCM16BE; /* assumed BE */
|
vgmstream->coding_type = coding_PCM16BE;
|
||||||
vgmstream->layout_type = layout_interleave;
|
vgmstream->layout_type = layout_interleave;
|
||||||
vgmstream->interleave_block_size = 0x02;
|
vgmstream->interleave_block_size = 0x02;
|
||||||
break;
|
break;
|
||||||
@ -76,10 +77,28 @@ VGMSTREAM* init_vgmstream_xmv_valve(STREAMFILE* streamFile) {
|
|||||||
vgmstream->codec_data = ffmpeg_data;
|
vgmstream->codec_data = ffmpeg_data;
|
||||||
vgmstream->coding_type = coding_FFmpeg;
|
vgmstream->coding_type = coding_FFmpeg;
|
||||||
vgmstream->layout_type = layout_none;
|
vgmstream->layout_type = layout_none;
|
||||||
|
vgmstream->loop_end_sample -= loop_end_skip;
|
||||||
|
|
||||||
xma_fix_raw_samples(vgmstream, streamFile, start_offset, data_size, 0, 1, 1);
|
xma_fix_raw_samples(vgmstream, streamFile, start_offset, data_size, 0, 1, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef VGM_USE_MPEG
|
||||||
|
case 0x03: { /* MP3 */
|
||||||
|
mpeg_codec_data *mpeg_data;
|
||||||
|
coding_t coding;
|
||||||
|
|
||||||
|
mpeg_data = init_mpeg(streamFile, start_offset, &coding, channels);
|
||||||
|
if (!mpeg_data) goto fail;
|
||||||
|
|
||||||
|
vgmstream->codec_data = mpeg_data;
|
||||||
|
vgmstream->coding_type = coding;
|
||||||
|
vgmstream->layout_type = layout_none;
|
||||||
|
|
||||||
|
/* strangely, number of samples is stored incorrectly for MP3, there's PCM size in this field instead */
|
||||||
|
vgmstream->num_samples = pcm_bytes_to_samples(num_samples, channels, 16);
|
||||||
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
case 0x02: /* ADPCM, not actually implemented */
|
case 0x02: /* ADPCM, not actually implemented */
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user