From a960a12e5864e8aa6ba1644e41533d8a21da69d4 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 1 Dec 2018 18:34:23 +0100 Subject: [PATCH] Fix some compiler warning/errors with libs disabled --- doc/BUILD.md | 2 +- ext_libs/clHCA.c | 6 +++--- src/meta/pos.c | 6 +++++- src/meta/ue4opus.c | 8 ++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index 8f9c260d..1d330660 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -30,7 +30,7 @@ **With GCC**: use the *./Makefile* in the root folder, see inside for options. For compilation flags check the *Makefile* in each folder. You may need to manually rebuild if you change a *.h* file (use *make clean*). -In Linux, Makefiles can be used to cross-compile with the MingW headers, but may not be updated to generate native code at the moment. It should be fixable with some effort. Autotools should build it as vgmstream-cli instead (see the Audacious section). +In Linux, Makefiles can be used to cross-compile with the MingW headers, but may not be updated to generate native code at the moment. It should be fixable with some effort. Autotools should build it as vgmstream-cli instead (see the Audacious section). Some Linux distributions like Arch Linux include pre-patched vgmstream with most libraries, you may want that instead (see: https://aur.archlinux.org/packages/vgmstream-kode54-git/). Windows CMD example: ``` diff --git a/ext_libs/clHCA.c b/ext_libs/clHCA.c index 0faea50b..5a7ae962 100644 --- a/ext_libs/clHCA.c +++ b/ext_libs/clHCA.c @@ -1551,9 +1551,9 @@ static const unsigned int decode5_imdct_window_int[128] = { static const float *decode5_imdct_window = (const float *)decode5_imdct_window_int; static void decoder5_run_imdct(stChannel *ch, int subframe) { - const static unsigned int size = HCA_SAMPLES_PER_SUBFRAME; - const static unsigned int half = HCA_SAMPLES_PER_SUBFRAME / 2; - const static unsigned int mdct_bits = HCA_MDCT_BITS; + static const unsigned int size = HCA_SAMPLES_PER_SUBFRAME; + static const unsigned int half = HCA_SAMPLES_PER_SUBFRAME / 2; + static const unsigned int mdct_bits = HCA_MDCT_BITS; /* apply DCT-IV to dequantized spectra */ diff --git a/src/meta/pos.c b/src/meta/pos.c index 0c904d62..5e499ce6 100644 --- a/src/meta/pos.c +++ b/src/meta/pos.c @@ -15,11 +15,12 @@ VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) { streamData = open_streamfile_by_ext(streamFile, "wav"); if (streamData) { - vgmstream = init_vgmstream_riff(streamData); + vgmstream = init_vgmstream_riff(streamData); if (!vgmstream) goto fail; vgmstream->meta_type = meta_RIFF_WAVE_POS; } else { +#ifdef VGM_USE_VORBIS /* hack for Ogg with external loops */ streamData = open_streamfile_by_ext(streamFile, "ogg"); if (streamData) { @@ -29,6 +30,9 @@ VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) { else { goto fail; } +#else + goto fail; +#endif } close_streamfile(streamData); diff --git a/src/meta/ue4opus.c b/src/meta/ue4opus.c index 516dac08..b3a3e489 100644 --- a/src/meta/ue4opus.c +++ b/src/meta/ue4opus.c @@ -29,9 +29,6 @@ VGMSTREAM * init_vgmstream_ue4opus(STREAMFILE *streamFile) { start_offset = 0x11; data_size = get_streamfile_size(streamFile) - start_offset; - /* usually uses 60ms for music (delay of 360 samples) */ - skip = ue4_opus_get_encoder_delay(start_offset, streamFile); - /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count, loop_flag); @@ -39,10 +36,13 @@ VGMSTREAM * init_vgmstream_ue4opus(STREAMFILE *streamFile) { vgmstream->meta_type = meta_UE4OPUS; vgmstream->sample_rate = sample_rate; - vgmstream->num_samples = num_samples - skip; #ifdef VGM_USE_FFMPEG { + /* usually uses 60ms for music (delay of 360 samples) */ + skip = ue4_opus_get_encoder_delay(start_offset, streamFile); + vgmstream->num_samples = num_samples - skip; + vgmstream->codec_data = init_ffmpeg_ue4_opus(streamFile, start_offset,data_size, vgmstream->channels, skip, vgmstream->sample_rate); if (!vgmstream->codec_data) goto fail; vgmstream->coding_type = coding_FFmpeg;