diff --git a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_winrt.h b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_winrt.h index 0a33993f..29bf79fe 100644 --- a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_winrt.h +++ b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_winrt.h @@ -19,11 +19,26 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h +#ifndef _SDL_config_winrt_h +#define _SDL_config_winrt_h #include "SDL_platform.h" +/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used + by SDL to determine which version of the Windows SDK is being used. +*/ +#include + +/* Define possibly-undefined NTDDI values (used when compiling SDL against + older versions of the Windows SDK. +*/ +#ifndef NTDDI_WINBLUE +#define NTDDI_WINBLUE 0x06030000 +#endif +#ifndef NTDDI_WIN10 +#define NTDDI_WIN10 0x0A000000 +#endif + /* This is a set of defines to configure the SDL features */ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) @@ -163,7 +178,12 @@ typedef unsigned int uintptr_t; #define SDL_LOADSO_WINDOWS 1 /* Enable various threading systems */ +#if (NTDDI_VERSION >= NTDDI_WINBLUE) +#define SDL_THREAD_WINDOWS 1 +#else +/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ #define SDL_THREAD_STDCPP 1 +#endif /* Enable various timer systems */ #define SDL_TIMER_WINDOWS 1 @@ -191,4 +211,4 @@ typedef unsigned int uintptr_t; #define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_windows_h */ +#endif /* _SDL_config_winrt_h */ diff --git a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_wiz.h b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_wiz.h index 4b3c5a2a..a5063ba7 100644 --- a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_wiz.h +++ b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_wiz.h @@ -97,7 +97,6 @@ #define HAVE_NANOSLEEP 1 #define HAVE_POW 1 -#define SDL_CDROM_DISABLED 1 #define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_OSS 1 diff --git a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_gamecontroller.h b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_gamecontroller.h index 72fba60b..5459387b 100644 --- a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_gamecontroller.h +++ b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_gamecontroller.h @@ -171,6 +171,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_ */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); +/** + * Return the SDL_GameController associated with an instance id. + */ +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); + /** * Return the name for this currently opened controller */ diff --git a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_joystick.h b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_joystick.h index a707e6c3..78176321 100644 --- a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_joystick.h +++ b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_joystick.h @@ -106,6 +106,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); +/** + * Return the SDL_Joystick associated with an instance id. + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid); + /** * Return the name for this currently opened joystick. * If no name can be found, this function returns NULL. @@ -253,11 +258,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); /** -* Return the battery level of this joystick -*/ + * Return the battery level of this joystick + */ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h index 53ae9da2..b6aa6acf 100644 --- a/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h +++ b/quakespasm/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-9915:77cf2d1b7215" -#define SDL_REVISION_NUMBER 9915 +#define SDL_REVISION "hg-9959:182bfe0e7a60" +#define SDL_REVISION_NUMBER 9959 diff --git a/quakespasm/MacOSX/SDL2.framework/Versions/A/SDL2 b/quakespasm/MacOSX/SDL2.framework/Versions/A/SDL2 index b3fab7b3..6648319e 100755 Binary files a/quakespasm/MacOSX/SDL2.framework/Versions/A/SDL2 and b/quakespasm/MacOSX/SDL2.framework/Versions/A/SDL2 differ diff --git a/quakespasm/MacOSX/codecs/include/opus/opusfile.h b/quakespasm/MacOSX/codecs/include/opus/opusfile.h index ea9a6c6e..91d06aa9 100644 --- a/quakespasm/MacOSX/codecs/include/opus/opusfile.h +++ b/quakespasm/MacOSX/codecs/include/opus/opusfile.h @@ -71,7 +71,7 @@ Vorbis mappings. A special stereo API can convert everything to 2 channels, making it simple - to support multichannel files in a application which only has stereo + to support multichannel files in an application which only has stereo output. Although the libopusfile ABI provides support for the theoretical maximum number of channels, the current implementation does not support @@ -90,9 +90,10 @@ (ignoring any other streams that might be concurrently multiplexed with it, such as a video stream). - The channel count can also change between links, but if your application is - not prepared to deal with this, it can use the stereo API to ensure the - audio from all links will always get decoded into a common format. + The channel count can also change between links. + If your application is not prepared to deal with this, it can use the stereo + API to ensure the audio from all links will always get decoded into a + common format. Since libopusfile always decodes to 48 kHz, you do not have to worry about the sample rate changing between links (as was possible with Vorbis). @@ -108,6 +109,8 @@ extern "C" { # include # include +/**@cond PRIVATE*/ + /*Enable special features for gcc and gcc-compatible compilers.*/ # if !defined(OP_GNUC_PREREQ) # if defined(__GNUC__)&&defined(__GNUC_MINOR__) @@ -122,9 +125,12 @@ extern "C" { # pragma GCC visibility push(default) # endif -typedef struct OpusHead OpusHead; -typedef struct OpusTags OpusTags; -typedef struct OggOpusFile OggOpusFile; +typedef struct OpusHead OpusHead; +typedef struct OpusTags OpusTags; +typedef struct OpusPictureTag OpusPictureTag; +typedef struct OpusServerInfo OpusServerInfo; +typedef struct OpusFileCallbacks OpusFileCallbacks; +typedef struct OggOpusFile OggOpusFile; /*Warning attributes for libopusfile functions.*/ # if OP_GNUC_PREREQ(3,4) @@ -138,6 +144,8 @@ typedef struct OggOpusFile OggOpusFile; # define OP_ARG_NONNULL(_x) # endif +/**@endcond*/ + /**\defgroup error_codes Error Codes*/ /*@{*/ /**\name List of possible error codes @@ -301,6 +309,87 @@ struct OpusTags{ char *vendor; }; +/**\name Picture tag image formats*/ +/*@{*/ + +/**The MIME type was not recognized, or the image data did not match the + declared MIME type.*/ +#define OP_PIC_FORMAT_UNKNOWN (-1) +/**The MIME type indicates the image data is really a URL.*/ +#define OP_PIC_FORMAT_URL (0) +/**The image is a JPEG.*/ +#define OP_PIC_FORMAT_JPEG (1) +/**The image is a PNG.*/ +#define OP_PIC_FORMAT_PNG (2) +/**The image is a GIF.*/ +#define OP_PIC_FORMAT_GIF (3) + +/*@}*/ + +/**The contents of a METADATA_BLOCK_PICTURE tag.*/ +struct OpusPictureTag{ + /**The picture type according to the ID3v2 APIC frame: +
    +
  1. Other
  2. +
  3. 32x32 pixels 'file icon' (PNG only)
  4. +
  5. Other file icon
  6. +
  7. Cover (front)
  8. +
  9. Cover (back)
  10. +
  11. Leaflet page
  12. +
  13. Media (e.g. label side of CD)
  14. +
  15. Lead artist/lead performer/soloist
  16. +
  17. Artist/performer
  18. +
  19. Conductor
  20. +
  21. Band/Orchestra
  22. +
  23. Composer
  24. +
  25. Lyricist/text writer
  26. +
  27. Recording Location
  28. +
  29. During recording
  30. +
  31. During performance
  32. +
  33. Movie/video screen capture
  34. +
  35. A bright colored fish
  36. +
  37. Illustration
  38. +
  39. Band/artist logotype
  40. +
  41. Publisher/Studio logotype
  42. +
