oslibs: rebuilt opusfile library from current xiph.org to catch the

recent seek bug fixes. rebuilt SDL2 from current SDL mercurial repo
(2015-12-11, rev. 9959).


git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1262 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2015-12-11 15:47:41 +00:00
parent 314144c363
commit a3705a9750
31 changed files with 868 additions and 83 deletions

View File

@ -19,11 +19,26 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#ifndef _SDL_config_windows_h #ifndef _SDL_config_winrt_h
#define _SDL_config_windows_h #define _SDL_config_winrt_h
#include "SDL_platform.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 <sdkddkver.h>
/* 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 */ /* This is a set of defines to configure the SDL features */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #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 #define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */ /* 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 #define SDL_THREAD_STDCPP 1
#endif
/* Enable various timer systems */ /* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1 #define SDL_TIMER_WINDOWS 1
@ -191,4 +211,4 @@ typedef unsigned int uintptr_t;
#define SDL_ASSEMBLY_ROUTINES 1 #define SDL_ASSEMBLY_ROUTINES 1
#endif #endif
#endif /* _SDL_config_windows_h */ #endif /* _SDL_config_winrt_h */

View File

@ -97,7 +97,6 @@
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
#define HAVE_POW 1 #define HAVE_POW 1
#define SDL_CDROM_DISABLED 1
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
#define SDL_AUDIO_DRIVER_OSS 1 #define SDL_AUDIO_DRIVER_OSS 1

View File

@ -171,6 +171,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
*/ */
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); 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 * Return the name for this currently opened controller
*/ */

View File

@ -106,6 +106,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
*/ */
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(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. * Return the name for this currently opened joystick.
* If no name can be found, this function returns NULL. * 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); 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); extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,2 +1,2 @@
#define SDL_REVISION "hg-9915:77cf2d1b7215" #define SDL_REVISION "hg-9959:182bfe0e7a60"
#define SDL_REVISION_NUMBER 9915 #define SDL_REVISION_NUMBER 9959

View File

