mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 23:10:10 +01:00
Add LOPU .lopus [Melty Blood Type Lumina (Switch)]
This commit is contained in:
parent
a5355da367
commit
011aa6c6c1
@ -289,7 +289,7 @@ static const char* extension_list[] = {
|
|||||||
"lmp4", //fake extension for .mp4
|
"lmp4", //fake extension for .mp4
|
||||||
"lmpc", //fake extension for .mpc, FFmpeg/not parsed
|
"lmpc", //fake extension for .mpc, FFmpeg/not parsed
|
||||||
"logg", //fake extension for .ogg
|
"logg", //fake extension for .ogg
|
||||||
"lopus", //fake extension for .opus
|
"lopus", //fake extension for .opus, used by LOPU too
|
||||||
"lp",
|
"lp",
|
||||||
"lpcm",
|
"lpcm",
|
||||||
"lpk",
|
"lpk",
|
||||||
@ -1364,6 +1364,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_BNK_RELIC, "Relic BNK header"},
|
{meta_BNK_RELIC, "Relic BNK header"},
|
||||||
{meta_XSH_XSD_XSS, "Treyarch XSH+XSD/XSS header"},
|
{meta_XSH_XSD_XSS, "Treyarch XSH+XSD/XSS header"},
|
||||||
{meta_PSB, "M2 PSB header"},
|
{meta_PSB, "M2 PSB header"},
|
||||||
|
{meta_LOPU, "French-Break LOPU header"},
|
||||||
};
|
};
|
||||||
|
|
||||||
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {
|
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {
|
||||||
|
@ -215,6 +215,7 @@
|
|||||||
<ClCompile Include="meta\ktsr.c" />
|
<ClCompile Include="meta\ktsr.c" />
|
||||||
<ClCompile Include="meta\ktss.c" />
|
<ClCompile Include="meta\ktss.c" />
|
||||||
<ClCompile Include="meta\kwb.c" />
|
<ClCompile Include="meta\kwb.c" />
|
||||||
|
<ClCompile Include="meta\lopu.c" />
|
||||||
<ClCompile Include="meta\lrmd.c" />
|
<ClCompile Include="meta\lrmd.c" />
|
||||||
<ClCompile Include="meta\lsf.c" />
|
<ClCompile Include="meta\lsf.c" />
|
||||||
<ClCompile Include="meta\mattel_hyperscan.c" />
|
<ClCompile Include="meta\mattel_hyperscan.c" />
|
||||||
|
@ -1903,6 +1903,9 @@
|
|||||||
<ClCompile Include="meta\kwb.c">
|
<ClCompile Include="meta\kwb.c">
|
||||||
<Filter>meta\Source Files</Filter>
|
<Filter>meta\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="meta\lopu.c">
|
||||||
|
<Filter>meta\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="meta\lrmd.c">
|
<ClCompile Include="meta\lrmd.c">
|
||||||
<Filter>meta\Source Files</Filter>
|
<Filter>meta\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
61
src/meta/lopu.c
Normal file
61
src/meta/lopu.c
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#include "meta.h"
|
||||||
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* LOPU - French-Bread's Opus [Melty Blood: Type Lumina (Switch)] */
|
||||||
|
VGMSTREAM* init_vgmstream_lopu(STREAMFILE* sf) {
|
||||||
|
VGMSTREAM* vgmstream = NULL;
|
||||||
|
int loop_flag, channels, sample_rate;
|
||||||
|
uint32_t start_offset, data_size;
|
||||||
|
int32_t num_samples, loop_start, loop_end, skip;
|
||||||
|
|
||||||
|
/* checks */
|
||||||
|
if (!is_id32be(0x00, sf, "LOPU"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* .lopus: real extension (honest) */
|
||||||
|
if (!check_extensions(sf, "lopus"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
start_offset = read_u32le(0x04, sf);
|
||||||
|
sample_rate = read_u32le(0x08, sf);
|
||||||
|
channels = read_s16le(0x0c, sf);
|
||||||
|
/* 0x10: ? (1984) */
|
||||||
|
num_samples = read_s32le(0x14, sf);
|
||||||
|
loop_start = read_s32le(0x18, sf);
|
||||||
|
loop_end = read_s32le(0x1c, sf) + 1;
|
||||||
|
/* 0x20: frame size */
|
||||||
|
skip = read_s16le(0x24, sf);
|
||||||
|
data_size = read_u32le(0x28, sf);
|
||||||
|
/* rest: null */
|
||||||
|
|
||||||
|
loop_flag = (loop_end > 0); /* -1 if no loop */
|
||||||
|
num_samples -= skip;
|
||||||
|
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
vgmstream->meta_type = meta_LOPU;
|
||||||
|
vgmstream->sample_rate = sample_rate;
|
||||||
|
vgmstream->num_samples = num_samples;
|
||||||
|
vgmstream->loop_start_sample = loop_start;
|
||||||
|
vgmstream->loop_end_sample = loop_end;
|
||||||
|
|
||||||
|
#ifdef VGM_USE_FFMPEG
|
||||||
|
vgmstream->codec_data = init_ffmpeg_switch_opus(sf, start_offset, data_size, vgmstream->channels, skip, vgmstream->sample_rate);
|
||||||
|
if (!vgmstream->codec_data) goto fail;
|
||||||
|
vgmstream->coding_type = coding_FFmpeg;
|
||||||
|
vgmstream->layout_type = layout_none;
|
||||||
|
#else
|
||||||
|
goto fail;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||||
|
goto fail;
|
||||||
|
return vgmstream;
|
||||||
|
fail:
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -964,4 +964,6 @@ VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf);
|
|||||||
|
|
||||||
VGMSTREAM* init_vgmstream_psb(STREAMFILE* sf);
|
VGMSTREAM* init_vgmstream_psb(STREAMFILE* sf);
|
||||||
|
|
||||||
|
VGMSTREAM* init_vgmstream_lopu(STREAMFILE* sf);
|
||||||
|
|
||||||
#endif /*_META_H*/
|
#endif /*_META_H*/
|
||||||
|
@ -527,6 +527,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
|
|||||||
init_vgmstream_bnk_relic,
|
init_vgmstream_bnk_relic,
|
||||||
init_vgmstream_xsh_xsd_xss,
|
init_vgmstream_xsh_xsd_xss,
|
||||||
init_vgmstream_psb,
|
init_vgmstream_psb,
|
||||||
|
init_vgmstream_lopu,
|
||||||
|
|
||||||
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
||||||
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
||||||
|
@ -747,6 +747,7 @@ typedef enum {
|
|||||||
meta_BNK_RELIC,
|
meta_BNK_RELIC,
|
||||||
meta_XSH_XSD_XSS,
|
meta_XSH_XSD_XSS,
|
||||||
meta_PSB,
|
meta_PSB,
|
||||||
|
meta_LOPU,
|
||||||
|
|
||||||
} meta_t;
|
} meta_t;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user