+ Others are reserved and should not be used. + There may only be one each of picture type 1 and 2 in a file.*/ + opus_int32 type; + /**The MIME type of the picture, in printable ASCII characters 0x20-0x7E. + The MIME type may also be "-->" to signify that the data part + is a URL pointing to the picture instead of the picture data itself. + In this case, a terminating NUL is appended to the URL string in #data, + but #data_length is set to the length of the string excluding that + terminating NUL.*/ + char *mime_type; + /**The description of the picture, in UTF-8.*/ + char *description; + /**The width of the picture in pixels.*/ + opus_uint32 width; + /**The height of the picture in pixels.*/ + opus_uint32 height; + /**The color depth of the picture in bits-per-pixel (not + bits-per-channel).*/ + opus_uint32 depth; + /**For indexed-color pictures (e.g., GIF), the number of colors used, or 0 + for non-indexed pictures.*/ + opus_uint32 colors; + /**The length of the picture data in bytes.*/ + opus_uint32 data_length; + /**The binary picture data.*/ + unsigned char *data; + /**The format of the picture data, if known. + One of +
    +
  • #OP_PIC_FORMAT_UNKNOWN,
  • +
  • #OP_PIC_FORMAT_URL,
  • +
  • #OP_PIC_FORMAT_JPEG,
  • +
  • #OP_PIC_FORMAT_PNG, or
  • +
  • #OP_PIC_FORMAT_GIF.
  • +
*/ + int format; +}; + /**\name Functions for manipulating header data These functions manipulate the #OpusHead and #OpusTags structures, @@ -363,7 +452,7 @@ ogg_int64_t opus_granule_sample(const OpusHead *_head,ogg_int64_t _gp) for validity. \param[in] _data The contents of the 'comment' header packet. \param _len The number of bytes of data in the 'info' header packet. - \retval 0 Success. + \retval 0 Success. \retval #OP_ENOTFORMAT If the data does not start with the "OpusTags" string. \retval #OP_EBADHEADER If the contents of the packet otherwise violate the @@ -372,6 +461,15 @@ ogg_int64_t opus_granule_sample(const OpusHead *_head,ogg_int64_t _gp) OP_WARN_UNUSED_RESULT int opus_tags_parse(OpusTags *_tags, const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2); +/**Performs a deep copy of an #OpusTags structure. + \param _dst The #OpusTags structure to copy into. + If this function fails, the contents of this structure remain + untouched. + \param _src The #OpusTags structure to copy from. + \retval 0 Success. + \retval #OP_EFAULT If there wasn't enough memory to copy the tags.*/ +int opus_tags_copy(OpusTags *_dst,const OpusTags *_src) OP_ARG_NONNULL(1); + /**Initializes an #OpusTags structure. This should be called on a freshly allocated #OpusTags structure before attempting to use it. @@ -447,7 +545,7 @@ int opus_tags_query_count(const OpusTags *_tags,const char *_tag) On error, no value is returned, and the previous contents remain unchanged. \return 0 on success, or a negative value on error. - \retval OP_EFALSE There was no track gain available in the given tags.*/ + \retval #OP_FALSE There was no track gain available in the given tags.*/ int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); @@ -458,6 +556,78 @@ int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8) \param _tags The #OpusTags structure to clear.*/ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); +/**Check if \a _comment is an instance of a \a _tag_name tag. + \see opus_tagncompare + \param _tag_name A NUL-terminated, case-insensitive, ASCII string containing + the name of the tag to check for (without the terminating + '=' character). + \param _comment The comment string to check. + \return An integer less than, equal to, or greater than zero if \a _comment + is found respectively, to be less than, to match, or be greater + than a "tag=value" string whose tag matches \a _tag_name.*/ +int opus_tagcompare(const char *_tag_name,const char *_comment); + +/**Check if \a _comment is an instance of a \a _tag_name tag. + This version is slightly more efficient than opus_tagcompare() if the length + of the tag name is already known (e.g., because it is a constant). + \see opus_tagcompare + \param _tag_name A case-insensitive ASCII string containing the name of the + tag to check for (without the terminating '=' character). + \param _tag_len The number of characters in the tag name. + This must be non-negative. + \param _comment The comment string to check. + \return An integer less than, equal to, or greater than zero if \a _comment + is found respectively, to be less than, to match, or be greater + than a "tag=value" string whose tag matches the first \a _tag_len + characters of \a _tag_name.*/ +int opus_tagncompare(const char *_tag_name,int _tag_len,const char *_comment); + +/**Parse a single METADATA_BLOCK_PICTURE tag. + This decodes the BASE64-encoded content of the tag and returns a structure + with the MIME type, description, image parameters (if known), and the + compressed image data. + If the MIME type indicates the presence of an image format we recognize + (JPEG, PNG, or GIF) and the actual image data contains the magic signature + associated with that format, then the OpusPictureTag::format field will be + set to the corresponding format. + This is provided as a convenience to avoid requiring applications to parse + the MIME type and/or do their own format detection for the commonly used + formats. + In this case, we also attempt to extract the image parameters directly from + the image data (overriding any that were present in the tag, which the + specification says applications are not meant to rely on). + The application must still provide its own support for actually decoding the + image data and, if applicable, retrieving that data from URLs. + \param[out] _pic Returns the parsed picture data. + No sanitation is done on the type, MIME type, or + description fields, so these might return invalid values. + The contents of this structure are left unmodified on + failure. + \param _tag The METADATA_BLOCK_PICTURE tag contents. + The leading "METADATA_BLOCK_PICTURE=" portion is optional, + to allow the function to be used on either directly on the + values in OpusTags::user_comments or on the return value + of opus_tags_query(). + \return 0 on success or a negative value on error. + \retval #OP_ENOTFORMAT The METADATA_BLOCK_PICTURE contents were not valid. + \retval #OP_EFAULT There was not enough memory to store the picture tag + contents.*/ +OP_WARN_UNUSED_RESULT int opus_picture_tag_parse(OpusPictureTag *_pic, + const char *_tag) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); + +/**Initializes an #OpusPictureTag structure. + This should be called on a freshly allocated #OpusPictureTag structure + before attempting to use it. + \param _pic The #OpusPictureTag structure to initialize.*/ +void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1); + +/**Clears the #OpusPictureTag structure. + This should be called on an #OpusPictureTag structure after it is no longer + needed. + It will free all memory used by the structure members. + \param _pic The #OpusPictureTag structure to clear.*/ +void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1); + /*@}*/ /*@}*/ @@ -474,6 +644,8 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); They may be expanded in the future.*/ /*@{*/ +/**@cond PRIVATE*/ + /*These are the raw numbers used to define the request codes. They should not be used directly.*/ #define OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST (6464) @@ -481,6 +653,7 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); #define OP_HTTP_PROXY_PORT_REQUEST (6592) #define OP_HTTP_PROXY_USER_REQUEST (6656) #define OP_HTTP_PROXY_PASS_REQUEST (6720) +#define OP_GET_SERVER_INFO_REQUEST (6784) #define OP_URL_OPT(_request) ((_request)+(char *)0) @@ -488,6 +661,64 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); provided to one of the URL options.*/ #define OP_CHECK_INT(_x) ((void)((_x)==(opus_int32)0),(opus_int32)(_x)) #define OP_CHECK_CONST_CHAR_PTR(_x) ((_x)+((_x)-(const char *)(_x))) +#define OP_CHECK_SERVER_INFO_PTR(_x) ((_x)+((_x)-(OpusServerInfo *)(_x))) + +/**@endcond*/ + +/**HTTP/Shoutcast/Icecast server information associated with a URL.*/ +struct OpusServerInfo{ + /**The name of the server (icy-name/ice-name). + This is NULL if there was no icy-name or + ice-name header.*/ + char *name; + /**A short description of the server (icy-description/ice-description). + This is NULL if there was no icy-description or + ice-description header.*/ + char *description; + /**The genre the server falls under (icy-genre/ice-genre). + This is NULL if there was no icy-genre or + ice-genre header.*/ + char *genre; + /**The homepage for the server (icy-url/ice-url). + This is NULL if there was no icy-url or + ice-url header.*/ + char *url; + /**The software used by the origin server (Server). + This is NULL if there was no Server header.*/ + char *server; + /**The media type of the entity sent to the recepient (Content-Type). + This is NULL if there was no Content-Type + header.*/ + char *content_type; + /**The nominal stream bitrate in kbps (icy-br/ice-bitrate). + This is -1 if there was no icy-br or + ice-bitrate header.*/ + opus_int32 bitrate_kbps; + /**Flag indicating whether the server is public (1) or not + (0) (icy-pub/ice-public). + This is -1 if there was no icy-pub or + ice-public header.*/ + int is_public; + /**Flag indicating whether the server is using HTTPS instead of HTTP. + This is 0 unless HTTPS is being used. + This may not match the protocol used in the original URL if there were + redirections.*/ + int is_ssl; +}; + +/**Initializes an #OpusServerInfo structure. + All fields are set as if the corresponding header was not available. + \param _info The #OpusServerInfo structure to initialize. + \note If you use this function, you must link against libopusurl.*/ +void opus_server_info_init(OpusServerInfo *_info) OP_ARG_NONNULL(1); + +/**Clears the #OpusServerInfo structure. + This should be called on an #OpusServerInfo structure after it is no longer + needed. + It will free all memory used by the structure members. + \param _info The #OpusServerInfo structure to clear. + \note If you use this function, you must link against libopusurl.*/ +void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1); /**Skip the certificate check when connecting via TLS/SSL (https). \param _b opus_int32: Whether or not to skip the certificate @@ -548,6 +779,27 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); #define OP_HTTP_PROXY_PASS(_pass) \ OP_URL_OPT(OP_HTTP_PROXY_PASS_REQUEST),OP_CHECK_CONST_CHAR_PTR(_pass) +/**Parse information about the streaming server (if any) and return it. + Very little validation is done. + In particular, OpusServerInfo::url may not be a valid URL, + OpusServerInfo::bitrate_kbps may not really be in kbps, and + OpusServerInfo::content_type may not be a valid MIME type. + The character set of the string fields is not specified anywhere, and should + not be assumed to be valid UTF-8. + \param _info OpusServerInfo *: Returns information about the server. + If there is any error opening the stream, the + contents of this structure remain + unmodified. + On success, fills in the structure with the + server information that was available, if + any. + After a successful return, the contents of + this structure should be freed by calling + opus_server_info_clear(). + \hideinitializer*/ +#define OP_GET_SERVER_INFO(_info) \ + OP_URL_OPT(OP_GET_SERVER_INFO_REQUEST),OP_CHECK_SERVER_INFO_PTR(_info) + /*@}*/ /*@}*/ @@ -563,8 +815,6 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); block of memory, or URLs.*/ /*@{*/ -typedef struct OpusFileCallbacks OpusFileCallbacks; - /**Reads up to \a _nbytes bytes of data from \a _stream. \param _stream The stream to read from. \param[out] _ptr The buffer to store the data in. @@ -698,6 +948,7 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb, takes a va_list instead of a variable number of arguments. It does not call the va_end macro, and because it invokes the va_arg macro, the value of \a _ap is undefined after the call. + \note If you use this function, you must link against libopusurl. \param[out] _cb The callbacks to use for this stream. If there is an error creating the stream, nothing will be filled in here. @@ -706,6 +957,10 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb, schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, + before passing them to this function. \param[in,out] _ap A list of the \ref url_options "optional flags" to use. This is a variable-length list of options terminated with NULL. @@ -714,7 +969,8 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb, OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb, const char *_url,va_list _ap) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); -/**Creates a stream that reads from the given URL using the specified proxy. +/**Creates a stream that reads from the given URL. + \note If you use this function, you must link against libopusurl. \param[out] _cb The callbacks to use for this stream. If there is an error creating the stream, nothing will be filled in here. @@ -723,6 +979,10 @@ OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb, are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, before + passing them to this function. \param ... The \ref url_options "optional flags" to use. This is a variable-length list of options terminated with NULL. @@ -805,12 +1065,17 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_memory(const unsigned char *_data, takes a va_list instead of a variable number of arguments. It does not call the va_end macro, and because it invokes the va_arg macro, the value of \a _ap is undefined after the call. + \note If you use this function, you must link against libopusurl. \param _url The URL to open. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, + with internationalized domain names encoded in + punycode, before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -825,13 +1090,16 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_vopen_url(const char *_url, int *_error,va_list _ap) OP_ARG_NONNULL(1); /**Open a stream from a URL. - However, this approach will not work for live streams or HTTP/1.0 servers - (which do not support Range requets). + \note If you use this function, you must link against libopusurl. \param _url The URL to open. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, + before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -954,6 +1222,7 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data, takes a va_list instead of a variable number of arguments. It does not call the va_end macro, and because it invokes the va_arg macro, the value of \a _ap is undefined after the call. + \note If you use this function, you must link against libopusurl. \see op_test_url \see op_test_callbacks \param _url The URL to open. @@ -962,6 +1231,10 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data, Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, + with internationalized domain names encoded in + punycode, before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -976,12 +1249,17 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_vtest_url(const char *_url, int *_error,va_list _ap) OP_ARG_NONNULL(1); /**Partially open a stream from a URL. + \note If you use this function, you must link against libopusurl. \see op_test_callbacks \param _url The URL to open. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, + before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -1128,7 +1406,7 @@ void op_free(OggOpusFile *_of); This function may be called on partially-opened streams. \param _of The \c OggOpusFile whose seekable status is to be returned. \return A non-zero value if seekable, and 0 if unseekable.*/ -int op_seekable(OggOpusFile *_of) OP_ARG_NONNULL(1); +int op_seekable(const OggOpusFile *_of) OP_ARG_NONNULL(1); /**Returns the number of links in this chained stream. This function may be called on partially-opened streams, but it will always @@ -1136,9 +1414,9 @@ int op_seekable(OggOpusFile *_of) OP_ARG_NONNULL(1); The actual number of links is not known until the stream is fully opened. \param _of The \c OggOpusFile from which to retrieve the link count. \return For fully-open seekable sources, this returns the total number of - links in the whole stream. + links in the whole stream, which will be at least 1. For partially-open or unseekable sources, this always returns 1.*/ -int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1); +int op_link_count(const OggOpusFile *_of) OP_ARG_NONNULL(1); /**Get the serial number of the given link in a (possibly-chained) Ogg Opus stream. @@ -1153,7 +1431,7 @@ int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1); the serial number of the last link. If the source is not seekable, this always returns the serial number of the current link.*/ -opus_uint32 op_serialno(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +opus_uint32 op_serialno(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the channel count of the given link in a (possibly-chained) Ogg Opus stream. @@ -1170,11 +1448,15 @@ opus_uint32 op_serialno(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); the channel count of the last link. If the source is not seekable, this always returns the channel count of the current link.*/ -int op_channel_count(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +int op_channel_count(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the total (compressed) size of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing overhead. + \warning If the Opus stream (or link) is concurrently multiplexed with other + logical streams (e.g., video), this returns the size of the entire stream + (or link), not just the number of bytes in the first logical Opus stream. + Returning the latter would require scanning the entire file. \param _of The \c OggOpusFile from which to retrieve the compressed size. \param _li The index of the link whose compressed size should be computed. Use a negative number to get the compressed size of the entire @@ -1188,7 +1470,7 @@ int op_channel_count(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); \retval #OP_EINVAL The source is not seekable (so we can't know the length), \a _li wasn't less than the total number of links in the stream, or the stream was only partially open.*/ -opus_int64 op_raw_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +opus_int64 op_raw_total(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the total PCM length (number of samples at 48 kHz) of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream. @@ -1206,7 +1488,7 @@ opus_int64 op_raw_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); \retval #OP_EINVAL The source is not seekable (so we can't know the length), \a _li wasn't less than the total number of links in the stream, or the stream was only partially open.*/ -ogg_int64_t op_pcm_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the ID header information for the given link in a (possibly chained) Ogg Opus stream. @@ -1222,7 +1504,7 @@ ogg_int64_t op_pcm_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); information for the current link is always returned, if available. \return The contents of the ID header for the given link.*/ -const OpusHead *op_head(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +const OpusHead *op_head(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the comment header information for the given link in a (possibly chained) Ogg Opus stream. @@ -1240,7 +1522,7 @@ const OpusHead *op_head(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); \return The contents of the comment header for the given link, or NULL if this is an unseekable stream that encountered an invalid link.*/ -const OpusTags *op_tags(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +const OpusTags *op_tags(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Retrieve the index of the current link. This is the link that produced the data most recently read by @@ -1257,20 +1539,29 @@ const OpusTags *op_tags(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); each time a new link is encountered (even though op_link_count() always returns 1). \retval #OP_EINVAL The stream was only partially open.*/ -int op_current_link(OggOpusFile *_of) OP_ARG_NONNULL(1); +int op_current_link(const OggOpusFile *_of) OP_ARG_NONNULL(1); -/**Computes the bitrate for a given link in a (possibly chained) Ogg Opus - stream. +/**Computes the bitrate of the stream, or of an individual link in a + (possibly-chained) Ogg Opus stream. The stream must be seekable to compute the bitrate. For unseekable streams, use op_bitrate_instant() to get periodic estimates. + \warning If the Opus stream (or link) is concurrently multiplexed with other + logical streams (e.g., video), this uses the size of the entire stream (or + link) to compute the bitrate, not just the number of bytes in the first + logical Opus stream. + Returning the latter requires scanning the entire file, but this may be done + by decoding the whole file and calling op_bitrate_instant() once at the + end. + Install a trivial decoding callback with op_set_decode_callback() if you + wish to skip actual decoding during this process. \param _of The \c OggOpusFile from which to retrieve the bitrate. \param _li The index of the link whose bitrate should be computed. - USe a negative number to get the bitrate of the whole stream. + Use a negative number to get the bitrate of the whole stream. \return The bitrate on success, or a negative value on error. \retval #OP_EINVAL The stream was only partially open, the stream was not seekable, or \a _li was larger than the number of links.*/ -opus_int32 op_bitrate(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +opus_int32 op_bitrate(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Compute the instantaneous bitrate, measured as the ratio of bits to playable samples decoded since a) the last call to op_bitrate_instant(), b) the last @@ -1289,7 +1580,7 @@ opus_int32 op_bitrate_instant(OggOpusFile *_of) OP_ARG_NONNULL(1); \param _of The \c OggOpusFile from which to retrieve the position indicator. \return The byte position that is currently being read from. \retval #OP_EINVAL The stream was only partially open.*/ -opus_int64 op_raw_tell(OggOpusFile *_of) OP_ARG_NONNULL(1); +opus_int64 op_raw_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1); /**Obtain the PCM offset of the next sample to be read. If the stream is not properly timestamped, this might not increment by the @@ -1298,7 +1589,7 @@ opus_int64 op_raw_tell(OggOpusFile *_of) OP_ARG_NONNULL(1); \param _of The \c OggOpusFile from which to retrieve the PCM offset. \return The PCM offset of the next sample to be read. \retval #OP_EINVAL The stream was only partially open.*/ -ogg_int64_t op_pcm_tell(OggOpusFile *_of) OP_ARG_NONNULL(1); +ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1); /*@}*/ /*@}*/ @@ -1399,13 +1690,73 @@ int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1); not check the error return code from op_read_float() or its associated functions. If the remote peer does not close the connection gracefully (with a TLS - "close notify" message), these functions will return OP_EREAD instead of 0 + "close notify" message), these functions will return #OP_EREAD instead of 0 when they reach the end of the file. If you are reading from an URL (particularly if seeking is not supported), you should make sure to check for this error and warn the user appropriately.*/ /*@{*/ +/**Indicates that the decoding callback should produce signed 16-bit + native-endian output samples.*/ +#define OP_DEC_FORMAT_SHORT (7008) +/**Indicates that the decoding callback should produce 32-bit native-endian + float samples.*/ +#define OP_DEC_FORMAT_FLOAT (7040) + +/**Indicates that the decoding callback did not decode anything, and that + libopusfile should decode normally instead.*/ +#define OP_DEC_USE_DEFAULT (6720) + +/**Called to decode an Opus packet. + This should invoke the functional equivalent of opus_multistream_decode() or + opus_multistream_decode_float(), except that it returns 0 on success + instead of the number of decoded samples (which is known a priori). + \param _ctx The application-provided callback context. + \param _decoder The decoder to use to decode the packet. + \param[out] _pcm The buffer to decode into. + This will always have enough room for \a _nchannels of + \a _nsamples samples, which should be placed into this + buffer interleaved. + \param _op The packet to decode. + This will always have its granule position set to a valid + value. + \param _nsamples The number of samples expected from the packet. + \param _nchannels The number of channels expected from the packet. + \param _format The desired sample output format. + This is either #OP_DEC_FORMAT_SHORT or + #OP_DEC_FORMAT_FLOAT. + \param _li The index of the link from which this packet was decoded. + \return A non-negative value on success, or a negative value on error. + The error codes should be the same as those returned by + opus_multistream_decode() or opus_multistream_decode_float(). + \retval 0 Decoding was successful. + The application has filled the buffer with + exactly \a _nsamples*\a + _nchannels samples in the requested + format. + \retval #OP_DEC_USE_DEFAULT No decoding was done. + libopusfile should decode normally + instead.*/ +typedef int (*op_decode_cb_func)(void *_ctx,OpusMSDecoder *_decoder,void *_pcm, + const ogg_packet *_op,int _nsamples,int _nchannels,int _format,int _li); + +/**Sets the packet decode callback function. + This is called once for each packet that needs to be decoded. + A call to this function is no guarantee that the audio will eventually be + delivered to the application. + Some or all of the data from the packet may be discarded (i.e., at the + beginning or end of a link, or after a seek), however the callback is + required to provide all of it. + \param _of The \c OggOpusFile on which to set the decode callback. + \param _decode_cb The callback function to call. + This may be NULL to disable calling the + callback. + \param _ctx The application-provided context pointer to pass to the + callback on each call.*/ +void op_set_decode_callback(OggOpusFile *_of, + op_decode_cb_func _decode_cb,void *_ctx) OP_ARG_NONNULL(1); + /**Gain offset type that indicates that the provided offset is relative to the header gain. This is the default.*/ @@ -1437,7 +1788,19 @@ int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1); \return 0 on success or a negative value on error. \retval #OP_EINVAL The \a _gain_type was unrecognized.*/ int op_set_gain_offset(OggOpusFile *_of, - int _gain_type,opus_int32 _gain_offset_q8); + int _gain_type,opus_int32 _gain_offset_q8) OP_ARG_NONNULL(1); + +/**Sets whether or not dithering is enabled for 16-bit decoding. + By default, when libopusfile is compiled to use floating-point + internally, calling op_read() or op_read_stereo() will first decode to + float, and then convert to fixed-point using noise-shaping dithering. + This flag can be used to disable that dithering. + When the application uses op_read_float() or op_read_float_stereo(), or when + the library has been compiled to decode directly to fixed point, this flag + has no effect. + \param _of The \c OggOpusFile on which to enable or disable dithering. + \param _enabled A non-zero value to enable dithering, or 0 to disable it.*/ +void op_set_dither_enabled(OggOpusFile *_of,int _enabled) OP_ARG_NONNULL(1); /**Reads more samples from the stream. \note Although \a _buf_size must indicate the total number of values that diff --git a/quakespasm/MacOSX/codecs/lib/libopusfile.dylib b/quakespasm/MacOSX/codecs/lib/libopusfile.dylib index 935cdf59..2e2e332f 100755 Binary files a/quakespasm/MacOSX/codecs/lib/libopusfile.dylib and b/quakespasm/MacOSX/codecs/lib/libopusfile.dylib differ diff --git a/quakespasm/Windows/SDL2/WhatsNew.txt b/quakespasm/Windows/SDL2/WhatsNew.txt index 79a6ae99..b37591d8 100644 --- a/quakespasm/Windows/SDL2/WhatsNew.txt +++ b/quakespasm/Windows/SDL2/WhatsNew.txt @@ -34,9 +34,11 @@ General: * Added a hint SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN to prevent window interaction while cursor is hidden * Added SDL_GetDisplayDPI() to get the DPI information for a display * Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick +* Added SDL_JoystickFromInstanceID(), as a helper function, to get the SDL_Joystick* that an event is referring to. +* Added SDL_GameControllerFromInstanceID(), as a helper function, to get the SDL_GameController* that an event is referring to. Windows: -* Added support for Windows Phone 8.1 +* Added support for Windows Phone 8.1 and Windows 10/UWP (Universal Windows Platform) * Timer resolution is now 1 ms by default, adjustable with the SDL_HINT_TIMER_RESOLUTION hint * SDLmain no longer depends on the C runtime, so you can use the same .lib in both Debug and Release builds * Added SDL_SetWindowsMessageHook() to set a function to be called for every windows message before TranslateMessage() @@ -63,6 +65,7 @@ Linux: * Enabled building with Mir and Wayland support by default. * Added IBus IME support * Added a hint SDL_HINT_IME_INTERNAL_EDITING to control whether IBus should handle text editing internally instead of sending SDL_TEXTEDITING events +* Added a hint SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling _NET_WM_PING protocol handling in SDL_CreateWindow() * Added support for multiple audio devices when using Pulseaudio * Fixed duplicate mouse events when using relative mouse motion diff --git a/quakespasm/Windows/SDL2/include/SDL_config_winrt.h b/quakespasm/Windows/SDL2/include/SDL_config_winrt.h index 0a33993f..29bf79fe 100644 --- a/quakespasm/Windows/SDL2/include/SDL_config_winrt.h +++ b/quakespasm/Windows/SDL2/include/SDL_config_winrt.h @@ -19,11 +19,26 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h +#ifndef _SDL_config_winrt_h +#define _SDL_config_winrt_h #include "SDL_platform.h" +/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used + by SDL to determine which version of the Windows SDK is being used. +*/ +#include + +/* Define possibly-undefined NTDDI values (used when compiling SDL against + older versions of the Windows SDK. +*/ +#ifndef NTDDI_WINBLUE +#define NTDDI_WINBLUE 0x06030000 +#endif +#ifndef NTDDI_WIN10 +#define NTDDI_WIN10 0x0A000000 +#endif + /* This is a set of defines to configure the SDL features */ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) @@ -163,7 +178,12 @@ typedef unsigned int uintptr_t; #define SDL_LOADSO_WINDOWS 1 /* Enable various threading systems */ +#if (NTDDI_VERSION >= NTDDI_WINBLUE) +#define SDL_THREAD_WINDOWS 1 +#else +/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ #define SDL_THREAD_STDCPP 1 +#endif /* Enable various timer systems */ #define SDL_TIMER_WINDOWS 1 @@ -191,4 +211,4 @@ typedef unsigned int uintptr_t; #define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_windows_h */ +#endif /* _SDL_config_winrt_h */ diff --git a/quakespasm/Windows/SDL2/include/SDL_config_wiz.h b/quakespasm/Windows/SDL2/include/SDL_config_wiz.h index 4b3c5a2a..a5063ba7 100644 --- a/quakespasm/Windows/SDL2/include/SDL_config_wiz.h +++ b/quakespasm/Windows/SDL2/include/SDL_config_wiz.h @@ -97,7 +97,6 @@ #define HAVE_NANOSLEEP 1 #define HAVE_POW 1 -#define SDL_CDROM_DISABLED 1 #define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_OSS 1 diff --git a/quakespasm/Windows/SDL2/include/SDL_gamecontroller.h b/quakespasm/Windows/SDL2/include/SDL_gamecontroller.h index 72fba60b..5459387b 100644 --- a/quakespasm/Windows/SDL2/include/SDL_gamecontroller.h +++ b/quakespasm/Windows/SDL2/include/SDL_gamecontroller.h @@ -171,6 +171,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_ */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); +/** + * Return the SDL_GameController associated with an instance id. + */ +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); + /** * Return the name for this currently opened controller */ diff --git a/quakespasm/Windows/SDL2/include/SDL_joystick.h b/quakespasm/Windows/SDL2/include/SDL_joystick.h index a707e6c3..78176321 100644 --- a/quakespasm/Windows/SDL2/include/SDL_joystick.h +++ b/quakespasm/Windows/SDL2/include/SDL_joystick.h @@ -106,6 +106,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); +/** + * Return the SDL_Joystick associated with an instance id. + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid); + /** * Return the name for this currently opened joystick. * If no name can be found, this function returns NULL. @@ -253,11 +258,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); /** -* Return the battery level of this joystick -*/ + * Return the battery level of this joystick + */ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/quakespasm/Windows/SDL2/include/SDL_revision.h b/quakespasm/Windows/SDL2/include/SDL_revision.h index 53ae9da2..b6aa6acf 100644 --- a/quakespasm/Windows/SDL2/include/SDL_revision.h +++ b/quakespasm/Windows/SDL2/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-9915:77cf2d1b7215" -#define SDL_REVISION_NUMBER 9915 +#define SDL_REVISION "hg-9959:182bfe0e7a60" +#define SDL_REVISION_NUMBER 9959 diff --git a/quakespasm/Windows/SDL2/lib/SDL2.dll b/quakespasm/Windows/SDL2/lib/SDL2.dll index 0f7da6c9..c8e41fe4 100644 Binary files a/quakespasm/Windows/SDL2/lib/SDL2.dll and b/quakespasm/Windows/SDL2/lib/SDL2.dll differ diff --git a/quakespasm/Windows/SDL2/lib/SDL2.lib b/quakespasm/Windows/SDL2/lib/SDL2.lib index 154943d2..e6b8281c 100644 Binary files a/quakespasm/Windows/SDL2/lib/SDL2.lib and b/quakespasm/Windows/SDL2/lib/SDL2.lib differ diff --git a/quakespasm/Windows/SDL2/lib/SDL2main.lib b/quakespasm/Windows/SDL2/lib/SDL2main.lib index d818168a..eda4307a 100644 Binary files a/quakespasm/Windows/SDL2/lib/SDL2main.lib and b/quakespasm/Windows/SDL2/lib/SDL2main.lib differ diff --git a/quakespasm/Windows/SDL2/lib/libSDL2.dll.a b/quakespasm/Windows/SDL2/lib/libSDL2.dll.a index b7388f94..aee9c002 100644 Binary files a/quakespasm/Windows/SDL2/lib/libSDL2.dll.a and b/quakespasm/Windows/SDL2/lib/libSDL2.dll.a differ diff --git a/quakespasm/Windows/SDL2/lib/libSDL2main.a b/quakespasm/Windows/SDL2/lib/libSDL2main.a index cce18d7f..f9b7e290 100644 Binary files a/quakespasm/Windows/SDL2/lib/libSDL2main.a and b/quakespasm/Windows/SDL2/lib/libSDL2main.a differ diff --git a/quakespasm/Windows/SDL2/lib64/SDL2.dll b/quakespasm/Windows/SDL2/lib64/SDL2.dll index 702de170..c8de03ef 100644 Binary files a/quakespasm/Windows/SDL2/lib64/SDL2.dll and b/quakespasm/Windows/SDL2/lib64/SDL2.dll differ diff --git a/quakespasm/Windows/SDL2/lib64/SDL2.lib b/quakespasm/Windows/SDL2/lib64/SDL2.lib index 03482c46..0e151ab1 100644 Binary files a/quakespasm/Windows/SDL2/lib64/SDL2.lib and b/quakespasm/Windows/SDL2/lib64/SDL2.lib differ diff --git a/quakespasm/Windows/SDL2/lib64/SDL2main.lib b/quakespasm/Windows/SDL2/lib64/SDL2main.lib index a8aa0762..036e0e14 100644 Binary files a/quakespasm/Windows/SDL2/lib64/SDL2main.lib and b/quakespasm/Windows/SDL2/lib64/SDL2main.lib differ diff --git a/quakespasm/Windows/SDL2/lib64/libSDL2.dll.a b/quakespasm/Windows/SDL2/lib64/libSDL2.dll.a index da99fb0f..8c4d9848 100644 Binary files a/quakespasm/Windows/SDL2/lib64/libSDL2.dll.a and b/quakespasm/Windows/SDL2/lib64/libSDL2.dll.a differ diff --git a/quakespasm/Windows/SDL2/lib64/libSDL2main.a b/quakespasm/Windows/SDL2/lib64/libSDL2main.a index f14f13b4..19e93ce9 100644 Binary files a/quakespasm/Windows/SDL2/lib64/libSDL2main.a and b/quakespasm/Windows/SDL2/lib64/libSDL2main.a differ diff --git a/quakespasm/Windows/codecs/include/opus/opusfile.h b/quakespasm/Windows/codecs/include/opus/opusfile.h index ea9a6c6e..91d06aa9 100644 --- a/quakespasm/Windows/codecs/include/opus/opusfile.h +++ b/quakespasm/Windows/codecs/include/opus/opusfile.h @@ -71,7 +71,7 @@ Vorbis mappings. A special stereo API can convert everything to 2 channels, making it simple - to support multichannel files in a application which only has stereo + to support multichannel files in an application which only has stereo output. Although the libopusfile ABI provides support for the theoretical maximum number of channels, the current implementation does not support @@ -90,9 +90,10 @@ (ignoring any other streams that might be concurrently multiplexed with it, such as a video stream). - The channel count can also change between links, but if your application is - not prepared to deal with this, it can use the stereo API to ensure the - audio from all links will always get decoded into a common format. + The channel count can also change between links. + If your application is not prepared to deal with this, it can use the stereo + API to ensure the audio from all links will always get decoded into a + common format. Since libopusfile always decodes to 48 kHz, you do not have to worry about the sample rate changing between links (as was possible with Vorbis). @@ -108,6 +109,8 @@ extern "C" { # include # include +/**@cond PRIVATE*/ + /*Enable special features for gcc and gcc-compatible compilers.*/ # if !defined(OP_GNUC_PREREQ) # if defined(__GNUC__)&&defined(__GNUC_MINOR__) @@ -122,9 +125,12 @@ extern "C" { # pragma GCC visibility push(default) # endif -typedef struct OpusHead OpusHead; -typedef struct OpusTags OpusTags; -typedef struct OggOpusFile OggOpusFile; +typedef struct OpusHead OpusHead; +typedef struct OpusTags OpusTags; +typedef struct OpusPictureTag OpusPictureTag; +typedef struct OpusServerInfo OpusServerInfo; +typedef struct OpusFileCallbacks OpusFileCallbacks; +typedef struct OggOpusFile OggOpusFile; /*Warning attributes for libopusfile functions.*/ # if OP_GNUC_PREREQ(3,4) @@ -138,6 +144,8 @@ typedef struct OggOpusFile OggOpusFile; # define OP_ARG_NONNULL(_x) # endif +/**@endcond*/ + /**\defgroup error_codes Error Codes*/ /*@{*/ /**\name List of possible error codes @@ -301,6 +309,87 @@ struct OpusTags{ char *vendor; }; +/**\name Picture tag image formats*/ +/*@{*/ + +/**The MIME type was not recognized, or the image data did not match the + declared MIME type.*/ +#define OP_PIC_FORMAT_UNKNOWN (-1) +/**The MIME type indicates the image data is really a URL.*/ +#define OP_PIC_FORMAT_URL (0) +/**The image is a JPEG.*/ +#define OP_PIC_FORMAT_JPEG (1) +/**The image is a PNG.*/ +#define OP_PIC_FORMAT_PNG (2) +/**The image is a GIF.*/ +#define OP_PIC_FORMAT_GIF (3) + +/*@}*/ + +/**The contents of a METADATA_BLOCK_PICTURE tag.*/ +struct OpusPictureTag{ + /**The picture type according to the ID3v2 APIC frame: +
    +
  1. Other
  2. +
  3. 32x32 pixels 'file icon' (PNG only)
  4. +
  5. Other file icon
  6. +
  7. Cover (front)
  8. +
  9. Cover (back)
  10. +
  11. Leaflet page
  12. +
  13. Media (e.g. label side of CD)
  14. +
  15. Lead artist/lead performer/soloist
  16. +
  17. Artist/performer
  18. +
  19. Conductor
  20. +
  21. Band/Orchestra
  22. +
  23. Composer
  24. +
  25. Lyricist/text writer
  26. +
  27. Recording Location
  28. +
  29. During recording
  30. +
  31. During performance
  32. +
  33. Movie/video screen capture
  34. +
  35. A bright colored fish
  36. +
  37. Illustration
  38. +
  39. Band/artist logotype
  40. +
  41. Publisher/Studio logotype
  42. +
