gosu 2.0.0.pre7 → 2.0.0.pre8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +1 -1
- data/dependencies/SDL/include/SDL_assert.h +1 -1
- data/dependencies/SDL/include/SDL_atomic.h +2 -2
- data/dependencies/SDL/include/SDL_audio.h +1 -1
- data/dependencies/SDL/include/SDL_bits.h +1 -1
- data/dependencies/SDL/include/SDL_blendmode.h +3 -3
- data/dependencies/SDL/include/SDL_clipboard.h +1 -1
- data/dependencies/SDL/include/SDL_config.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +1 -1
- data/dependencies/SDL/include/SDL_egl.h +1 -1
- data/dependencies/SDL/include/SDL_endian.h +1 -1
- data/dependencies/SDL/include/SDL_error.h +1 -1
- data/dependencies/SDL/include/SDL_events.h +4 -11
- data/dependencies/SDL/include/SDL_filesystem.h +3 -3
- data/dependencies/SDL/include/SDL_gamecontroller.h +27 -5
- data/dependencies/SDL/include/SDL_gesture.h +1 -1
- data/dependencies/SDL/include/SDL_guid.h +1 -1
- data/dependencies/SDL/include/SDL_haptic.h +1 -1
- data/dependencies/SDL/include/SDL_hidapi.h +1 -1
- data/dependencies/SDL/include/SDL_hints.h +257 -1
- data/dependencies/SDL/include/SDL_joystick.h +1 -1
- data/dependencies/SDL/include/SDL_keyboard.h +5 -3
- data/dependencies/SDL/include/SDL_keycode.h +1 -1
- data/dependencies/SDL/include/SDL_loadso.h +1 -1
- data/dependencies/SDL/include/SDL_locale.h +1 -1
- data/dependencies/SDL/include/SDL_log.h +3 -3
- data/dependencies/SDL/include/SDL_main.h +1 -1
- data/dependencies/SDL/include/SDL_messagebox.h +1 -1
- data/dependencies/SDL/include/SDL_metal.h +1 -1
- data/dependencies/SDL/include/SDL_misc.h +1 -1
- data/dependencies/SDL/include/SDL_mouse.h +1 -1
- data/dependencies/SDL/include/SDL_mutex.h +1 -1
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +1 -1
- data/dependencies/SDL/include/SDL_pixels.h +20 -2
- data/dependencies/SDL/include/SDL_platform.h +7 -1
- data/dependencies/SDL/include/SDL_power.h +1 -1
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +1 -1
- data/dependencies/SDL/include/SDL_render.h +2 -2
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +1 -1
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +1 -1
- data/dependencies/SDL/include/SDL_shape.h +1 -1
- data/dependencies/SDL/include/SDL_stdinc.h +18 -12
- data/dependencies/SDL/include/SDL_surface.h +1 -1
- data/dependencies/SDL/include/SDL_system.h +17 -2
- data/dependencies/SDL/include/SDL_syswm.h +1 -1
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +1 -1
- data/dependencies/SDL/include/SDL_test_common.h +1 -1
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +1 -1
- data/dependencies/SDL/include/SDL_test_fuzzer.h +1 -1
- data/dependencies/SDL/include/SDL_test_harness.h +1 -1
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +1 -1
- data/dependencies/SDL/include/SDL_thread.h +1 -1
- data/dependencies/SDL/include/SDL_timer.h +1 -1
- data/dependencies/SDL/include/SDL_touch.h +1 -1
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +3 -3
- data/dependencies/SDL/include/SDL_video.h +8 -2
- data/dependencies/SDL/include/begin_code.h +3 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -3
- data/dependencies/SDL_sound/dr_flac.h +9 -5
- data/dependencies/SDL_sound/dr_mp3.h +14 -3
- data/dependencies/SDL_sound/stb_vorbis.h +66 -20
- data/dependencies/stb/stb_image.h +173 -175
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/image.rb +2 -1
- data/lib64/SDL2.dll +0 -0
- metadata +5 -5
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -58,8 +58,8 @@ typedef struct SDL_version
|
|
58
58
|
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
59
59
|
*/
|
60
60
|
#define SDL_MAJOR_VERSION 2
|
61
|
-
#define SDL_MINOR_VERSION
|
62
|
-
#define SDL_PATCHLEVEL
|
61
|
+
#define SDL_MINOR_VERSION 30
|
62
|
+
#define SDL_PATCHLEVEL 0
|
63
63
|
|
64
64
|
/**
|
65
65
|
* Macro to determine SDL version program was compiled against.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1278,7 +1278,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
|
|
1278
1278
|
/**
|
1279
1279
|
* Return whether the window has a surface associated with it.
|
1280
1280
|
*
|
1281
|
-
* \returns SDL_TRUE if there is a surface associated with the window, or
|
1281
|
+
* \returns SDL_TRUE if there is a surface associated with the window, or
|
1282
|
+
* SDL_FALSE otherwise.
|
1282
1283
|
*
|
1283
1284
|
* \since This function is available since SDL 2.28.0.
|
1284
1285
|
*
|
@@ -1340,6 +1341,11 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
|
|
1340
1341
|
*
|
1341
1342
|
* This function is equivalent to the SDL 1.2 API SDL_UpdateRects().
|
1342
1343
|
*
|
1344
|
+
* Note that this function will update _at least_ the rectangles specified,
|
1345
|
+
* but this is only intended as an optimization; in practice, this might
|
1346
|
+
* update more of the screen (or all of the screen!), depending on what
|
1347
|
+
* method SDL uses to send pixels to the system.
|
1348
|
+
*
|
1343
1349
|
* \param window the window to update
|
1344
1350
|
* \param rects an array of SDL_Rect structures representing areas of the
|
1345
1351
|
* surface to copy, in pixels
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -36,6 +36,8 @@
|
|
36
36
|
#ifndef SDL_DEPRECATED
|
37
37
|
# if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
|
38
38
|
# define SDL_DEPRECATED __attribute__((deprecated))
|
39
|
+
# elif defined(_MSC_VER)
|
40
|
+
# define SDL_DEPRECATED __declspec(deprecated)
|
39
41
|
# else
|
40
42
|
# define SDL_DEPRECATED
|
41
43
|
# endif
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
Binary file
|
Binary file
|
@@ -23,16 +23,17 @@
|
|
23
23
|
#if SOUND_SUPPORTS_VORBIS
|
24
24
|
|
25
25
|
/* Configure and include stb_vorbis for compiling... */
|
26
|
+
#define STB_VORBIS_SDL 1 /* for SDL_sound-specific stuff. */
|
26
27
|
#define STB_VORBIS_NO_STDIO 1
|
27
28
|
#define STB_VORBIS_NO_CRT 1
|
28
29
|
#define STB_VORBIS_NO_PUSHDATA_API 1
|
29
|
-
#define STB_VORBIS_MAX_CHANNELS
|
30
|
+
#define STB_VORBIS_MAX_CHANNELS 8 /* For 7.1 surround sound */
|
30
31
|
#define STB_VORBIS_NO_COMMENTS 1
|
31
32
|
#define STB_FORCEINLINE SDL_FORCE_INLINE
|
32
33
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
33
34
|
#define STB_VORBIS_BIG_ENDIAN 1
|
34
35
|
#endif
|
35
|
-
#define STBV_CDECL SDLCALL /* for SDL_qsort */
|
36
|
+
#define STBV_CDECL SDLCALL /* for SDL_qsort() */
|
36
37
|
|
37
38
|
#if !defined(__clang_analyzer__)
|
38
39
|
#ifdef assert
|
@@ -124,7 +125,9 @@ static int VORBIS_open(Sound_Sample *sample, const char *ext)
|
|
124
125
|
sample->actual.rate = stb->sample_rate;
|
125
126
|
num_frames = stb_vorbis_stream_length_in_samples(stb);
|
126
127
|
if (!num_frames)
|
127
|
-
|
128
|
+
{
|
129
|
+
BAIL_MACRO("VORBIS: No samples in ogg/vorbis stream.", 0);
|
130
|
+
}
|
128
131
|
else
|
129
132
|
{
|
130
133
|
const unsigned int rate = stb->sample_rate;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
3
|
-
dr_flac - v0.12.
|
3
|
+
dr_flac - v0.12.42 - 2023-11-02
|
4
4
|
|
5
5
|
David Reid - mackron@gmail.com
|
6
6
|
|
@@ -235,7 +235,7 @@ extern "C" {
|
|
235
235
|
|
236
236
|
#define DRFLAC_VERSION_MAJOR 0
|
237
237
|
#define DRFLAC_VERSION_MINOR 12
|
238
|
-
#define DRFLAC_VERSION_REVISION
|
238
|
+
#define DRFLAC_VERSION_REVISION 42
|
239
239
|
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)
|
240
240
|
|
241
241
|
#include <stddef.h> /* For size_t. */
|
@@ -1851,7 +1851,7 @@ static DRFLAC_INLINE drflac_uint32 drflac__swap_endian_uint32(drflac_uint32 n)
|
|
1851
1851
|
#if defined(_MSC_VER) && !defined(__clang__)
|
1852
1852
|
return _byteswap_ulong(n);
|
1853
1853
|
#elif defined(__GNUC__) || defined(__clang__)
|
1854
|
-
#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. */
|
1854
|
+
#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. */
|
1855
1855
|
/* Inline assembly optimized implementation for ARM. In my testing, GCC does not generate optimized code with __builtin_bswap32(). */
|
1856
1856
|
drflac_uint32 r;
|
1857
1857
|
__asm__ __volatile__ (
|
@@ -2815,7 +2815,7 @@ static DRFLAC_INLINE drflac_uint32 drflac__clz_lzcnt(drflac_cache_t x)
|
|
2815
2815
|
|
2816
2816
|
return r;
|
2817
2817
|
}
|
2818
|
-
#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. */
|
2818
|
+
#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. */
|
2819
2819
|
{
|
2820
2820
|
unsigned int r;
|
2821
2821
|
__asm__ __volatile__ (
|
@@ -6492,7 +6492,7 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d
|
|
6492
6492
|
for (;;) {
|
6493
6493
|
drflac_metadata metadata;
|
6494
6494
|
drflac_uint8 isLastBlock = 0;
|
6495
|
-
drflac_uint8 blockType;
|
6495
|
+
drflac_uint8 blockType = 0;
|
6496
6496
|
drflac_uint32 blockSize;
|
6497
6497
|
if (drflac__read_and_decode_block_header(onRead, pUserData, &isLastBlock, &blockType, &blockSize) == DRFLAC_FALSE) {
|
6498
6498
|
return DRFLAC_FALSE;
|
@@ -12077,6 +12077,10 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
|
|
12077
12077
|
/*
|
12078
12078
|
REVISION HISTORY
|
12079
12079
|
================
|
12080
|
+
v0.12.42 - 2023-11-02
|
12081
|
+
- Fix build for ARMv6-M.
|
12082
|
+
- Fix a compilation warning with GCC.
|
12083
|
+
|
12080
12084
|
v0.12.41 - 2023-06-17
|
12081
12085
|
- Fix an incorrect date in revision history. No functional change.
|
12082
12086
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
|
3
|
-
dr_mp3 - v0.6.
|
3
|
+
dr_mp3 - v0.6.38 - 2023-11-02
|
4
4
|
|
5
5
|
David Reid - mackron@gmail.com
|
6
6
|
|
@@ -95,7 +95,7 @@ extern "C" {
|
|
95
95
|
|
96
96
|
#define DRMP3_VERSION_MAJOR 0
|
97
97
|
#define DRMP3_VERSION_MINOR 6
|
98
|
-
#define DRMP3_VERSION_REVISION
|
98
|
+
#define DRMP3_VERSION_REVISION 38
|
99
99
|
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)
|
100
100
|
|
101
101
|
#include <stddef.h> /* For size_t. */
|
@@ -713,7 +713,7 @@ static int drmp3_have_simd(void)
|
|
713
713
|
|
714
714
|
#endif
|
715
715
|
|
716
|
-
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64)
|
716
|
+
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64) && !defined(__ARM_ARCH_6M__)
|
717
717
|
#define DRMP3_HAVE_ARMV6 1
|
718
718
|
static __inline__ __attribute__((always_inline)) drmp3_int32 drmp3_clip_int16_arm(drmp3_int32 a)
|
719
719
|
{
|
@@ -2701,6 +2701,11 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__callbacks(drmp3* pMP3, drmp3d_sa
|
|
2701
2701
|
DRMP3_ASSERT(pMP3->pData != NULL);
|
2702
2702
|
DRMP3_ASSERT(pMP3->dataCapacity > 0);
|
2703
2703
|
|
2704
|
+
/* Do a runtime check here to try silencing a false-positive from clang-analyzer. */
|
2705
|
+
if (pMP3->pData == NULL) {
|
2706
|
+
return 0;
|
2707
|
+
}
|
2708
|
+
|
2704
2709
|
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. */
|
2705
2710
|
|
2706
2711
|
/* Consume the data. */
|
@@ -4490,6 +4495,12 @@ counts rather than sample counts.
|
|
4490
4495
|
/*
|
4491
4496
|
REVISION HISTORY
|
4492
4497
|
================
|
4498
|
+
v0.6.38 - 2023-11-02
|
4499
|
+
- Fix build for ARMv6-M.
|
4500
|
+
|
4501
|
+
v0.6.37 - 2023-07-07
|
4502
|
+
- Silence a static analysis warning.
|
4503
|
+
|
4493
4504
|
v0.6.36 - 2023-06-17
|
4494
4505
|
- Fix an incorrect date in revision history. No functional change.
|
4495
4506
|
|
@@ -21,6 +21,7 @@
|
|
21
21
|
//
|
22
22
|
// Feature contributors:
|
23
23
|
// Dougall Johnson (sample-exact seeking)
|
24
|
+
// Vitaly Novichkov (sample-accurate tell)
|
24
25
|
//
|
25
26
|
// Bugfix/warning contributors:
|
26
27
|
// Terje Mathisen Niklas Frykholm Andy Hill
|
@@ -150,8 +151,10 @@ typedef struct
|
|
150
151
|
// get general information about the file
|
151
152
|
extern stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f);
|
152
153
|
|
154
|
+
#ifndef STB_VORBIS_NO_COMMENTS
|
153
155
|
// get ogg comments
|
154
156
|
extern stb_vorbis_comment stb_vorbis_get_comment(stb_vorbis *f);
|
157
|
+
#endif
|
155
158
|
|
156
159
|
// get the last error detected (clears it, too)
|
157
160
|
extern int stb_vorbis_get_error(stb_vorbis *f);
|
@@ -166,6 +169,12 @@ extern void stb_vorbis_close(stb_vorbis *f);
|
|
166
169
|
// NOT WORKING YET after a seek with PULLDATA API
|
167
170
|
extern int stb_vorbis_get_sample_offset(stb_vorbis *f);
|
168
171
|
|
172
|
+
// this function returns the count of returned samples from the beginning of the
|
173
|
+
// file. Functions "stb_vorbis_get_samples_*", "stb_vorbis_seek_*()" will
|
174
|
+
// affect the returned value. Use this call to get the accurate sample position
|
175
|
+
// during playback.
|
176
|
+
extern int stb_vorbis_get_playback_sample_offset(stb_vorbis *f);
|
177
|
+
|
169
178
|
// returns the current seek point within the file, or offset from the beginning
|
170
179
|
// of the memory buffer. In pushdata mode it returns 0.
|
171
180
|
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
|
|
296
305
|
// confused.
|
297
306
|
#endif
|
298
307
|
|
299
|
-
#ifdef
|
308
|
+
#ifdef STB_VORBIS_SDL
|
300
309
|
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);
|
301
310
|
extern stb_vorbis * stb_vorbis_open_rwops(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc);
|
302
311
|
#endif
|
@@ -551,10 +560,12 @@ enum STBVorbisError
|
|
551
560
|
// #define STB_VORBIS_NO_DEFER_FLOOR
|
552
561
|
|
553
562
|
// STB_VORBIS_NO_COMMENTS
|
554
|
-
//
|
563
|
+
// Disables reading and storing user comments.
|
555
564
|
// #define STB_VORBIS_NO_COMMENTS
|
556
565
|
|
557
566
|
|
567
|
+
|
568
|
+
|
558
569
|
//////////////////////////////////////////////////////////////////////////////
|
559
570
|
|
560
571
|
#ifdef STB_VORBIS_NO_PULLDATA_API
|
@@ -637,7 +648,7 @@ enum STBVorbisError
|
|
637
648
|
#define MAX_BLOCKSIZE_LOG 13 // from specification
|
638
649
|
#define MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG)
|
639
650
|
|
640
|
-
#ifdef
|
651
|
+
#ifdef STB_VORBIS_SDL
|
641
652
|
typedef Uint8 uint8;
|
642
653
|
typedef Sint8 int8;
|
643
654
|
typedef Uint16 uint16;
|
@@ -768,7 +779,6 @@ typedef struct
|
|
768
779
|
|
769
780
|
typedef struct
|
770
781
|
{
|
771
|
-
// https://github.com/nothings/stb/pull/1312
|
772
782
|
MappingChannel *chan;
|
773
783
|
uint16 coupling_steps;
|
774
784
|
uint8 submaps;
|
@@ -821,7 +831,7 @@ struct stb_vorbis
|
|
821
831
|
uint32 f_start;
|
822
832
|
int close_on_free;
|
823
833
|
#endif
|
824
|
-
#ifdef
|
834
|
+
#ifdef STB_VORBIS_SDL
|
825
835
|
SDL_RWops *rwops;
|
826
836
|
uint32 rwops_start;
|
827
837
|
int close_on_free;
|
@@ -887,6 +897,9 @@ struct stb_vorbis
|
|
887
897
|
uint32 current_loc; // sample location of next frame to decode
|
888
898
|
int current_loc_valid;
|
889
899
|
|
900
|
+
int32 current_playback_loc; // sample location of played samples
|
901
|
+
int current_playback_loc_valid;
|
902
|
+
|
890
903
|
// per-blocksize precomputed data
|
891
904
|
|
892
905
|
// twiddle factors
|
@@ -970,6 +983,8 @@ static int error(vorb *f, enum STBVorbisError e)
|
|
970
983
|
// given a sufficiently large block of memory, make an array of pointers to subblocks of it
|
971
984
|
static void *make_block_array(void *mem, int count, int size)
|
972
985
|
{
|
986
|
+
if (!mem) return NULL;
|
987
|
+
else {
|
973
988
|
int i;
|
974
989
|
void ** p = (void **) mem;
|
975
990
|
char *q = (char *) (p + count);
|
@@ -978,10 +993,12 @@ static void *make_block_array(void *mem, int count, int size)
|
|
978
993
|
q += size;
|
979
994
|
}
|
980
995
|
return p;
|
996
|
+
}
|
981
997
|
}
|
982
998
|
|
983
999
|
static void *setup_malloc(vorb *f, int sz)
|
984
1000
|
{
|
1001
|
+
if (sz <= 0 || INT_MAX - 7 < sz) return NULL;
|
985
1002
|
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs.
|
986
1003
|
f->setup_memory_required += sz;
|
987
1004
|
if (f->alloc.alloc_buffer) {
|
@@ -1001,6 +1018,7 @@ static void setup_free(vorb *f, void *p)
|
|
1001
1018
|
|
1002
1019
|
static void *setup_temp_malloc(vorb *f, int sz)
|
1003
1020
|
{
|
1021
|
+
if (sz <= 0 || INT_MAX - 7 < sz) return NULL;
|
1004
1022
|
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs.
|
1005
1023
|
if (f->alloc.alloc_buffer) {
|
1006
1024
|
if (f->temp_offset - sz < f->setup_offset) return NULL;
|
@@ -1369,7 +1387,7 @@ static int STBV_CDECL point_compare(const void *p, const void *q)
|
|
1369
1387
|
/////////////////////// END LEAF SETUP FUNCTIONS //////////////////////////
|
1370
1388
|
|
1371
1389
|
|
1372
|
-
#ifdef
|
1390
|
+
#ifdef STB_VORBIS_SDL
|
1373
1391
|
#define USE_MEMORY(z) FALSE
|
1374
1392
|
#elif defined(STB_VORBIS_NO_STDIO)
|
1375
1393
|
#define USE_MEMORY(z) TRUE
|
@@ -1379,7 +1397,7 @@ static int STBV_CDECL point_compare(const void *p, const void *q)
|
|
1379
1397
|
|
1380
1398
|
static uint8 get8(vorb *z)
|
1381
1399
|
{
|
1382
|
-
#ifdef
|
1400
|
+
#ifdef STB_VORBIS_SDL
|
1383
1401
|
uint8 c;
|
1384
1402
|
if (SDL_RWread(z->rwops, &c, 1, 1) != 1) { z->eof = TRUE; return 0; }
|
1385
1403
|
return c;
|
@@ -1412,7 +1430,7 @@ static uint32 get32(vorb *f)
|
|
1412
1430
|
|
1413
1431
|
static int getn(vorb *z, uint8 *data, int n)
|
1414
1432
|
{
|
1415
|
-
#ifdef
|
1433
|
+
#ifdef STB_VORBIS_SDL
|
1416
1434
|
if (SDL_RWread(z->rwops, data, n, 1) == 1) return 1;
|
1417
1435
|
z->eof = 1;
|
1418
1436
|
return 0;
|
@@ -1438,7 +1456,7 @@ static int getn(vorb *z, uint8 *data, int n)
|
|
1438
1456
|
|
1439
1457
|
static void skip(vorb *z, int n)
|
1440
1458
|
{
|
1441
|
-
#ifdef
|
1459
|
+
#ifdef STB_VORBIS_SDL
|
1442
1460
|
SDL_RWseek(z->rwops, n, RW_SEEK_CUR);
|
1443
1461
|
|
1444
1462
|
#else
|
@@ -1464,7 +1482,7 @@ static int set_file_offset(stb_vorbis *f, unsigned int loc)
|
|
1464
1482
|
#endif
|
1465
1483
|
f->eof = 0;
|
1466
1484
|
|
1467
|
-
#ifdef
|
1485
|
+
#ifdef STB_VORBIS_SDL
|
1468
1486
|
if (loc + f->rwops_start < loc || loc >= 0x80000000) {
|
1469
1487
|
loc = 0x7fffffff;
|
1470
1488
|
f->eof = 1;
|
@@ -1837,7 +1855,7 @@ static int codebook_decode_scalar(vorb *f, Codebook *c)
|
|
1837
1855
|
|
1838
1856
|
#define DECODE(var,f,c) \
|
1839
1857
|
DECODE_RAW(var,f,c) \
|
1840
|
-
if (c->sparse) var = c->sorted_values[var];
|
1858
|
+
if (c->sparse && var >= 0) var = c->sorted_values[var];
|
1841
1859
|
|
1842
1860
|
#ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK
|
1843
1861
|
#define DECODE_VQ(var,f,c) DECODE_RAW(var,f,c)
|
@@ -2151,7 +2169,7 @@ STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, in
|
|
2151
2169
|
ady -= abs(base) * adx;
|
2152
2170
|
if (x1 > n) x1 = n;
|
2153
2171
|
if (x < x1) {
|
2154
|
-
LINE_OP(output[x], inverse_db_table[y&255]);
|
2172
|
+
LINE_OP(output[x], inverse_db_table[(uint32)y&255]);
|
2155
2173
|
for (++x; x < x1; ++x) {
|
2156
2174
|
err += ady;
|
2157
2175
|
if (err >= adx) {
|
@@ -2159,7 +2177,7 @@ STB_FORCEINLINE void draw_line(float *output, int x0, int y0, int x1, int y1, in
|
|
2159
2177
|
y += sy;
|
2160
2178
|
} else
|
2161
2179
|
y += base;
|
2162
|
-
LINE_OP(output[x], inverse_db_table[y&255]);
|
2180
|
+
LINE_OP(output[x], inverse_db_table[(uint32)y&255]);
|
2163
2181
|
}
|
2164
2182
|
}
|
2165
2183
|
}
|
@@ -3596,6 +3614,8 @@ static int vorbis_pump_first_frame(stb_vorbis *f)
|
|
3596
3614
|
res = vorbis_decode_packet(f, &len, &left, &right);
|
3597
3615
|
if (res)
|
3598
3616
|
vorbis_finish_frame(f, len, left, right);
|
3617
|
+
f->current_playback_loc = 0;
|
3618
|
+
f->current_playback_loc_valid = TRUE;
|
3599
3619
|
return res;
|
3600
3620
|
}
|
3601
3621
|
|
@@ -3746,8 +3766,16 @@ static int start_decoder(vorb *f)
|
|
3746
3766
|
f->comment_list = NULL;
|
3747
3767
|
if (f->comment_list_length > 0)
|
3748
3768
|
{
|
3749
|
-
|
3750
|
-
|
3769
|
+
if (INT_MAX / sizeof(char*) < f->comment_list_length)
|
3770
|
+
goto no_comment;
|
3771
|
+
len = sizeof(char*) * f->comment_list_length;
|
3772
|
+
f->comment_list = (char**) setup_malloc(f, len);
|
3773
|
+
if (f->comment_list == NULL) {
|
3774
|
+
no_comment:
|
3775
|
+
f->comment_list_length = 0;
|
3776
|
+
return error(f, VORBIS_outofmem);
|
3777
|
+
}
|
3778
|
+
memset(f->comment_list, 0, len);
|
3751
3779
|
}
|
3752
3780
|
|
3753
3781
|
for(i=0; i < f->comment_list_length; ++i) {
|
@@ -4379,7 +4407,7 @@ static void vorbis_deinit(stb_vorbis *p)
|
|
4379
4407
|
setup_temp_free(p, &p->temp_values, 0);
|
4380
4408
|
setup_temp_free(p, &p->temp_mults, 0);
|
4381
4409
|
}
|
4382
|
-
#ifdef
|
4410
|
+
#ifdef STB_VORBIS_SDL
|
4383
4411
|
if (p->close_on_free) SDL_RWclose(p->rwops);
|
4384
4412
|
#endif
|
4385
4413
|
#ifndef STB_VORBIS_NO_STDIO
|
@@ -4407,7 +4435,7 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
|
|
4407
4435
|
p->stream = NULL;
|
4408
4436
|
p->codebooks = NULL;
|
4409
4437
|
p->page_crc_tests = -1;
|
4410
|
-
#ifdef
|
4438
|
+
#ifdef STB_VORBIS_SDL
|
4411
4439
|
p->close_on_free = FALSE;
|
4412
4440
|
p->rwops = NULL;
|
4413
4441
|
#endif
|
@@ -4425,6 +4453,14 @@ int stb_vorbis_get_sample_offset(stb_vorbis *f)
|
|
4425
4453
|
return -1;
|
4426
4454
|
}
|
4427
4455
|
|
4456
|
+
int stb_vorbis_get_playback_sample_offset(stb_vorbis *f)
|
4457
|
+
{
|
4458
|
+
if (f->current_playback_loc_valid)
|
4459
|
+
return f->current_playback_loc;
|
4460
|
+
else
|
4461
|
+
return -1;
|
4462
|
+
}
|
4463
|
+
|
4428
4464
|
stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f)
|
4429
4465
|
{
|
4430
4466
|
stb_vorbis_info d;
|
@@ -4672,7 +4708,7 @@ unsigned int stb_vorbis_get_file_offset(stb_vorbis *f)
|
|
4672
4708
|
#ifndef STB_VORBIS_NO_PUSHDATA_API
|
4673
4709
|
if (f->push_mode) return 0;
|
4674
4710
|
#endif
|
4675
|
-
#ifdef
|
4711
|
+
#ifdef STB_VORBIS_SDL
|
4676
4712
|
return (unsigned int) (SDL_RWtell(f->rwops) - f->rwops_start);
|
4677
4713
|
#else
|
4678
4714
|
if (USE_MEMORY(f)) return (unsigned int) (f->stream - f->stream_start);
|
@@ -5045,13 +5081,16 @@ int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number)
|
|
5045
5081
|
}
|
5046
5082
|
// the next frame should start with the sample
|
5047
5083
|
if (f->current_loc != sample_number) return error(f, VORBIS_seek_failed);
|
5084
|
+
f->current_playback_loc = sample_number;
|
5048
5085
|
return 1;
|
5049
5086
|
}
|
5050
5087
|
|
5051
5088
|
int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number)
|
5052
5089
|
{
|
5053
|
-
if (!stb_vorbis_seek_frame(f, sample_number))
|
5090
|
+
if (!stb_vorbis_seek_frame(f, sample_number)) {
|
5091
|
+
f->current_playback_loc_valid = FALSE;
|
5054
5092
|
return 0;
|
5093
|
+
}
|
5055
5094
|
|
5056
5095
|
if (sample_number != f->current_loc) {
|
5057
5096
|
int n;
|
@@ -5062,6 +5101,9 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number)
|
|
5062
5101
|
f->channel_buffer_start += (sample_number - frame_start);
|
5063
5102
|
}
|
5064
5103
|
|
5104
|
+
f->current_playback_loc_valid = TRUE;
|
5105
|
+
f->current_playback_loc = sample_number;
|
5106
|
+
|
5065
5107
|
return 1;
|
5066
5108
|
}
|
5067
5109
|
|
@@ -5228,7 +5270,7 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st
|
|
5228
5270
|
}
|
5229
5271
|
#endif // STB_VORBIS_NO_STDIO
|
5230
5272
|
|
5231
|
-
#ifdef
|
5273
|
+
#ifdef STB_VORBIS_SDL
|
5232
5274
|
stb_vorbis * stb_vorbis_open_rwops_section(SDL_RWops *rwops, int close_on_free, int *error, const stb_vorbis_alloc *alloc, unsigned int length)
|
5233
5275
|
{
|
5234
5276
|
stb_vorbis *f, p;
|
@@ -5486,6 +5528,7 @@ int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short
|
|
5486
5528
|
if (n == len) break;
|
5487
5529
|
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break;
|
5488
5530
|
}
|
5531
|
+
f->current_playback_loc += n;
|
5489
5532
|
return n;
|
5490
5533
|
}
|
5491
5534
|
|
@@ -5503,6 +5546,7 @@ int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, in
|
|
5503
5546
|
if (n == len) break;
|
5504
5547
|
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break;
|
5505
5548
|
}
|
5549
|
+
f->current_playback_loc += n;
|
5506
5550
|
return n;
|
5507
5551
|
}
|
5508
5552
|
|
@@ -5611,6 +5655,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float
|
|
5611
5655
|
if (!stb_vorbis_get_frame_float(f, NULL, &outputs))
|
5612
5656
|
break;
|
5613
5657
|
}
|
5658
|
+
f->current_playback_loc += n;
|
5614
5659
|
return n;
|
5615
5660
|
}
|
5616
5661
|
|
@@ -5637,6 +5682,7 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
|
|
5637
5682
|
if (!stb_vorbis_get_frame_float(f, NULL, &outputs))
|
5638
5683
|
break;
|
5639
5684
|
}
|
5685
|
+
f->current_playback_loc += n;
|
5640
5686
|
return n;
|
5641
5687
|
}
|
5642
5688
|
#endif // STB_VORBIS_NO_PULLDATA_API
|