From f0897c78682999e6daa8c8122e9284c680c0ff91 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 28 Jul 2024 17:30:38 +0200 Subject: [PATCH] cleanup: internal stuff --- src/vgmstream.c | 10 +++++----- src/vgmstream.h | 2 +- src/vgmstream_init.c | 4 ++-- src/vgmstream_init.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/vgmstream.c b/src/vgmstream.c index 31cbd938..3d37461b 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -16,7 +16,7 @@ #include "util/sf_utils.h" -static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf, int format_id); +static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf); /*****************************************************************************/ @@ -39,7 +39,7 @@ VGMSTREAM* init_vgmstream_from_STREAMFILE(STREAMFILE* sf) { } -bool prepare_vgmstream(VGMSTREAM* vgmstream, STREAMFILE* sf, int format_id) { +bool prepare_vgmstream(VGMSTREAM* vgmstream, STREAMFILE* sf) { /* fail if there is nothing/too much to play (<=0 generates empty files, >N writes GBs of garbage) */ if (vgmstream->num_samples <= 0 || vgmstream->num_samples > VGMSTREAM_MAX_NUM_SAMPLES) { @@ -68,7 +68,7 @@ bool prepare_vgmstream(VGMSTREAM* vgmstream, STREAMFILE* sf, int format_id) { /* test if candidate for dual stereo */ if (vgmstream->channels == 1 && vgmstream->allow_dual_stereo == 1) { - try_dual_file_stereo(vgmstream, sf, format_id); + try_dual_file_stereo(vgmstream, sf); } @@ -428,7 +428,7 @@ fail: /* See if there is a second file which may be the second channel, given an already opened mono vgmstream. * If a suitable file is found, open it and change opened_vgmstream to a stereo vgmstream. */ -static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf, int format_id) { +static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf) { /* filename search pairs for dual file stereo */ static const char* const dfs_pairs[][2] = { {"L","R"}, /* most common in .dsp and .vag */ @@ -516,7 +516,7 @@ static void try_dual_file_stereo(VGMSTREAM* opened_vgmstream, STREAMFILE* sf, in return; //;VGM_LOG("DFS: match %i filename=%s\n", dfs_pair, new_filename); - init_vgmstream_t init_vgmstream_function = get_vgmstream_format_init(format_id); + init_vgmstream_t init_vgmstream_function = get_vgmstream_format_init(opened_vgmstream->format_id); if (init_vgmstream_function == NULL) goto fail; diff --git a/src/vgmstream.h b/src/vgmstream.h index 822c918b..69f7575e 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -177,7 +177,7 @@ typedef struct { /* other config */ bool allow_dual_stereo; /* search for dual stereo (file_L.ext + file_R.ext = single stereo file) */ - + int format_id; /* internal format ID */ /* layout/block state */ size_t full_block_size; /* actual data size of an entire block (ie. may be fixed, include padding/headers, etc) */ diff --git a/src/vgmstream_init.c b/src/vgmstream_init.c index b039a3f6..625357ed 100644 --- a/src/vgmstream_init.c +++ b/src/vgmstream_init.c @@ -572,10 +572,10 @@ VGMSTREAM* detect_vgmstream_format(STREAMFILE* sf) { if (!vgmstream) continue; - int format_id = i + 1; + vgmstream->format_id = i + 1; /* validate + setup vgmstream */ - if (!prepare_vgmstream(vgmstream, sf, format_id)) { + if (!prepare_vgmstream(vgmstream, sf)) { /* keep trying if wasn't valid, as simpler formats may return a vgmstream by mistake */ close_vgmstream(vgmstream); continue; diff --git a/src/vgmstream_init.h b/src/vgmstream_init.h index 30e8c812..0fa1aa6a 100644 --- a/src/vgmstream_init.h +++ b/src/vgmstream_init.h @@ -4,7 +4,7 @@ #include "meta/meta.h" #include "vgmstream.h" -bool prepare_vgmstream(VGMSTREAM* vgmstream, STREAMFILE* sf, int format_id); +bool prepare_vgmstream(VGMSTREAM* vgmstream, STREAMFILE* sf); VGMSTREAM* detect_vgmstream_format(STREAMFILE* sf); init_vgmstream_t get_vgmstream_format_init(int format_id);