@ -71,7 +71,7 @@
<a href="http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9">Vorbis <a href="http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9">Vorbis
mappings</a>. mappings</a>.
A special stereo API can convert everything to 2 channels, making it simple 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. output.
Although the <tt>libopusfile</tt> ABI provides support for the theoretical Although the <tt>libopusfile</tt> ABI provides support for the theoretical
maximum number of channels, the current implementation does not support 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, (ignoring any other streams that might be concurrently multiplexed with it,
such as a video stream). such as a video stream).
The channel count can also change between links, but if your application is The channel count can also change between links.
not prepared to deal with this, it can use the stereo API to ensure the If your application is not prepared to deal with this, it can use the stereo
audio from all links will always get decoded into a common format. API to ensure the audio from all links will always get decoded into a
common format.
Since <tt>libopusfile</tt> always decodes to 48&nbsp;kHz, you do not have to Since <tt>libopusfile</tt> always decodes to 48&nbsp;kHz, you do not have to
worry about the sample rate changing between links (as was possible with worry about the sample rate changing between links (as was possible with
Vorbis). Vorbis).
@ -108,6 +109,8 @@ extern "C" {
# include <ogg/ogg.h> # include <ogg/ogg.h>
# include <opus/opus_multistream.h> # include <opus/opus_multistream.h>
/**@cond PRIVATE*/
/*Enable special features for gcc and gcc-compatible compilers.*/ /*Enable special features for gcc and gcc-compatible compilers.*/
# if !defined(OP_GNUC_PREREQ) # if !defined(OP_GNUC_PREREQ)
# if defined(__GNUC__)&&defined(__GNUC_MINOR__) # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
@ -122,9 +125,12 @@ extern "C" {
# pragma GCC visibility push(default) # pragma GCC visibility push(default)
# endif # endif
typedef struct OpusHead OpusHead; typedef struct OpusHead OpusHead;
typedef struct OpusTags OpusTags; typedef struct OpusTags OpusTags;
typedef struct OggOpusFile OggOpusFile; typedef struct OpusPictureTag OpusPictureTag;
typedef struct OpusServerInfo OpusServerInfo;
typedef struct OpusFileCallbacks OpusFileCallbacks;
typedef struct OggOpusFile OggOpusFile;
/*Warning attributes for libopusfile functions.*/ /*Warning attributes for libopusfile functions.*/
# if OP_GNUC_PREREQ(3,4) # if OP_GNUC_PREREQ(3,4)
@ -138,6 +144,8 @@ typedef struct OggOpusFile OggOpusFile;
# define OP_ARG_NONNULL(_x) # define OP_ARG_NONNULL(_x)
# endif # endif
/**@endcond*/
/**\defgroup error_codes Error Codes*/ /**\defgroup error_codes Error Codes*/
/*@{*/ /*@{*/
/**\name List of possible error codes /**\name List of possible error codes
@ -301,6 +309,87 @@ struct OpusTags{
char *vendor; 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:
<ol start="0">
<li>Other</li>
<li>32x32 pixels 'file icon' (PNG only)</li>
<li>Other file icon</li>
<li>Cover (front)</li>
<li>Cover (back)</li>
<li>Leaflet page</li>
<li>Media (e.g. label side of CD)</li>
<li>Lead artist/lead performer/soloist</li>
<li>Artist/performer</li>
<li>Conductor</li>
<li>Band/Orchestra</li>
<li>Composer</li>
<li>Lyricist/text writer</li>
<li>Recording Location</li>
<li>During recording</li>
<li>During performance</li>
<li>Movie/video screen capture</li>
<li>A bright colored fish</li>
<li>Illustration</li>
<li>Band/artist logotype</li>
<li>Publisher/Studio logotype</li>
</ol>
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 <code>"-->"</code> 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 (<em>not</em>
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
<ul>
<li>#OP_PIC_FORMAT_UNKNOWN,</li>
<li>#OP_PIC_FORMAT_URL,</li>
<li>#OP_PIC_FORMAT_JPEG,</li>
<li>#OP_PIC_FORMAT_PNG, or</li>
<li>#OP_PIC_FORMAT_GIF.</li>
</ul>*/
int format;
};
/**\name Functions for manipulating header data /**\name Functions for manipulating header data
These functions manipulate the #OpusHead and #OpusTags structures, 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. for validity.
\param[in] _data The contents of the 'comment' header packet. \param[in] _data The contents of the 'comment' header packet.
\param _len The number of bytes of data in the 'info' 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" \retval #OP_ENOTFORMAT If the data does not start with the "OpusTags"
string. string.
\retval #OP_EBADHEADER If the contents of the packet otherwise violate the \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, OP_WARN_UNUSED_RESULT int opus_tags_parse(OpusTags *_tags,
const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2); 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. /**Initializes an #OpusTags structure.
This should be called on a freshly allocated #OpusTags structure before This should be called on a freshly allocated #OpusTags structure before
attempting to use it. 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 On error, no value is returned, and the previous
contents remain unchanged. contents remain unchanged.
\return 0 on success, or a negative value on error. \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) int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8)
OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); 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.*/ \param _tags The #OpusTags structure to clear.*/
void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); 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.*/ They may be expanded in the future.*/
/*@{*/ /*@{*/
/**@cond PRIVATE*/
/*These are the raw numbers used to define the request codes. /*These are the raw numbers used to define the request codes.
They should not be used directly.*/ They should not be used directly.*/
#define OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST (6464) #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_PORT_REQUEST (6592)
#define OP_HTTP_PROXY_USER_REQUEST (6656) #define OP_HTTP_PROXY_USER_REQUEST (6656)
#define OP_HTTP_PROXY_PASS_REQUEST (6720) #define OP_HTTP_PROXY_PASS_REQUEST (6720)
#define OP_GET_SERVER_INFO_REQUEST (6784)
#define OP_URL_OPT(_request) ((_request)+(char *)0) #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.*/ provided to one of the URL options.*/
#define OP_CHECK_INT(_x) ((void)((_x)==(opus_int32)0),(opus_int32)(_x)) #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_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 <code>NULL</code> if there was no <code>icy-name</code> or
<code>ice-name</code> header.*/
char *name;
/**A short description of the server (icy-description/ice-description).
This is <code>NULL</code> if there was no <code>icy-description</code> or
<code>ice-description</code> header.*/
char *description;
/**The genre the server falls under (icy-genre/ice-genre).
This is <code>NULL</code> if there was no <code>icy-genre</code> or
<code>ice-genre</code> header.*/
char *genre;
/**The homepage for the server (icy-url/ice-url).
This is <code>NULL</code> if there was no <code>icy-url</code> or
<code>ice-url</code> header.*/
char *url;
/**The software used by the origin server (Server).
This is <code>NULL</code> if there was no <code>Server</code> header.*/
char *server;
/**The media type of the entity sent to the recepient (Content-Type).
This is <code>NULL</code> if there was no <code>Content-Type</code>
header.*/
char *content_type;
/**The nominal stream bitrate in kbps (icy-br/ice-bitrate).
This is <code>-1</code> if there was no <code>icy-br</code> or
<code>ice-bitrate</code> header.*/
opus_int32 bitrate_kbps;
/**Flag indicating whether the server is public (<code>1</code>) or not
(<code>0</code>) (icy-pub/ice-public).
This is <code>-1</code> if there was no <code>icy-pub</code> or
<code>ice-public</code> header.*/
int is_public;
/**Flag indicating whether the server is using HTTPS instead of HTTP.
This is <code>0</code> 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 <tt>libopusurl</tt>.*/
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 <tt>libopusurl</tt>.*/
void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1);
/**Skip the certificate check when connecting via TLS/SSL (https). /**Skip the certificate check when connecting via TLS/SSL (https).
\param _b <code>opus_int32</code>: Whether or not to skip the certificate \param _b <code>opus_int32</code>: 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) \ #define OP_HTTP_PROXY_PASS(_pass) \
OP_URL_OPT(OP_HTTP_PROXY_PASS_REQUEST),OP_CHECK_CONST_CHAR_PTR(_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.*/ block of memory, or URLs.*/
/*@{*/ /*@{*/
typedef struct OpusFileCallbacks OpusFileCallbacks;
/**Reads up to \a _nbytes bytes of data from \a _stream. /**Reads up to \a _nbytes bytes of data from \a _stream.
\param _stream The stream to read from. \param _stream The stream to read from.
\param[out] _ptr The buffer to store the data in. \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. takes a va_list instead of a variable number of arguments.
It does not call the <code>va_end</code> macro, and because it invokes the It does not call the <code>va_end</code> macro, and because it invokes the
<code>va_arg</code> macro, the value of \a _ap is undefined after the call. <code>va_arg</code> macro, the value of \a _ap is undefined after the call.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\param[out] _cb The callbacks to use for this stream. \param[out] _cb The callbacks to use for this stream.
If there is an error creating the stream, nothing will If there is an error creating the stream, nothing will
be filled in here. be filled in here.
@ -706,6 +957,10 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb,
schemes are supported. schemes are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always fail. 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. \param[in,out] _ap A list of the \ref url_options "optional flags" to use.
This is a variable-length list of options terminated This is a variable-length list of options terminated
with <code>NULL</code>. with <code>NULL</code>.
@ -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, 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); 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 <tt>libopusurl</tt>.
\param[out] _cb The callbacks to use for this stream. \param[out] _cb The callbacks to use for this stream.
If there is an error creating the stream, nothing will be If there is an error creating the stream, nothing will be
filled in here. filled in here.
@ -723,6 +979,10 @@ OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb,
are supported. are supported.
Both <http:> and <https:> may be disabled at compile time, Both <http:> and <https:> may be disabled at compile time,
in which case opening such URLs will always fail. 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. \param ... The \ref url_options "optional flags" to use.
This is a variable-length list of options terminated with This is a variable-length list of options terminated with
<code>NULL</code>. <code>NULL</code>.
@ -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. takes a va_list instead of a variable number of arguments.
It does not call the <code>va_end</code> macro, and because it invokes the It does not call the <code>va_end</code> macro, and because it invokes the
<code>va_arg</code> macro, the value of \a _ap is undefined after the call. <code>va_arg</code> macro, the value of \a _ap is undefined after the call.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\param _url The URL to open. \param _url The URL to open.
Currently only the <file:>, <http:>, and <https:> Currently only the <file:>, <http:>, and <https:>
schemes are supported. schemes are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always time, in which case opening such URLs will always
fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want You may pass in <code>NULL</code> if you don't want
the failure code. 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); int *_error,va_list _ap) OP_ARG_NONNULL(1);
/**Open a stream from a URL. /**Open a stream from a URL.
However, this approach will not work for live streams or HTTP/1.0 servers \note If you use this function, you must link against <tt>libopusurl</tt>.
(which do not support Range requets).
\param _url The URL to open. \param _url The URL to open.
Currently only the <file:>, <http:>, and <https:> schemes Currently only the <file:>, <http:>, and <https:> schemes
are supported. are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want the You may pass in <code>NULL</code> if you don't want the
failure code. 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. takes a va_list instead of a variable number of arguments.
It does not call the <code>va_end</code> macro, and because it invokes the It does not call the <code>va_end</code> macro, and because it invokes the
<code>va_arg</code> macro, the value of \a _ap is undefined after the call. <code>va_arg</code> macro, the value of \a _ap is undefined after the call.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\see op_test_url \see op_test_url
\see op_test_callbacks \see op_test_callbacks
\param _url The URL to open. \param _url The URL to open.
@ -962,6 +1231,10 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data,
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always time, in which case opening such URLs will always
fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want You may pass in <code>NULL</code> if you don't want
the failure code. 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); int *_error,va_list _ap) OP_ARG_NONNULL(1);
/**Partially open a stream from a URL. /**Partially open a stream from a URL.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\see op_test_callbacks \see op_test_callbacks
\param _url The URL to open. \param _url The URL to open.
Currently only the <file:>, <http:>, and <https:> Currently only the <file:>, <http:>, and <https:>
schemes are supported. schemes are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want the You may pass in <code>NULL</code> if you don't want the
failure code. failure code.
@ -1128,7 +1406,7 @@ void op_free(OggOpusFile *_of);
This function may be called on partially-opened streams. This function may be called on partially-opened streams.
\param _of The \c OggOpusFile whose seekable status is to be returned. \param _of The \c OggOpusFile whose seekable status is to be returned.
\return A non-zero value if seekable, and 0 if unseekable.*/ \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. /**Returns the number of links in this chained stream.
This function may be called on partially-opened streams, but it will always 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. 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. \param _of The \c OggOpusFile from which to retrieve the link count.
\return For fully-open seekable sources, this returns the total number of \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.*/ 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 /**Get the serial number of the given link in a (possibly-chained) Ogg Opus
stream. stream.
@ -1153,7 +1431,7 @@ int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1);
the serial number of the last link. the serial number of the last link.
If the source is not seekable, this always returns the serial number If the source is not seekable, this always returns the serial number
of the current link.*/ 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 /**Get the channel count of the given link in a (possibly-chained) Ogg Opus
stream. stream.
@ -1170,11 +1448,15 @@ opus_uint32 op_serialno(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
the channel count of the last link. the channel count of the last link.
If the source is not seekable, this always returns the channel count If the source is not seekable, this always returns the channel count
of the current link.*/ 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 /**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 a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing
overhead. 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 _of The \c OggOpusFile from which to retrieve the compressed size.
\param _li The index of the link whose compressed size should be computed. \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 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), \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 \a _li wasn't less than the total number of links in
the stream, or the stream was only partially open.*/ 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 /**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. 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), \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 \a _li wasn't less than the total number of links in
the stream, or the stream was only partially open.*/ 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 /**Get the ID header information for the given link in a (possibly chained) Ogg
Opus stream. 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 information for the current link is always returned, if
available. available.
\return The contents of the ID header for the given link.*/ \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 /**Get the comment header information for the given link in a (possibly
chained) Ogg Opus stream. 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 \return The contents of the comment header for the given link, or
<code>NULL</code> if this is an unseekable stream that encountered <code>NULL</code> if this is an unseekable stream that encountered
an invalid link.*/ 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. /**Retrieve the index of the current link.
This is the link that produced the data most recently read by 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() each time a new link is encountered (even though op_link_count()
always returns 1). always returns 1).
\retval #OP_EINVAL The stream was only partially open.*/ \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 /**Computes the bitrate of the stream, or of an individual link in a
stream. (possibly-chained) Ogg Opus stream.
The stream must be seekable to compute the bitrate. The stream must be seekable to compute the bitrate.
For unseekable streams, use op_bitrate_instant() to get periodic estimates. 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 _of The \c OggOpusFile from which to retrieve the bitrate.
\param _li The index of the link whose bitrate should be computed. \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. \return The bitrate on success, or a negative value on error.
\retval #OP_EINVAL The stream was only partially open, the stream was not \retval #OP_EINVAL The stream was only partially open, the stream was not
seekable, or \a _li was larger than the number of seekable, or \a _li was larger than the number of
links.*/ 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 /**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 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. \param _of The \c OggOpusFile from which to retrieve the position indicator.
\return The byte position that is currently being read from. \return The byte position that is currently being read from.
\retval #OP_EINVAL The stream was only partially open.*/ \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. /**Obtain the PCM offset of the next sample to be read.
If the stream is not properly timestamped, this might not increment by the 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. \param _of The \c OggOpusFile from which to retrieve the PCM offset.
\return The PCM offset of the next sample to be read. \return The PCM offset of the next sample to be read.
\retval #OP_EINVAL The stream was only partially open.*/ \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 not check the error return code from op_read_float() or its associated
functions. functions.
If the remote peer does not close the connection gracefully (with a TLS 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. when they reach the end of the file.
If you are reading from an <https:> URL (particularly if seeking is not If you are reading from an <https:> URL (particularly if seeking is not
supported), you should make sure to check for this error and warn the user supported), you should make sure to check for this error and warn the user
appropriately.*/ 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
<tt>libopusfile</tt> 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 <code>\a _nsamples*\a
_nchannels</code> samples in the requested
format.
\retval #OP_DEC_USE_DEFAULT No decoding was done.
<tt>libopusfile</tt> 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 <code>NULL</code> 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 /**Gain offset type that indicates that the provided offset is relative to the
header gain. header gain.
This is the default.*/ 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. \return 0 on success or a negative value on error.
\retval #OP_EINVAL The \a _gain_type was unrecognized.*/ \retval #OP_EINVAL The \a _gain_type was unrecognized.*/
int op_set_gain_offset(OggOpusFile *_of, 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 <tt>libopusfile</tt> 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. /**Reads more samples from the stream.
\note Although \a _buf_size must indicate the total number of values that \note Although \a _buf_size must indicate the total number of values that

View File

@ -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 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_GetDisplayDPI() to get the DPI information for a display
* Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick * 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: 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 * 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 * 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() * 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. * Enabled building with Mir and Wayland support by default.
* Added IBus IME support * 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_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 * Added support for multiple audio devices when using Pulseaudio
* Fixed duplicate mouse events when using relative mouse motion * Fixed duplicate mouse events when using relative mouse motion

View File

@ -19,11 +19,26 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#ifndef _SDL_config_windows_h #ifndef _SDL_config_winrt_h
#define _SDL_config_windows_h #define _SDL_config_winrt_h
#include "SDL_platform.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 <sdkddkver.h>
/* 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 */ /* This is a set of defines to configure the SDL features */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #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 #define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */ /* 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 #define SDL_THREAD_STDCPP 1
#endif
/* Enable various timer systems */ /* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1 #define SDL_TIMER_WINDOWS 1
@ -191,4 +211,4 @@ typedef unsigned int uintptr_t;
#define SDL_ASSEMBLY_ROUTINES 1 #define SDL_ASSEMBLY_ROUTINES 1
#endif #endif
#endif /* _SDL_config_windows_h */ #endif /* _SDL_config_winrt_h */

View File

@ -97,7 +97,6 @@
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
#define HAVE_POW 1 #define HAVE_POW 1
#define SDL_CDROM_DISABLED 1
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
#define SDL_AUDIO_DRIVER_OSS 1 #define SDL_AUDIO_DRIVER_OSS 1

View File

@ -171,6 +171,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
*/ */
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); 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 * Return the name for this currently opened controller
*/ */

View File

@ -106,6 +106,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
*/ */
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(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. * Return the name for this currently opened joystick.
* If no name can be found, this function returns NULL. * 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); 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); extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,2 +1,2 @@
#define SDL_REVISION "hg-9915:77cf2d1b7215" #define SDL_REVISION "hg-9959:182bfe0e7a60"
#define SDL_REVISION_NUMBER 9915 #define SDL_REVISION_NUMBER 9959

