Update SDL2 to newest version to fix 7.1 playback

This fixes 7.1 playback. Before this commit, SDL used 7.1 front audio configuration with Center Left and Center Right speakers, but without Rear speakers.

See https://github.com/libsdl-org/SDL/issues/11709 for more details.
This commit is contained in:
Acaki committed 2025-07-07 20:14:09 +08:00
1 parent 489e60d2b1
commit 616c7673a4
92 files changed
+5767 -3694

No files matched your search

+60 -57
View File
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -19,11 +19,13 @@
3. This notice may not be removed or altered from any source distribution.
*/
/* WIKI CATEGORY: RWOPS */
/**
* \file SDL_rwops.h
* # CategoryRWOPS
*
* This file provides a general interface for SDL to read and write
* data streams. It can easily be extended to files, memory, etc.
* This file provides a general interface for SDL to read and write data
* streams. It can easily be extended to files, memory, etc.
*/
#ifndef SDL_rwops_h_
@@ -57,7 +59,7 @@ typedef struct SDL_RWops
Sint64 (SDLCALL * size) (struct SDL_RWops * context);
/**
* Seek to \c offset relative to \c whence, one of stdio's whence values:
* Seek to `offset` relative to `whence`, one of stdio's whence values:
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
*
* \return the final offset in the data stream, or -1 on error.
@@ -66,8 +68,8 @@ typedef struct SDL_RWops
int whence);
/**
* Read up to \c maxnum objects each of size \c size from the data
* stream to the area pointed at by \c ptr.
* Read up to `maxnum` objects each of size `size` from the data
* stream to the area pointed at by `ptr`.
*
* \return the number of objects read, or 0 at error or end of file.
*/
@@ -75,8 +77,8 @@ typedef struct SDL_RWops
size_t size, size_t maxnum);
/**
* Write exactly \c num objects each of size \c size from the area
* pointed at by \c ptr to data stream.
* Write exactly `num` objects each of size `size` from the area
* pointed at by `ptr` to data stream.
*
* \return the number of objects written, or 0 at error or end of file.
*/
@@ -186,7 +188,7 @@ typedef struct SDL_RWops
*
* Closing the SDL_RWops will close the file handle SDL is holding internally.
*
* \param file a UTF-8 string representing the filename to open
* \param file a UTF-8 string representing the filename to open.
* \param mode an ASCII string representing the mode to be used for opening
* the file.
* \returns a pointer to the SDL_RWops structure that is created, or NULL on
@@ -224,10 +226,10 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose);
* `FILE*`, depending on what system headers are available to SDL. It is
* always intended to be the `FILE*` type from the C runtime's stdio.h.
*
* \param fp the `FILE*` that feeds the SDL_RWops stream
* \param fp the `FILE*` that feeds the SDL_RWops stream.
* \param autoclose SDL_TRUE to close the `FILE*` when closing the SDL_RWops,
* SDL_FALSE to leave the `FILE*` open when the RWops is
* closed
* closed.
* \returns a pointer to the SDL_RWops structure that is created, or NULL on
* failure; call SDL_GetError() for more information.
*
@@ -260,8 +262,8 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
* If you need to make sure the RWops never writes to the memory buffer, you
* should use SDL_RWFromConstMem() with a read-only buffer of memory instead.
*
* \param mem a pointer to a buffer to feed an SDL_RWops stream
* \param size the buffer size, in bytes
* \param mem a pointer to a buffer to feed an SDL_RWops stream.
* \param size the buffer size, in bytes.
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
* SDL_GetError() for more information.
*
@@ -295,8 +297,8 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
* If you need to write to a memory buffer, you should use SDL_RWFromMem()
* with a writable buffer of memory instead.
*
* \param mem a pointer to a read-only buffer to feed an SDL_RWops stream
* \param size the buffer size, in bytes
* \param mem a pointer to a read-only buffer to feed an SDL_RWops stream.
* \param size the buffer size, in bytes.
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
* SDL_GetError() for more information.
*
@@ -358,7 +360,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
* creation of the SDL_RWops is not freed by SDL_FreeRW(); the programmer must
* be responsible for managing that memory in their **close** method.
*
* \param area the SDL_RWops structure to be freed
* \param area the SDL_RWops structure to be freed.
*
* \since This function is available since SDL 2.0.0.
*
@@ -366,6 +368,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
*/
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
/* Possible `whence` values for SDL_RWops seeking... */
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */
#define RW_SEEK_CUR 1 /**< Seek relative to current read point */
#define RW_SEEK_END 2 /**< Seek relative to the end of data */
@@ -375,7 +378,7 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
*
* Prior to SDL 2.0.10, this function was a macro.
*
* \param context the SDL_RWops to get the size of the data stream from
* \param context the SDL_RWops to get the size of the data stream from.
* \returns the size of the data stream in the SDL_RWops on success, -1 if
* unknown or a negative error code on failure; call SDL_GetError()
* for more information.
@@ -402,10 +405,10 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
*
* Prior to SDL 2.0.10, this function was a macro.
*
* \param context a pointer to an SDL_RWops structure
* \param context a pointer to an SDL_RWops structure.
* \param offset an offset in bytes, relative to **whence** location; can be
* negative
* \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END`
* negative.
* \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END`.
* \returns the final offset in the data stream after the seek or -1 on error.
*
* \since This function is available since SDL 2.0.10.
@@ -432,7 +435,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
* Prior to SDL 2.0.10, this function was a macro.
*
* \param context a SDL_RWops data stream object from which to get the current
* offset
* offset.
* \returns the current offset in the stream, or -1 if the information can not
* be determined.
*
@@ -462,10 +465,10 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
*
* Prior to SDL 2.0.10, this function was a macro.
*
* \param context a pointer to an SDL_RWops structure
* \param ptr a pointer to a buffer to read data into
* \param size the size of each object to read, in bytes
* \param maxnum the maximum number of objects to be read
* \param context a pointer to an SDL_RWops structure.
* \param ptr a pointer to a buffer to read data into.
* \param size the size of each object to read, in bytes.
* \param maxnum the maximum number of objects to be read.
* \returns the number of objects read, or 0 at error or end of file; call
* SDL_GetError() for more information.
*
@@ -496,10 +499,10 @@ extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
*
* Prior to SDL 2.0.10, this function was a macro.
*
* \param context a pointer to an SDL_RWops structure
* \param ptr a pointer to a buffer containing data to write
* \param size the size of an object to write, in bytes
* \param num the number of objects to write
* \param context a pointer to an SDL_RWops structure.
* \param ptr a pointer to a buffer containing data to write.
* \param size the size of an object to write, in bytes.
* \param num the number of objects to write.
* \returns the number of objects written, which will be less than **num** on
* error; call SDL_GetError() for more information.
*
@@ -530,7 +533,7 @@ extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
*
* Prior to SDL 2.0.10, this function was a macro.
*
* \param context SDL_RWops structure to close
* \param context SDL_RWops structure to close.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
@@ -555,9 +558,9 @@ extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
*
* The data should be freed with SDL_free().
*
* \param src the SDL_RWops to read all available data from
* \param datasize if not NULL, will store the number of bytes read
* \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning
* \param src the SDL_RWops to read all available data from.
* \param datasize if not NULL, will store the number of bytes read.
* \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning.
* \returns the data, or NULL if there was an error.
*
* \since This function is available since SDL 2.0.6.
@@ -578,8 +581,8 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src,
* Prior to SDL 2.0.10, this function was a macro wrapping around
* SDL_LoadFile_RW.
*
* \param file the path to read all available data from
* \param datasize if not NULL, will store the number of bytes read
* \param file the path to read all available data from.
* \param datasize if not NULL, will store the number of bytes read.
* \returns the data, or NULL if there was an error.
*
* \since This function is available since SDL 2.0.10.
@@ -596,7 +599,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
/**
* Use this function to read a byte from an SDL_RWops.
*
* \param src the SDL_RWops to read from
* \param src the SDL_RWops to read from.
* \returns the read byte on success or 0 on failure; call SDL_GetError() for
* more information.
*
@@ -613,7 +616,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order.
*
* \param src the stream from which to read data
* \param src the stream from which to read data.
* \returns 16 bits of data in the native byte order of the platform.
*
* \since This function is available since SDL 2.0.0.
@@ -629,7 +632,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order.
*
* \param src the stream from which to read data
* \param src the stream from which to read data.
* \returns 16 bits of data in the native byte order of the platform.
*
* \since This function is available since SDL 2.0.0.
@@ -645,7 +648,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order.
*
* \param src the stream from which to read data
* \param src the stream from which to read data.
* \returns 32 bits of data in the native byte order of the platform.
*
* \since This function is available since SDL 2.0.0.
@@ -661,7 +664,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order.
*
* \param src the stream from which to read data
* \param src the stream from which to read data.
* \returns 32 bits of data in the native byte order of the platform.
*
* \since This function is available since SDL 2.0.0.
@@ -677,7 +680,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order.
*
* \param src the stream from which to read data
* \param src the stream from which to read data.
* \returns 64 bits of data in the native byte order of the platform.
*
* \since This function is available since SDL 2.0.0.
@@ -693,7 +696,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order.
*
* \param src the stream from which to read data
* \param src the stream from which to read data.
* \returns 64 bits of data in the native byte order of the platform.
*
* \since This function is available since SDL 2.0.0.
@@ -713,8 +716,8 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
/**
* Use this function to write a byte to an SDL_RWops.
*
* \param dst the SDL_RWops to write to
* \param value the byte value to write
* \param dst the SDL_RWops to write to.
* \param value the byte value to write.
* \returns 1 on success or 0 on failure; call SDL_GetError() for more
* information.
*
@@ -732,8 +735,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
* specifies native format, and the data written will be in little-endian
* format.
*
* \param dst the stream to which data will be written
* \param value the data to be written, in native format
* \param dst the stream to which data will be written.
* \param value the data to be written, in native format.
* \returns 1 on successful write, 0 on error.
*
* \since This function is available since SDL 2.0.0.
@@ -749,8 +752,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
* SDL byteswaps the data only if necessary, so the application always
* specifies native format, and the data written will be in big-endian format.
*
* \param dst the stream to which data will be written
* \param value the data to be written, in native format
* \param dst the stream to which data will be written.
* \param value the data to be written, in native format.
* \returns 1 on successful write, 0 on error.
*
* \since This function is available since SDL 2.0.0.
@@ -767,8 +770,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
* specifies native format, and the data written will be in little-endian
* format.
*
* \param dst the stream to which data will be written
* \param value the data to be written, in native format
* \param dst the stream to which data will be written.
* \param value the data to be written, in native format.
* \returns 1 on successful write, 0 on error.
*
* \since This function is available since SDL 2.0.0.
@@ -784,8 +787,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
* SDL byteswaps the data only if necessary, so the application always
* specifies native format, and the data written will be in big-endian format.
*
* \param dst the stream to which data will be written
* \param value the data to be written, in native format
* \param dst the stream to which data will be written.
* \param value the data to be written, in native format.
* \returns 1 on successful write, 0 on error.
*
* \since This function is available since SDL 2.0.0.
@@ -802,8 +805,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
* specifies native format, and the data written will be in little-endian
* format.
*
* \param dst the stream to which data will be written
* \param value the data to be written, in native format
* \param dst the stream to which data will be written.
* \param value the data to be written, in native format.
* \returns 1 on successful write, 0 on error.
*
* \since This function is available since SDL 2.0.0.
@@ -819,8 +822,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
* SDL byteswaps the data only if necessary, so the application always
* specifies native format, and the data written will be in big-endian format.
*
* \param dst the stream to which data will be written
* \param value the data to be written, in native format
* \param dst the stream to which data will be written.
* \param value the data to be written, in native format.
* \returns 1 on successful write, 0 on error.
*
* \since This function is available since SDL 2.0.0.