Added
Link Here
|
1 |
From 1f8b5c25fabe1d611e828f112b7c76dac907b524 Mon Sep 17 00:00:00 2001 |
2 |
From: Anonymous Maarten <anonymous.maarten@gmail.com> |
3 |
Date: Wed, 5 Jul 2023 12:31:47 +0200 |
4 |
Subject: [PATCH 01/17] cmake: use SDL2_INCLUDE_DIRS instead of target property |
5 |
|
6 |
--- |
7 |
CMakeLists.txt | 20 ++++---------------- |
8 |
1 file changed, 4 insertions(+), 16 deletions(-) |
9 |
|
10 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
11 |
index 8dedebc..0773dec 100644 |
12 |
--- CMakeLists.txt |
13 |
+++ CMakeLists.txt |
14 |
@@ -215,14 +215,8 @@ if(SDLSOUND_BUILD_STATIC) |
15 |
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
16 |
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2> |
17 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>) |
18 |
- if(TARGET SDL2::SDL2-static) |
19 |
- get_target_property(_sdl2_include_dir SDL2::SDL2-static INTERFACE_INCLUDE_DIRECTORIES) |
20 |
- target_include_directories(SDL2_sound-static PUBLIC "$<BUILD_INTERFACE:${_sdl2_include_dir}>") |
21 |
- target_link_libraries(SDL2_sound-static PRIVATE $<BUILD_INTERFACE:SDL2::SDL2-static> ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) |
22 |
- else() |
23 |
- target_include_directories(SDL2_sound-static PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") |
24 |
- target_link_libraries(SDL2_sound-static PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) |
25 |
- endif() |
26 |
+ target_include_directories(SDL2_sound-static PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") |
27 |
+ target_link_libraries(SDL2_sound-static PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) |
28 |
set(SDLSOUND_LIB_TARGET SDL2_sound-static) |
29 |
endif() |
30 |
|
31 |
@@ -249,14 +243,8 @@ if(SDLSOUND_BUILD_SHARED) |
32 |
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2> |
33 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> |
34 |
) |
35 |
- if(TARGET SDL2::SDL2) |
36 |
- get_target_property(_sdl2_include_dir SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES) |
37 |
- target_include_directories(SDL2_sound PUBLIC "$<BUILD_INTERFACE:${_sdl2_include_dir}>") |
38 |
- target_link_libraries(SDL2_sound PRIVATE $<BUILD_INTERFACE:SDL2::SDL2> ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) |
39 |
- else() |
40 |
- target_include_directories(SDL2_sound PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") |
41 |
- target_link_libraries(SDL2_sound PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) |
42 |
- endif() |
43 |
+ target_include_directories(SDL2_sound PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") |
44 |
+ target_link_libraries(SDL2_sound PRIVATE "$<BUILD_INTERFACE:${SDL2_LIBRARIES}>" ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) |
45 |
set(SDLSOUND_LIB_TARGET SDL2_sound) |
46 |
endif() |
47 |
|
48 |
|
49 |
From f80947aa7bda23925b2c22cbb2b4da1f9e8d2e6c Mon Sep 17 00:00:00 2001 |
50 |
From: Ozkan Sezer <sezeroz@gmail.com> |
51 |
Date: Wed, 5 Jul 2023 17:55:32 +0300 |
52 |
Subject: [PATCH 02/17] sync dr_mp3 and dr_flac with mainstream. |
53 |
|
54 |
--- |
55 |
src/dr_flac.h | 71 ++++++++++++++++++++++++++++++++++----------------- |
56 |
src/dr_mp3.h | 48 ++++++++++++++++++++++++---------- |
57 |
2 files changed, 82 insertions(+), 37 deletions(-) |
58 |
|
59 |
diff --git a/src/dr_flac.h b/src/dr_flac.h |
60 |
index 0c43eed..1ede99f 100644 |
61 |
--- src/dr_flac.h |
62 |
+++ src/dr_flac.h |
63 |
@@ -1,6 +1,6 @@ |
64 |
/* |
65 |
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. |
66 |
-dr_flac - v0.12.39 - 2022-09-17 |
67 |
+dr_flac - v0.12.41 - 2023-06-17 |
68 |
|
69 |
David Reid - mackron@gmail.com |
70 |
|
71 |
@@ -235,12 +235,12 @@ extern "C" { |
72 |
|
73 |
#define DRFLAC_VERSION_MAJOR 0 |
74 |
#define DRFLAC_VERSION_MINOR 12 |
75 |
-#define DRFLAC_VERSION_REVISION 39 |
76 |
+#define DRFLAC_VERSION_REVISION 41 |
77 |
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION) |
78 |
|
79 |
#include <stddef.h> /* For size_t. */ |
80 |
|
81 |
-/* Sized types. */ |
82 |
+/* Sized Types */ |
83 |
typedef signed char drflac_int8; |
84 |
typedef unsigned char drflac_uint8; |
85 |
typedef signed short drflac_int16; |
86 |
@@ -273,7 +273,9 @@ typedef drflac_uint8 drflac_bool8; |
87 |
typedef drflac_uint32 drflac_bool32; |
88 |
#define DRFLAC_TRUE 1 |
89 |
#define DRFLAC_FALSE 0 |
90 |
+/* End Sized Types */ |
91 |
|
92 |
+/* Decorations */ |
93 |
#if !defined(DRFLAC_API) |
94 |
#if defined(DRFLAC_DLL) |
95 |
#if defined(_WIN32) |
96 |
@@ -303,6 +305,7 @@ typedef drflac_uint32 drflac_bool32; |
97 |
#define DRFLAC_PRIVATE static |
98 |
#endif |
99 |
#endif |
100 |
+/* End Decorations */ |
101 |
|
102 |
#if defined(_MSC_VER) && _MSC_VER >= 1700 /* Visual Studio 2012 */ |
103 |
#define DRFLAC_DEPRECATED __declspec(deprecated) |
104 |
@@ -321,6 +324,16 @@ typedef drflac_uint32 drflac_bool32; |
105 |
DRFLAC_API void drflac_version(drflac_uint32* pMajor, drflac_uint32* pMinor, drflac_uint32* pRevision); |
106 |
DRFLAC_API const char* drflac_version_string(void); |
107 |
|
108 |
+/* Allocation Callbacks */ |
109 |
+typedef struct |
110 |
+{ |
111 |
+ void* pUserData; |
112 |
+ void* (* onMalloc)(size_t sz, void* pUserData); |
113 |
+ void* (* onRealloc)(void* p, size_t sz, void* pUserData); |
114 |
+ void (* onFree)(void* p, void* pUserData); |
115 |
+} drflac_allocation_callbacks; |
116 |
+/* End Allocation Callbacks */ |
117 |
+ |
118 |
/* |
119 |
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, |
120 |
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. |
121 |
@@ -329,11 +342,22 @@ but also more memory. In my testing there is diminishing returns after about 4KB |
122 |
#define DR_FLAC_BUFFER_SIZE 4096 |
123 |
#endif |
124 |
|
125 |
-/* Check if we can enable 64-bit optimizations. */ |
126 |
+ |
127 |
+/* Architecture Detection */ |
128 |
#if defined(_WIN64) || defined(_LP64) || defined(__LP64__) |
129 |
#define DRFLAC_64BIT |
130 |
#endif |
131 |
|
132 |
+#if defined(__x86_64__) || defined(_M_X64) |
133 |
+ #define DRFLAC_X64 |
134 |
+#elif defined(__i386) || defined(_M_IX86) |
135 |
+ #define DRFLAC_X86 |
136 |
+#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) |
137 |
+ #define DRFLAC_ARM |
138 |
+#endif |
139 |
+/* End Architecture Detection */ |
140 |
+ |
141 |
+ |
142 |
#ifdef DRFLAC_64BIT |
143 |
typedef drflac_uint64 drflac_cache_t; |
144 |
#else |
145 |
@@ -562,14 +586,6 @@ will be set to one of the DRFLAC_METADATA_BLOCK_TYPE_* tokens. |
146 |
typedef void (* drflac_meta_proc)(void* pUserData, drflac_metadata* pMetadata); |
147 |
|
148 |
|
149 |
-typedef struct |
150 |
-{ |
151 |
- void* pUserData; |
152 |
- void* (* onMalloc)(size_t sz, void* pUserData); |
153 |
- void* (* onRealloc)(void* p, size_t sz, void* pUserData); |
154 |
- void (* onFree)(void* p, void* pUserData); |
155 |
-} drflac_allocation_callbacks; |
156 |
- |
157 |
/* Structure for internal use. Only used for decoders opened with drflac_open_memory. */ |
158 |
typedef struct |
159 |
{ |
160 |
@@ -1351,6 +1367,7 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat |
161 |
#include <stdlib.h> |
162 |
#include <string.h> |
163 |
|
164 |
+/* Inline */ |
165 |
#ifdef _MSC_VER |
166 |
#define DRFLAC_INLINE __forceinline |
167 |
#elif defined(__GNUC__) |
168 |
@@ -1377,15 +1394,7 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat |
169 |
#else |
170 |
#define DRFLAC_INLINE |
171 |
#endif |
172 |
- |
173 |
-/* CPU architecture. */ |
174 |
-#if defined(__x86_64__) || defined(_M_X64) |
175 |
- #define DRFLAC_X64 |
176 |
-#elif defined(__i386) || defined(_M_IX86) |
177 |
- #define DRFLAC_X86 |
178 |
-#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) |
179 |
- #define DRFLAC_ARM |
180 |
-#endif |
181 |
+/* End Inline */ |
182 |
|
183 |
/* |
184 |
Intrinsics Support |
185 |
@@ -1623,6 +1632,7 @@ static DRFLAC_INLINE drflac_bool32 drflac_has_sse41(void) |
186 |
|
187 |
#define DRFLAC_MAX_SIMD_VECTOR_SIZE 64 /* 64 for AVX-512 in the future. */ |
188 |
|
189 |
+/* Result Codes */ |
190 |
typedef drflac_int32 drflac_result; |
191 |
#define DRFLAC_SUCCESS 0 |
192 |
#define DRFLAC_ERROR -1 /* A generic error. */ |
193 |
@@ -1678,7 +1688,10 @@ typedef drflac_int32 drflac_result; |
194 |
#define DRFLAC_CANCELLED -51 |
195 |
#define DRFLAC_MEMORY_ALREADY_MAPPED -52 |
196 |
#define DRFLAC_AT_END -53 |
197 |
-#define DRFLAC_CRC_MISMATCH -128 |
198 |
+ |
199 |
+#define DRFLAC_CRC_MISMATCH -100 |
200 |
+/* End Result Codes */ |
201 |
+ |
202 |
|
203 |
#define DRFLAC_SUBFRAME_CONSTANT 0 |
204 |
#define DRFLAC_SUBFRAME_VERBATIM 1 |
205 |
@@ -8141,6 +8154,7 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac |
206 |
#include <wchar.h> /* For wcslen(), wcsrtombs() */ |
207 |
#endif |
208 |
|
209 |
+/* Errno */ |
210 |
/* 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. */ |
211 |
#include <errno.h> |
212 |
static drflac_result drflac_result_from_errno(int e) |
213 |
@@ -8544,7 +8558,9 @@ static drflac_result drflac_result_from_errno(int e) |
214 |
default: return DRFLAC_ERROR; |
215 |
} |
216 |
} |
217 |
+/* End Errno */ |
218 |
|
219 |
+/* fopen */ |
220 |
static drflac_result drflac_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode) |
221 |
{ |
222 |
#if defined(_MSC_VER) && _MSC_VER >= 1400 |
223 |
@@ -8702,6 +8718,7 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons |
224 |
return DRFLAC_SUCCESS; |
225 |
} |
226 |
#endif |
227 |
+/* End fopen */ |
228 |
|
229 |
static size_t drflac__on_read_stdio(void* pUserData, void* bufferOut, size_t bytesToRead) |
230 |
{ |
231 |
@@ -11666,6 +11683,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p |
232 |
|
233 |
/* High Level APIs */ |
234 |
|
235 |
+/* SIZE_MAX */ |
236 |
#if defined(SIZE_MAX) |
237 |
#define DRFLAC_SIZE_MAX SIZE_MAX |
238 |
#else |
239 |
@@ -11675,6 +11693,7 @@ DRFLAC_API drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 p |
240 |
#define DRFLAC_SIZE_MAX 0xFFFFFFFF |
241 |
#endif |
242 |
#endif |
243 |
+/* End SIZE_MAX */ |
244 |
|
245 |
|
246 |
/* Using a macro as the definition of the drflac__full_decode_and_close_*() API family. Sue me. */ |
247 |
@@ -12058,6 +12077,12 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat |
248 |
/* |
249 |
REVISION HISTORY |
250 |
================ |
251 |
+v0.12.41 - 2023-06-17 |
252 |
+ - Fix an incorrect date in revision history. No functional change. |
253 |
+ |
254 |
+v0.12.40 - 2023-05-22 |
255 |
+ - Minor code restructure. No functional change. |
256 |
+ |
257 |
v0.12.39 - 2022-09-17 |
258 |
- Fix compilation with DJGPP. |
259 |
- Fix compilation error with Visual Studio 2019 and the ARM build. |
260 |
@@ -12488,7 +12513,7 @@ For more information, please refer to <http://unlicense.org/> |
261 |
=============================================================================== |
262 |
ALTERNATIVE 2 - MIT No Attribution |
263 |
=============================================================================== |
264 |
-Copyright 2020 David Reid |
265 |
+Copyright 2023 David Reid |
266 |
|
267 |
Permission is hereby granted, free of charge, to any person obtaining a copy of |
268 |
this software and associated documentation files (the "Software"), to deal in |
269 |
diff --git a/src/dr_mp3.h b/src/dr_mp3.h |
270 |
index 59876c8..2e82189 100644 |
271 |
--- src/dr_mp3.h |
272 |
+++ src/dr_mp3.h |
273 |
@@ -1,6 +1,6 @@ |
274 |
/* |
275 |
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. |
276 |
-dr_mp3 - v0.6.34 - 2022-09-17 |
277 |
+dr_mp3 - v0.6.36 - 2023-06-17 |
278 |
|
279 |
David Reid - mackron@gmail.com |
280 |
|
281 |
@@ -95,12 +95,12 @@ extern "C" { |
282 |
|
283 |
#define DRMP3_VERSION_MAJOR 0 |
284 |
#define DRMP3_VERSION_MINOR 6 |
285 |
-#define DRMP3_VERSION_REVISION 34 |
286 |
+#define DRMP3_VERSION_REVISION 36 |
287 |
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION) |
288 |
|
289 |
#include <stddef.h> /* For size_t. */ |
290 |
|
291 |
-/* Sized types. */ |
292 |
+/* Sized Types */ |
293 |
typedef signed char drmp3_int8; |
294 |
typedef unsigned char drmp3_uint8; |
295 |
typedef signed short drmp3_int16; |
296 |
@@ -133,7 +133,9 @@ typedef drmp3_uint8 drmp3_bool8; |
297 |
typedef drmp3_uint32 drmp3_bool32; |
298 |
#define DRMP3_TRUE 1 |
299 |
#define DRMP3_FALSE 0 |
300 |
+/* End Sized Types */ |
301 |
|
302 |
+/* Decorations */ |
303 |
#if !defined(DRMP3_API) |
304 |
#if defined(DRMP3_DLL) |
305 |
#if defined(_WIN32) |
306 |
@@ -163,7 +165,9 @@ typedef drmp3_uint32 drmp3_bool32; |
307 |
#define DRMP3_PRIVATE static |
308 |
#endif |
309 |
#endif |
310 |
+/* End Decorations */ |
311 |
|
312 |
+/* Result Codes */ |
313 |
typedef drmp3_int32 drmp3_result; |
314 |
#define DRMP3_SUCCESS 0 |
315 |
#define DRMP3_ERROR -1 /* A generic error. */ |
316 |
@@ -219,11 +223,12 @@ typedef drmp3_int32 drmp3_result; |
317 |
#define DRMP3_CANCELLED -51 |
318 |
#define DRMP3_MEMORY_ALREADY_MAPPED -52 |
319 |
#define DRMP3_AT_END -53 |
320 |
- |
321 |
+/* End Result Codes */ |
322 |
|
323 |
#define DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME 1152 |
324 |
#define DRMP3_MAX_SAMPLES_PER_FRAME (DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME*2) |
325 |
|
326 |
+/* Inline */ |
327 |
#ifdef _MSC_VER |
328 |
#define DRMP3_INLINE __forceinline |
329 |
#elif defined(__GNUC__) |
330 |
@@ -250,12 +255,24 @@ typedef drmp3_int32 drmp3_result; |
331 |
#else |
332 |
#define DRMP3_INLINE |
333 |
#endif |
334 |
+/* End Inline */ |
335 |
|
336 |
|
337 |
DRMP3_API void drmp3_version(drmp3_uint32* pMajor, drmp3_uint32* pMinor, drmp3_uint32* pRevision); |
338 |
DRMP3_API const char* drmp3_version_string(void); |
339 |
|
340 |
|
341 |
+/* Allocation Callbacks */ |
342 |
+typedef struct |
343 |
+{ |
344 |
+ void* pUserData; |
345 |
+ void* (* onMalloc)(size_t sz, void* pUserData); |
346 |
+ void* (* onRealloc)(void* p, size_t sz, void* pUserData); |
347 |
+ void (* onFree)(void* p, void* pUserData); |
348 |
+} drmp3_allocation_callbacks; |
349 |
+/* End Allocation Callbacks */ |
350 |
+ |
351 |
+ |
352 |
/* |
353 |
Low Level Push API |
354 |
================== |
355 |
@@ -329,14 +346,6 @@ will be either drmp3_seek_origin_start or drmp3_seek_origin_current. |
356 |
*/ |
357 |
typedef drmp3_bool32 (* drmp3_seek_proc)(void* pUserData, int offset, drmp3_seek_origin origin); |
358 |
|
359 |
-typedef struct |
360 |
-{ |
361 |
- void* pUserData; |
362 |
- void* (* onMalloc)(size_t sz, void* pUserData); |
363 |
- void* (* onRealloc)(void* p, size_t sz, void* pUserData); |
364 |
- void (* onFree)(void* p, void* pUserData); |
365 |
-} drmp3_allocation_callbacks; |
366 |
- |
367 |
typedef struct |
368 |
{ |
369 |
drmp3_uint32 channels; |
370 |
@@ -2415,6 +2424,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num |
371 |
Main Public API |
372 |
|
373 |
************************************************************************************************************************************************************/ |
374 |
+/* SIZE_MAX */ |
375 |
#if defined(SIZE_MAX) |
376 |
#define DRMP3_SIZE_MAX SIZE_MAX |
377 |
#else |
378 |
@@ -2424,6 +2434,7 @@ DRMP3_API void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, size_t num |
379 |
#define DRMP3_SIZE_MAX 0xFFFFFFFF |
380 |
#endif |
381 |
#endif |
382 |
+/* End SIZE_MAX */ |
383 |
|
384 |
/* Options. */ |
385 |
#ifndef DRMP3_SEEK_LEADING_MP3_FRAMES |
386 |
@@ -2931,6 +2942,7 @@ DRMP3_API drmp3_bool32 drmp3_init_memory(drmp3* pMP3, const void* pData, size_t |
387 |
#include <stdio.h> |
388 |
#include <wchar.h> /* For wcslen(), wcsrtombs() */ |
389 |
|
390 |
+/* Errno */ |
391 |
/* drmp3_result_from_errno() is only used inside DR_MP3_NO_STDIO for now. Move this out if it's ever used elsewhere. */ |
392 |
#include <errno.h> |
393 |
static drmp3_result drmp3_result_from_errno(int e) |
394 |
@@ -3334,7 +3346,9 @@ static drmp3_result drmp3_result_from_errno(int e) |
395 |
default: return DRMP3_ERROR; |
396 |
} |
397 |
} |
398 |
+/* End Errno */ |
399 |
|
400 |
+/* fopen */ |
401 |
static drmp3_result drmp3_fopen(FILE** ppFile, const char* pFilePath, const char* pOpenMode) |
402 |
{ |
403 |
#if defined(_MSC_VER) && _MSC_VER >= 1400 |
404 |
@@ -3490,7 +3504,7 @@ static drmp3_result drmp3_wfopen(FILE** ppFile, const wchar_t* pFilePath, const |
405 |
|
406 |
return DRMP3_SUCCESS; |
407 |
} |
408 |
- |
409 |
+/* End fopen */ |
410 |
|
411 |
|
412 |
static size_t drmp3__on_read_stdio(void* pUserData, void* pBufferOut, size_t bytesToRead) |
413 |
@@ -4476,6 +4490,12 @@ counts rather than sample counts. |
414 |
/* |
415 |
REVISION HISTORY |
416 |
================ |
417 |
+v0.6.36 - 2023-06-17 |
418 |
+ - Fix an incorrect date in revision history. No functional change. |
419 |
+ |
420 |
+v0.6.35 - 2023-05-22 |
421 |
+ - Minor code restructure. No functional change. |
422 |
+ |
423 |
v0.6.34 - 2022-09-17 |
424 |
- Fix compilation with DJGPP. |
425 |
- Fix compilation when compiling with x86 with no SSE2. |
426 |
@@ -4777,7 +4797,7 @@ For more information, please refer to <http://unlicense.org/> |
427 |
=============================================================================== |
428 |
ALTERNATIVE 2 - MIT No Attribution |
429 |
=============================================================================== |
430 |
-Copyright 2020 David Reid |
431 |
+Copyright 2023 David Reid |
432 |
|
433 |
Permission is hereby granted, free of charge, to any person obtaining a copy of |
434 |
this software and associated documentation files (the "Software"), to deal in |
435 |
|
436 |
From 1507be95c3605e4fd6a48ea4c527e4aa711a1566 Mon Sep 17 00:00:00 2001 |
437 |
From: Anonymous Maarten <madebr@users.noreply.github.com> |
438 |
Date: Fri, 13 Oct 2023 17:50:02 +0000 |
439 |
Subject: [PATCH 05/17] playsound: fix potention null pointer read |
440 |
|
441 |
Potential fix for https://retrace.fedoraproject.org/faf/reports/556333/ |
442 |
--- |
443 |
examples/playsound.c | 2 +- |
444 |
1 file changed, 1 insertion(+), 1 deletion(-) |
445 |
|
446 |
diff --git a/examples/playsound.c b/examples/playsound.c |
447 |
index b23b001..24f8132 100644 |
448 |
--- examples/playsound.c |
449 |
+++ examples/playsound.c |
450 |
@@ -839,7 +839,7 @@ int main(int argc, char **argv) |
451 |
global_state.predecode = 1; |
452 |
} /* else if */ |
453 |
|
454 |
- else if (SDL_strcmp(argv[i], "--loop") == 0) |
455 |
+ else if (SDL_strcmp(argv[i], "--loop") == 0 && argc > i + 1) |
456 |
{ |
457 |
global_state.looping = SDL_atoi(argv[++i]); |
458 |
} /* else if */ |
459 |
|
460 |
From c8e96bec10e7f314ecbf422bdafaf386098d3105 Mon Sep 17 00:00:00 2001 |
461 |
From: Anonymous Maarten <anonymous.maarten@gmail.com> |
462 |
Date: Thu, 26 Oct 2023 18:18:14 +0200 |
463 |
Subject: [PATCH 06/17] cmake: make sure SDL2_sound::SDL2_sound always exists |
464 |
|
465 |
--- |
466 |
CMakeLists.txt | 5 +++++ |
467 |
cmake/SDL2_soundConfig.cmake.in | 11 +++++++++++ |
468 |
2 files changed, 16 insertions(+) |
469 |
|
470 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
471 |
index 67d5ef9..1e08345 100644 |
472 |
--- CMakeLists.txt |
473 |
+++ CMakeLists.txt |
474 |
@@ -413,4 +413,9 @@ message_bool_option("Build static library" SDLSOUND_BUILD_STATIC) |
475 |
message_bool_option("Build shared library" SDLSOUND_BUILD_SHARED) |
476 |
message_bool_option("Build stdio test program" SDLSOUND_BUILD_TEST) |
477 |
|
478 |
+# Make sure SDL2_sound::SDL2_sound always exists |
479 |
+if(TARGET SDL2_sound::SDL2_sound-static AND NOT TARGET SDL2_sound::SDL2_sound) |
480 |
+ add_library(SDL2_sound::SDL2_sound ALIAS SDL2_sound-static) |
481 |
+endif() |
482 |
+ |
483 |
# end of CMakeLists.txt |
484 |
diff --git a/cmake/SDL2_soundConfig.cmake.in b/cmake/SDL2_soundConfig.cmake.in |
485 |
index 5ad8890..c92bdd0 100644 |
486 |
--- cmake/SDL2_soundConfig.cmake.in |
487 |
+++ cmake/SDL2_soundConfig.cmake.in |
488 |
@@ -21,3 +21,14 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2_sound-static-targets.cmake") |
489 |
endif() |
490 |
|
491 |
check_required_components(SDL2_sound) |
492 |
+ |
493 |
+# Create SDL2_sound::SDL2_sound alias for static-only builds |
494 |
+if(TARGET SDL2_sound::SDL2_sound-static AND NOT TARGET SDL2_sound::SDL2_sound) |
495 |
+ if(CMAKE_VERSION VERSION_LESS "3.18") |
496 |
+ # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. |
497 |
+ add_library(SDL2_sound::SDL2_sound INTERFACE IMPORTED) |
498 |
+ set_target_properties(SDL2_sound::SDL2_sound PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2_sound::SDL2_sound-static") |
499 |
+ else() |
500 |
+ add_library(SDL2_sound::SDL2_sound ALIAS SDL2_sound::SDL2_sound-static) |
501 |
+ endif() |
502 |
+endif() |
503 |
|
504 |
From a7e7d1f6e9bdc5e813c696d13ba243706f8ccce3 Mon Sep 17 00:00:00 2001 |
505 |
From: Ozkan Sezer <sezeroz@gmail.com> |
506 |
Date: Tue, 7 Nov 2023 22:40:04 +0300 |
507 |
Subject: [PATCH 07/17] Import an stb_vorbis fix from upstream PR/1563: |
508 |
|
509 |
Patch by Seb de Graffenried (@Seb-degraff): https://github.com/nothings/stb/pull/1563 |
510 |
Fixes distorted decompressed audio when UBSan was enabled. |
511 |
--- |
512 |
src/stb_vorbis.h | 4 ++-- |
513 |
1 file changed, 2 insertions(+), 2 deletions(-) |
514 |
|
515 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
516 |
index f651f74..34c53b5 100644 |
517 |
--- src/stb_vorbis.h |
518 |
+++ src/stb_vorbis.h |
519 |
@@ -2151,7 +2151,7 @@ STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, in |
520 |
ady -= abs(base) * adx; |
521 |
if (x1 > n) x1 = n; |
522 |
if (x < x1) { |
523 |
- LINE_OP(output[x], inverse_db_table[y&255]); |
524 |
+ LINE_OP(output[x], inverse_db_table[(uint32)y&255]); |
525 |
for (++x; x < x1; ++x) { |
526 |
err += ady; |
527 |
if (err >= adx) { |
528 |
@@ -2159,7 +2159,7 @@ STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, in |
529 |
y += sy; |
530 |
} else |
531 |
y += base; |
532 |
- LINE_OP(output[x], inverse_db_table[y&255]); |
533 |
+ LINE_OP(output[x], inverse_db_table[(uint32)y&255]); |
534 |
} |
535 |
} |
536 |
} |
537 |
|
538 |
From d9d196a43ff1b207fe5644e3943a459495a6642c Mon Sep 17 00:00:00 2001 |
539 |
From: Ozkan Sezer <sezeroz@gmail.com> |
540 |
Date: Sat, 2 Dec 2023 10:29:20 +0300 |
541 |
Subject: [PATCH 08/17] updated dr_libs from mainstream. |
542 |
|
543 |
--- |
544 |
src/dr_flac.h | 14 +++++++++----- |
545 |
src/dr_mp3.h | 17 ++++++++++++++--- |
546 |
2 files changed, 23 insertions(+), 8 deletions(-) |
547 |
|
548 |
diff --git a/src/dr_flac.h b/src/dr_flac.h |
549 |
index 1ede99f..14324cf 100644 |
550 |
--- src/dr_flac.h |
551 |
+++ src/dr_flac.h |
552 |
@@ -1,6 +1,6 @@ |
553 |
/* |
554 |
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. |
555 |
-dr_flac - v0.12.41 - 2023-06-17 |
556 |
+dr_flac - v0.12.42 - 2023-11-02 |
557 |
|
558 |
David Reid - mackron@gmail.com |
559 |
|
560 |
@@ -235,7 +235,7 @@ extern "C" { |
561 |
|
562 |
#define DRFLAC_VERSION_MAJOR 0 |
563 |
#define DRFLAC_VERSION_MINOR 12 |
564 |
-#define DRFLAC_VERSION_REVISION 41 |
565 |
+#define DRFLAC_VERSION_REVISION 42 |
566 |
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION) |
567 |
|
568 |
#include <stddef.h> /* For size_t. */ |
569 |
@@ -1851,7 +1851,7 @@ static DRFLAC_INLINE drflac_uint32 drflac__swap_endian_uint32(drflac_uint32 n) |
570 |
#if defined(_MSC_VER) && !defined(__clang__) |
571 |
return _byteswap_ulong(n); |
572 |
#elif defined(__GNUC__) || defined(__clang__) |
573 |
- #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. */ |
574 |
+ #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. */ |
575 |
/* Inline assembly optimized implementation for ARM. In my testing, GCC does not generate optimized code with __builtin_bswap32(). */ |
576 |
drflac_uint32 r; |
577 |
__asm__ __volatile__ ( |
578 |
@@ -2815,7 +2815,7 @@ static DRFLAC_INLINE drflac_uint32 drflac__clz_lzcnt(drflac_cache_t x) |
579 |
|
580 |
return r; |
581 |
} |
582 |
- #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. */ |
583 |
+ #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. */ |
584 |
{ |
585 |
unsigned int r; |
586 |
__asm__ __volatile__ ( |
587 |
@@ -6492,7 +6492,7 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d |
588 |
for (;;) { |
589 |
drflac_metadata metadata; |
590 |
drflac_uint8 isLastBlock = 0; |
591 |
- drflac_uint8 blockType; |
592 |
+ drflac_uint8 blockType = 0; |
593 |
drflac_uint32 blockSize; |
594 |
if (drflac__read_and_decode_block_header(onRead, pUserData, &isLastBlock, &blockType, &blockSize) == DRFLAC_FALSE) { |
595 |
return DRFLAC_FALSE; |
596 |
@@ -12077,6 +12077,10 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat |
597 |
/* |
598 |
REVISION HISTORY |
599 |
================ |
600 |
+v0.12.42 - 2023-11-02 |
601 |
+ - Fix build for ARMv6-M. |
602 |
+ - Fix a compilation warning with GCC. |
603 |
+ |
604 |
v0.12.41 - 2023-06-17 |
605 |
- Fix an incorrect date in revision history. No functional change. |
606 |
|
607 |
diff --git a/src/dr_mp3.h b/src/dr_mp3.h |
608 |
index 2e82189..84849ee 100644 |
609 |
--- src/dr_mp3.h |
610 |
+++ src/dr_mp3.h |
611 |
@@ -1,6 +1,6 @@ |
612 |
/* |
613 |
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. |
614 |
-dr_mp3 - v0.6.36 - 2023-06-17 |
615 |
+dr_mp3 - v0.6.38 - 2023-11-02 |
616 |
|
617 |
David Reid - mackron@gmail.com |
618 |
|
619 |
@@ -95,7 +95,7 @@ extern "C" { |
620 |
|
621 |
#define DRMP3_VERSION_MAJOR 0 |
622 |
#define DRMP3_VERSION_MINOR 6 |
623 |
-#define DRMP3_VERSION_REVISION 36 |
624 |
+#define DRMP3_VERSION_REVISION 38 |
625 |
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION) |
626 |
|
627 |
#include <stddef.h> /* For size_t. */ |
628 |
@@ -713,7 +713,7 @@ static int drmp3_have_simd(void) |
629 |
|
630 |
#endif |
631 |
|
632 |
-#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64) |
633 |
+#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64) && !defined(__ARM_ARCH_6M__) |
634 |
#define DRMP3_HAVE_ARMV6 1 |
635 |
static __inline__ __attribute__((always_inline)) drmp3_int32 drmp3_clip_int16_arm(drmp3_int32 a) |
636 |
{ |
637 |
@@ -2701,6 +2701,11 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__callbacks(drmp3* pMP3, drmp3d_sa |
638 |
DRMP3_ASSERT(pMP3->pData != NULL); |
639 |
DRMP3_ASSERT(pMP3->dataCapacity > 0); |
640 |
|
641 |
+ /* Do a runtime check here to try silencing a false-positive from clang-analyzer. */ |
642 |
+ if (pMP3->pData == NULL) { |
643 |
+ return 0; |
644 |
+ } |
645 |
+ |
646 |
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. */ |
647 |
|
648 |
/* Consume the data. */ |
649 |
@@ -4490,6 +4495,12 @@ counts rather than sample counts. |
650 |
/* |
651 |
REVISION HISTORY |
652 |
================ |
653 |
+v0.6.38 - 2023-11-02 |
654 |
+ - Fix build for ARMv6-M. |
655 |
+ |
656 |
+v0.6.37 - 2023-07-07 |
657 |
+ - Silence a static analysis warning. |
658 |
+ |
659 |
v0.6.36 - 2023-06-17 |
660 |
- Fix an incorrect date in revision history. No functional change. |
661 |
|
662 |
|
663 |
From a9e5aa85b2fe2c28e1af398105a9260eee1d7f9d Mon Sep 17 00:00:00 2001 |
664 |
From: Ozkan Sezer <sezeroz@gmail.com> |
665 |
Date: Mon, 11 Dec 2023 05:50:02 +0300 |
666 |
Subject: [PATCH 09/17] stb_vorbis: fix CVE-2023-45676 and CVE-2023-45677. |
667 |
MIME-Version: 1.0 |
668 |
Content-Type: text/plain; charset=UTF-8 |
669 |
Content-Transfer-Encoding: 8bit |
670 |
|
671 |
Based on the patches by Jaroslav Lobačevski (@JarLob) submitted |
672 |
to mainstream at: https://github.com/nothings/stb/pull/1554 and |
673 |
https://github.com/nothings/stb/pull/1555 |
674 |
|
675 |
GHSL-2023-166/CVE-2023-45676: Multi-byte write heap buffer overflow in start_decoder() |
676 |
GHSL-2023-167/CVE-2023-45677: Heap buffer out of bounds write in start_decoder() |
677 |
--- |
678 |
src/stb_vorbis.h | 1 + |
679 |
1 file changed, 1 insertion(+) |
680 |
|
681 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
682 |
index 34c53b5..ca102ac 100644 |
683 |
--- src/stb_vorbis.h |
684 |
+++ src/stb_vorbis.h |
685 |
@@ -982,6 +982,7 @@ static void *make_block_array(void *mem, int count, int size) |
686 |
|
687 |
static void *setup_malloc(vorb *f, int sz) |
688 |
{ |
689 |
+ if (sz < 0 || INT_MAX - 7 < sz) return NULL; |
690 |
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. |
691 |
f->setup_memory_required += sz; |
692 |
if (f->alloc.alloc_buffer) { |
693 |
|
694 |
From 09996c45b9d4d9601aa48fa1e872c6bb302f0ad9 Mon Sep 17 00:00:00 2001 |
695 |
From: Ozkan Sezer <sezeroz@gmail.com> |
696 |
Date: Mon, 11 Dec 2023 05:50:10 +0300 |
697 |
Subject: [PATCH 10/17] stb_vorbis: fix CVE-2023-45679 and CVE-2023-45680. |
698 |
MIME-Version: 1.0 |
699 |
Content-Type: text/plain; charset=UTF-8 |
700 |
Content-Transfer-Encoding: 8bit |
701 |
|
702 |
Based on the patches by Jaroslav Lobačevski (@JarLob) submitted |
703 |
to mainstream at: https://github.com/nothings/stb/pull/1557 and |
704 |
https://github.com/nothings/stb/pull/1558 |
705 |
|
706 |
GHSL-2023-169/CVE-2023-45679: Attempt to free an uninitialized memory pointer in vorbis_deinit() |
707 |
GHSL-2023-170/CVE-2023-45680: Null pointer dereference in vorbis_deinit() |
708 |
--- |
709 |
src/stb_vorbis.h | 9 +++++++-- |
710 |
1 file changed, 7 insertions(+), 2 deletions(-) |
711 |
|
712 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
713 |
index ca102ac..9ded38c 100644 |
714 |
--- src/stb_vorbis.h |
715 |
+++ src/stb_vorbis.h |
716 |
@@ -3747,8 +3747,13 @@ static int start_decoder(vorb *f) |
717 |
f->comment_list = NULL; |
718 |
if (f->comment_list_length > 0) |
719 |
{ |
720 |
- f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); |
721 |
- if (f->comment_list == NULL) return error(f, VORBIS_outofmem); |
722 |
+ len = sizeof(char*) * f->comment_list_length; |
723 |
+ f->comment_list = (char**) setup_malloc(f, len); |
724 |
+ if (f->comment_list == NULL) { |
725 |
+ f->comment_list_length = 0; |
726 |
+ return error(f, VORBIS_outofmem); |
727 |
+ } |
728 |
+ memset(f->comment_list, 0, len); |
729 |
} |
730 |
|
731 |
for(i=0; i < f->comment_list_length; ++i) { |
732 |
|
733 |
From f04567f547a76fbd63f7271054aeaa7dd3659710 Mon Sep 17 00:00:00 2001 |
734 |
From: Ozkan Sezer <sezeroz@gmail.com> |
735 |
Date: Mon, 11 Dec 2023 05:50:14 +0300 |
736 |
Subject: [PATCH 11/17] stb_vorbis: fix CVE-2023-45681 (integer overflow.) |
737 |
MIME-Version: 1.0 |
738 |
Content-Type: text/plain; charset=UTF-8 |
739 |
Content-Transfer-Encoding: 8bit |
740 |
|
741 |
Based on patch by Jaroslav Lobačevski (@JarLob) submitted to |
742 |
mainstream at https://github.com/nothings/stb/pull/1559 |
743 |
|
744 |
GHSL-2023-171/CVE-2023-45681: Out of bounds heap buffer write |
745 |
--- |
746 |
src/stb_vorbis.h | 3 +++ |
747 |
1 file changed, 3 insertions(+) |
748 |
|
749 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
750 |
index 9ded38c..0d916e8 100644 |
751 |
--- src/stb_vorbis.h |
752 |
+++ src/stb_vorbis.h |
753 |
@@ -3747,9 +3747,12 @@ static int start_decoder(vorb *f) |
754 |
f->comment_list = NULL; |
755 |
if (f->comment_list_length > 0) |
756 |
{ |
757 |
+ if (INT_MAX / sizeof(char*) < f->comment_list_length) |
758 |
+ goto no_comment; |
759 |
len = sizeof(char*) * f->comment_list_length; |
760 |
f->comment_list = (char**) setup_malloc(f, len); |
761 |
if (f->comment_list == NULL) { |
762 |
+ no_comment: |
763 |
f->comment_list_length = 0; |
764 |
return error(f, VORBIS_outofmem); |
765 |
} |
766 |
|
767 |
From 9ebcb8bb5f2ad9233022fa064c48dd91a707b0ac Mon Sep 17 00:00:00 2001 |
768 |
From: Ozkan Sezer <sezeroz@gmail.com> |
769 |
Date: Mon, 11 Dec 2023 05:50:50 +0300 |
770 |
Subject: [PATCH 12/17] stb_vorbis: fix CVE-2023-45682 |
771 |
MIME-Version: 1.0 |
772 |
Content-Type: text/plain; charset=UTF-8 |
773 |
Content-Transfer-Encoding: 8bit |
774 |
|
775 |
Based on patch by Jaroslav Lobačevski (@JarLob) submitted to |
776 |
mainstream at https://github.com/nothings/stb/pull/1560 |
777 |
|
778 |
GHSL-2023-172/CVE-2023-45682: Wild address read in vorbis_decode_packet_rest() |
779 |
--- |
780 |
src/stb_vorbis.h | 2 +- |
781 |
1 file changed, 1 insertion(+), 1 deletion(-) |
782 |
|
783 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
784 |
index 0d916e8..1b1a206 100644 |
785 |
--- src/stb_vorbis.h |
786 |
+++ src/stb_vorbis.h |
787 |
@@ -1838,7 +1838,7 @@ static int codebook_decode_scalar(vorb *f, Codebook *c) |
788 |
|
789 |
#define DECODE(var,f,c) \ |
790 |
DECODE_RAW(var,f,c) \ |
791 |
- if (c->sparse) var = c->sorted_values[var]; |
792 |
+ if (c->sparse && var >= 0) var = c->sorted_values[var]; |
793 |
|
794 |
#ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK |
795 |
#define DECODE_VQ(var,f,c) DECODE_RAW(var,f,c) |
796 |
|
797 |
From d372bfed324b27184ceaf878955429fe21c4fd8a Mon Sep 17 00:00:00 2001 |
798 |
From: Ozkan Sezer <sezeroz@gmail.com> |
799 |
Date: Mon, 11 Dec 2023 08:51:10 +0300 |
800 |
Subject: [PATCH 13/17] SDL_sound_vorbis.c: error-out if the vorbis file has no |
801 |
samples. |
802 |
|
803 |
--- |
804 |
src/SDL_sound_vorbis.c | 4 +++- |
805 |
1 file changed, 3 insertions(+), 1 deletion(-) |
806 |
|
807 |
diff --git a/src/SDL_sound_vorbis.c b/src/SDL_sound_vorbis.c |
808 |
index c418831..ac44446 100644 |
809 |
--- src/SDL_sound_vorbis.c |
810 |
+++ src/SDL_sound_vorbis.c |
811 |
@@ -124,7 +124,9 @@ static int VORBIS_open(Sound_Sample *sample, const char *ext) |
812 |
sample->actual.rate = stb->sample_rate; |
813 |
num_frames = stb_vorbis_stream_length_in_samples(stb); |
814 |
if (!num_frames) |
815 |
- internal->total_time = -1; |
816 |
+ { |
817 |
+ BAIL_MACRO("VORBIS: No samples in ogg/vorbis stream.", 0); |
818 |
+ } |
819 |
else |
820 |
{ |
821 |
const unsigned int rate = stb->sample_rate; |
822 |
|
823 |
From 7cc5fecbd78e4dabd9915d6e55cf565895ada116 Mon Sep 17 00:00:00 2001 |
824 |
From: Ozkan Sezer <sezeroz@gmail.com> |
825 |
Date: Mon, 11 Dec 2023 08:55:40 +0300 |
826 |
Subject: [PATCH 14/17] stb_vorbis: revise CVE-2023-45676 / CVE-2023-45677 fix. |
827 |
|
828 |
c.f.: https://github.com/nothings/stb/issues/1248. |
829 |
--- |
830 |
src/stb_vorbis.h | 2 +- |
831 |
1 file changed, 1 insertion(+), 1 deletion(-) |
832 |
|
833 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
834 |
index 1b1a206..06a684c 100644 |
835 |
--- src/stb_vorbis.h |
836 |
+++ src/stb_vorbis.h |
837 |
@@ -982,7 +982,7 @@ static void *make_block_array(void *mem, int count, int size) |
838 |
|
839 |
static void *setup_malloc(vorb *f, int sz) |
840 |
{ |
841 |
- if (sz < 0 || INT_MAX - 7 < sz) return NULL; |
842 |
+ if (sz <= 0 || INT_MAX - 7 < sz) return NULL; |
843 |
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. |
844 |
f->setup_memory_required += sz; |
845 |
if (f->alloc.alloc_buffer) { |
846 |
|
847 |
From 6ee6c835364360954847eda74824f141e1409775 Mon Sep 17 00:00:00 2001 |
848 |
From: Ozkan Sezer <sezeroz@gmail.com> |
849 |
Date: Mon, 11 Dec 2023 11:37:04 +0300 |
850 |
Subject: [PATCH 15/17] stb_vorbis: apply CVE-2023-45676/CVE-2023-45677 fix to |
851 |
setup_temp_malloc |
852 |
|
853 |
(c.f.: https://github.com/nothings/stb/issues/1248, |
854 |
https://github.com/nothings/stb/pull/1554 , |
855 |
https://github.com/nothings/stb/pull/1555 ) |
856 |
--- |
857 |
src/stb_vorbis.h | 4 ++++ |
858 |
1 file changed, 4 insertions(+) |
859 |
|
860 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
861 |
index 06a684c..cf33242 100644 |
862 |
--- src/stb_vorbis.h |
863 |
+++ src/stb_vorbis.h |
864 |
@@ -970,6 +970,8 @@ static int error(vorb *f, enum STBVorbisError e) |
865 |
// given a sufficiently large block of memory, make an array of pointers to subblocks of it |
866 |
static void *make_block_array(void *mem, int count, int size) |
867 |
{ |
868 |
+ if (!mem) return NULL; |
869 |
+ else { |
870 |
int i; |
871 |
void ** p = (void **) mem; |
872 |
char *q = (char *) (p + count); |
873 |
@@ -978,6 +980,7 @@ static void *make_block_array(void *mem, int count, int size) |
874 |
q += size; |
875 |
} |
876 |
return p; |
877 |
+ } |
878 |
} |
879 |
|
880 |
static void *setup_malloc(vorb *f, int sz) |
881 |
@@ -1002,6 +1005,7 @@ static void setup_free(vorb *f, void *p) |
882 |
|
883 |
static void *setup_temp_malloc(vorb *f, int sz) |
884 |
{ |
885 |
+ if (sz <= 0 || INT_MAX - 7 < sz) return NULL; |
886 |
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. |
887 |
if (f->alloc.alloc_buffer) { |
888 |
if (f->temp_offset - sz < f->setup_offset) return NULL; |
889 |
|
890 |
From c5639414c1bb24fb4eef5861c13adb42a4aab950 Mon Sep 17 00:00:00 2001 |
891 |
From: Ozkan Sezer <sezeroz@gmail.com> |
892 |
Date: Wed, 13 Dec 2023 08:00:02 +0300 |
893 |
Subject: [PATCH 16/17] stb_vorbis: sync with stb_vorbis SDL fork, and |
894 |
SDL_mixer |
895 |
|
896 |
--- |
897 |
src/SDL_sound_vorbis.c | 5 ++-- |
898 |
src/stb_vorbis.h | 63 ++++++++++++++++++++++++++++++++---------- |
899 |
2 files changed, 51 insertions(+), 17 deletions(-) |
900 |
|
901 |
diff --git a/src/SDL_sound_vorbis.c b/src/SDL_sound_vorbis.c |
902 |
index ac44446..b427521 100644 |
903 |
--- src/SDL_sound_vorbis.c |
904 |
+++ src/SDL_sound_vorbis.c |
905 |
@@ -23,16 +23,17 @@ |
906 |
#if SOUND_SUPPORTS_VORBIS |
907 |
|
908 |
/* Configure and include stb_vorbis for compiling... */ |
909 |
+#define STB_VORBIS_SDL 1 /* for SDL_sound-specific stuff. */ |
910 |
#define STB_VORBIS_NO_STDIO 1 |
911 |
#define STB_VORBIS_NO_CRT 1 |
912 |
#define STB_VORBIS_NO_PUSHDATA_API 1 |
913 |
-#define STB_VORBIS_MAX_CHANNELS 6 |
914 |
+#define STB_VORBIS_MAX_CHANNELS 8 /* For 7.1 surround sound */ |
915 |
#define STB_VORBIS_NO_COMMENTS 1 |
916 |
#define STB_FORCEINLINE SDL_FORCE_INLINE |
917 |
#if SDL_BYTEORDER == SDL_BIG_ENDIAN |
918 |
#define STB_VORBIS_BIG_ENDIAN 1 |
919 |
#endif |
920 |
-#define STBV_CDECL SDLCALL /* for SDL_qsort */ |
921 |
+#define STBV_CDECL SDLCALL /* for SDL_qsort() */ |
922 |
|
923 |
#if !defined(__clang_analyzer__) |
924 |
#ifdef assert |
925 |
diff --git a/src/stb_vorbis.h b/src/stb_vorbis.h |
926 |
index cf33242..8686bdf 100644 |
927 |
--- src/stb_vorbis.h |
928 |
+++ src/stb_vorbis.h |
929 |
@@ -21,6 +21,7 @@ |
930 |
// |
931 |
// Feature contributors: |
932 |
// Dougall Johnson (sample-exact seeking) |
933 |
+// Vitaly Novichkov (sample-accurate tell) |
934 |
// |
935 |
// Bugfix/warning contributors: |
936 |
// Terje Mathisen Niklas Frykholm Andy Hill |
937 |
@@ -150,8 +151,10 @@ typedef struct |
938 |
// get general information about the file |
939 |
extern stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f); |
940 |
|
941 |
+#ifndef STB_VORBIS_NO_COMMENTS |
942 |
// get ogg comments |
943 |
extern stb_vorbis_comment stb_vorbis_get_comment(stb_vorbis *f); |
944 |
+#endif |
945 |
|
946 |
// get the last error detected (clears it, too) |
947 |
extern int stb_vorbis_get_error(stb_vorbis *f); |
948 |
@@ -166,6 +169,12 @@ extern void stb_vorbis_close(stb_vorbis *f); |
949 |
// NOT WORKING YET after a seek with PULLDATA API |
950 |
extern int stb_vorbis_get_sample_offset(stb_vorbis *f); |
951 |
|
952 |
+// this function returns the count of returned samples from the beginning of the |
953 |
+// file. Functions "stb_vorbis_get_samples_*", "stb_vorbis_seek_*()" will |
954 |
+// affect the returned value. Use this call to get the accurate sample position |
955 |
+// during playback. |
956 |
+extern int stb_vorbis_get_playback_sample_offset(stb_vorbis *f); |
957 |
+ |
958 |
// returns the current seek point within the file, or offset from the beginning |
959 |
// of the memory buffer. In pushdata mode it returns 0. |
960 |
extern unsigned int stb_vorbis_get_file_offset(stb_vorbis *f); |
961 |
@@ -296,7 +305,7 @@ extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_cl |
962 |
// confused. |
963 |
#endif |
964 |
|
965 |
-#ifdef __SDL_SOUND_INTERNAL__ |
966 |
+#ifdef STB_VORBIS_SDL |
967 |
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); |
968 |
extern stb_vorbis * stb_vorbis_open_rwops(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc); |
969 |
#endif |
970 |
@@ -551,10 +560,12 @@ enum STBVorbisError |
971 |
// #define STB_VORBIS_NO_DEFER_FLOOR |
972 |
|
973 |
// STB_VORBIS_NO_COMMENTS |
974 |
-// disables reading and storing user comments |
975 |
+// Disables reading and storing user comments. |
976 |
// #define STB_VORBIS_NO_COMMENTS |
977 |
|
978 |
|
979 |
+ |
980 |
+ |
981 |
////////////////////////////////////////////////////////////////////////////// |
982 |
|
983 |
#ifdef STB_VORBIS_NO_PULLDATA_API |
984 |
@@ -637,7 +648,7 @@ enum STBVorbisError |
985 |
#define MAX_BLOCKSIZE_LOG 13 // from specification |
986 |
#define MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG) |
987 |
|
988 |
-#ifdef __SDL_SOUND_INTERNAL__ |
989 |
+#ifdef STB_VORBIS_SDL |
990 |
typedef Uint8 uint8; |
991 |
typedef Sint8 int8; |
992 |
typedef Uint16 uint16; |
993 |
@@ -768,7 +779,6 @@ typedef struct |
994 |
|
995 |
typedef struct |
996 |
{ |
997 |
- // https://github.com/nothings/stb/pull/1312 |
998 |
MappingChannel *chan; |
999 |
uint16 coupling_steps; |
1000 |
uint8 submaps; |
1001 |
@@ -821,7 +831,7 @@ struct stb_vorbis |
1002 |
uint32 f_start; |
1003 |
int close_on_free; |
1004 |
#endif |
1005 |
-#ifdef __SDL_SOUND_INTERNAL__ |
1006 |
+#ifdef STB_VORBIS_SDL |
1007 |
SDL_RWops *rwops; |
1008 |
uint32 rwops_start; |
1009 |
int close_on_free; |
1010 |
@@ -887,6 +897,9 @@ struct stb_vorbis |
1011 |
uint32 current_loc; // sample location of next frame to decode |
1012 |
int current_loc_valid; |
1013 |
|
1014 |
+ int32 current_playback_loc; // sample location of played samples |
1015 |
+ int current_playback_loc_valid; |
1016 |
+ |
1017 |
// per-blocksize precomputed data |
1018 |
|
1019 |
// twiddle factors |
1020 |
@@ -1374,7 +1387,7 @@ static int STBV_CDECL point_compare(const void *p, const void *q) |
1021 |
/////////////////////// END LEAF SETUP FUNCTIONS ////////////////////////// |
1022 |
|
1023 |
|
1024 |
-#ifdef __SDL_SOUND_INTERNAL__ |
1025 |
+#ifdef STB_VORBIS_SDL |
1026 |
#define USE_MEMORY(z) FALSE |
1027 |
#elif defined(STB_VORBIS_NO_STDIO) |
1028 |
#define USE_MEMORY(z) TRUE |
1029 |
@@ -1384,7 +1397,7 @@ static int STBV_CDECL point_compare(const void *p, const void *q) |
1030 |
|
1031 |
static uint8 get8(vorb *z) |
1032 |
{ |
1033 |
- #ifdef __SDL_SOUND_INTERNAL__ |
1034 |
+ #ifdef STB_VORBIS_SDL |
1035 |
uint8 c; |
1036 |
if (SDL_RWread(z->rwops, &c, 1, 1) != 1) { z->eof = TRUE; return 0; } |
1037 |
return c; |
1038 |
@@ -1417,7 +1430,7 @@ static uint32 get32(vorb *f) |
1039 |
|
1040 |
static int getn(vorb *z, uint8 *data, int n) |
1041 |
{ |
1042 |
- #ifdef __SDL_SOUND_INTERNAL__ |
1043 |
+ #ifdef STB_VORBIS_SDL |
1044 |
if (SDL_RWread(z->rwops, data, n, 1) == 1) return 1; |
1045 |
z->eof = 1; |
1046 |
return 0; |
1047 |
@@ -1443,7 +1456,7 @@ static int getn(vorb *z, uint8 *data, int n) |
1048 |
|
1049 |
static void skip(vorb *z, int n) |
1050 |
{ |
1051 |
- #ifdef __SDL_SOUND_INTERNAL__ |
1052 |
+ #ifdef STB_VORBIS_SDL |
1053 |
SDL_RWseek(z->rwops, n, RW_SEEK_CUR); |
1054 |
|
1055 |
#else |
1056 |
@@ -1469,7 +1482,7 @@ static int set_file_offset(stb_vorbis *f, unsigned int loc) |
1057 |
#endif |
1058 |
f->eof = 0; |
1059 |
|
1060 |
- #ifdef __SDL_SOUND_INTERNAL__ |
1061 |
+ #ifdef STB_VORBIS_SDL |
1062 |
if (loc + f->rwops_start < loc || loc >= 0x80000000) { |
1063 |
loc = 0x7fffffff; |
1064 |
f->eof = 1; |
1065 |
@@ -3601,6 +3614,8 @@ static int vorbis_pump_first_frame(stb_vorbis *f) |
1066 |
res = vorbis_decode_packet(f, &len, &left, &right); |
1067 |
if (res) |
1068 |
vorbis_finish_frame(f, len, left, right); |
1069 |
+ f->current_playback_loc = 0; |
1070 |
+ f->current_playback_loc_valid = TRUE; |
1071 |
return res; |
1072 |
} |
1073 |
|
1074 |
@@ -4392,7 +4407,7 @@ static void vorbis_deinit(stb_vorbis *p) |
1075 |
setup_temp_free(p, &p->temp_values, 0); |
1076 |
setup_temp_free(p, &p->temp_mults, 0); |
1077 |
} |
1078 |
- #ifdef __SDL_SOUND_INTERNAL__ |
1079 |
+ #ifdef STB_VORBIS_SDL |
1080 |
if (p->close_on_free) SDL_RWclose(p->rwops); |
1081 |
#endif |
1082 |
#ifndef STB_VORBIS_NO_STDIO |
1083 |
@@ -4420,7 +4435,7 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z) |
1084 |
p->stream = NULL; |
1085 |
p->codebooks = NULL; |
1086 |
p->page_crc_tests = -1; |
1087 |
- #ifdef __SDL_SOUND_INTERNAL__ |
1088 |
+ #ifdef STB_VORBIS_SDL |
1089 |
p->close_on_free = FALSE; |
1090 |
p->rwops = NULL; |
1091 |
#endif |
1092 |
@@ -4438,6 +4453,14 @@ int stb_vorbis_get_sample_offset(stb_vorbis *f) |
1093 |
return -1; |
1094 |
} |
1095 |
|
1096 |
+int stb_vorbis_get_playback_sample_offset(stb_vorbis *f) |
1097 |
+{ |
1098 |
+ if (f->current_playback_loc_valid) |
1099 |
+ return f->current_playback_loc; |
1100 |
+ else |
1101 |
+ return -1; |
1102 |
+} |
1103 |
+ |
1104 |
stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f) |
1105 |
{ |
1106 |
stb_vorbis_info d; |
1107 |
@@ -4685,7 +4708,7 @@ unsigned int stb_vorbis_get_file_offset(stb_vorbis *f) |
1108 |
#ifndef STB_VORBIS_NO_PUSHDATA_API |
1109 |
if (f->push_mode) return 0; |
1110 |
#endif |
1111 |
- #ifdef __SDL_SOUND_INTERNAL__ |
1112 |
+ #ifdef STB_VORBIS_SDL |
1113 |
return (unsigned int) (SDL_RWtell(f->rwops) - f->rwops_start); |
1114 |
#else |
1115 |
if (USE_MEMORY(f)) return (unsigned int) (f->stream - f->stream_start); |
1116 |
@@ -5058,13 +5081,16 @@ int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number) |
1117 |
} |
1118 |
// the next frame should start with the sample |
1119 |
if (f->current_loc != sample_number) return error(f, VORBIS_seek_failed); |
1120 |
+ f->current_playback_loc = sample_number; |
1121 |
return 1; |
1122 |
} |
1123 |
|
1124 |
int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number) |
1125 |
{ |
1126 |
- if (!stb_vorbis_seek_frame(f, sample_number)) |
1127 |
+ if (!stb_vorbis_seek_frame(f, sample_number)) { |
1128 |
+ f->current_playback_loc_valid = FALSE; |
1129 |
return 0; |
1130 |
+ } |
1131 |
|
1132 |
if (sample_number != f->current_loc) { |
1133 |
int n; |
1134 |
@@ -5075,6 +5101,9 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number) |
1135 |
f->channel_buffer_start += (sample_number - frame_start); |
1136 |
} |
1137 |
|
1138 |
+ f->current_playback_loc_valid = TRUE; |
1139 |
+ f->current_playback_loc = sample_number; |
1140 |
+ |
1141 |
return 1; |
1142 |
} |
1143 |
|
1144 |
@@ -5241,7 +5270,7 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st |
1145 |
} |
1146 |
#endif // STB_VORBIS_NO_STDIO |
1147 |
|
1148 |
-#ifdef __SDL_SOUND_INTERNAL__ |
1149 |
+#ifdef STB_VORBIS_SDL |
1150 |
stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length) |
1151 |
{ |
1152 |
stb_vorbis *f, p; |
1153 |
@@ -5499,6 +5528,7 @@ int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short |
1154 |
if (n == len) break; |
1155 |
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; |
1156 |
} |
1157 |
+ f->current_playback_loc += n; |
1158 |
return n; |
1159 |
} |
1160 |
|
1161 |
@@ -5516,6 +5546,7 @@ int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, in |
1162 |
if (n == len) break; |
1163 |
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; |
1164 |
} |
1165 |
+ f->current_playback_loc += n; |
1166 |
return n; |
1167 |
} |
1168 |
|
1169 |
@@ -5624,6 +5655,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float |
1170 |
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) |
1171 |
break; |
1172 |
} |
1173 |
+ f->current_playback_loc += n; |
1174 |
return n; |
1175 |
} |
1176 |
|
1177 |
@@ -5650,6 +5682,7 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in |
1178 |
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) |
1179 |
break; |
1180 |
} |
1181 |
+ f->current_playback_loc += n; |
1182 |
return n; |
1183 |
} |
1184 |
#endif // STB_VORBIS_NO_PULLDATA_API |
1185 |
|
1186 |
From fdcecafbfdcbdd2b77c5b591948c237df19c864e Mon Sep 17 00:00:00 2001 |
1187 |
From: Sepcnt <sepcnt@proton.me> |
1188 |
Date: Fri, 19 Jan 2024 00:08:17 +0800 |
1189 |
Subject: [PATCH 17/17] Update CMakeLists.txt, add option for docs |
1190 |
|
1191 |
Add SDLSOUND_BUILD_DOCS option to control whether build docs |
1192 |
--- |
1193 |
CMakeLists.txt | 48 +++++++++++++++++++++++++++--------------------- |
1194 |
1 file changed, 27 insertions(+), 21 deletions(-) |
1195 |
|
1196 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
1197 |
index 1e08345..f755820 100644 |
1198 |
--- CMakeLists.txt |
1199 |
+++ CMakeLists.txt |
1200 |
@@ -353,27 +353,32 @@ install(FILES src/SDL_sound.h |
1201 |
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SDL2_sound.pc |
1202 |
DESTINATION "${PKGCONFIG_INSTALLDIR}") |
1203 |
|
1204 |
-find_package(Doxygen) |
1205 |
-if(DOXYGEN_FOUND) |
1206 |
- set(SDLSOUND_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") |
1207 |
- configure_file( |
1208 |
- "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile" |
1209 |
- "${SDLSOUND_OUTPUT_DOXYFILE}" |
1210 |
- COPYONLY |
1211 |
- ) |
1212 |
- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n") |
1213 |
- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${SDLSOUND_VERSION}\"\n") |
1214 |
- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n") |
1215 |
- file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n") |
1216 |
- |
1217 |
- add_custom_target( |
1218 |
- SDL2_sound-docs |
1219 |
- ${DOXYGEN_EXECUTABLE} "${SDLSOUND_OUTPUT_DOXYFILE}" |
1220 |
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" |
1221 |
- COMMENT "Building documentation..." |
1222 |
- ) |
1223 |
-else() |
1224 |
- message(STATUS "Doxygen not found. You won't be able to build documentation.") |
1225 |
+option(SDLSOUND_BUILD_DOCS "Build documentation" TRUE) |
1226 |
+mark_as_advanced(SDLSOUND_BUILD_DOCS) |
1227 |
+ |
1228 |
+if(SDLSOUND_BUILD_DOCS) |
1229 |
+ find_package(Doxygen) |
1230 |
+ if(DOXYGEN_FOUND) |
1231 |
+ set(SDLSOUND_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") |
1232 |
+ configure_file( |
1233 |
+ "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile" |
1234 |
+ "${SDLSOUND_OUTPUT_DOXYFILE}" |
1235 |
+ COPYONLY |
1236 |
+ ) |
1237 |
+ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n") |
1238 |
+ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${SDLSOUND_VERSION}\"\n") |
1239 |
+ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n") |
1240 |
+ file(APPEND "${SDLSOUND_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n") |
1241 |
+ |
1242 |
+ add_custom_target( |
1243 |
+ SDL2_sound-docs |
1244 |
+ ${DOXYGEN_EXECUTABLE} "${SDLSOUND_OUTPUT_DOXYFILE}" |
1245 |
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" |
1246 |
+ COMMENT "Building documentation..." |
1247 |
+ ) |
1248 |
+ else() |
1249 |
+ message(STATUS "Doxygen not found. You won't be able to build documentation.") |
1250 |
+ endif() |
1251 |
endif() |
1252 |
|
1253 |
configure_file( |
1254 |
@@ -412,6 +417,7 @@ message_bool_option("COREAUDIO support" SDLSOUND_DECODER_COREAUDIO) |
1255 |
message_bool_option("Build static library" SDLSOUND_BUILD_STATIC) |
1256 |
message_bool_option("Build shared library" SDLSOUND_BUILD_SHARED) |
1257 |
message_bool_option("Build stdio test program" SDLSOUND_BUILD_TEST) |
1258 |
+message_bool_option("Build documentation" SDLSOUND_BUILD_DOCS) |
1259 |
|
1260 |
# Make sure SDL2_sound::SDL2_sound always exists |
1261 |
if(TARGET SDL2_sound::SDL2_sound-static AND NOT TARGET SDL2_sound::SDL2_sound) |