Binary file not shown.

Binary file not shown.

View File

@ -71,7 +71,7 @@
<a href="http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9">Vorbis <a href="http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9">Vorbis
mappings</a>. mappings</a>.
A special stereo API can convert everything to 2 channels, making it simple 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. output.
Although the <tt>libopusfile</tt> ABI provides support for the theoretical Although the <tt>libopusfile</tt> ABI provides support for the theoretical
maximum number of channels, the current implementation does not support 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, (ignoring any other streams that might be concurrently multiplexed with it,
such as a video stream). such as a video stream).
The channel count can also change between links, but if your application is The channel count can also change between links.
not prepared to deal with this, it can use the stereo API to ensure the If your application is not prepared to deal with this, it can use the stereo
audio from all links will always get decoded into a common format. API to ensure the audio from all links will always get decoded into a
common format.
Since <tt>libopusfile</tt> always decodes to 48&nbsp;kHz, you do not have to Since <tt>libopusfile</tt> always decodes to 48&nbsp;kHz, you do not have to
worry about the sample rate changing between links (as was possible with worry about the sample rate changing between links (as was possible with
Vorbis). Vorbis).
@ -108,6 +109,8 @@ extern "C" {
# include <ogg/ogg.h> # include <ogg/ogg.h>
# include <opus/opus_multistream.h> # include <opus/opus_multistream.h>
/**@cond PRIVATE*/
/*Enable special features for gcc and gcc-compatible compilers.*/ /*Enable special features for gcc and gcc-compatible compilers.*/
# if !defined(OP_GNUC_PREREQ) # if !defined(OP_GNUC_PREREQ)
# if defined(__GNUC__)&&defined(__GNUC_MINOR__) # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
@ -122,9 +125,12 @@ extern "C" {
# pragma GCC visibility push(default) # pragma GCC visibility push(default)
# endif # endif
typedef struct OpusHead OpusHead; typedef struct OpusHead OpusHead;
typedef struct OpusTags OpusTags; typedef struct OpusTags OpusTags;
typedef struct OggOpusFile OggOpusFile; typedef struct OpusPictureTag OpusPictureTag;
typedef struct OpusServerInfo OpusServerInfo;
typedef struct OpusFileCallbacks OpusFileCallbacks;
typedef struct OggOpusFile OggOpusFile;
/*Warning attributes for libopusfile functions.*/ /*Warning attributes for libopusfile functions.*/
# if OP_GNUC_PREREQ(3,4) # if OP_GNUC_PREREQ(3,4)
@ -138,6 +144,8 @@ typedef struct OggOpusFile OggOpusFile;
# define OP_ARG_NONNULL(_x) # define OP_ARG_NONNULL(_x)
# endif # endif
/**@endcond*/
/**\defgroup error_codes Error Codes*/ /**\defgroup error_codes Error Codes*/
/*@{*/ /*@{*/
/**\name List of possible error codes /**\name List of possible error codes
@ -301,6 +309,87 @@ struct OpusTags{
char *vendor; 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:
<ol start="0">
<li>Other</li>
<li>32x32 pixels 'file icon' (PNG only)</li>
<li>Other file icon</li>
<li>Cover (front)</li>
<li>Cover (back)</li>
<li>Leaflet page</li>
<li>Media (e.g. label side of CD)</li>
<li>Lead artist/lead performer/soloist</li>
<li>Artist/performer</li>
<li>Conductor</li>
<li>Band/Orchestra</li>
<li>Composer</li>
<li>Lyricist/text writer</li>
<li>Recording Location</li>
<li>During recording</li>
<li>During performance</li>
<li>Movie/video screen capture</li>
<li>A bright colored fish</li>
<li>Illustration</li>
<li>Band/artist logotype</li>
<li>Publisher/Studio logotype</li>
</ol>
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 <code>"-->"</code> 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 (<em>not</em>
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
<ul>
<li>#OP_PIC_FORMAT_UNKNOWN,</li>
<li>#OP_PIC_FORMAT_URL,</li>
<li>#OP_PIC_FORMAT_JPEG,</li>
<li>#OP_PIC_FORMAT_PNG, or</li>
<li>#OP_PIC_FORMAT_GIF.</li>
</ul>*/
int format;
};
/**\name Functions for manipulating header data /**\name Functions for manipulating header data
These functions manipulate the #OpusHead and #OpusTags structures, 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. for validity.
\param[in] _data The contents of the 'comment' header packet. \param[in] _data The contents of the 'comment' header packet.
\param _len The number of bytes of data in the 'info' 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" \retval #OP_ENOTFORMAT If the data does not start with the "OpusTags"
string. string.
\retval #OP_EBADHEADER If the contents of the packet otherwise violate the \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, OP_WARN_UNUSED_RESULT int opus_tags_parse(OpusTags *_tags,
const unsigned char *_data,size_t _len) OP_ARG_NONNULL(2); 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. /**Initializes an #OpusTags structure.
This should be called on a freshly allocated #OpusTags structure before This should be called on a freshly allocated #OpusTags structure before
attempting to use it. 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 On error, no value is returned, and the previous
contents remain unchanged. contents remain unchanged.
\return 0 on success, or a negative value on error. \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) int opus_tags_get_track_gain(const OpusTags *_tags,int *_gain_q8)
OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); 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.*/ \param _tags The #OpusTags structure to clear.*/
void opus_tags_clear(OpusTags *_tags) OP_ARG_NONNULL(1); 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.*/ They may be expanded in the future.*/
/*@{*/ /*@{*/
/**@cond PRIVATE*/
/*These are the raw numbers used to define the request codes. /*These are the raw numbers used to define the request codes.
They should not be used directly.*/ They should not be used directly.*/
#define OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST (6464) #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_PORT_REQUEST (6592)
#define OP_HTTP_PROXY_USER_REQUEST (6656) #define OP_HTTP_PROXY_USER_REQUEST (6656)
#define OP_HTTP_PROXY_PASS_REQUEST (6720) #define OP_HTTP_PROXY_PASS_REQUEST (6720)
#define OP_GET_SERVER_INFO_REQUEST (6784)
#define OP_URL_OPT(_request) ((_request)+(char *)0) #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.*/ provided to one of the URL options.*/
#define OP_CHECK_INT(_x) ((void)((_x)==(opus_int32)0),(opus_int32)(_x)) #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_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 <code>NULL</code> if there was no <code>icy-name</code> or
<code>ice-name</code> header.*/
char *name;
/**A short description of the server (icy-description/ice-description).
This is <code>NULL</code> if there was no <code>icy-description</code> or
<code>ice-description</code> header.*/
char *description;
/**The genre the server falls under (icy-genre/ice-genre).
This is <code>NULL</code> if there was no <code>icy-genre</code> or
<code>ice-genre</code> header.*/
char *genre;
/**The homepage for the server (icy-url/ice-url).
This is <code>NULL</code> if there was no <code>icy-url</code> or
<code>ice-url</code> header.*/
char *url;
/**The software used by the origin server (Server).
This is <code>NULL</code> if there was no <code>Server</code> header.*/
char *server;
/**The media type of the entity sent to the recepient (Content-Type).
This is <code>NULL</code> if there was no <code>Content-Type</code>
header.*/
char *content_type;
/**The nominal stream bitrate in kbps (icy-br/ice-bitrate).
This is <code>-1</code> if there was no <code>icy-br</code> or
<code>ice-bitrate</code> header.*/
opus_int32 bitrate_kbps;
/**Flag indicating whether the server is public (<code>1</code>) or not
(<code>0</code>) (icy-pub/ice-public).
This is <code>-1</code> if there was no <code>icy-pub</code> or
<code>ice-public</code> header.*/
int is_public;
/**Flag indicating whether the server is using HTTPS instead of HTTP.
This is <code>0</code> 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 <tt>libopusurl</tt>.*/
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 <tt>libopusurl</tt>.*/
void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1);
/**Skip the certificate check when connecting via TLS/SSL (https). /**Skip the certificate check when connecting via TLS/SSL (https).
\param _b <code>opus_int32</code>: Whether or not to skip the certificate \param _b <code>opus_int32</code>: 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) \ #define OP_HTTP_PROXY_PASS(_pass) \
OP_URL_OPT(OP_HTTP_PROXY_PASS_REQUEST),OP_CHECK_CONST_CHAR_PTR(_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.*/ block of memory, or URLs.*/
/*@{*/ /*@{*/
typedef struct OpusFileCallbacks OpusFileCallbacks;
/**Reads up to \a _nbytes bytes of data from \a _stream. /**Reads up to \a _nbytes bytes of data from \a _stream.
\param _stream The stream to read from. \param _stream The stream to read from.
\param[out] _ptr The buffer to store the data in. \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. takes a va_list instead of a variable number of arguments.
It does not call the <code>va_end</code> macro, and because it invokes the It does not call the <code>va_end</code> macro, and because it invokes the
<code>va_arg</code> macro, the value of \a _ap is undefined after the call. <code>va_arg</code> macro, the value of \a _ap is undefined after the call.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\param[out] _cb The callbacks to use for this stream. \param[out] _cb The callbacks to use for this stream.
If there is an error creating the stream, nothing will If there is an error creating the stream, nothing will
be filled in here. be filled in here.
@ -706,6 +957,10 @@ OP_WARN_UNUSED_RESULT void *op_mem_stream_create(OpusFileCallbacks *_cb,
schemes are supported. schemes are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always fail. 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. \param[in,out] _ap A list of the \ref url_options "optional flags" to use.
This is a variable-length list of options terminated This is a variable-length list of options terminated
with <code>NULL</code>. with <code>NULL</code>.
@ -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, 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); 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 <tt>libopusurl</tt>.
\param[out] _cb The callbacks to use for this stream. \param[out] _cb The callbacks to use for this stream.
If there is an error creating the stream, nothing will be If there is an error creating the stream, nothing will be
filled in here. filled in here.
@ -723,6 +979,10 @@ OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb,
are supported. are supported.
Both <http:> and <https:> may be disabled at compile time, Both <http:> and <https:> may be disabled at compile time,
in which case opening such URLs will always fail. 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. \param ... The \ref url_options "optional flags" to use.
This is a variable-length list of options terminated with This is a variable-length list of options terminated with
<code>NULL</code>. <code>NULL</code>.
@ -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. takes a va_list instead of a variable number of arguments.
It does not call the <code>va_end</code> macro, and because it invokes the It does not call the <code>va_end</code> macro, and because it invokes the
<code>va_arg</code> macro, the value of \a _ap is undefined after the call. <code>va_arg</code> macro, the value of \a _ap is undefined after the call.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\param _url The URL to open. \param _url The URL to open.
Currently only the <file:>, <http:>, and <https:> Currently only the <file:>, <http:>, and <https:>
schemes are supported. schemes are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always time, in which case opening such URLs will always
fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want You may pass in <code>NULL</code> if you don't want
the failure code. 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); int *_error,va_list _ap) OP_ARG_NONNULL(1);
/**Open a stream from a URL. /**Open a stream from a URL.
However, this approach will not work for live streams or HTTP/1.0 servers \note If you use this function, you must link against <tt>libopusurl</tt>.
(which do not support Range requets).
\param _url The URL to open. \param _url The URL to open.
Currently only the <file:>, <http:>, and <https:> schemes Currently only the <file:>, <http:>, and <https:> schemes
are supported. are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want the You may pass in <code>NULL</code> if you don't want the
failure code. 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. takes a va_list instead of a variable number of arguments.
It does not call the <code>va_end</code> macro, and because it invokes the It does not call the <code>va_end</code> macro, and because it invokes the
<code>va_arg</code> macro, the value of \a _ap is undefined after the call. <code>va_arg</code> macro, the value of \a _ap is undefined after the call.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\see op_test_url \see op_test_url
\see op_test_callbacks \see op_test_callbacks
\param _url The URL to open. \param _url The URL to open.
@ -962,6 +1231,10 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_memory(const unsigned char *_data,
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always time, in which case opening such URLs will always
fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want You may pass in <code>NULL</code> if you don't want
the failure code. 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); int *_error,va_list _ap) OP_ARG_NONNULL(1);
/**Partially open a stream from a URL. /**Partially open a stream from a URL.
\note If you use this function, you must link against <tt>libopusurl</tt>.
\see op_test_callbacks \see op_test_callbacks
\param _url The URL to open. \param _url The URL to open.
Currently only the <file:>, <http:>, and <https:> Currently only the <file:>, <http:>, and <https:>
schemes are supported. schemes are supported.
Both <http:> and <https:> may be disabled at compile Both <http:> and <https:> may be disabled at compile
time, in which case opening such URLs will always fail. 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. \param[out] _error Returns 0 on success, or a failure code on error.
You may pass in <code>NULL</code> if you don't want the You may pass in <code>NULL</code> if you don't want the
failure code. failure code.
@ -1128,7 +1406,7 @@ void op_free(OggOpusFile *_of);
This function may be called on partially-opened streams. This function may be called on partially-opened streams.
\param _of The \c OggOpusFile whose seekable status is to be returned. \param _of The \c OggOpusFile whose seekable status is to be returned.
\return A non-zero value if seekable, and 0 if unseekable.*/ \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. /**Returns the number of links in this chained stream.
This function may be called on partially-opened streams, but it will always 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. 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. \param _of The \c OggOpusFile from which to retrieve the link count.
\return For fully-open seekable sources, this returns the total number of \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.*/ 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 /**Get the serial number of the given link in a (possibly-chained) Ogg Opus
stream. stream.
@ -1153,7 +1431,7 @@ int op_link_count(OggOpusFile *_of) OP_ARG_NONNULL(1);
the serial number of the last link. the serial number of the last link.
If the source is not seekable, this always returns the serial number If the source is not seekable, this always returns the serial number
of the current link.*/ 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 /**Get the channel count of the given link in a (possibly-chained) Ogg Opus
stream. stream.
@ -1170,11 +1448,15 @@ opus_uint32 op_serialno(OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
the channel count of the last link. the channel count of the last link.
If the source is not seekable, this always returns the channel count If the source is not seekable, this always returns the channel count
of the current link.*/ 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 /**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 a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing
overhead. 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 _of The \c OggOpusFile from which to retrieve the compressed size.
\param _li The index of the link whose compressed size should be computed. \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 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), \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 \a _li wasn't less than the total number of links in
the stream, or the stream was only partially open.*/ 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 /**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. 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), \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 \a _li wasn't less than the total number of links in
the stream, or the stream was only partially open.*/ 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 /**Get the ID header information for the given link in a (possibly chained) Ogg
Opus stream. 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 information for the current link is always returned, if
available. available.
\return The contents of the ID header for the given link.*/ \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 /**Get the comment header information for the given link in a (possibly
chained) Ogg Opus stream. 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 \return The contents of the comment header for the given link, or
<code>NULL</code> if this is an unseekable stream that encountered <code>NULL</code> if this is an unseekable stream that encountered
an invalid link.*/ 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. /**Retrieve the index of the current link.
This is the link that produced the data most recently read by 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() each time a new link is encountered (even though op_link_count()
always returns 1). always returns 1).
\retval #OP_EINVAL The stream was only partially open.*/ \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 /**Computes the bitrate of the stream, or of an individual link in a
stream. (possibly-chained) Ogg Opus stream.
The stream must be seekable to compute the bitrate. The stream must be seekable to compute the bitrate.
For unseekable streams, use op_bitrate_instant() to get periodic estimates. 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 _of The \c OggOpusFile from which to retrieve the bitrate.
\param _li The index of the link whose bitrate should be computed. \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. \return The bitrate on success, or a negative value on error.
\retval #OP_EINVAL The stream was only partially open, the stream was not \retval #OP_EINVAL The stream was only partially open, the stream was not
seekable, or \a _li was larger than the number of seekable, or \a _li was larger than the number of
links.*/ 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 /**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 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. \param _of The \c OggOpusFile from which to retrieve the position indicator.
\return The byte position that is currently being read from. \return The byte position that is currently being read from.
\retval #OP_EINVAL The stream was only partially open.*/ \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. /**Obtain the PCM offset of the next sample to be read.
If the stream is not properly timestamped, this might not increment by the 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. \param _of The \c OggOpusFile from which to retrieve the PCM offset.
\return The PCM offset of the next sample to be read. \return The PCM offset of the next sample to be read.
\retval #OP_EINVAL The stream was only partially open.*/ \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 not check the error return code from op_read_float() or its associated
functions. functions.
If the remote peer does not close the connection gracefully (with a TLS 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. when they reach the end of the file.
If you are reading from an <https:> URL (particularly if seeking is not If you are reading from an <https:> URL (particularly if seeking is not
supported), you should make sure to check for this error and warn the user supported), you should make sure to check for this error and warn the user
appropriately.*/ 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
<tt>libopusfile</tt> 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 <code>\a _nsamples*\a
_nchannels</code> samples in the requested
format.
\retval #OP_DEC_USE_DEFAULT No decoding was done.
<tt>libopusfile</tt> 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 <code>NULL</code> 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 /**Gain offset type that indicates that the provided offset is relative to the
header gain. header gain.
This is the default.*/ 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. \return 0 on success or a negative value on error.
\retval #OP_EINVAL The \a _gain_type was unrecognized.*/ \retval #OP_EINVAL The \a _gain_type was unrecognized.*/
int op_set_gain_offset(OggOpusFile *_of, 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 <tt>libopusfile</tt> 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. /**Reads more samples from the stream.
\note Although \a _buf_size must indicate the total number of values that \note Although \a _buf_size must indicate the total number of values that