FreeBSD Bugzilla – Attachment 250116 Details for
Bug 278491
audio/sdl2_sound: Backport upstream patches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for sdl2_sound
sdl2_sound-fixup.patch (text/plain), 48.42 KB, created by
Daniel Engberg
on 2024-04-20 22:09:30 UTC
(
hide
)
Description:
Patch for sdl2_sound
Filename:
MIME Type:
Creator:
Daniel Engberg
Created:
2024-04-20 22:09:30 UTC
Size:
48.42 KB
patch
obsolete
>diff --git a/audio/sdl2_sound/Makefile b/audio/sdl2_sound/Makefile >index 23cd4b807028..54a69926d7c5 100644 >--- a/audio/sdl2_sound/Makefile >+++ b/audio/sdl2_sound/Makefile >@@ -1,7 +1,9 @@ > PORTNAME= sdl2_sound >-DISTVERSIONPREFIX= v > DISTVERSION= 2.0.2 >+PORTREVISION= 1 > CATEGORIES= audio >+MASTER_SITES= https://github.com/icculus/SDL_sound/releases/download/v${DISTVERSION}/ >+DISTNAME= SDL2_sound-${DISTVERSION} > > MAINTAINER= amdmi3@FreeBSD.org > COMMENT= Abstract SDL soundfile decoder >@@ -11,20 +13,18 @@ WWW= https://icculus.org/SDL_sound/ \ > LICENSE= ZLIB > LICENSE_FILE_ZLIB=${WRKSRC}/LICENSE.txt > >-USES= cmake sdl >+USES= cmake pathfix sdl > USE_SDL= sdl2 >-USE_GITHUB= yes >-GH_ACCOUNT= icculus >-GH_PROJECT= SDL_sound > USE_LDCONFIG= yes > > PORTDOCS= * > PORTEXAMPLES= * > >-OPTIONS_DEFINE= MIDI DOCS EXAMPLES >+OPTIONS_DEFINE= DOCS EXAMPLES MIDI > OPTIONS_DEFAULT=MIDI > > MIDI_DESC= MIDI support >+ > MIDI_CMAKE_BOOL=SDLSOUND_DECODER_MIDI > MIDI_VARS= LICENSE+=ART10 \ > LICENSE_COMB=multi \ >diff --git a/audio/sdl2_sound/distinfo b/audio/sdl2_sound/distinfo >index f939710aa625..d2e5a32ba821 100644 >--- a/audio/sdl2_sound/distinfo >+++ b/audio/sdl2_sound/distinfo >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1688690484 >-SHA256 (icculus-SDL_sound-v2.0.2_GH0.tar.gz) = 5f92600de48ec640985d13e50d111af9ac30be797bc9a36eafa5d8cecc7e1f60 >-SIZE (icculus-SDL_sound-v2.0.2_GH0.tar.gz) = 459868 >+TIMESTAMP = 1713649595 >+SHA256 (SDL2_sound-2.0.2.tar.gz) = 465a81d6004af731768b881b2f50383150cc58a8d346653bad85e2375829cc3a >+SIZE (SDL2_sound-2.0.2.tar.gz) = 459893 >diff --git a/audio/sdl2_sound/files/patch-git-01-20240119 b/audio/sdl2_sound/files/patch-git-01-20240119 >new file mode 100644 >index 000000000000..b668c59b4872 >--- /dev/null >+++ b/audio/sdl2_sound/files/patch-git-01-20240119 >@@ -0,0 +1,1261 @@ >+From 1f8b5c25fabe1d611e828f112b7c76dac907b524 Mon Sep 17 00:00:00 2001 >+From: Anonymous Maarten <anonymous.maarten@gmail.com> >+Date: Wed, 5 Jul 2023 12:31:47 +0200 >+Subject: [PATCH 01/17] cmake: use SDL2_INCLUDE_DIRS instead of target property >+ >+--- >+ CMakeLists.txt | 20 ++++---------------- >+ 1 file changed, 4 insertions(+), 16 deletions(-) >+ >+diff --git a/CMakeLists.txt b/CMakeLists.txt >+index 8dedebc..0773dec 100644 >+--- CMakeLists.txt >++++ CMakeLists.txt >+@@ -215,14 +215,8 @@ if(SDLSOUND_BUILD_STATIC) >+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> >+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2> >+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>) >+- if(TARGET SDL2::SDL2-static) >+- get_target_property(_sdl2_include_dir SDL2::SDL2-static INTERFACE_INCLUDE_DIRECTORIES) >+- target_include_directories(SDL2_sound-static PUBLIC "$<BUILD_INTERFACE:${_sdl2_include_dir}>") >+- target_link_libraries(SDL2_sound-static PRIVATE $<BUILD_INTERFACE:SDL2::SDL2-static> ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) >+- else() >+- target_include_directories(SDL2_sound-static PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") >+- target_link_libraries(SDL2_sound-static PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) >+- endif() >++ target_include_directories(SDL2_sound-static PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") >++ target_link_libraries(SDL2_sound-static PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) >+ set(SDLSOUND_LIB_TARGET SDL2_sound-static) >+ endif() >+ >+@@ -249,14 +243,8 @@ if(SDLSOUND_BUILD_SHARED) >+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2> >+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> >+ ) >+- if(TARGET SDL2::SDL2) >+- get_target_property(_sdl2_include_dir SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES) >+- target_include_directories(SDL2_sound PUBLIC "$<BUILD_INTERFACE:${_sdl2_include_dir}>") >+- target_link_libraries(SDL2_sound PRIVATE $<BUILD_INTERFACE:SDL2::SDL2> ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) >+- else() >+- target_include_directories(SDL2_sound PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") >+- target_link_libraries(SDL2_sound PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) >+- endif() >++ target_include_directories(SDL2_sound PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") >++ target_link_libraries(SDL2_sound PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) >+ set(SDLSOUND_LIB_TARGET SDL2_sound) >+ endif() >+ >+ >+From f80947aa7bda23925b2c22cbb2b4da1f9e8d2e6c Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Wed, 5 Jul 2023 17:55:32 +0300 >+Subject: [PATCH 02/17] sync dr_mp3 and dr_flac with mainstream. >+ >+--- >+ src/dr_flac.h | 71 ++++++++++++++++++++++++++++++++++----------------- >+ src/dr_mp3.h | 48 ++++++++++++++++++++++++---------- >+ 2 files changed, 82 insertions(+), 37 deletions(-) >+ >+diff --git a/src/dr_flac.h b/src/dr_flac.h >+index 0c43eed..1ede99f 100644 >+--- src/dr_flac.h >++++ src/dr_flac.h >+@@ -1,6 +1,6 @@ >+ /* >+ FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. >+-dr_flac - v0.12.39 - 2022-09-17 >++dr_flac - v0.12.41 - 2023-06-17 >+ >+ David Reid - mackron@gmail.com >+ >+@@ -235,12 +235,12 @@ extern "C" { >+ >+ #define DRFLAC_VERSION_MAJOR 0 >+ #define DRFLAC_VERSION_MINOR 12 >+-#define DRFLAC_VERSION_REVISION 39 >++#define DRFLAC_VERSION_REVISION 41 >+ #define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION) >+ >+ #include <stddef.h> /* For size_t. */ >+ >+-/* Sized types. */ >++/* Sized Types */ >+ typedef signed char drflac_int8; >+ typedef unsigned char drflac_uint8; >+ typedef signed short drflac_int16; >+@@ -273,7 +273,9 @@ typedef drflac_uint8 drflac_bool8; >+ typedef drflac_uint32 drflac_bool32; >+ #define DRFLAC_TRUE 1 >+ #define DRFLAC_FALSE 0 >++/* End Sized Types */ >+ >++/* Decorations */ >+ #if !defined(DRFLAC_API) >+ #if defined(DRFLAC_DLL) >+ #if defined(_WIN32) >+@@ -303,6 +305,7 @@ typedef drflac_uint32 drflac_bool32; >+ #define DRFLAC_PRIVATE static >+ #endif >+ #endif >++/* End Decorations */ >+ >+ #if defined(_MSC_VER) && _MSC_VER >= 1700 /* Visual Studio 2012 */ >+ #define DRFLAC_DEPRECATED __declspec(deprecated) >+@@ -321,6 +324,16 @@ typedef drflac_uint32 drflac_bool32; >+ DRFLAC_API void drflac_version(drflac_uint32* pMajor, drflac_uint32* pMinor, drflac_uint32* pRevision); >+ DRFLAC_API const char* drflac_version_string(void); >+ >++/* Allocation Callbacks */ >++typedef struct >++{ >++ void* pUserData; >++ void* (* onMalloc)(size_t sz, void* pUserData); >++ void* (* onRealloc)(void* p, size_t sz, void* pUserData); >++ void (* onFree)(void* p, void* pUserData); >++} drflac_allocation_callbacks; >++/* End Allocation Callbacks */ >++ >+ /* >+ As data is read from the client it is placed into an internal buffer for fast access. This controls the size of that buffer. Larger values means more speed, >+ but also more memory. In my testing there is diminishing returns after about 4KB, but you can fiddle with this to suit your own needs. Must be a multiple of 8. >+@@ -329,11 +342,22 @@ but also more memory. In my testing there is diminishing returns after about 4KB >+ #define DR_FLAC_BUFFER_SIZE 4096 >+ #endif >+ >+-/* Check if we can enable 64-bit optimizations. */ >++ >++/* Architecture Detection */ >+ #if defined(_WIN64) || defined(_LP64) || defined(__LP64__) >+ #define DRFLAC_64BIT >+ #endif >+ >++#if defined(__x86_64__) || defined(_M_X64) >++ #define DRFLAC_X64 >++#elif defined(__i386) || defined(_M_IX86) >++ #define DRFLAC_X86 >++#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) >++ #define DRFLAC_ARM >++#endif >++/* End Architecture Detection */ >++ >++ >+ #ifdef DRFLAC_64BIT >+ typedef drflac_uint64 drflac_cache_t; >+ #else >+@@ -562,14 +586,6 @@ will be set to one of the DRFLAC_METADATA_BLOCK_TYPE_* tokens. >+ typedef void (* drflac_meta_proc)(void* pUserData, drflac_metadata* pMetadata); >+ >+ >+-typedef struct >+-{ >+- void* pUserData; >+- void* (* onMalloc)(size_t sz, void* pUserData); >+- void* (* onRealloc)(void* p, size_t sz, void* pUserData); >+- void (* onFree)(void* p, void* pUserData); >+-} drflac_allocation_callbacks; >+- >+ /* Structure for internal use. Only used for decoders opened with drflac_open_memory. */ >+ typedef struct >+ { >+@@ -1351,6 +1367,7 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat >+ #include <stdlib.h> >+ #include <string.h> >+ >++/* Inline */ >+ #ifdef _MSC_VER >+ #define DRFLAC_INLINE __forceinline >+ #elif defined(__GNUC__) >+@@ -1377,15 +1394,7 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat >+ #else >+ #define DRFLAC_INLINE >+ #endif >+- >+-/* CPU architecture. */ >+-#if defined(__x86_64__) || defined(_M_X64) >+- #define DRFLAC_X64 >+-#elif defined(__i386) || defined(_M_IX86) >+- #define DRFLAC_X86 >+-#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) >+- #define DRFLAC_ARM >+-#endif >++/* End Inline */ >+ >+ /* >+ Intrinsics Support >+@@ -1623,6 +1632,7 @@ static DRFLAC_INLINE drflac_bool32 drflac_has_sse41(void) >+ >+ #define DRFLAC_MAX_SIMD_VECTOR_SIZE 64 /* 64 for AVX-512 in the future. */ >+ >++/* Result Codes */ >+ typedef drflac_int32 drflac_result; >+ #define DRFLAC_SUCCESS 0 >+ #define DRFLAC_ERROR -1 /* A generic error. */ >+@@ -1678,7 +1688,10 @@ typedef drflac_int32 drflac_result; >+ #define DRFLAC_CANCELLED -51 >+ #define DRFLAC_MEMORY_ALREADY_MAPPED -52 >+ #define DRFLAC_AT_END -53 >+-#define DRFLAC_CRC_MISMATCH -128 >++ >++#define DRFLAC_CRC_MISMATCH -100 >++/* End Result Codes */ >++ >+ >+ #define DRFLAC_SUBFRAME_CONSTANT 0 >+ #define DRFLAC_SUBFRAME_VERBATIM 1 >+@@ -8141,6 +8154,7 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac >+ #include <wchar.h> /* For wcslen(), wcsrtombs() */ >+ #endif >+ >++/* Errno */ >+ /* drflac_result_from_errno() is only used for fopen() and wfopen() so putting it inside DR_WAV_NO_STDIO for now. If something else needs this later we can move it out. */ >+ #include <errno.h> >+ static drflac_result drflac_result_from_errno(int e) >+@@ -8544,7 +8558,9 @@ static drflac_result drflac_result_from_errno(int e) >+ default: return DRFLAC_ERROR; >+ } >+ } >++/* End Errno */ >+ >++/* fopen */ >+ static drflac_result drflac_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode) >+ { >+ #if defined(_MSC_VER) && _MSC_VER >= 1400 >+@@ -8702,6 +8718,7 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons >+ return DRFLAC_SUCCESS; >+ } >+ #endif >++/* End fopen */ >+ >+ static size_t drflac__on_read_stdio(void* pUserData, void* bufferOut, size_t bytesToRead) >+ { >+@@ -11666,6 +11683,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p >+ >+ /* High Level APIs */ >+ >++/* SIZE_MAX */ >+ #if defined(SIZE_MAX) >+ #define DRFLAC_SIZE_MAX SIZE_MAX >+ #else >+@@ -11675,6 +11693,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p >+ #define DRFLAC_SIZE_MAX 0xFFFFFFFF >+ #endif >+ #endif >++/* End SIZE_MAX */ >+ >+ >+ /* Using a macro as the definition of the drflac__full_decode_and_close_*() API family. Sue me. */ >+@@ -12058,6 +12077,12 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat >+ /* >+ REVISION HISTORY >+ ================ >++v0.12.41 - 2023-06-17 >++ - Fix an incorrect date in revision history. No functional change. >++ >++v0.12.40 - 2023-05-22 >++ - Minor code restructure. No functional change. >++ >+ v0.12.39 - 2022-09-17 >+ - Fix compilation with DJGPP. >+ - Fix compilation error with Visual Studio 2019 and the ARM build. >+@@ -12488,7 +12513,7 @@ For more information, please refer to <http://unlicense.org/> >+ =============================================================================== >+ ALTERNATIVE 2 - MIT No Attribution >+ =============================================================================== >+-Copyright 2020 David Reid >++Copyright 2023 David Reid >+ >+ Permission is hereby granted, free of charge, to any person obtaining a copy of >+ this software and associated documentation files (the "Software"), to deal in >+diff --git a/src/dr_mp3.h b/src/dr_mp3.h >+index 59876c8..2e82189 100644 >+--- src/dr_mp3.h >++++ src/dr_mp3.h >+@@ -1,6 +1,6 @@ >+ /* >+ MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. >+-dr_mp3 - v0.6.34 - 2022-09-17 >++dr_mp3 - v0.6.36 - 2023-06-17 >+ >+ David Reid - mackron@gmail.com >+ >+@@ -95,12 +95,12 @@ extern "C" { >+ >+ #define DRMP3_VERSION_MAJOR 0 >+ #define DRMP3_VERSION_MINOR 6 >+-#define DRMP3_VERSION_REVISION 34 >++#define DRMP3_VERSION_REVISION 36 >+ #define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION) >+ >+ #include <stddef.h> /* For size_t. */ >+ >+-/* Sized types. */ >++/* Sized Types */ >+ typedef signed char drmp3_int8; >+ typedef unsigned char drmp3_uint8; >+ typedef signed short drmp3_int16; >+@@ -133,7 +133,9 @@ typedef drmp3_uint8 drmp3_bool8; >+ typedef drmp3_uint32 drmp3_bool32; >+ #define DRMP3_TRUE 1 >+ #define DRMP3_FALSE 0 >++/* End Sized Types */ >+ >++/* Decorations */ >+ #if !defined(DRMP3_API) >+ #if defined(DRMP3_DLL) >+ #if defined(_WIN32) >+@@ -163,7 +165,9 @@ typedef drmp3_uint32 drmp3_bool32; >+ #define DRMP3_PRIVATE static >+ #endif >+ #endif >++/* End Decorations */ >+ >++/* Result Codes */ >+ typedef drmp3_int32 drmp3_result; >+ #define DRMP3_SUCCESS 0 >+ #define DRMP3_ERROR -1 /* A generic error. */ >+@@ -219,11 +223,12 @@ typedef drmp3_int32 drmp3_result; >+ #define DRMP3_CANCELLED -51 >+ #define DRMP3_MEMORY_ALREADY_MAPPED -52 >+ #define DRMP3_AT_END -53 >+- >++/* End Result Codes */ >+ >+ #define DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME 1152 >+ #define DRMP3_MAX_SAMPLES_PER_FRAME (DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME*2) >+ >++/* Inline */ >+ #ifdef _MSC_VER >+ #define DRMP3_INLINE __forceinline >+ #elif defined(__GNUC__) >+@@ -250,12 +255,24 @@ typedef drmp3_int32 drmp3_result; >+ #else >+ #define DRMP3_INLINE >+ #endif >++/* End Inline */ >+ >+ >+ DRMP3_API void drmp3_version(drmp3_uint32* pMajor, drmp3_uint32* pMinor, drmp3_uint32* pRevision); >+ DRMP3_API const char* drmp3_version_string(void); >+ >+ >++/* Allocation Callbacks */ >++typedef struct >++{ >++ void* pUserData; >++ void* (* onMalloc)(size_t sz, void* pUserData); >++ void* (* onRealloc)(void* p, size_t sz, void* pUserData); >++ void (* onFree)(void* p, void* pUserData); >++} drmp3_allocation_callbacks; >++/* End Allocation Callbacks */ >++ >++ >+ /* >+ Low Level Push API >+ ================== >+@@ -329,14 +346,6 @@ will be either drmp3_seek_origin_start or drmp3_seek_origin_current. >+ */ >+ typedef drmp3_bool32 (* drmp3_seek_proc)(void* pUserData, int offset, drmp3_seek_origin origin); >+ >+-typedef struct >+-{ >+- void* pUserData; >+- void* (* onMalloc)(size_t sz, void* pUserData); >+- void* (* onRealloc)(void* p, size_t sz, void* pUserData); >+- void (* onFree)(void* p, void* pUserData); >+-} drmp3_allocation_callbacks; >+- >+ typedef struct >+ { >+ drmp3_uint32 channels; >+@@ -2415,6 +2424,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num >+ Main Public API >+ >+ ************************************************************************************************************************************************************/ >++/* SIZE_MAX */ >+ #if defined(SIZE_MAX) >+ #define DRMP3_SIZE_MAX SIZE_MAX >+ #else >+@@ -2424,6 +2434,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num >+ #define DRMP3_SIZE_MAX 0xFFFFFFFF >+ #endif >+ #endif >++/* End SIZE_MAX */ >+ >+ /* Options. */ >+ #ifndef DRMP3_SEEK_LEADING_MP3_FRAMES >+@@ -2931,6 +2942,7 @@ DRMP3_API drmp3_bool32 drmp3_init_memory(drmp3* pMP3, const void* pData, size_t >+ #include <stdio.h> >+ #include <wchar.h> /* For wcslen(), wcsrtombs() */ >+ >++/* Errno */ >+ /* drmp3_result_from_errno() is only used inside DR_MP3_NO_STDIO for now. Move this out if it's ever used elsewhere. */ >+ #include <errno.h> >+ static drmp3_result drmp3_result_from_errno(int e) >+@@ -3334,7 +3346,9 @@ static drmp3_result drmp3_result_from_errno(int e) >+ default: return DRMP3_ERROR; >+ } >+ } >++/* End Errno */ >+ >++/* fopen */ >+ static drmp3_result drmp3_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode) >+ { >+ #if defined(_MSC_VER) && _MSC_VER >= 1400 >+@@ -3490,7 +3504,7 @@ static drmp3_result drmp3_wfopen(FILE** ppFile, const wchar_t* pFilePath, const >+ >+ return DRMP3_SUCCESS; >+ } >+- >++/* End fopen */ >+ >+ >+ static size_t drmp3__on_read_stdio(void* pUserData, void* pBufferOut, size_t bytesToRead) >+@@ -4476,6 +4490,12 @@ counts rather than sample counts. >+ /* >+ REVISION HISTORY >+ ================ >++v0.6.36 - 2023-06-17 >++ - Fix an incorrect date in revision history. No functional change. >++ >++v0.6.35 - 2023-05-22 >++ - Minor code restructure. No functional change. >++ >+ v0.6.34 - 2022-09-17 >+ - Fix compilation with DJGPP. >+ - Fix compilation when compiling with x86 with no SSE2. >+@@ -4777,7 +4797,7 @@ For more information, please refer to <http://unlicense.org/> >+ =============================================================================== >+ ALTERNATIVE 2 - MIT No Attribution >+ =============================================================================== >+-Copyright 2020 David Reid >++Copyright 2023 David Reid >+ >+ Permission is hereby granted, free of charge, to any person obtaining a copy of >+ this software and associated documentation files (the "Software"), to deal in >+ >+From 1507be95c3605e4fd6a48ea4c527e4aa711a1566 Mon Sep 17 00:00:00 2001 >+From: Anonymous Maarten <madebr@users.noreply.github.com> >+Date: Fri, 13 Oct 2023 17:50:02 +0000 >+Subject: [PATCH 05/17] playsound: fix potention null pointer read >+ >+Potential fix for https://retrace.fedoraproject.org/faf/reports/556333/ >+--- >+ examples/playsound.c | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/examples/playsound.c b/examples/playsound.c >+index b23b001..24f8132 100644 >+--- examples/playsound.c >++++ examples/playsound.c >+@@ -839,7 +839,7 @@ int main(int argc, char **argv) >+ global_state.predecode = 1; >+ } /* else if */ >+ >+- else if (SDL_strcmp(argv[i], "--loop") == 0) >++ else if (SDL_strcmp(argv[i], "--loop") == 0 && argc > i + 1) >+ { >+ global_state.looping = SDL_atoi(argv[++i]); >+ } /* else if */ >+ >+From c8e96bec10e7f314ecbf422bdafaf386098d3105 Mon Sep 17 00:00:00 2001 >+From: Anonymous Maarten <anonymous.maarten@gmail.com> >+Date: Thu, 26 Oct 2023 18:18:14 +0200 >+Subject: [PATCH 06/17] cmake: make sure SDL2_sound::SDL2_sound always exists >+ >+--- >+ CMakeLists.txt | 5 +++++ >+ cmake/SDL2_soundConfig.cmake.in | 11 +++++++++++ >+ 2 files changed, 16 insertions(+) >+ >+diff --git a/CMakeLists.txt b/CMakeLists.txt >+index 67d5ef9..1e08345 100644 >+--- CMakeLists.txt >++++ CMakeLists.txt >+@@ -413,4 +413,9 @@ message_bool_option("Build static library" SDLSOUND_BUILD_STATIC) >+ message_bool_option("Build shared library" SDLSOUND_BUILD_SHARED) >+ message_bool_option("Build stdio test program" SDLSOUND_BUILD_TEST) >+ >++# Make sure SDL2_sound::SDL2_sound always exists >++if(TARGET SDL2_sound::SDL2_sound-static AND NOT TARGET SDL2_sound::SDL2_sound) >++ add_library(SDL2_sound::SDL2_sound ALIAS SDL2_sound-static) >++endif() >++ >+ # end of CMakeLists.txt >+diff --git a/cmake/SDL2_soundConfig.cmake.in b/cmake/SDL2_soundConfig.cmake.in >+index 5ad8890..c92bdd0 100644 >+--- cmake/SDL2_soundConfig.cmake.in >++++ cmake/SDL2_soundConfig.cmake.in >+@@ -21,3 +21,14 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2_sound-static-targets.cmake") >+ endif() >+ >+ check_required_components(SDL2_sound) >++ >++# Create SDL2_sound::SDL2_sound alias for static-only builds >++if(TARGET SDL2_sound::SDL2_sound-static AND NOT TARGET SDL2_sound::SDL2_sound) >++ if(CMAKE_VERSION VERSION_LESS "3.18") >++ # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. >++ add_library(SDL2_sound::SDL2_sound INTERFACE IMPORTED) >++ set_target_properties(SDL2_sound::SDL2_sound PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2_sound::SDL2_sound-static") >++ else() >++ add_library(SDL2_sound::SDL2_sound ALIAS SDL2_sound::SDL2_sound-static) >++ endif() >++endif() >+ >+From a7e7d1f6e9bdc5e813c696d13ba243706f8ccce3 Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Tue, 7 Nov 2023 22:40:04 +0300 >+Subject: [PATCH 07/17] Import an stb_vorbis fix from upstream PR/1563: >+ >+Patch by Seb de Graffenried (@Seb-degraff): https://github.com/nothings/stb/pull/1563 >+Fixes distorted decompressed audio when UBSan was enabled. >+--- >+ src/stb_vorbis.h | 4 ++-- >+ 1 file changed, 2 insertions(+), 2 deletions(-) >+ >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index f651f74..34c53b5 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -2151,7 +2151,7 @@ STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, in >+ ady -= abs(base) * adx; >+ if (x1 > n) x1 = n; >+ if (x < x1) { >+- LINE_OP(output[x], inverse_db_table[y&255]); >++ LINE_OP(output[x], inverse_db_table[(uint32)y&255]); >+ for (++x; x < x1; ++x) { >+ err += ady; >+ if (err >= adx) { >+@@ -2159,7 +2159,7 @@ STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, in >+ y += sy; >+ } else >+ y += base; >+- LINE_OP(output[x], inverse_db_table[y&255]); >++ LINE_OP(output[x], inverse_db_table[(uint32)y&255]); >+ } >+ } >+ } >+ >+From d9d196a43ff1b207fe5644e3943a459495a6642c Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Sat, 2 Dec 2023 10:29:20 +0300 >+Subject: [PATCH 08/17] updated dr_libs from mainstream. >+ >+--- >+ src/dr_flac.h | 14 +++++++++----- >+ src/dr_mp3.h | 17 ++++++++++++++--- >+ 2 files changed, 23 insertions(+), 8 deletions(-) >+ >+diff --git a/src/dr_flac.h b/src/dr_flac.h >+index 1ede99f..14324cf 100644 >+--- src/dr_flac.h >++++ src/dr_flac.h >+@@ -1,6 +1,6 @@ >+ /* >+ FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. >+-dr_flac - v0.12.41 - 2023-06-17 >++dr_flac - v0.12.42 - 2023-11-02 >+ >+ David Reid - mackron@gmail.com >+ >+@@ -235,7 +235,7 @@ extern "C" { >+ >+ #define DRFLAC_VERSION_MAJOR 0 >+ #define DRFLAC_VERSION_MINOR 12 >+-#define DRFLAC_VERSION_REVISION 41 >++#define DRFLAC_VERSION_REVISION 42 >+ #define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION) >+ >+ #include <stddef.h> /* For size_t. */ >+@@ -1851,7 +1851,7 @@ static DRFLAC_INLINE drflac_uint32 drflac__swap_endian_uint32(drflac_uint32 n) >+ #if defined(_MSC_VER) && !defined(__clang__) >+ return _byteswap_ulong(n); >+ #elif defined(__GNUC__) || defined(__clang__) >+- #if defined(DRFLAC_ARM) && (defined(__ARM_ARCH) && __ARM_ARCH >= 6) && !defined(DRFLAC_64BIT) /* <-- 64-bit inline assembly has not been tested, so disabling for now. */ >++ #if defined(DRFLAC_ARM) && (defined(__ARM_ARCH) && __ARM_ARCH >= 6) && !defined(__ARM_ARCH_6M__) && !defined(DRFLAC_64BIT) /* <-- 64-bit inline assembly has not been tested, so disabling for now. */ >+ /* Inline assembly optimized implementation for ARM. In my testing, GCC does not generate optimized code with __builtin_bswap32(). */ >+ drflac_uint32 r; >+ __asm__ __volatile__ ( >+@@ -2815,7 +2815,7 @@ static DRFLAC_INLINE drflac_uint32 drflac__clz_lzcnt(drflac_cache_t x) >+ >+ return r; >+ } >+- #elif defined(DRFLAC_ARM) && (defined(__ARM_ARCH) && __ARM_ARCH >= 5) && !defined(DRFLAC_64BIT) /* <-- I haven't tested 64-bit inline assembly, so only enabling this for the 32-bit build for now. */ >++ #elif defined(DRFLAC_ARM) && (defined(__ARM_ARCH) && __ARM_ARCH >= 5) && !defined(__ARM_ARCH_6M__) && !defined(DRFLAC_64BIT) /* <-- I haven't tested 64-bit inline assembly, so only enabling this for the 32-bit build for now. */ >+ { >+ unsigned int r; >+ __asm__ __volatile__ ( >+@@ -6492,7 +6492,7 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d >+ for (;;) { >+ drflac_metadata metadata; >+ drflac_uint8 isLastBlock = 0; >+- drflac_uint8 blockType; >++ drflac_uint8 blockType = 0; >+ drflac_uint32 blockSize; >+ if (drflac__read_and_decode_block_header(onRead, pUserData, &isLastBlock, &blockType, &blockSize) == DRFLAC_FALSE) { >+ return DRFLAC_FALSE; >+@@ -12077,6 +12077,10 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat >+ /* >+ REVISION HISTORY >+ ================ >++v0.12.42 - 2023-11-02 >++ - Fix build for ARMv6-M. >++ - Fix a compilation warning with GCC. >++ >+ v0.12.41 - 2023-06-17 >+ - Fix an incorrect date in revision history. No functional change. >+ >+diff --git a/src/dr_mp3.h b/src/dr_mp3.h >+index 2e82189..84849ee 100644 >+--- src/dr_mp3.h >++++ src/dr_mp3.h >+@@ -1,6 +1,6 @@ >+ /* >+ MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. >+-dr_mp3 - v0.6.36 - 2023-06-17 >++dr_mp3 - v0.6.38 - 2023-11-02 >+ >+ David Reid - mackron@gmail.com >+ >+@@ -95,7 +95,7 @@ extern "C" { >+ >+ #define DRMP3_VERSION_MAJOR 0 >+ #define DRMP3_VERSION_MINOR 6 >+-#define DRMP3_VERSION_REVISION 36 >++#define DRMP3_VERSION_REVISION 38 >+ #define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION) >+ >+ #include <stddef.h> /* For size_t. */ >+@@ -713,7 +713,7 @@ static int drmp3_have_simd(void) >+ >+ #endif >+ >+-#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64) >++#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64) && !defined(__ARM_ARCH_6M__) >+ #define DRMP3_HAVE_ARMV6 1 >+ static __inline__ __attribute__((always_inline)) drmp3_int32 drmp3_clip_int16_arm(drmp3_int32 a) >+ { >+@@ -2701,6 +2701,11 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__callbacks(drmp3* pMP3, drmp3d_sa >+ DRMP3_ASSERT(pMP3->pData != NULL); >+ DRMP3_ASSERT(pMP3->dataCapacity > 0); >+ >++ /* Do a runtime check here to try silencing a false-positive from clang-analyzer. */ >++ if (pMP3->pData == NULL) { >++ return 0; >++ } >++ >+ pcmFramesRead = drmp3dec_decode_frame(&pMP3->decoder, pMP3->pData + pMP3->dataConsumed, (int)pMP3->dataSize, pPCMFrames, &info); /* <-- Safe size_t -> int conversion thanks to the check above. */ >+ >+ /* Consume the data. */ >+@@ -4490,6 +4495,12 @@ counts rather than sample counts. >+ /* >+ REVISION HISTORY >+ ================ >++v0.6.38 - 2023-11-02 >++ - Fix build for ARMv6-M. >++ >++v0.6.37 - 2023-07-07 >++ - Silence a static analysis warning. >++ >+ v0.6.36 - 2023-06-17 >+ - Fix an incorrect date in revision history. No functional change. >+ >+ >+From a9e5aa85b2fe2c28e1af398105a9260eee1d7f9d Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Mon, 11 Dec 2023 05:50:02 +0300 >+Subject: [PATCH 09/17] stb_vorbis: fix CVE-2023-45676 and CVE-2023-45677. >+MIME-Version: 1.0 >+Content-Type: text/plain; charset=UTF-8 >+Content-Transfer-Encoding: 8bit >+ >+Based on the patches by Jaroslav LobaÄevski (@JarLob) submitted >+to mainstream at: https://github.com/nothings/stb/pull/1554 and >+https://github.com/nothings/stb/pull/1555 >+ >+GHSL-2023-166/CVE-2023-45676: Multi-byte write heap buffer overflow in start_decoder() >+GHSL-2023-167/CVE-2023-45677: Heap buffer out of bounds write in start_decoder() >+--- >+ src/stb_vorbis.h | 1 + >+ 1 file changed, 1 insertion(+) >+ >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index 34c53b5..ca102ac 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -982,6 +982,7 @@ static void *make_block_array(void *mem, int count, int size) >+ >+ static void *setup_malloc(vorb *f, int sz) >+ { >++ if (sz < 0 || INT_MAX - 7 < sz) return NULL; >+ sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. >+ f->setup_memory_required += sz; >+ if (f->alloc.alloc_buffer) { >+ >+From 09996c45b9d4d9601aa48fa1e872c6bb302f0ad9 Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Mon, 11 Dec 2023 05:50:10 +0300 >+Subject: [PATCH 10/17] stb_vorbis: fix CVE-2023-45679 and CVE-2023-45680. >+MIME-Version: 1.0 >+Content-Type: text/plain; charset=UTF-8 >+Content-Transfer-Encoding: 8bit >+ >+Based on the patches by Jaroslav LobaÄevski (@JarLob) submitted >+to mainstream at: https://github.com/nothings/stb/pull/1557 and >+https://github.com/nothings/stb/pull/1558 >+ >+GHSL-2023-169/CVE-2023-45679: Attempt to free an uninitialized memory pointer in vorbis_deinit() >+GHSL-2023-170/CVE-2023-45680: Null pointer dereference in vorbis_deinit() >+--- >+ src/stb_vorbis.h | 9 +++++++-- >+ 1 file changed, 7 insertions(+), 2 deletions(-) >+ >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index ca102ac..9ded38c 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -3747,8 +3747,13 @@ static int start_decoder(vorb *f) >+ f->comment_list = NULL; >+ if (f->comment_list_length > 0) >+ { >+- f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); >+- if (f->comment_list == NULL) return error(f, VORBIS_outofmem); >++ len = sizeof(char*) * f->comment_list_length; >++ f->comment_list = (char**) setup_malloc(f, len); >++ if (f->comment_list == NULL) { >++ f->comment_list_length = 0; >++ return error(f, VORBIS_outofmem); >++ } >++ memset(f->comment_list, 0, len); >+ } >+ >+ for(i=0; i < f->comment_list_length; ++i) { >+ >+From f04567f547a76fbd63f7271054aeaa7dd3659710 Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Mon, 11 Dec 2023 05:50:14 +0300 >+Subject: [PATCH 11/17] stb_vorbis: fix CVE-2023-45681 (integer overflow.) >+MIME-Version: 1.0 >+Content-Type: text/plain; charset=UTF-8 >+Content-Transfer-Encoding: 8bit >+ >+Based on patch by Jaroslav LobaÄevski (@JarLob) submitted to >+mainstream at https://github.com/nothings/stb/pull/1559 >+ >+GHSL-2023-171/CVE-2023-45681: Out of bounds heap buffer write >+--- >+ src/stb_vorbis.h | 3 +++ >+ 1 file changed, 3 insertions(+) >+ >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index 9ded38c..0d916e8 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -3747,9 +3747,12 @@ static int start_decoder(vorb *f) >+ f->comment_list = NULL; >+ if (f->comment_list_length > 0) >+ { >++ if (INT_MAX / sizeof(char*) < f->comment_list_length) >++ goto no_comment; >+ len = sizeof(char*) * f->comment_list_length; >+ f->comment_list = (char**) setup_malloc(f, len); >+ if (f->comment_list == NULL) { >++ no_comment: >+ f->comment_list_length = 0; >+ return error(f, VORBIS_outofmem); >+ } >+ >+From 9ebcb8bb5f2ad9233022fa064c48dd91a707b0ac Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Mon, 11 Dec 2023 05:50:50 +0300 >+Subject: [PATCH 12/17] stb_vorbis: fix CVE-2023-45682 >+MIME-Version: 1.0 >+Content-Type: text/plain; charset=UTF-8 >+Content-Transfer-Encoding: 8bit >+ >+Based on patch by Jaroslav LobaÄevski (@JarLob) submitted to >+mainstream at https://github.com/nothings/stb/pull/1560 >+ >+GHSL-2023-172/CVE-2023-45682: Wild address read in vorbis_decode_packet_rest() >+--- >+ src/stb_vorbis.h | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index 0d916e8..1b1a206 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -1838,7 +1838,7 @@ static int codebook_decode_scalar(vorb *f, Codebook *c) >+ >+ #define DECODE(var,f,c) \ >+ DECODE_RAW(var,f,c) \ >+- if (c->sparse) var = c->sorted_values[var]; >++ if (c->sparse && var >= 0) var = c->sorted_values[var]; >+ >+ #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK >+ #define DECODE_VQ(var,f,c) DECODE_RAW(var,f,c) >+ >+From d372bfed324b27184ceaf878955429fe21c4fd8a Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Mon, 11 Dec 2023 08:51:10 +0300 >+Subject: [PATCH 13/17] SDL_sound_vorbis.c: error-out if the vorbis file has no >+ samples. >+ >+--- >+ src/SDL_sound_vorbis.c | 4 +++- >+ 1 file changed, 3 insertions(+), 1 deletion(-) >+ >+diff --git a/src/SDL_sound_vorbis.c b/src/SDL_sound_vorbis.c >+index c418831..ac44446 100644 >+--- src/SDL_sound_vorbis.c >++++ src/SDL_sound_vorbis.c >+@@ -124,7 +124,9 @@ static int VORBIS_open(Sound_Sample *sample, const char *ext) >+ sample->actual.rate = stb->sample_rate; >+ num_frames = stb_vorbis_stream_length_in_samples(stb); >+ if (!num_frames) >+- internal->total_time = -1; >++ { >++ BAIL_MACRO("VORBIS: No samples in ogg/vorbis stream.", 0); >++ } >+ else >+ { >+ const unsigned int rate = stb->sample_rate; >+ >+From 7cc5fecbd78e4dabd9915d6e55cf565895ada116 Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Mon, 11 Dec 2023 08:55:40 +0300 >+Subject: [PATCH 14/17] stb_vorbis: revise CVE-2023-45676 / CVE-2023-45677 fix. >+ >+c.f.: https://github.com/nothings/stb/issues/1248. >+--- >+ src/stb_vorbis.h | 2 +- >+ 1 file changed, 1 insertion(+), 1 deletion(-) >+ >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index 1b1a206..06a684c 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -982,7 +982,7 @@ static void *make_block_array(void *mem, int count, int size) >+ >+ static void *setup_malloc(vorb *f, int sz) >+ { >+- if (sz < 0 || INT_MAX - 7 < sz) return NULL; >++ if (sz <= 0 || INT_MAX - 7 < sz) return NULL; >+ sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. >+ f->setup_memory_required += sz; >+ if (f->alloc.alloc_buffer) { >+ >+From 6ee6c835364360954847eda74824f141e1409775 Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Mon, 11 Dec 2023 11:37:04 +0300 >+Subject: [PATCH 15/17] stb_vorbis: apply CVE-2023-45676/CVE-2023-45677 fix to >+ setup_temp_malloc >+ >+(c.f.: https://github.com/nothings/stb/issues/1248, >+ https://github.com/nothings/stb/pull/1554 , >+ https://github.com/nothings/stb/pull/1555 ) >+--- >+ src/stb_vorbis.h | 4 ++++ >+ 1 file changed, 4 insertions(+) >+ >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index 06a684c..cf33242 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -970,6 +970,8 @@ static int error(vorb *f, enum STBVorbisError e) >+ // given a sufficiently large block of memory, make an array of pointers to subblocks of it >+ static void *make_block_array(void *mem, int count, int size) >+ { >++ if (!mem) return NULL; >++ else { >+ int i; >+ void ** p = (void **) mem; >+ char *q = (char *) (p + count); >+@@ -978,6 +980,7 @@ static void *make_block_array(void *mem, int count, int size) >+ q += size; >+ } >+ return p; >++ } >+ } >+ >+ static void *setup_malloc(vorb *f, int sz) >+@@ -1002,6 +1005,7 @@ static void setup_free(vorb *f, void *p) >+ >+ static void *setup_temp_malloc(vorb *f, int sz) >+ { >++ if (sz <= 0 || INT_MAX - 7 < sz) return NULL; >+ sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. >+ if (f->alloc.alloc_buffer) { >+ if (f->temp_offset - sz < f->setup_offset) return NULL; >+ >+From c5639414c1bb24fb4eef5861c13adb42a4aab950 Mon Sep 17 00:00:00 2001 >+From: Ozkan Sezer <sezeroz@gmail.com> >+Date: Wed, 13 Dec 2023 08:00:02 +0300 >+Subject: [PATCH 16/17] stb_vorbis: sync with stb_vorbis SDL fork, and >+ SDL_mixer >+ >+--- >+ src/SDL_sound_vorbis.c | 5 ++-- >+ src/stb_vorbis.h | 63 ++++++++++++++++++++++++++++++++---------- >+ 2 files changed, 51 insertions(+), 17 deletions(-) >+ >+diff --git a/src/SDL_sound_vorbis.c b/src/SDL_sound_vorbis.c >+index ac44446..b427521 100644 >+--- src/SDL_sound_vorbis.c >++++ src/SDL_sound_vorbis.c >+@@ -23,16 +23,17 @@ >+ #if SOUND_SUPPORTS_VORBIS >+ >+ /* Configure and include stb_vorbis for compiling... */ >++#define STB_VORBIS_SDL 1 /* for SDL_sound-specific stuff. */ >+ #define STB_VORBIS_NO_STDIO 1 >+ #define STB_VORBIS_NO_CRT 1 >+ #define STB_VORBIS_NO_PUSHDATA_API 1 >+-#define STB_VORBIS_MAX_CHANNELS 6 >++#define STB_VORBIS_MAX_CHANNELS 8 /* For 7.1 surround sound */ >+ #define STB_VORBIS_NO_COMMENTS 1 >+ #define STB_FORCEINLINE SDL_FORCE_INLINE >+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN >+ #define STB_VORBIS_BIG_ENDIAN 1 >+ #endif >+-#define STBV_CDECL SDLCALL /* for SDL_qsort */ >++#define STBV_CDECL SDLCALL /* for SDL_qsort() */ >+ >+ #if !defined(__clang_analyzer__) >+ #ifdef assert >+diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h >+index cf33242..8686bdf 100644 >+--- src/stb_vorbis.h >++++ src/stb_vorbis.h >+@@ -21,6 +21,7 @@ >+ // >+ // Feature contributors: >+ // Dougall Johnson (sample-exact seeking) >++// Vitaly Novichkov (sample-accurate tell) >+ // >+ // Bugfix/warning contributors: >+ // Terje Mathisen Niklas Frykholm Andy Hill >+@@ -150,8 +151,10 @@ typedef struct >+ // get general information about the file >+ extern stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f); >+ >++#ifndef STB_VORBIS_NO_COMMENTS >+ // get ogg comments >+ extern stb_vorbis_comment stb_vorbis_get_comment(stb_vorbis *f); >++#endif >+ >+ // get the last error detected (clears it, too) >+ extern int stb_vorbis_get_error(stb_vorbis *f); >+@@ -166,6 +169,12 @@ extern void stb_vorbis_close(stb_vorbis *f); >+ // NOT WORKING YET after a seek with PULLDATA API >+ extern int stb_vorbis_get_sample_offset(stb_vorbis *f); >+ >++// this function returns the count of returned samples from the beginning of the >++// file. Functions "stb_vorbis_get_samples_*", "stb_vorbis_seek_*()" will >++// affect the returned value. Use this call to get the accurate sample position >++// during playback. >++extern int stb_vorbis_get_playback_sample_offset(stb_vorbis *f); >++ >+ // returns the current seek point within the file, or offset from the beginning >+ // of the memory buffer. In pushdata mode it returns 0. >+ extern unsigned int stb_vorbis_get_file_offset(stb_vorbis *f); >+@@ -296,7 +305,7 @@ extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_cl >+ // confused. >+ #endif >+ >+-#ifdef __SDL_SOUND_INTERNAL__ >++#ifdef STB_VORBIS_SDL >+ extern stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length); >+ extern stb_vorbis * stb_vorbis_open_rwops(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc); >+ #endif >+@@ -551,10 +560,12 @@ enum STBVorbisError >+ // #define STB_VORBIS_NO_DEFER_FLOOR >+ >+ // STB_VORBIS_NO_COMMENTS >+-// disables reading and storing user comments >++// Disables reading and storing user comments. >+ // #define STB_VORBIS_NO_COMMENTS >+ >+ >++ >++ >+ ////////////////////////////////////////////////////////////////////////////// >+ >+ #ifdef STB_VORBIS_NO_PULLDATA_API >+@@ -637,7 +648,7 @@ enum STBVorbisError >+ #define MAX_BLOCKSIZE_LOG 13 // from specification >+ #define MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG) >+ >+-#ifdef __SDL_SOUND_INTERNAL__ >++#ifdef STB_VORBIS_SDL >+ typedef Uint8 uint8; >+ typedef Sint8 int8; >+ typedef Uint16 uint16; >+@@ -768,7 +779,6 @@ typedef struct >+ >+ typedef struct >+ { >+- // https://github.com/nothings/stb/pull/1312 >+ MappingChannel *chan; >+ uint16 coupling_steps; >+ uint8 submaps; >+@@ -821,7 +831,7 @@ struct stb_vorbis >+ uint32 f_start; >+ int close_on_free; >+ #endif >+-#ifdef __SDL_SOUND_INTERNAL__ >++#ifdef STB_VORBIS_SDL >+ SDL_RWops *rwops; >+ uint32 rwops_start; >+ int close_on_free; >+@@ -887,6 +897,9 @@ struct stb_vorbis >+ uint32 current_loc; // sample location of next frame to decode >+ int current_loc_valid; >+ >++ int32 current_playback_loc; // sample location of played samples >++ int current_playback_loc_valid; >++ >+ // per-blocksize precomputed data >+ >+ // twiddle factors >+@@ -1374,7 +1387,7 @@ static int STBV_CDECL point_compare(const void *p, const void *q) >+ /////////////////////// END LEAF SETUP FUNCTIONS ////////////////////////// >+ >+ >+-#ifdef __SDL_SOUND_INTERNAL__ >++#ifdef STB_VORBIS_SDL >+ #define USE_MEMORY(z) FALSE >+ #elif defined(STB_VORBIS_NO_STDIO) >+ #define USE_MEMORY(z) TRUE >+@@ -1384,7 +1397,7 @@ static int STBV_CDECL point_compare(const void *p, const void *q) >+ >+ static uint8 get8(vorb *z) >+ { >+- #ifdef __SDL_SOUND_INTERNAL__ >++ #ifdef STB_VORBIS_SDL >+ uint8 c; >+ if (SDL_RWread(z->rwops, &c, 1, 1) != 1) { z->eof = TRUE; return 0; } >+ return c; >+@@ -1417,7 +1430,7 @@ static uint32 get32(vorb *f) >+ >+ static int getn(vorb *z, uint8 *data, int n) >+ { >+- #ifdef __SDL_SOUND_INTERNAL__ >++ #ifdef STB_VORBIS_SDL >+ if (SDL_RWread(z->rwops, data, n, 1) == 1) return 1; >+ z->eof = 1; >+ return 0; >+@@ -1443,7 +1456,7 @@ static int getn(vorb *z, uint8 *data, int n) >+ >+ static void skip(vorb *z, int n) >+ { >+- #ifdef __SDL_SOUND_INTERNAL__ >++ #ifdef STB_VORBIS_SDL >+ SDL_RWseek(z->rwops, n, RW_SEEK_CUR); >+ >+ #else >+@@ -1469,7 +1482,7 @@ static int set_file_offset(stb_vorbis *f, unsigned int loc) >+ #endif >+ f->eof = 0; >+ >+- #ifdef __SDL_SOUND_INTERNAL__ >++ #ifdef STB_VORBIS_SDL >+ if (loc + f->rwops_start < loc || loc >= 0x80000000) { >+ loc = 0x7fffffff; >+ f->eof = 1; >+@@ -3601,6 +3614,8 @@ static int vorbis_pump_first_frame(stb_vorbis *f) >+ res = vorbis_decode_packet(f, &len, &left, &right); >+ if (res) >+ vorbis_finish_frame(f, len, left, right); >++ f->current_playback_loc = 0; >++ f->current_playback_loc_valid = TRUE; >+ return res; >+ } >+ >+@@ -4392,7 +4407,7 @@ static void vorbis_deinit(stb_vorbis *p) >+ setup_temp_free(p, &p->temp_values, 0); >+ setup_temp_free(p, &p->temp_mults, 0); >+ } >+- #ifdef __SDL_SOUND_INTERNAL__ >++ #ifdef STB_VORBIS_SDL >+ if (p->close_on_free) SDL_RWclose(p->rwops); >+ #endif >+ #ifndef STB_VORBIS_NO_STDIO >+@@ -4420,7 +4435,7 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z) >+ p->stream = NULL; >+ p->codebooks = NULL; >+ p->page_crc_tests = -1; >+- #ifdef __SDL_SOUND_INTERNAL__ >++ #ifdef STB_VORBIS_SDL >+ p->close_on_free = FALSE; >+ p->rwops = NULL; >+ #endif >+@@ -4438,6 +4453,14 @@ int stb_vorbis_get_sample_offset(stb_vorbis *f) >+ return -1; >+ } >+ >++int stb_vorbis_get_playback_sample_offset(stb_vorbis *f) >++{ >++ if (f->current_playback_loc_valid) >++ return f->current_playback_loc; >++ else >++ return -1; >++} >++ >+ stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f) >+ { >+ stb_vorbis_info d; >+@@ -4685,7 +4708,7 @@ unsigned int stb_vorbis_get_file_offset(stb_vorbis *f) >+ #ifndef STB_VORBIS_NO_PUSHDATA_API >+ if (f->push_mode) return 0; >+ #endif >+- #ifdef __SDL_SOUND_INTERNAL__ >++ #ifdef STB_VORBIS_SDL >+ return (unsigned int) (SDL_RWtell(f->rwops) - f->rwops_start); >+ #else >+ if (USE_MEMORY(f)) return (unsigned int) (f->stream - f->stream_start); >+@@ -5058,13 +5081,16 @@ int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number) >+ } >+ // the next frame should start with the sample >+ if (f->current_loc != sample_number) return error(f, VORBIS_seek_failed); >++ f->current_playback_loc = sample_number; >+ return 1; >+ } >+ >+ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number) >+ { >+- if (!stb_vorbis_seek_frame(f, sample_number)) >++ if (!stb_vorbis_seek_frame(f, sample_number)) { >++ f->current_playback_loc_valid = FALSE; >+ return 0; >++ } >+ >+ if (sample_number != f->current_loc) { >+ int n; >+@@ -5075,6 +5101,9 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number) >+ f->channel_buffer_start += (sample_number - frame_start); >+ } >+ >++ f->current_playback_loc_valid = TRUE; >++ f->current_playback_loc = sample_number; >++ >+ return 1; >+ } >+ >+@@ -5241,7 +5270,7 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st >+ } >+ #endif // STB_VORBIS_NO_STDIO >+ >+-#ifdef __SDL_SOUND_INTERNAL__ >++#ifdef STB_VORBIS_SDL >+ stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length) >+ { >+ stb_vorbis *f, p; >+@@ -5499,6 +5528,7 @@ int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short >+ if (n == len) break; >+ if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; >+ } >++ f->current_playback_loc += n; >+ return n; >+ } >+ >+@@ -5516,6 +5546,7 @@ int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, in >+ if (n == len) break; >+ if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; >+ } >++ f->current_playback_loc += n; >+ return n; >+ } >+ >+@@ -5624,6 +5655,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float >+ if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) >+ break; >+ } >++ f->current_playback_loc += n; >+ return n; >+ } >+ >+@@ -5650,6 +5682,7 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in >+ if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) >+ break; >+ } >++ f->current_playback_loc += n; >+ return n; >+ } >+ #endif // STB_VORBIS_NO_PULLDATA_API >+ >+From fdcecafbfdcbdd2b77c5b591948c237df19c864e Mon Sep 17 00:00:00 2001 >+From: Sepcnt <sepcnt@proton.me> >+Date: Fri, 19 Jan 2024 00:08:17 +0800 >+Subject: [PATCH 17/17] Update CMakeLists.txt, add option for docs >+ >+Add SDLSOUND_BUILD_DOCS option to control whether build docs >+--- >+ CMakeLists.txt | 48 +++++++++++++++++++++++++++--------------------- >+ 1 file changed, 27 insertions(+), 21 deletions(-) >+ >+diff --git a/CMakeLists.txt b/CMakeLists.txt >+index 1e08345..f755820 100644 >+--- CMakeLists.txt >++++ CMakeLists.txt >+@@ -353,27 +353,32 @@ install(FILES src/SDL_sound.h >+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SDL2_sound.pc >+ DESTINATION "${PKGCONFIG_INSTALLDIR}") >+ >+-find_package(Doxygen) >+-if(DOXYGEN_FOUND) >+- set(SDLSOUND_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") >+- configure_file( >+- "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile" >+- "${SDLSOUND_OUTPUT_DOXYFILE}" >+- COPYONLY >+- ) >+- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n") >+- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${SDLSOUND_VERSION}\"\n") >+- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n") >+- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n") >+- >+- add_custom_target( >+- SDL2_sound-docs >+- ${DOXYGEN_EXECUTABLE} "${SDLSOUND_OUTPUT_DOXYFILE}" >+- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" >+- COMMENT "Building documentation..." >+- ) >+-else() >+- message(STATUS "Doxygen not found. You won't be able to build documentation.") >++option(SDLSOUND_BUILD_DOCS "Build documentation" TRUE) >++mark_as_advanced(SDLSOUND_BUILD_DOCS) >++ >++if(SDLSOUND_BUILD_DOCS) >++ find_package(Doxygen) >++ if(DOXYGEN_FOUND) >++ set(SDLSOUND_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") >++ configure_file( >++ "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile" >++ "${SDLSOUND_OUTPUT_DOXYFILE}" >++ COPYONLY >++ ) >++ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n") >++ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${SDLSOUND_VERSION}\"\n") >++ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n") >++ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n") >++ >++ add_custom_target( >++ SDL2_sound-docs >++ ${DOXYGEN_EXECUTABLE} "${SDLSOUND_OUTPUT_DOXYFILE}" >++ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" >++ COMMENT "Building documentation..." >++ ) >++ else() >++ message(STATUS "Doxygen not found. You won't be able to build documentation.") >++ endif() >+ endif() >+ >+ configure_file( >+@@ -412,6 +417,7 @@ message_bool_option("COREAUDIO support" SDLSOUND_DECODER_COREAUDIO) >+ message_bool_option("Build static library" SDLSOUND_BUILD_STATIC) >+ message_bool_option("Build shared library" SDLSOUND_BUILD_SHARED) >+ message_bool_option("Build stdio test program" SDLSOUND_BUILD_TEST) >++message_bool_option("Build documentation" SDLSOUND_BUILD_DOCS) >+ >+ # Make sure SDL2_sound::SDL2_sound always exists >+ if(TARGET SDL2_sound::SDL2_sound-static AND NOT TARGET SDL2_sound::SDL2_sound)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 278491
: 250116