cleanup: vid1

This commit is contained in:
bnnm 2023-06-24 15:58:29 +02:00
parent fc2bca92a8
commit dd92360096
3 changed files with 17 additions and 15 deletions

View File

@ -668,7 +668,7 @@ VGMSTREAM * init_vgmstream_ea_tmx(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ea_sbr(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ea_sbr_harmony(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ngc_vid1(STREAMFILE * streamFile);
VGMSTREAM* init_vgmstream_vid1(STREAMFILE* sf);
VGMSTREAM * init_vgmstream_flx(STREAMFILE * streamFile);

View File

@ -1,36 +1,38 @@
#include "meta.h"
#include "../coding/coding.h"
#include "../layout/layout.h"
#include "../util/endianness.h"
/* VID1 - Factor 5/DivX format GC/Xbox games [Gun (GC), Tony Hawk's American Wasteland (GC), Enter The Matrix (Xbox)]*/
VGMSTREAM * init_vgmstream_ngc_vid1(STREAMFILE* sf) {
VGMSTREAM* init_vgmstream_vid1(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset, header_offset;
uint32_t start_offset, header_offset;
int loop_flag = 0, channels, sample_rate;
uint32_t codec;
int big_endian;
uint32_t (*read_u32)(off_t,STREAMFILE*);
read_u32_t read_u32;
/* checks */
/* .vid: video + (often) audio
* .ogg: audio only [Gun (GC)], .logg: for plugins */
if (!check_extensions(sf,"vid,ogg,logg"))
goto fail;
/* chunked/blocked format containing video or audio frames */
if (read_u32be(0x00, sf) == 0x56494431) { /* "VID1" BE (GC) */
if (is_id32be(0x00, sf, "VID1")) { /* BE (GC) */
big_endian = 1;
}
else if (read_u32le(0x00,sf) == 0x56494431) { /* "VID1" LE (Xbox) */
else if (is_id32le(0x00,sf, "VID1")) { /* LE (Xbox) */
big_endian = 0;
}
else {
goto fail;
return NULL;
}
/* .vid: video + (often) audio
* .ogg: audio only [Gun (GC)], .logg: for plugins */
if (!check_extensions(sf,"vid,ogg,logg"))
return NULL;
read_u32 = big_endian ? read_u32be : read_u32le;
/* chunked/blocked format containing video or audio frames */
/* find actual header start/size in the chunks (id + size + null) */
{

View File

@ -337,7 +337,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
init_vgmstream_ea_tmx,
init_vgmstream_ea_sbr,
init_vgmstream_ea_sbr_harmony,
init_vgmstream_ngc_vid1,
init_vgmstream_vid1,
init_vgmstream_flx,
init_vgmstream_mogg,
init_vgmstream_kma9,