+ Others are reserved and should not be used. + There may only be one each of picture type 1 and 2 in a file.*/ + opus_int32 type; + /**The MIME type of the picture, in printable ASCII characters 0x20-0x7E. + The MIME type may also be "-->" to signify that the data part + is a URL pointing to the picture instead of the picture data itself. + In this case, a terminating NUL is appended to the URL string in #data, + but #data_length is set to the length of the string excluding that + terminating NUL.*/ + char *mime_type; + /**The description of the picture, in UTF-8.*/ + char *description; + /**The width of the picture in pixels.*/ + opus_uint32 width; + /**The height of the picture in pixels.*/ + opus_uint32 height; + /**The color depth of the picture in bits-per-pixel (not + bits-per-channel).*/ + opus_uint32 depth; + /**For indexed-color pictures (e.g., GIF), the number of colors used, or 0 + for non-indexed pictures.*/ + opus_uint32 colors; + /**The length of the picture data in bytes.*/ + opus_uint32 data_length; + /**The binary picture data.*/ + unsigned char *data; + /**The format of the picture data, if known. + One of +
    +
  • #OP_PIC_FORMAT_UNKNOWN,
  • +
  • #OP_PIC_FORMAT_URL,
  • +
  • #OP_PIC_FORMAT_JPEG,
  • +
  • #OP_PIC_FORMAT_PNG, or
  • +
  • #OP_PIC_FORMAT_GIF.
  • +
*/ + int format; +}; + /**\name Functions for manipulating header data These functions manipulate the #OpusHead and #OpusTags structures, @@ -363,7 +452,7 @@ ogg_int64_t opus_granule_sample(const OpusHead *_head,ogg_int64_t _gp) for validity. \param[in] _data The contents of the 'comment' header packet. \param _len The number of bytes of data in the 'info' header packet. - \retval 0 Success. + \retval 0 Success. \retval #OP_ENOTFORMAT If the data does not start with the "OpusTags" string. \retval #OP_EBADHEADER If the contents of the packet otherwise violate the @@ -372,6 +461,15 @@ ogg_int64_t opus_granule_sample(const OpusHead *_head,ogg_int64_t _gp) OP_WARN_UNUSED_RESULT int opus_tags_parse(OpusTags *_tags, const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2); +/**Performs a deep copy of an #OpusTags structure. + \param _dst The #OpusTags structure to copy into. + If this function fails, the contents of this structure remain + untouched. + \param _src The #OpusTags structure to copy from. + \retval 0 Success. + \retval #OP_EFAULT If there wasn't enough memory to copy the tags.*/ +int opus_tags_copy(OpusTags *_dst,const OpusTags *_src) OP_ARG_NONNULL(1); + /**Initializes an #OpusTags structure. This should be called on a freshly allocated #OpusTags structure before attempting to use it. @@ -447,7 +545,7 @@ int opus_tags_query_count(const OpusTags *_tags,const char *_tag) On error, no value is returned, and the previous contents remain unchanged. \return 0 on success, or a negative value on error. - \retval OP_EFALSE There was no track gain available in the given tags.*/ + \retval #OP_FALSE There was no track gain available in the given tags.*/ int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); @@ -458,6 +556,78 @@ int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8) \param _tags The #OpusTags structure to clear.*/ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); +/**Check if \a _comment is an instance of a \a _tag_name tag. + \see opus_tagncompare + \param _tag_name A NUL-terminated, case-insensitive, ASCII string containing + the name of the tag to check for (without the terminating + '=' character). + \param _comment The comment string to check. + \return An integer less than, equal to, or greater than zero if \a _comment + is found respectively, to be less than, to match, or be greater + than a "tag=value" string whose tag matches \a _tag_name.*/ +int opus_tagcompare(const char *_tag_name,const char *_comment); + +/**Check if \a _comment is an instance of a \a _tag_name tag. + This version is slightly more efficient than opus_tagcompare() if the length + of the tag name is already known (e.g., because it is a constant). + \see opus_tagcompare + \param _tag_name A case-insensitive ASCII string containing the name of the + tag to check for (without the terminating '=' character). + \param _tag_len The number of characters in the tag name. + This must be non-negative. + \param _comment The comment string to check. + \return An integer less than, equal to, or greater than zero if \a _comment + is found respectively, to be less than, to match, or be greater + than a "tag=value" string whose tag matches the first \a _tag_len + characters of \a _tag_name.*/ +int opus_tagncompare(const char *_tag_name,int _tag_len,const char *_comment); + +/**Parse a single METADATA_BLOCK_PICTURE tag. + This decodes the BASE64-encoded content of the tag and returns a structure + with the MIME type, description, image parameters (if known), and the + compressed image data. + If the MIME type indicates the presence of an image format we recognize + (JPEG, PNG, or GIF) and the actual image data contains the magic signature + associated with that format, then the OpusPictureTag::format field will be + set to the corresponding format. + This is provided as a convenience to avoid requiring applications to parse + the MIME type and/or do their own format detection for the commonly used + formats. + In this case, we also attempt to extract the image parameters directly from + the image data (overriding any that were present in the tag, which the + specification says applications are not meant to rely on). + The application must still provide its own support for actually decoding the + image data and, if applicable, retrieving that data from URLs. + \param[out] _pic Returns the parsed picture data. + No sanitation is done on the type, MIME type, or + description fields, so these might return invalid values. + The contents of this structure are left unmodified on + failure. + \param _tag The METADATA_BLOCK_PICTURE tag contents. + The leading "METADATA_BLOCK_PICTURE=" portion is optional, + to allow the function to be used on either directly on the + values in OpusTags::user_comments or on the return value + of opus_tags_query(). + \return 0 on success or a negative value on error. + \retval #OP_ENOTFORMAT The METADATA_BLOCK_PICTURE contents were not valid. + \retval #OP_EFAULT There was not enough memory to store the picture tag + contents.*/ +OP_WARN_UNUSED_RESULT int opus_picture_tag_parse(OpusPictureTag *_pic, + const char *_tag) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); + +/**Initializes an #OpusPictureTag structure. + This should be called on a freshly allocated #OpusPictureTag structure + before attempting to use it. + \param _pic The #OpusPictureTag structure to initialize.*/ +void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1); + +/**Clears the #OpusPictureTag structure. + This should be called on an #OpusPictureTag structure after it is no longer + needed. + It will free all memory used by the structure members. + \param _pic The #OpusPictureTag structure to clear.*/ +void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1); + /*@}*/ /*@}*/ @@ -474,6 +644,8 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); They may be expanded in the future.*/ /*@{*/ +/**@cond PRIVATE*/ + /*These are the raw numbers used to define the request codes. They should not be used directly.*/ #define OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST (6464) @@ -481,6 +653,7 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); #define OP_HTTP_PROXY_PORT_REQUEST (6592) #define OP_HTTP_PROXY_USER_REQUEST (6656) #define OP_HTTP_PROXY_PASS_REQUEST (6720) +#define OP_GET_SERVER_INFO_REQUEST (6784) #define OP_URL_OPT(_request) ((_request)+(char *)0) @@ -488,6 +661,64 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); provided to one of the URL options.*/ #define OP_CHECK_INT(_x) ((void)((_x)==(opus_int32)0),(opus_int32)(_x)) #define OP_CHECK_CONST_CHAR_PTR(_x) ((_x)+((_x)-(const char *)(_x))) +#define OP_CHECK_SERVER_INFO_PTR(_x) ((_x)+((_x)-(OpusServerInfo *)(_x))) + +/**@endcond*/ + +/**HTTP/Shoutcast/Icecast server information associated with a URL.*/ +struct OpusServerInfo{ + /**The name of the server (icy-name/ice-name). + This is NULL if there was no icy-name or + ice-name header.*/ + char *name; + /**A short description of the server (icy-description/ice-description). + This is NULL if there was no icy-description or + ice-description header.*/ + char *description; + /**The genre the server falls under (icy-genre/ice-genre). + This is NULL if there was no icy-genre or + ice-genre header.*/ + char *genre; + /**The homepage for the server (icy-url/ice-url). + This is NULL if there was no icy-url or + ice-url header.*/ + char *url; + /**The software used by the origin server (Server). + This is NULL if there was no Server header.*/ + char *server; + /**The media type of the entity sent to the recepient (Content-Type). + This is NULL if there was no Content-Type + header.*/ + char *content_type; + /**The nominal stream bitrate in kbps (icy-br/ice-bitrate). + This is -1 if there was no icy-br or + ice-bitrate header.*/ + opus_int32 bitrate_kbps; + /**Flag indicating whether the server is public (1) or not + (0) (icy-pub/ice-public). + This is -1 if there was no icy-pub or + ice-public header.*/ + int is_public; + /**Flag indicating whether the server is using HTTPS instead of HTTP. + This is 0 unless HTTPS is being used. + This may not match the protocol used in the original URL if there were + redirections.*/ + int is_ssl; +}; + +/**Initializes an #OpusServerInfo structure. + All fields are set as if the corresponding header was not available. + \param _info The #OpusServerInfo structure to initialize. + \note If you use this function, you must link against libopusurl.*/ +void opus_server_info_init(OpusServerInfo *_info) OP_ARG_NONNULL(1); + +/**Clears the #OpusServerInfo structure. + This should be called on an #OpusServerInfo structure after it is no longer + needed. + It will free all memory used by the structure members. + \param _info The #OpusServerInfo structure to clear. + \note If you use this function, you must link against libopusurl.*/ +void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1); /**Skip the certificate check when connecting via TLS/SSL (https). \param _b opus_int32: Whether or not to skip the certificate @@ -548,6 +779,27 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); #define OP_HTTP_PROXY_PASS(_pass) \ OP_URL_OPT(OP_HTTP_PROXY_PASS_REQUEST),OP_CHECK_CONST_CHAR_PTR(_pass) +/**Parse information about the streaming server (if any) and return it. + Very little validation is done. + In particular, OpusServerInfo::url may not be a valid URL, + OpusServerInfo::bitrate_kbps may not really be in kbps, and + OpusServerInfo::content_type may not be a valid MIME type. + The character set of the string fields is not specified anywhere, and should + not be assumed to be valid UTF-8. + \param _info OpusServerInfo *: Returns information about the server. + If there is any error opening the stream, the + contents of this structure remain + unmodified. + On success, fills in the structure with the + server information that was available, if + any. + After a successful return, the contents of + this structure should be freed by calling + opus_server_info_clear(). + \hideinitializer*/ +#define OP_GET_SERVER_INFO(_info) \ + OP_URL_OPT(OP_GET_SERVER_INFO_REQUEST),OP_CHECK_SERVER_INFO_PTR(_info) + /*@}*/ /*@}*/ @@ -563,8 +815,6 @@ void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); block of memory, or URLs.*/ /*@{*/ -typedef struct OpusFileCallbacks OpusFileCallbacks; - /**Reads up to \a _nbytes bytes of data from \a _stream. \param _stream The stream to read from. \param[out] _ptr The buffer to store the data in. @@ -698,6 +948,7 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb, takes a va_list instead of a variable number of arguments. It does not call the va_end macro, and because it invokes the va_arg macro, the value of \a _ap is undefined after the call. + \note If you use this function, you must link against libopusurl. \param[out] _cb The callbacks to use for this stream. If there is an error creating the stream, nothing will be filled in here. @@ -706,6 +957,10 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb, schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, + before passing them to this function. \param[in,out] _ap A list of the \ref url_options "optional flags" to use. This is a variable-length list of options terminated with NULL. @@ -714,7 +969,8 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb, OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb, const char *_url,va_list _ap) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); -/**Creates a stream that reads from the given URL using the specified proxy. +/**Creates a stream that reads from the given URL. + \note If you use this function, you must link against libopusurl. \param[out] _cb The callbacks to use for this stream. If there is an error creating the stream, nothing will be filled in here. @@ -723,6 +979,10 @@ OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb, are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, before + passing them to this function. \param ... The \ref url_options "optional flags" to use. This is a variable-length list of options terminated with NULL. @@ -805,12 +1065,17 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_memory(const unsigned char *_data, takes a va_list instead of a variable number of arguments. It does not call the va_end macro, and because it invokes the va_arg macro, the value of \a _ap is undefined after the call. + \note If you use this function, you must link against libopusurl. \param _url The URL to open. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, + with internationalized domain names encoded in + punycode, before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -825,13 +1090,16 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_vopen_url(const char *_url, int *_error,va_list _ap) OP_ARG_NONNULL(1); /**Open a stream from a URL. - However, this approach will not work for live streams or HTTP/1.0 servers - (which do not support Range requets). + \note If you use this function, you must link against libopusurl. \param _url The URL to open. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, + before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -954,6 +1222,7 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data, takes a va_list instead of a variable number of arguments. It does not call the va_end macro, and because it invokes the va_arg macro, the value of \a _ap is undefined after the call. + \note If you use this function, you must link against libopusurl. \see op_test_url \see op_test_callbacks \param _url The URL to open. @@ -962,6 +1231,10 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data, Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, + with internationalized domain names encoded in + punycode, before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -976,12 +1249,17 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_vtest_url(const char *_url, int *_error,va_list _ap) OP_ARG_NONNULL(1); /**Partially open a stream from a URL. + \note If you use this function, you must link against libopusurl. \see op_test_callbacks \param _url The URL to open. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. + Currently this only supports URIs. + IRIs should be converted to UTF-8 and URL-escaped, with + internationalized domain names encoded in punycode, + before passing them to this function. \param[out] _error Returns 0 on success, or a failure code on error. You may pass in NULL if you don't want the failure code. @@ -1128,7 +1406,7 @@ void op_free(OggOpusFile *_of); This function may be called on partially-opened streams. \param _of The \c OggOpusFile whose seekable status is to be returned. \return A non-zero value if seekable, and 0 if unseekable.*/ -int op_seekable(OggOpusFile *_of) OP_ARG_NONNULL(1); +int op_seekable(const OggOpusFile *_of) OP_ARG_NONNULL(1); /**Returns the number of links in this chained stream. This function may be called on partially-opened streams, but it will always @@ -1136,9 +1414,9 @@ int op_seekable(OggOpusFile *_of) OP_ARG_NONNULL(1); The actual number of links is not known until the stream is fully opened. \param _of The \c OggOpusFile from which to retrieve the link count. \return For fully-open seekable sources, this returns the total number of - links in the whole stream. + links in the whole stream, which will be at least 1. For partially-open or unseekable sources, this always returns 1.*/ -int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1); +int op_link_count(const OggOpusFile *_of) OP_ARG_NONNULL(1); /**Get the serial number of the given link in a (possibly-chained) Ogg Opus stream. @@ -1153,7 +1431,7 @@ int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1); the serial number of the last link. If the source is not seekable, this always returns the serial number of the current link.*/ -opus_uint32 op_serialno(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +opus_uint32 op_serialno(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the channel count of the given link in a (possibly-chained) Ogg Opus stream. @@ -1170,11 +1448,15 @@ opus_uint32 op_serialno(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); the channel count of the last link. If the source is not seekable, this always returns the channel count of the current link.*/ -int op_channel_count(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +int op_channel_count(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the total (compressed) size of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing overhead. + \warning If the Opus stream (or link) is concurrently multiplexed with other + logical streams (e.g., video), this returns the size of the entire stream + (or link), not just the number of bytes in the first logical Opus stream. + Returning the latter would require scanning the entire file. \param _of The \c OggOpusFile from which to retrieve the compressed size. \param _li The index of the link whose compressed size should be computed. Use a negative number to get the compressed size of the entire @@ -1188,7 +1470,7 @@ int op_channel_count(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); \retval #OP_EINVAL The source is not seekable (so we can't know the length), \a _li wasn't less than the total number of links in the stream, or the stream was only partially open.*/ -opus_int64 op_raw_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +opus_int64 op_raw_total(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the total PCM length (number of samples at 48 kHz) of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream. @@ -1206,7 +1488,7 @@ opus_int64 op_raw_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); \retval #OP_EINVAL The source is not seekable (so we can't know the length), \a _li wasn't less than the total number of links in the stream, or the stream was only partially open.*/ -ogg_int64_t op_pcm_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the ID header information for the given link in a (possibly chained) Ogg Opus stream. @@ -1222,7 +1504,7 @@ ogg_int64_t op_pcm_total(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); information for the current link is always returned, if available. \return The contents of the ID header for the given link.*/ -const OpusHead *op_head(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +const OpusHead *op_head(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Get the comment header information for the given link in a (possibly chained) Ogg Opus stream. @@ -1240,7 +1522,7 @@ const OpusHead *op_head(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); \return The contents of the comment header for the given link, or NULL if this is an unseekable stream that encountered an invalid link.*/ -const OpusTags *op_tags(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +const OpusTags *op_tags(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Retrieve the index of the current link. This is the link that produced the data most recently read by @@ -1257,20 +1539,29 @@ const OpusTags *op_tags(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); each time a new link is encountered (even though op_link_count() always returns 1). \retval #OP_EINVAL The stream was only partially open.*/ -int op_current_link(OggOpusFile *_of) OP_ARG_NONNULL(1); +int op_current_link(const OggOpusFile *_of) OP_ARG_NONNULL(1); -/**Computes the bitrate for a given link in a (possibly chained) Ogg Opus - stream. +/**Computes the bitrate of the stream, or of an individual link in a + (possibly-chained) Ogg Opus stream. The stream must be seekable to compute the bitrate. For unseekable streams, use op_bitrate_instant() to get periodic estimates. + \warning If the Opus stream (or link) is concurrently multiplexed with other + logical streams (e.g., video), this uses the size of the entire stream (or + link) to compute the bitrate, not just the number of bytes in the first + logical Opus stream. + Returning the latter requires scanning the entire file, but this may be done + by decoding the whole file and calling op_bitrate_instant() once at the + end. + Install a trivial decoding callback with op_set_decode_callback() if you + wish to skip actual decoding during this process. \param _of The \c OggOpusFile from which to retrieve the bitrate. \param _li The index of the link whose bitrate should be computed. - USe a negative number to get the bitrate of the whole stream. + Use a negative number to get the bitrate of the whole stream. \return The bitrate on success, or a negative value on error. \retval #OP_EINVAL The stream was only partially open, the stream was not seekable, or \a _li was larger than the number of links.*/ -opus_int32 op_bitrate(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); +opus_int32 op_bitrate(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1); /**Compute the instantaneous bitrate, measured as the ratio of bits to playable samples decoded since a) the last call to op_bitrate_instant(), b) the last @@ -1289,7 +1580,7 @@ opus_int32 op_bitrate_instant(OggOpusFile *_of) OP_ARG_NONNULL(1); \param _of The \c OggOpusFile from which to retrieve the position indicator. \return The byte position that is currently being read from. \retval #OP_EINVAL The stream was only partially open.*/ -opus_int64 op_raw_tell(OggOpusFile *_of) OP_ARG_NONNULL(1); +opus_int64 op_raw_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1); /**Obtain the PCM offset of the next sample to be read. If the stream is not properly timestamped, this might not increment by the @@ -1298,7 +1589,7 @@ opus_int64 op_raw_tell(OggOpusFile *_of) OP_ARG_NONNULL(1); \param _of The \c OggOpusFile from which to retrieve the PCM offset. \return The PCM offset of the next sample to be read. \retval #OP_EINVAL The stream was only partially open.*/ -ogg_int64_t op_pcm_tell(OggOpusFile *_of) OP_ARG_NONNULL(1); +ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1); /*@}*/ /*@}*/ @@ -1399,13 +1690,73 @@ int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1); not check the error return code from op_read_float() or its associated functions. If the remote peer does not close the connection gracefully (with a TLS - "close notify" message), these functions will return OP_EREAD instead of 0 + "close notify" message), these functions will return #OP_EREAD instead of 0 when they reach the end of the file. If you are reading from an URL (particularly if seeking is not supported), you should make sure to check for this error and warn the user appropriately.*/ /*@{*/ +/**Indicates that the decoding callback should produce signed 16-bit + native-endian output samples.*/ +#define OP_DEC_FORMAT_SHORT (7008) +/**Indicates that the decoding callback should produce 32-bit native-endian + float samples.*/ +#define OP_DEC_FORMAT_FLOAT (7040) + +/**Indicates that the decoding callback did not decode anything, and that + libopusfile should decode normally instead.*/ +#define OP_DEC_USE_DEFAULT (6720) + +/**Called to decode an Opus packet. + This should invoke the functional equivalent of opus_multistream_decode() or + opus_multistream_decode_float(), except that it returns 0 on success + instead of the number of decoded samples (which is known a priori). + \param _ctx The application-provided callback context. + \param _decoder The decoder to use to decode the packet. + \param[out] _pcm The buffer to decode into. + This will always have enough room for \a _nchannels of + \a _nsamples samples, which should be placed into this + buffer interleaved. + \param _op The packet to decode. + This will always have its granule position set to a valid + value. + \param _nsamples The number of samples expected from the packet. + \param _nchannels The number of channels expected from the packet. + \param _format The desired sample output format. + This is either #OP_DEC_FORMAT_SHORT or + #OP_DEC_FORMAT_FLOAT. + \param _li The index of the link from which this packet was decoded. + \return A non-negative value on success, or a negative value on error. + The error codes should be the same as those returned by + opus_multistream_decode() or opus_multistream_decode_float(). + \retval 0 Decoding was successful. + The application has filled the buffer with + exactly \a _nsamples*\a + _nchannels samples in the requested + format. + \retval #OP_DEC_USE_DEFAULT No decoding was done. + libopusfile should decode normally + instead.*/ +typedef int (*op_decode_cb_func)(void *_ctx,OpusMSDecoder *_decoder,void *_pcm, + const ogg_packet *_op,int _nsamples,int _nchannels,int _format,int _li); + +/**Sets the packet decode callback function. + This is called once for each packet that needs to be decoded. + A call to this function is no guarantee that the audio will eventually be + delivered to the application. + Some or all of the data from the packet may be discarded (i.e., at the + beginning or end of a link, or after a seek), however the callback is + required to provide all of it. + \param _of The \c OggOpusFile on which to set the decode callback. + \param _decode_cb The callback function to call. + This may be NULL to disable calling the + callback. + \param _ctx The application-provided context pointer to pass to the + callback on each call.*/ +void op_set_decode_callback(OggOpusFile *_of, + op_decode_cb_func _decode_cb,void *_ctx) OP_ARG_NONNULL(1); + /**Gain offset type that indicates that the provided offset is relative to the header gain. This is the default.*/ @@ -1437,7 +1788,19 @@ int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1); \return 0 on success or a negative value on error. \retval #OP_EINVAL The \a _gain_type was unrecognized.*/ int op_set_gain_offset(OggOpusFile *_of, - int _gain_type,opus_int32 _gain_offset_q8); + int _gain_type,opus_int32 _gain_offset_q8) OP_ARG_NONNULL(1); + +/**Sets whether or not dithering is enabled for 16-bit decoding. + By default, when libopusfile is compiled to use floating-point + internally, calling op_read() or op_read_stereo() will first decode to + float, and then convert to fixed-point using noise-shaping dithering. + This flag can be used to disable that dithering. + When the application uses op_read_float() or op_read_float_stereo(), or when + the library has been compiled to decode directly to fixed point, this flag + has no effect. + \param _of The \c OggOpusFile on which to enable or disable dithering. + \param _enabled A non-zero value to enable dithering, or 0 to disable it.*/ +void op_set_dither_enabled(OggOpusFile *_of,int _enabled) OP_ARG_NONNULL(1); /**Reads more samples from the stream. \note Although \a _buf_size must indicate the total number of values that diff --git a/quakespasm/Windows/codecs/x64/libopusfile-0.dll b/quakespasm/Windows/codecs/x64/libopusfile-0.dll index 3b73a935..1784effc 100644 Binary files a/quakespasm/Windows/codecs/x64/libopusfile-0.dll and b/quakespasm/Windows/codecs/x64/libopusfile-0.dll differ diff --git a/quakespasm/Windows/codecs/x64/libopusfile.dll.a b/quakespasm/Windows/codecs/x64/libopusfile.dll.a index 2f31a9bb..206e5456 100644 Binary files a/quakespasm/Windows/codecs/x64/libopusfile.dll.a and b/quakespasm/Windows/codecs/x64/libopusfile.dll.a differ diff --git a/quakespasm/Windows/codecs/x64/libopusfile.lib b/quakespasm/Windows/codecs/x64/libopusfile.lib index 6d87263e..899a7adb 100644 Binary files a/quakespasm/Windows/codecs/x64/libopusfile.lib and b/quakespasm/Windows/codecs/x64/libopusfile.lib differ diff --git a/quakespasm/Windows/codecs/x86/libopusfile-0.dll b/quakespasm/Windows/codecs/x86/libopusfile-0.dll index 432b6069..686c6b00 100644 Binary files a/quakespasm/Windows/codecs/x86/libopusfile-0.dll and b/quakespasm/Windows/codecs/x86/libopusfile-0.dll differ diff --git a/quakespasm/Windows/codecs/x86/libopusfile.dll.a b/quakespasm/Windows/codecs/x86/libopusfile.dll.a index ffa57a5c..9080f9b7 100644 Binary files a/quakespasm/Windows/codecs/x86/libopusfile.dll.a and b/quakespasm/Windows/codecs/x86/libopusfile.dll.a differ diff --git a/quakespasm/Windows/codecs/x86/libopusfile.lib b/quakespasm/Windows/codecs/x86/libopusfile.lib index d36ff516..bcf26770 100644 Binary files a/quakespasm/Windows/codecs/x86/libopusfile.lib and b/quakespasm/Windows/codecs/x86/libopusfile.lib differ