Class OpusFile
- java.lang.Object
-
- org.lwjgl.util.opus.OpusFile
-
public class OpusFile extends java.lang.ObjectIntroduction
This is the documentation for the libopusfile C API.
The libopusfile package provides a convenient high-level API for decoding and basic manipulation of all Ogg Opus audio streams. libopusfile is implemented as a layer on top of Xiph.Org's reference libogg and libopus libraries.
libopusfile provides several sets of built-in routines for file/stream access, and may also use custom stream I/O routines provided by the embedded environment. There are built-in I/O routines provided for ANSI-compliant
stdio(FILE *), memory buffers, and URLs (includingfile:URLs, plus optionallyhttp:andhttps:URLs).Organization
The main API is divided into several sections:
- stream_open_close
- stream_info
- stream_decoding
- stream_seeking
Several additional sections are not tied to the main API.
- stream_callbacks
- header_info
- error_codes
Overview
The libopusfile API always decodes files to 48 kHz. The original sample rate is not preserved by the lossy compression, though it is stored in the header to allow you to resample to it after decoding (the libopusfile API does not currently provide a resampler, but the the Speex resampler is a good choice if you need one). In general, if you are playing back the audio, you should leave it at 48 kHz, provided your audio hardware supports it. When decoding to a file, it may be worth resampling back to the original sample rate, so as not to surprise users who might not expect the sample rate to change after encoding to Opus and decoding.
Opus files can contain anywhere from 1 to 255 channels of audio. The channel mappings for up to 8 channels are the same as the Vorbis mappings. A special stereo API can convert everything to 2 channels, making it simple to support multichannel files in an application which only has stereo output. Although the libopusfile ABI provides support for the theoretical maximum number of channels, the current implementation does not support files with more than 8 channels, as they do not have well-defined channel mappings.
Like all Ogg files, Opus files may be "chained". That is, multiple Opus files may be combined into a single, longer file just by concatenating the original files. This is commonly done in internet radio streaming, as it allows the title and artist to be updated each time the song changes, since each link in the chain includes its own set of metadata.
libopusfile fully supports chained files. It will decode the first Opus stream found in each link of a chained file (ignoring any other streams that might be concurrently multiplexed with it, such as a video stream).
The channel count can also change between links. If your application is not prepared to deal with this, it can use the stereo API to ensure the audio from all links will always get decoded into a common format. Since libopusfile always decodes to 48 kHz, you do not have to worry about the sample rate changing between links (as was possible with Vorbis). This makes application support for chained files with libopusfile very easy.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpusFile.FunctionsContains the function pointers loaded fromOpus.getLibrary().
-
Field Summary
Fields Modifier and Type Field Description static intOP_ABSOLUTE_GAINGain offset type that indicates that the provided offset should be used as the gain directly, without applying any the header or track gains.static intOP_ALBUM_GAINGain offset type that indicates that the provided offset is relative to theR128_ALBUM_GAINvalue (if any), in addition to the header gain.static intOP_DEC_FORMAT_FLOATIndicates that the decoding callback should produce 32-bit native-endian float samples.static intOP_DEC_FORMAT_SHORTIndicates that the decoding callback should produce signed 16-bit native-endian output samples.static intOP_DEC_USE_DEFAULTIndicates that the decoding callback did not decode anything, and that libopusfile should decode normally instead.static intOP_EBADHEADER
OP_EBADLINK
OP_EBADPACKET
OP_EBADTIMESTAMP
OP_EFAULT
OP_EIMPL
OP_EINVAL
OP_ENOSEEK
OP_ENOTAUDIO
OP_ENOTFORMAT
OP_EOF
OP_EREAD
OP_EVERSION
OP_FALSEError codes.static intOP_GET_SERVER_INFO_REQUESTThese are the raw numbers used to define the request codes.static intOP_HEADER_GAINGain offset type that indicates that the provided offset is relative to the header gain.static intOP_HOLEError codes.static intOP_HTTP_PROXY_HOST_REQUEST
OP_HTTP_PROXY_PASS_REQUEST
OP_HTTP_PROXY_PORT_REQUEST
OP_HTTP_PROXY_USER_REQUESTThese are the raw numbers used to define the request codes.static intOP_PIC_FORMAT_GIF
OP_PIC_FORMAT_JPEG
OP_PIC_FORMAT_PNG
OP_PIC_FORMAT_UNKNOWN
OP_PIC_FORMAT_URLPicture tag image formats.static intOP_SSL_SKIP_CERTIFICATE_CHECK_REQUESTThese are the raw numbers used to define the request codes.static intOP_TRACK_GAINGain offset type that indicates that the provided offset is relative to theR128_TRACK_GAINvalue (if any), in addition to the header gain.static intOPUS_CHANNEL_COUNT_MAX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longnop_fdopen(long _cb, int _fd, long _mode)Unsafe version of:op_fdopen(org.lwjgl.util.opus.OpusFileCallbacks, int, java.nio.ByteBuffer)static longnop_fopen(long _cb, long _path, long _mode)static longnop_freopen(long _cb, long _path, long _mode, long _stream)static longnop_head(long _of, int _li)Unsafe version of:op_head(long, int)static longnop_mem_stream_create(long _cb, long _data, long _size)static longnop_open_callbacks(long _stream, long _cb, long _initial_data, long _initial_bytes, long _error)static longnop_open_file(long _path, long _error)Unsafe version of:op_open_file(java.nio.ByteBuffer, java.nio.IntBuffer)static longnop_open_memory(long _data, long _size, long _error)Unsafe version of:op_open_memory(java.nio.ByteBuffer, java.nio.IntBuffer)static intnop_read(long _of, long _pcm, int _buf_size, long _li)Unsafe version of:op_read(long, java.nio.ShortBuffer, java.nio.IntBuffer)static intnop_read_float(long _of, long _pcm, int _buf_size, long _li)Unsafe version of:op_read_float(long, java.nio.FloatBuffer, java.nio.IntBuffer)static intnop_read_float_stereo(long _of, long _pcm, int _buf_size)Unsafe version of:op_read_float_stereo(long, java.nio.FloatBuffer)static intnop_read_stereo(long _of, long _pcm, int _buf_size)Unsafe version of:op_read_stereo(long, java.nio.ShortBuffer)static voidnop_set_decode_callback(long _of, long _decode_cb, long _ctx)Unsafe version of:op_set_decode_callback(long, org.lwjgl.util.opus.OPDecodeCBFuncI, long)static longnop_tags(long _of, int _li)Unsafe version of:op_tags(long, int)static intnop_test(long _head, long _initial_data, long _initial_bytes)Unsafe version of:op_test(org.lwjgl.util.opus.OpusHead, java.nio.ByteBuffer)static longnop_test_callbacks(long _stream, long _cb, long _initial_data, long _initial_bytes, long _error)static longnop_test_file(long _path, long _error)Unsafe version of:op_test_file(java.nio.ByteBuffer, java.nio.IntBuffer)static longnop_test_memory(long _data, long _size, long _error)Unsafe version of:op_test_memory(java.nio.ByteBuffer, java.nio.IntBuffer)static longnopus_granule_sample(long _head, long _gp)Unsafe version of:granule_samplestatic intnopus_head_parse(long _head, long _data, long _len)Unsafe version of:head_parsestatic voidnopus_picture_tag_clear(long _pic)Unsafe version of:picture_tag_clearstatic voidnopus_picture_tag_init(long _pic)Unsafe version of:picture_tag_initstatic intnopus_picture_tag_parse(long _pic, long _tag)Unsafe version of:picture_tag_parsestatic intnopus_tagcompare(long _tag_name, long _comment)Unsafe version of:tagcomparestatic intnopus_tagncompare(long _tag_name, int _tag_len, long _comment)Unsafe version of:tagncomparestatic intnopus_tags_add(long _tags, long _tag, long _value)Unsafe version of:tags_addstatic intnopus_tags_add_comment(long _tags, long _comment)Unsafe version of:tags_add_commentstatic voidnopus_tags_clear(long _tags)Unsafe version of:tags_clearstatic intnopus_tags_copy(long _dst, long _src)Unsafe version of:tags_copystatic intnopus_tags_get_album_gain(long _tags, long _gain_q8)Unsafe version of:tags_get_album_gainstatic longnopus_tags_get_binary_suffix(long _tags, long _len)Unsafe version of:tags_get_binary_suffixstatic intnopus_tags_get_track_gain(long _tags, long _gain_q8)Unsafe version of:tags_get_track_gainstatic voidnopus_tags_init(long _tags)Unsafe version of:tags_initstatic intnopus_tags_parse(long _tags, long _data, long _len)Unsafe version of:tags_parsestatic longnopus_tags_query(long _tags, long _tag, int _count)Unsafe version of:tags_querystatic intnopus_tags_query_count(long _tags, long _tag)Unsafe version of:tags_query_countstatic intnopus_tags_set_binary_suffix(long _tags, long _data, int _len)Unsafe version of:tags_set_binary_suffixstatic intop_bitrate(long _of, int _li)Computes the bitrate of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream.static intop_bitrate_instant(long _of)Compute the instantaneous bitrate, measured as the ratio of bits to playable samples decoded since the last call toop_bitrate_instant(), the last seek, or the start of playback, whichever was most recent.static intop_channel_count(long _of, int _li)Get the channel count of the given link in a (possibly-chained) Ogg Opus stream.static intop_current_link(long _of)Retrieve the index of the current link.static longop_fdopen(OpusFileCallbacks _cb, int _fd, java.lang.CharSequence _mode)Opens a stream withfdopen()and fills in a set of callbacks that can be used to access it.static longop_fdopen(OpusFileCallbacks _cb, int _fd, java.nio.ByteBuffer _mode)Opens a stream withfdopen()and fills in a set of callbacks that can be used to access it.static longop_fopen(OpusFileCallbacks _cb, java.lang.CharSequence _path, java.lang.CharSequence _mode)Opens a stream withfopen()and fills in a set of callbacks that can be used to access it.static longop_fopen(OpusFileCallbacks _cb, java.nio.ByteBuffer _path, java.nio.ByteBuffer _mode)Opens a stream withfopen()and fills in a set of callbacks that can be used to access it.static voidop_free(long _of)Release all memory used by anOggOpusFile.static longop_freopen(OpusFileCallbacks _cb, java.lang.CharSequence _path, java.lang.CharSequence _mode, long _stream)Opens a stream withfreopen()and fills in a set of callbacks that can be used to access it.static longop_freopen(OpusFileCallbacks _cb, java.nio.ByteBuffer _path, java.nio.ByteBuffer _mode, long _stream)Opens a stream withfreopen()and fills in a set of callbacks that can be used to access it.static OpusHeadop_head(long _of, int _li)Get the ID header information for the given link in a (possibly chained) Ogg Opus stream.static intop_link_count(long _of)Returns the number of links in this chained stream.static longop_mem_stream_create(OpusFileCallbacks _cb, java.nio.ByteBuffer _data)Creates a stream that reads from the given block of memory.static longop_open_callbacks(long _stream, OpusFileCallbacks _cb, java.nio.ByteBuffer _initial_data, java.nio.IntBuffer _error)Open a stream using the given set of callbacks to access it.static longop_open_file(java.lang.CharSequence _path, java.nio.IntBuffer _error)Open a stream from the given file path.static longop_open_file(java.nio.ByteBuffer _path, java.nio.IntBuffer _error)Open a stream from the given file path.static longop_open_memory(java.nio.ByteBuffer _data, java.nio.IntBuffer _error)Open a stream from a memory buffer.static intop_pcm_seek(long _of, long _pcm_offset)Seek to the specified PCM offset, such that decoding will begin at exactly the requested position.static longop_pcm_tell(long _of)Obtain the PCM offset of the next sample to be read.static longop_pcm_total(long _of, int _li)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.static intop_raw_seek(long _of, long _byte_offset)Seek to a byte offset relative to the compressed data.static longop_raw_tell(long _of)Obtain the current value of the position indicator for_of.static longop_raw_total(long _of, int _li)Get the total (compressed) size of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing overhead.static intop_read(long _of, java.nio.ShortBuffer _pcm, java.nio.IntBuffer _li)Reads more samples from the stream.static intop_read_float(long _of, java.nio.FloatBuffer _pcm, java.nio.IntBuffer _li)Reads more samples from the stream.static intop_read_float_stereo(long _of, java.nio.FloatBuffer _pcm)Reads more samples from the stream and downmixes to stereo, if necessary.static intop_read_stereo(long _of, java.nio.ShortBuffer _pcm)Reads more samples from the stream and downmixes to stereo, if necessary.static booleanop_seekable(long _of)Returns whether or not the stream being read is seekable.static intop_serialno(long _of, int _li)Get the serial number of the given link in a (possibly-chained) Ogg Opus stream.static voidop_set_decode_callback(long _of, OPDecodeCBFuncI _decode_cb, long _ctx)Sets the packet decode callback function.static voidop_set_dither_enabled(long _of, boolean _enabled)Sets whether or not dithering is enabled for 16-bit decoding.static intop_set_gain_offset(long _of, int _gain_type, int _gain_offset_q8)Sets the gain to be used for decoded output.static OpusTagsop_tags(long _of, int _li)Get the comment header information for the given link in a (possibly chained) Ogg Opus stream.static intop_test(OpusHead _head, java.nio.ByteBuffer _initial_data)Test to see if this is an Opus stream.static longop_test_callbacks(long _stream, OpusFileCallbacks _cb, java.nio.ByteBuffer _initial_data, java.nio.IntBuffer _error)Partially open a stream using the given set of callbacks to access it.static longop_test_file(java.lang.CharSequence _path, java.nio.IntBuffer _error)Partially open a stream from the given file path.static longop_test_file(java.nio.ByteBuffer _path, java.nio.IntBuffer _error)Partially open a stream from the given file path.static longop_test_memory(java.nio.ByteBuffer _data, java.nio.IntBuffer _error)Partially open a stream from a memory buffer.static intop_test_open(long _of)Finish opening a stream partially opened withop_test_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)or one of the associated convenience functions.static longopus_granule_sample(OpusHead _head, long _gp)Converts a granule position to a sample offset for a given Ogg Opus stream.static intopus_head_parse(OpusHead _head, java.nio.ByteBuffer _data)Parses the contents of the ID header packet of an Ogg Opus stream.static voidopus_picture_tag_clear(OpusPictureTag _pic)Clears theOpusPictureTagstructure.static voidopus_picture_tag_init(OpusPictureTag _pic)Initializes anOpusPictureTagstructure.static intopus_picture_tag_parse(OpusPictureTag _pic, java.lang.CharSequence _tag)Parse a singleMETADATA_BLOCK_PICTUREtag.static intopus_picture_tag_parse(OpusPictureTag _pic, java.nio.ByteBuffer _tag)Parse a singleMETADATA_BLOCK_PICTUREtag.static intopus_tagcompare(java.lang.CharSequence _tag_name, java.lang.CharSequence _comment)Check if_commentis an instance of a_tag_nametag.static intopus_tagcompare(java.nio.ByteBuffer _tag_name, java.nio.ByteBuffer _comment)Check if_commentis an instance of a_tag_nametag.static intopus_tagncompare(java.lang.CharSequence _tag_name, java.lang.CharSequence _comment)Check if_commentis an instance of a_tag_nametag.static intopus_tagncompare(java.nio.ByteBuffer _tag_name, java.nio.ByteBuffer _comment)Check if_commentis an instance of a_tag_nametag.static intopus_tags_add(OpusTags _tags, java.lang.CharSequence _tag, java.lang.CharSequence _value)Add a (tag, value) pair to an initializedOpusTagsstructure.static intopus_tags_add(OpusTags _tags, java.nio.ByteBuffer _tag, java.nio.ByteBuffer _value)Add a (tag, value) pair to an initializedOpusTagsstructure.static intopus_tags_add_comment(OpusTags _tags, java.lang.CharSequence _comment)Add a comment to an initializedOpusTagsstructure.static intopus_tags_add_comment(OpusTags _tags, java.nio.ByteBuffer _comment)Add a comment to an initializedOpusTagsstructure.static voidopus_tags_clear(OpusTags _tags)Clears theOpusTagsstructure.static intopus_tags_copy(OpusTags _dst, OpusTags _src)Performs a deep copy of anOpusTagsstructure.static intopus_tags_get_album_gain(OpusTags _tags, java.nio.IntBuffer _gain_q8)Get the album gain from anR128_ALBUM_GAINtag, if one was specified.static java.nio.ByteBufferopus_tags_get_binary_suffix(OpusTags _tags)Retrieve the binary suffix data at the end of the packet (if any).static intopus_tags_get_track_gain(OpusTags _tags, java.nio.IntBuffer _gain_q8)Get the track gain from anR128_TRACK_GAINtag, if one was specified.static voidopus_tags_init(OpusTags _tags)Initializes anOpusTagsstructure.static intopus_tags_parse(OpusTags _tags, java.nio.ByteBuffer _data)Parses the contents of the 'comment' header packet of an Ogg Opus stream.static java.lang.Stringopus_tags_query(OpusTags _tags, java.lang.CharSequence _tag, int _count)Look up a comment value by its tag.static java.lang.Stringopus_tags_query(OpusTags _tags, java.nio.ByteBuffer _tag, int _count)Look up a comment value by its tag.static intopus_tags_query_count(OpusTags _tags, java.lang.CharSequence _tag)Look up the number of instances of a tag.static intopus_tags_query_count(OpusTags _tags, java.nio.ByteBuffer _tag)Look up the number of instances of a tag.static intopus_tags_set_binary_suffix(OpusTags _tags, java.nio.ByteBuffer _data)Replace the binary suffix data at the end of the packet (if any).
-
-
-
Field Detail
-
OP_FALSE, OP_EOF, OP_HOLE, OP_EREAD, OP_EFAULT, OP_EIMPL, OP_EINVAL, OP_ENOTFORMAT, OP_EBADHEADER, OP_EVERSION, OP_ENOTAUDIO, OP_EBADPACKET, OP_EBADLINK, OP_ENOSEEK, OP_EBADTIMESTAMP
Error codes.Enum values:
FALSE- A request did not succeed.EOF- Currently not used externally.HOLE- There was a hole in the page sequence numbers (e.g., a page was corrupt or missing).EREAD- An underlying read, seek, or tell operation failed when it should have succeeded.EFAULT- ANULLpointer was passed where one was unexpected, or an internal memory allocation failed, or an internal library error was encountered.EIMPL- The stream used a feature that is not implemented, such as an unsupported channel family.EINVAL- One or more parameters to a function were invalid.ENOTFORMAT- A purported Ogg Opus stream did not begin with an Ogg page, a purported header packet did not start with one of the required strings, "OpusHead" or "OpusTags", or a link in a chained file was encountered that did not contain any logical Opus streams.EBADHEADER- A required header packet was not properly formatted, contained illegal values, or was missing altogether.EVERSION- The ID header contained an unrecognized version numberENOTAUDIO- Currently not used at all.EBADPACKET- An audio packet failed to decode properly. This is usually caused by a multistream Ogg packet where the durations of the individual Opus packets contained in it are not all the same.EBADLINK- We failed to find data we had seen before, or the bitstream structure was sufficiently malformed that seeking to the target destination was impossible.ENOSEEK- An operation that requires seeking was requested on an unseekable stream.EBADTIMESTAMP- The first or last granule position of a link failed basic validity checks.
-
OPUS_CHANNEL_COUNT_MAX
- See Also:
- Constant Field Values
-
OP_PIC_FORMAT_UNKNOWN, OP_PIC_FORMAT_URL, OP_PIC_FORMAT_JPEG, OP_PIC_FORMAT_PNG, OP_PIC_FORMAT_GIF
Picture tag image formats.Enum values:
PIC_FORMAT_UNKNOWN- The MIME type was not recognized, or the image data did not match the declared MIME type.PIC_FORMAT_URL- The MIME type indicates the image data is really a URL.PIC_FORMAT_JPEG- The image is a JPEG.PIC_FORMAT_PNG- The image is a PNG.PIC_FORMAT_GIF- The image is a GIF.
-
OP_SSL_SKIP_CERTIFICATE_CHECK_REQUEST, OP_HTTP_PROXY_HOST_REQUEST, OP_HTTP_PROXY_PORT_REQUEST, OP_HTTP_PROXY_USER_REQUEST, OP_HTTP_PROXY_PASS_REQUEST, OP_GET_SERVER_INFO_REQUEST
These are the raw numbers used to define the request codes. They should not be used directly.
-
OP_DEC_FORMAT_SHORT
Indicates that the decoding callback should produce signed 16-bit native-endian output samples.
-
OP_DEC_FORMAT_FLOAT
Indicates that the decoding callback should produce 32-bit native-endian float samples.
-
OP_DEC_USE_DEFAULT
Indicates that the decoding callback did not decode anything, and that libopusfile should decode normally instead.
-
OP_HEADER_GAIN
Gain offset type that indicates that the provided offset is relative to the header gain.This is the default.
-
OP_ALBUM_GAIN
Gain offset type that indicates that the provided offset is relative to theR128_ALBUM_GAINvalue (if any), in addition to the header gain.
-
OP_TRACK_GAIN
Gain offset type that indicates that the provided offset is relative to theR128_TRACK_GAINvalue (if any), in addition to the header gain.
-
OP_ABSOLUTE_GAIN
Gain offset type that indicates that the provided offset should be used as the gain directly, without applying any the header or track gains.
-
-
Method Detail
-
nopus_head_parse
public static int nopus_head_parse(long _head, long _data, long _len)Unsafe version of:head_parse- Parameters:
_len- the number of bytes of data in the ID header packet
-
opus_head_parse
public static int opus_head_parse(OpusHead _head, java.nio.ByteBuffer _data)
Parses the contents of the ID header packet of an Ogg Opus stream.- Parameters:
_head- returns the contents of the parsed packet. The contents of this structure are untouched on error. This may beNULLto merely test the header for validity._data- the contents of the ID header packet- Returns:
- 0 on success or a negative value on error:
ENOTFORMATIf the data does not start with the "OpusHead" string.EVERSIONIf the version field signaled a version this library does not know how to parse.EIMPLIf the channel mapping family was 255, which general purpose players should not attempt to play.EBADHEADERIf the contents of the packet otherwise violate the Ogg Opus specification:- Insufficient data
- Too much data for the known minor versions
- An unrecognized channel mapping family
- Zero channels or too many channels
- Zero coded streams
- Too many coupled streams, or
- An invalid channel mapping index
-
nopus_granule_sample
public static long nopus_granule_sample(long _head, long _gp)Unsafe version of:granule_sample
-
opus_granule_sample
public static long opus_granule_sample(OpusHead _head, long _gp)
Converts a granule position to a sample offset for a given Ogg Opus stream.The sample offset is simply
_gp-_head->pre_skip. Granule position values smaller thanOpusHead::pre_skipcorrespond to audio that should never be played, and thus have no associated sample offset. This function returns-1for such values. This function also correctly handles extremely large granule positions, which may have wrapped around to a negative number when stored in a signedogg_int64_tvalue.- Parameters:
_head- theOpusHeadinformation from the ID header of the stream_gp- the granule position to convert- Returns:
- the sample offset associated with the given granule position (counting at a 48 kHz sampling rate), or the special value
-1on error (i.e., the granule position was smaller than the pre-skip amount)
-
nopus_tags_parse
public static int nopus_tags_parse(long _tags, long _data, long _len)Unsafe version of:tags_parse- Parameters:
_len- the number of bytes of data in the 'info' header packet
-
opus_tags_parse
public static int opus_tags_parse(@Nullable OpusTags _tags, java.nio.ByteBuffer _data)Parses the contents of the 'comment' header packet of an Ogg Opus stream.- Parameters:
_tags- an uninitializedOpusTagsstructure. This returns the contents of the parsed packet. The contents of this structure are untouched on error. This may beNULLto merely test the header for validity._data- the contents of the 'comment' header packet- Returns:
0: SuccessENOTFORMATIf the data does not start with the "OpusTags" stringEBADHEADERIf the contents of the packet otherwise violate the Ogg Opus specificationEFAULTIf there wasn't enough memory to store the tags
-
nopus_tags_copy
public static int nopus_tags_copy(long _dst, long _src)Unsafe version of:tags_copy
-
opus_tags_copy
public static int opus_tags_copy(OpusTags _dst, OpusTags _src)
Performs a deep copy of anOpusTagsstructure.- Parameters:
_dst- theOpusTagsstructure to copy into. If this function fails, the contents of this structure remain untouched._src- theOpusTagsstructure to copy from- Returns:
0: SuccessEFAULTIf there wasn't enough memory to copy the tags
-
nopus_tags_init
public static void nopus_tags_init(long _tags)
Unsafe version of:tags_init
-
opus_tags_init
public static void opus_tags_init(OpusTags _tags)
Initializes anOpusTagsstructure. This should be called on a freshly allocatedOpusTagsstructure before attempting to use it.- Parameters:
_tags- theOpusTagsstructure to initialize
-
nopus_tags_add
public static int nopus_tags_add(long _tags, long _tag, long _value)Unsafe version of:tags_add
-
opus_tags_add
public static int opus_tags_add(OpusTags _tags, java.nio.ByteBuffer _tag, java.nio.ByteBuffer _value) public static int opus_tags_add(OpusTags _tags, java.lang.CharSequence _tag, java.lang.CharSequence _value)
Add a (tag, value) pair to an initializedOpusTagsstructure.Note
Neither
opus_tags_add()nortags_add_commentsupport values containing embeddedNULs, although the bitstream format does support them. To add such tags, you will need to manipulate theOpusTagsstructure directly.- Parameters:
_tags- theOpusTagsstructure to add the (tag, value) pair to_tag- aNUL-terminated, case-insensitive, ASCII string containing the tag to add (without an'='character)_value- aNUL-terminated UTF-8 containing the corresponding value- Returns:
- 0 on success, or a negative value on failure:
EFAULTAn internal memory allocation failed
-
nopus_tags_add_comment
public static int nopus_tags_add_comment(long _tags, long _comment)Unsafe version of:tags_add_comment
-
opus_tags_add_comment
public static int opus_tags_add_comment(OpusTags _tags, java.nio.ByteBuffer _comment) public static int opus_tags_add_comment(OpusTags _tags, java.lang.CharSequence _comment)
Add a comment to an initializedOpusTagsstructure.Note
Neither
opus_tags_add_comment()nortags_addsupport comments containing embeddedNULs, although the bitstream format does support them. To add such tags, you will need to manipulate theOpusTagsstructure directly.- Parameters:
_tags- theOpusTagsstructure to add the comment to_comment- aNUL-terminated UTF-8 string containing the comment in"TAG=value"form- Returns:
- 0 on success, or a negative value on failure:
EFAULTAn internal memory allocation failed
-
nopus_tags_set_binary_suffix
public static int nopus_tags_set_binary_suffix(long _tags, long _data, int _len)Unsafe version of:tags_set_binary_suffix- Parameters:
_len- the number of bytes of binary data to append. This may be zero to remove any existing binary suffix data.
-
opus_tags_set_binary_suffix
public static int opus_tags_set_binary_suffix(OpusTags _tags, @Nullable java.nio.ByteBuffer _data)
Replace the binary suffix data at the end of the packet (if any).- Parameters:
_tags- an initializedOpusTagsstructure_data- a buffer of binary data to append after the encoded user comments. The least significant bit of the first byte of this data must be set (to ensure the data is preserved by other editors).- Returns:
- 0 on success, or a negative value on failure:
-
nopus_tags_query
public static long nopus_tags_query(long _tags, long _tag, int _count)Unsafe version of:tags_query
-
opus_tags_query
@Nullable public static java.lang.String opus_tags_query(OpusTags _tags, java.nio.ByteBuffer _tag, int _count) @Nullable public static java.lang.String opus_tags_query(OpusTags _tags, java.lang.CharSequence _tag, int _count)
Look up a comment value by its tag.- Parameters:
_tags- an initializedOpusTagsstructure_tag- the tag to look up_count- the instance of the tag.The same tag can appear multiple times, each with a distinct value, so an index is required to retrieve them all. The order in which these values appear is significant and should be preserved. Use
tags_query_countto get the legal range for the_countparameter.- Returns:
- a pointer to the queried tag's value.
This points directly to data in the
OpusTagsstructure. It should not be modified or freed by the application, and modifications to the structure may invalidate the pointer.NULLif no matching tag is found.
-
nopus_tags_query_count
public static int nopus_tags_query_count(long _tags, long _tag)Unsafe version of:tags_query_count
-
opus_tags_query_count
public static int opus_tags_query_count(OpusTags _tags, java.nio.ByteBuffer _tag) public static int opus_tags_query_count(OpusTags _tags, java.lang.CharSequence _tag)
Look up the number of instances of a tag.Call this first when querying for a specific tag and then iterate over the number of instances with separate calls to
tags_queryto retrieve all the values for that tag in order.- Parameters:
_tags- an initializedOpusTagsstructure_tag- the tag to look up- Returns:
- the number of instances of this particular tag
-
nopus_tags_get_binary_suffix
public static long nopus_tags_get_binary_suffix(long _tags, long _len)Unsafe version of:tags_get_binary_suffix- Parameters:
_len- returns the number of bytes of binary suffix data returned
-
opus_tags_get_binary_suffix
@Nullable public static java.nio.ByteBuffer opus_tags_get_binary_suffix(OpusTags _tags)
Retrieve the binary suffix data at the end of the packet (if any).- Parameters:
_tags- an initializedOpusTagsstructure- Returns:
- a pointer to the binary suffix data, or
NULLif none was present
-
nopus_tags_get_album_gain
public static int nopus_tags_get_album_gain(long _tags, long _gain_q8)Unsafe version of:tags_get_album_gain
-
opus_tags_get_album_gain
public static int opus_tags_get_album_gain(OpusTags _tags, java.nio.IntBuffer _gain_q8)
Get the album gain from anR128_ALBUM_GAINtag, if one was specified. This searches for the firstR128_ALBUM_GAINtag with a valid signed, 16-bit decimal integer value and returns the value. This routine is exposed merely for convenience for applications which wish to do something special with the album gain (i.e., display it). If you simply wish to apply the album gain instead of the header gain, you can useop_set_gain_offset(long, int, int)with anALBUM_GAINtype and no offset.- Parameters:
_tags- an initializedOpusTagsstructure_gain_q8- the album gain, in1/256thsof a dB. This will lie in the range[-32768,32767], and should be applied in addition to the header gain. On error, no value is returned, and the previous contents remain unchanged.- Returns:
- 0 on success, or a negative value on failure:
FALSEThere was no album gain available in the given tags
-
nopus_tags_get_track_gain
public static int nopus_tags_get_track_gain(long _tags, long _gain_q8)Unsafe version of:tags_get_track_gain
-
opus_tags_get_track_gain
public static int opus_tags_get_track_gain(OpusTags _tags, java.nio.IntBuffer _gain_q8)
Get the track gain from anR128_TRACK_GAINtag, if one was specified.This searches for the first
R128_TRACK_GAINtag with a valid signed, 16-bit decimal integer value and returns the value. This routine is exposed merely for convenience for applications which wish to do something special with the track gain (i.e., display it). If you simply wish to apply the track gain instead of the header gain, you can useop_set_gain_offset(long, int, int)with anTRACK_GAINtype and no offset.- Parameters:
_tags- an initializedOpusTagsstructure_gain_q8- the track gain, in1/256thsof a dB. This will lie in the range[-32768,32767], and should be applied in addition to the header gain. On error, no value is returned, and the previous contents remain unchanged.- Returns:
- 0 on success, or a negative value on failure:
FALSEThere was no track gain available in the given tags
-
nopus_tags_clear
public static void nopus_tags_clear(long _tags)
Unsafe version of:tags_clear
-
opus_tags_clear
public static void opus_tags_clear(OpusTags _tags)
Clears theOpusTagsstructure.This should be called on an
OpusTagsstructure after it is no longer needed. It will free all memory used by the structure members.- Parameters:
_tags- theOpusTagsstructure to clear
-
nopus_tagcompare
public static int nopus_tagcompare(long _tag_name, long _comment)Unsafe version of:tagcompare
-
opus_tagcompare
public static int opus_tagcompare(java.nio.ByteBuffer _tag_name, java.nio.ByteBuffer _comment) public static int opus_tagcompare(java.lang.CharSequence _tag_name, java.lang.CharSequence _comment)Check if_commentis an instance of a_tag_nametag.- Parameters:
_tag_name- aNUL-terminated, case-insensitive, ASCII string containing the name of the tag to check for (without the terminating'='character)_comment- the comment string to check- Returns:
- an integer less than, equal to, or greater than zero if
_commentis found respectively, to be less than, to match, or be greater than a"tag=value"string whose tag matches_tag_name
-
nopus_tagncompare
public static int nopus_tagncompare(long _tag_name, int _tag_len, long _comment)Unsafe version of:tagncompare- Parameters:
_tag_len- the number of characters in the tag name. This must be non-negative.
-
opus_tagncompare
public static int opus_tagncompare(java.nio.ByteBuffer _tag_name, java.nio.ByteBuffer _comment) public static int opus_tagncompare(java.lang.CharSequence _tag_name, java.lang.CharSequence _comment)Check if_commentis an instance of a_tag_nametag.This version is slightly more efficient than
tagcompareif the length of the tag name is already known (e.g., because it is a constant).- Parameters:
_tag_name- a case-insensitive ASCII string containing the name of the tag to check for (without the terminating'='character)_comment- the comment string to check- Returns:
- an integer less than, equal to, or greater than zero if
_commentis found respectively, to be less than, to match, or be greater than a"tag=value"string whose tag matches the first_tag_lencharacters of_tag_name
-
nopus_picture_tag_parse
public static int nopus_picture_tag_parse(long _pic, long _tag)Unsafe version of:picture_tag_parse
-
opus_picture_tag_parse
public static int opus_picture_tag_parse(OpusPictureTag _pic, java.nio.ByteBuffer _tag) public static int opus_picture_tag_parse(OpusPictureTag _pic, java.lang.CharSequence _tag)
Parse a singleMETADATA_BLOCK_PICTUREtag.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::formatfield 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.- Parameters:
_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.
_tag- theMETADATA_BLOCK_PICTUREtag contents. The leading"METADATA_BLOCK_PICTURE="portion is optional, to allow the function to be used on either directly on the values inOpusTags::user_commentsor on the return value oftags_query.- Returns:
- 0 on success, or a negative value on failure:
ENOTFORMATThe METADATA_BLOCK_PICTURE contents were not validEFAULTThere was not enough memory to store the picture tag contents
-
nopus_picture_tag_init
public static void nopus_picture_tag_init(long _pic)
Unsafe version of:picture_tag_init
-
opus_picture_tag_init
public static void opus_picture_tag_init(OpusPictureTag _pic)
Initializes anOpusPictureTagstructure. This should be called on a freshly allocatedOpusPictureTagstructure before attempting to use it.- Parameters:
_pic- theOpusPictureTagstructure to initialize
-
nopus_picture_tag_clear
public static void nopus_picture_tag_clear(long _pic)
Unsafe version of:picture_tag_clear
-
opus_picture_tag_clear
public static void opus_picture_tag_clear(OpusPictureTag _pic)
Clears theOpusPictureTagstructure.This should be called on an
OpusPictureTagstructure after it is no longer needed. It will free all memory used by the structure members.- Parameters:
_pic- theOpusPictureTagstructure to clear
-
nop_fopen
public static long nop_fopen(long _cb, long _path, long _mode)
-
op_fopen
public static long op_fopen(OpusFileCallbacks _cb, java.nio.ByteBuffer _path, java.nio.ByteBuffer _mode) public static long op_fopen(OpusFileCallbacks _cb, java.lang.CharSequence _path, java.lang.CharSequence _mode)
Opens a stream withfopen()and fills in a set of callbacks that can be used to access it.This is useful to avoid writing your own portable 64-bit seeking wrappers, and also avoids cross-module linking issues on Windows, where a
FILE *must be accessed by routines defined in the same module that opened it.- Parameters:
_cb- the callbacks to use for this file. If there is an error opening the file, nothing will be filled in here._path- the path to the file to open. On Windows, this string must be UTF-8 (to allow access to files whose names cannot be represented in the current MBCS code page). All other systems use the native character encoding._mode- the mode to open the file in- Returns:
- a stream handle to use with the callbacks, or
NULLon error
-
nop_fdopen
public static long nop_fdopen(long _cb, int _fd, long _mode)Unsafe version of:op_fdopen(org.lwjgl.util.opus.OpusFileCallbacks, int, java.nio.ByteBuffer)
-
op_fdopen
public static long op_fdopen(OpusFileCallbacks _cb, int _fd, java.nio.ByteBuffer _mode) public static long op_fdopen(OpusFileCallbacks _cb, int _fd, java.lang.CharSequence _mode)
Opens a stream withfdopen()and fills in a set of callbacks that can be used to access it.This is useful to avoid writing your own portable 64-bit seeking wrappers, and also avoids cross-module linking issues on Windows, where a
FILE *must be accessed by routines defined in the same module that opened it.- Parameters:
_cb- the callbacks to use for this file. If there is an error opening the file, nothing will be filled in here._fd- the file descriptor to open_mode- the mode to open the file in- Returns:
- a stream handle to use with the callbacks, or
NULLon error
-
nop_freopen
public static long nop_freopen(long _cb, long _path, long _mode, long _stream)
-
op_freopen
public static long op_freopen(OpusFileCallbacks _cb, java.nio.ByteBuffer _path, java.nio.ByteBuffer _mode, long _stream) public static long op_freopen(OpusFileCallbacks _cb, java.lang.CharSequence _path, java.lang.CharSequence _mode, long _stream)
Opens a stream withfreopen()and fills in a set of callbacks that can be used to access it.This is useful to avoid writing your own portable 64-bit seeking wrappers, and also avoids cross-module linking issues on Windows, where a
FILE *must be accessed by routines defined in the same module that opened it.- Parameters:
_cb- the callbacks to use for this file. If there is an error opening the file, nothing will be filled in here._path- the path to the file to open. On Windows, this string must be UTF-8 (to allow access to files whose names cannot be represented in the current MBCS code page). All other systems use the native character encoding._mode- the mode to open the file in_stream- a stream previously returned byop_fopen(org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.ByteBuffer),op_fdopen(org.lwjgl.util.opus.OpusFileCallbacks, int, java.nio.ByteBuffer), orop_freopen(org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.ByteBuffer, long)- Returns:
- a stream handle to use with the callbacks, or
NULLon error
-
nop_mem_stream_create
public static long nop_mem_stream_create(long _cb, long _data, long _size)- Parameters:
_size- the size of the block of memory
-
op_mem_stream_create
public static long op_mem_stream_create(OpusFileCallbacks _cb, java.nio.ByteBuffer _data)
Creates a stream that reads from the given block of memory.This block of memory must contain the complete stream to decode. This is useful for caching small streams (e.g., sound effects) in RAM.
- Parameters:
_cb- the callbacks to use for this stream. If there is an error creating the stream, nothing will be filled in here._data- the block of memory to read from- Returns:
- a stream handle to use with the callbacks, or
NULLon error
-
nop_test
public static int nop_test(long _head, long _initial_data, long _initial_bytes)Unsafe version of:op_test(org.lwjgl.util.opus.OpusHead, java.nio.ByteBuffer)- Parameters:
_initial_bytes- the number of bytes in_initial_data
-
op_test
public static int op_test(@Nullable OpusHead _head, java.nio.ByteBuffer _initial_data)Test to see if this is an Opus stream.For good results, you will need at least 57 bytes (for a pure Opus-only stream). Something like 512 bytes will give more reliable results for multiplexed streams. This function is meant to be a quick-rejection filter. Its purpose is not to guarantee that a stream is a valid Opus stream, but to ensure that it looks enough like Opus that it isn't going to be recognized as some other format (except possibly an Opus stream that is also multiplexed with other codecs, such as video).
- Parameters:
_head- the parsed ID header contents. You may passNULLif you do not need this information. If the function fails, the contents of this structure remain untouched._initial_data- an initial buffer of data from the start of the stream- Returns:
- 0 if the data appears to be Opus, or a negative value on error.
FALSEThere was not enough data to tell if this was an Opus stream or notEFAULTAn internal memory allocation failedEIMPLThe stream used a feature that is not implemented, such as an unsupported channel familyENOTFORMATIf the data did not contain a recognizable ID header for an Opus streamEVERSIONIf the version field signaled a version this library does not know how to parseEBADHEADERThe ID header was not properly formatted or contained illegal values
-
nop_open_file
public static long nop_open_file(long _path, long _error)Unsafe version of:op_open_file(java.nio.ByteBuffer, java.nio.IntBuffer)
-
op_open_file
public static long op_open_file(java.nio.ByteBuffer _path, @Nullable java.nio.IntBuffer _error) public static long op_open_file(java.lang.CharSequence _path, @Nullable java.nio.IntBuffer _error)Open a stream from the given file path.- Parameters:
_path- the path to the file to open_error- returns 0 on success, or a failure code on error.You may pass in
NULLif you don't want the failure code. The failure code will beEFAULTif the file could not be opened, or one of the other failure codes fromop_open_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)otherwise.- Returns:
- a freshly opened
OggOpusFile, orNULLon error
-
nop_open_memory
public static long nop_open_memory(long _data, long _size, long _error)Unsafe version of:op_open_memory(java.nio.ByteBuffer, java.nio.IntBuffer)- Parameters:
_size- the number of bytes in the buffer
-
op_open_memory
public static long op_open_memory(java.nio.ByteBuffer _data, @Nullable java.nio.IntBuffer _error)Open a stream from a memory buffer.- Parameters:
_data- the memory buffer to open_error- returns 0 on success, or a failure code on error.You may pass in
NULLif you don't want the failure code. Seeop_open_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)for a full list of failure codes.- Returns:
- a freshly opened
OggOpusFile, orNULLon error
-
nop_open_callbacks
public static long nop_open_callbacks(long _stream, long _cb, long _initial_data, long _initial_bytes, long _error)Unsafe version of:op_open_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)- Parameters:
_initial_bytes- the number of bytes in_initial_data.If the stream is seekable, its current position (as reported by
"tell()"at the start of this function) must be equal to_initial_bytes. Otherwise, seeking to absolute positions will generate inconsistent results.
-
op_open_callbacks
public static long op_open_callbacks(long _stream, OpusFileCallbacks _cb, java.nio.ByteBuffer _initial_data, @Nullable java.nio.IntBuffer _error)Open a stream using the given set of callbacks to access it.- Parameters:
_stream- the stream to read from (e.g., aFILE *). This value will be passed verbatim as the first argument to all of the callbacks._cb- the callbacks with which to access the stream."read()"must be implemented."seek()"and"tell()"may beNULL, or may always return-1to indicate a stream is unseekable, but if"seek()"is implemented and succeeds on a particular stream, then"tell()"must also."close()"may beNULL, but if it is not, it will be called when theOggOpusFileis destroyed byop_free(long). It will not be called ifop_open_callbacks()fails with an error._initial_data- an initial buffer of data from the start of the stream.Applications can read some number of bytes from the start of the stream to help identify this as an Opus stream, and then provide them here to allow the stream to be opened, even if it is unseekable.
_error- returns 0 on success, or a failure code on error.You may pass in
NULLif you don't want the failure code. The failure code will be one of:EREADAn underlying read, seek, or tell operation failed when it should have succeeded, or we failed to find data in the stream we had seen beforeEFAULTThere was a memory allocation failure, or an internal library errorEIMPLThe stream used a feature that is not implemented, such as an unsupported channel familyEINVAL"seek()"was implemented and succeeded on this source, but"tell()"did not, or the starting position indicator was not equal to_initial_bytesENOTFORMATThe stream contained a link that did not have any logical Opus streams in itEBADHEADERA required header packet was not properly formatted, contained illegal values, or was missing altogetherEVERSIONAn ID header contained an unrecognized version numberEBADLINKWe failed to find data we had seen before after seekingEBADTIMESTAMPThe first or last timestamp in a link failed basic validity checks
- Returns:
- a freshly opened
OggOpusFile, orNULLon error.libopusfile does not take ownership of the stream if the call fails. The calling application is responsible for closing the stream if this call returns an error.
-
nop_test_file
public static long nop_test_file(long _path, long _error)Unsafe version of:op_test_file(java.nio.ByteBuffer, java.nio.IntBuffer)
-
op_test_file
public static long op_test_file(java.nio.ByteBuffer _path, @Nullable java.nio.IntBuffer _error) public static long op_test_file(java.lang.CharSequence _path, @Nullable java.nio.IntBuffer _error)Partially open a stream from the given file path.- Parameters:
_path- the path to the file to open_error- returns 0 on success, or a failure code on error.You may pass in
NULLif you don't want the failure code. The failure code will beEFAULTif the file could not be opened, or one of the other failure codes fromop_open_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)otherwise.- Returns:
- a partially opened
OggOpusFile, orNULLon error
-
nop_test_memory
public static long nop_test_memory(long _data, long _size, long _error)Unsafe version of:op_test_memory(java.nio.ByteBuffer, java.nio.IntBuffer)- Parameters:
_size- the number of bytes in the buffer
-
op_test_memory
public static long op_test_memory(java.nio.ByteBuffer _data, @Nullable java.nio.IntBuffer _error)Partially open a stream from a memory buffer.- Parameters:
_data- the memory buffer to open_error- returns 0 on success, or a failure code on error.You may pass in
NULLif you don't want the failure code. Seeop_open_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)for a full list of failure codes.- Returns:
- a partially opened
OggOpusFile, orNULLon error
-
nop_test_callbacks
public static long nop_test_callbacks(long _stream, long _cb, long _initial_data, long _initial_bytes, long _error)Unsafe version of:op_test_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)- Parameters:
_initial_bytes- the number of bytes in_initial_data.If the stream is seekable, its current position (as reported by
"tell()"at the start of this function) must be equal to_initial_bytes. Otherwise, seeking to absolute positions will generate inconsistent results.
-
op_test_callbacks
public static long op_test_callbacks(long _stream, OpusFileCallbacks _cb, java.nio.ByteBuffer _initial_data, @Nullable java.nio.IntBuffer _error)Partially open a stream using the given set of callbacks to access it.This tests for Opusness and loads the headers for the first link. It does not seek (although it tests for seekability). You can query a partially open stream for the few pieces of basic information returned by
op_serialno(long, int),op_channel_count(long, int),op_head(long, int), andop_tags(long, int)(but only for the first link). You may also determine if it is seekable via a call toop_seekable(long). You cannot read audio from the stream, seek, get the size or duration, get information from links other than the first one, or even get the total number of links until you finish opening the stream withop_test_open(long). If you do not need to do any of these things, you can dispose of it withop_free(long)instead.This function is provided mostly to simplify porting existing code that used libvorbisfile. For new code, you are likely better off using
op_test(org.lwjgl.util.opus.OpusHead, java.nio.ByteBuffer)instead, which is less resource-intensive, requires less data to succeed, and imposes a hard limit on the amount of data it examines (important for unseekable streams, where all such data must be buffered until you are sure of the stream type).- Parameters:
_stream- the stream to read from (e.g., aFILE *). This value will be passed verbatim as the first argument to all of the callbacks._cb- the callbacks with which to access the stream."read()"must be implemented."seek()"and"tell()"may beNULL, or may always return-1to indicate a stream is unseekable, but if"seek()"is implemented and succeeds on a particular stream, then"tell()"must also."close()"may beNULL, but if it is not, it will be called when theOggOpusFileis destroyed byop_free(long). It will not be called ifop_open_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)fails with an error._initial_data- an initial buffer of data from the start of the stream.Applications can read some number of bytes from the start of the stream to help identify this as an Opus stream, and then provide them here to allow the stream to be tested more thoroughly, even if it is unseekable.
_error- returns 0 on success, or a failure code on error.You may pass in
NULLif you don't want the failure code. Seeop_open_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)for a full list of failure codes.- Returns:
- a partially opened
OggOpusFile, orNULLon error.libopusfile does not take ownership of the stream if the call fails. The calling application is responsible for closing the stream if this call returns an error.
-
op_test_open
public static int op_test_open(long _of)
Finish opening a stream partially opened withop_test_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)or one of the associated convenience functions.If this function fails, you are still responsible for freeing the
OggOpusFilewithop_free(long).- Parameters:
_of- theOggOpusFileto finish opening- Returns:
- 0 on success, or a negative value on error:
EREADAn underlying read, seek, or tell operation failed when it should have succeededEFAULTThere was a memory allocation failure, or an internal library errorEIMPLThe stream used a feature that is not implemented, such as an unsupported channel familyEINVALThe stream was not partially opened withop_test_callbacks(long, org.lwjgl.util.opus.OpusFileCallbacks, java.nio.ByteBuffer, java.nio.IntBuffer)or one of the associated convenience functionsENOTFORMATThe stream contained a link that did not have any logical Opus streams in itEBADHEADERA required header packet was not properly formatted, contained illegal values, or was missing altogetherEVERSIONAn ID header contained an unrecognized version numberEBADLINKWe failed to find data we had seen before after seekingEBADTIMESTAMPThe first or last timestamp in a link failed basic validity checks
-
op_free
public static void op_free(long _of)
Release all memory used by anOggOpusFile.- Parameters:
_of- theOggOpusFileto free
-
op_seekable
public static boolean op_seekable(long _of)
Returns whether or not the stream being read is seekable.This is true if
- The
"seek()"and"tell()"callbacks are both non-NULL - The
"seek()"callback was successfully executed at least once, and - The
"tell()"callback was successfully able to report the position indicator afterwards
This function may be called on partially-opened streams.
- Parameters:
_of- theOggOpusFilewhose seekable status is to be returned- Returns:
- a non-zero value if seekable, and 0 if unseekable
- The
-
op_link_count
public static int op_link_count(long _of)
Returns the number of links in this chained stream.This function may be called on partially-opened streams, but it will always return 1. The actual number of links is not known until the stream is fully opened.
- Parameters:
_of- theOggOpusFilefrom which to retrieve the link count- Returns:
- for fully-open seekable streams, this returns the total number of links in the whole stream, which will be at least 1. For partially-open or unseekable streams, this always returns 1.
-
op_serialno
public static int op_serialno(long _of, int _li)Get the serial number of the given link in a (possibly-chained) Ogg Opus stream.This function may be called on partially-opened streams, but it will always return the serial number of the Opus stream in the first link.
- Parameters:
_of- theOggOpusFilefrom which to retrieve the serial number_li- the index of the link whose serial number should be retrieved. Use a negative number to get the serial number of the current link.- Returns:
- the serial number of the given link.
If
_liis greater than the total number of links, this returns the serial number of the last link. If the stream is not seekable, this always returns the serial number of the current link.
-
op_channel_count
public static int op_channel_count(long _of, int _li)Get the channel count of the given link in a (possibly-chained) Ogg Opus stream.This is equivalent to
op_head(_of,_li)->channel_count, but is provided for convenience. This function may be called on partially-opened streams, but it will always return the channel count of the Opus stream in the first link.- Parameters:
_of- theOggOpusFilefrom which to retrieve the channel count_li- the index of the link whose channel count should be retrieved. Use a negative number to get the channel count of the current link.- Returns:
- the channel count of the given link.
If
_liis greater than the total number of links, this returns the channel count of the last link. If the stream is not seekable, this always returns the channel count of the current link.
-
op_raw_total
public static long op_raw_total(long _of, int _li)Get the total (compressed) size of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing overhead.Warning: If the Opus stream (or link) is concurrently multiplexed with other logical streams (e.g., video), this returns the size of the entire stream (or link), not just the number of bytes in the first logical Opus stream. Returning the latter would require scanning the entire file.
- Parameters:
_of- theOggOpusFilefrom which to retrieve the compressed size_li- the index of the link whose compressed size should be computed. Use a negative number to get the compressed size of the entire stream.- Returns:
- the compressed size of the entire stream if
_liis negative, the compressed size of link_liif it is non-negative, or a negative value on error.The compressed size of the entire stream may be smaller than that of the underlying stream if trailing garbage was detected in the file.
EINVALThe stream is not seekable (so we can't know the length),#_li wasn't less than the total number of links in the stream, or the stream was only partially open.
-
op_pcm_total
public static long op_pcm_total(long _of, int _li)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.Users looking for
op_time_total()should useop_pcm_total()instead. Because timestamps in Opus are fixed at 48 kHz, there is no need for a separate function to convert this to seconds (and leaving it out avoids introducing floating point to the API, for those that wish to avoid it).- Parameters:
_of- theOggOpusFilefrom which to retrieve the PCM offset_li- the index of the link whose PCM length should be computed. Use a negative number to get the PCM length of the entire stream.- Returns:
- the PCM length of the entire stream if
_liis negative, the PCM length of link_liif it is non-negative, or a negative value on error.EINVALThe stream is not seekable (so we can't know the length),_liwasn't less than the total number of links in the stream, or the stream was only partially open.
-
nop_head
public static long nop_head(long _of, int _li)Unsafe version of:op_head(long, int)
-
op_head
@Nullable public static OpusHead op_head(long _of, int _li)
Get the ID header information for the given link in a (possibly chained) Ogg Opus stream.This function may be called on partially-opened streams, but it will always return the ID header information of the Opus stream in the first link.
- Parameters:
_of- theOggOpusFilefrom which to retrieve the ID header information_li- the index of the link whose ID header information should be retrieved. Use a negative number to get the ID header information of the current link. For an unseekable stream,_liis ignored, and the ID header information for the current link is always returned, if available.- Returns:
- the contents of the ID header for the given link
-
nop_tags
public static long nop_tags(long _of, int _li)Unsafe version of:op_tags(long, int)
-
op_tags
@Nullable public static OpusTags op_tags(long _of, int _li)
Get the comment header information for the given link in a (possibly chained) Ogg Opus stream.This function may be called on partially-opened streams, but it will always return the tags from the Opus stream in the first link.
- Parameters:
_of- theOggOpusFilefrom which to retrieve the comment header information_li- the index of the link whose comment header information should be retrieved. Use a negative number to get the comment header information of the current link. For an unseekable stream,_liis ignored, and the comment header information for the current link is always returned, if available.- Returns:
- the contents of the comment header for the given link, or
NULLif this is an unseekable stream that encountered an invalid link
-
op_current_link
public static int op_current_link(long _of)
Retrieve the index of the current link.This is the link that produced the data most recently read by
op_read_float(long, java.nio.FloatBuffer, java.nio.IntBuffer)or its associated functions, or, after a seek, the link that the seek target landed in. Reading more data may advance the link index (even on the first read after a seek).- Parameters:
_of- theOggOpusFilefrom which to retrieve the current link index- Returns:
- the index of the current link on success, or a negative value on failure.
For seekable streams, this is a number between 0 (inclusive) and the value returned by
op_link_count(long)(exclusive). For unseekable streams, this value starts at 0 and increments by one each time a new link is encountered (even thoughop_link_count()always returns 1).EINVALThe stream was only partially open.
-
op_bitrate
public static int op_bitrate(long _of, int _li)Computes the bitrate of the stream, or of an individual link in a (possibly-chained) Ogg Opus stream.The stream must be seekable to compute the bitrate. For unseekable streams, use
op_bitrate_instant(long)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 withop_set_decode_callback(long, org.lwjgl.util.opus.OPDecodeCBFuncI, long)if you wish to skip actual decoding during this process.- Parameters:
_of- theOggOpusFilefrom which to retrieve the bitrate_li- the index of the link whose bitrate should be computed. Use a negative number to get the bitrate of the whole stream.- Returns:
- the bitrate on success, or a negative value on error.
EINVALThe stream was only partially open, the stream was not seekable, or_liwas larger than the number of links.
-
op_bitrate_instant
public static int op_bitrate_instant(long _of)
Compute the instantaneous bitrate, measured as the ratio of bits to playable samples decoded since- the last call to
op_bitrate_instant(), - the last seek, or
- the start of playback, whichever was most recent.
This will spike somewhat after a seek or at the start/end of a chain boundary, as pre-skip, pre-roll, and end-trimming causes samples to be decoded but not played.
- the last call to
-
op_raw_tell
public static long op_raw_tell(long _of)
Obtain the current value of the position indicator for_of.- Parameters:
_of- theOggOpusFilefrom which to retrieve the position indicator- Returns:
- the byte position that is currently being read from.
EINVALThe stream was only partially open.
-
op_pcm_tell
public static long op_pcm_tell(long _of)
Obtain the PCM offset of the next sample to be read.If the stream is not properly timestamped, this might not increment by the proper amount between reads, or even return monotonically increasing values.
- Parameters:
_of- theOggOpusFilefrom which to retrieve the PCM offset- Returns:
- the PCM offset of the next sample to be read.
EINVALThe stream was only partially open.
-
op_raw_seek
public static int op_raw_seek(long _of, long _byte_offset)Seek to a byte offset relative to the compressed data.This also scans packets to update the PCM cursor. It will cross a logical bitstream boundary, but only if it can't get any packets out of the tail of the link to which it seeks.
- Parameters:
_of- theOggOpusFilein which to seek_byte_offset- the byte position to seek to. This must be between 0 andop_raw_total(_of, -1)(inclusive).- Returns:
- 0 on success, or a negative error code on failure:
-
op_pcm_seek
public static int op_pcm_seek(long _of, long _pcm_offset)Seek to the specified PCM offset, such that decoding will begin at exactly the requested position.- Parameters:
_of- theOggOpusFilein which to seek_pcm_offset- the PCM offset to seek to. This is in samples at 48 kHz relative to the start of the stream.- Returns:
- 0 on success, or a negative value on error:
EREADAn underlying read or seek operation failedEINVALThe stream was only partially open, or the target was outside the valid range for the streamENOSEEKThis stream is not seekableEBADLINKWe failed to find data we had seen before, or the bitstream structure was sufficiently malformed that seeking to the target destination was impossible
-
nop_set_decode_callback
public static void nop_set_decode_callback(long _of, long _decode_cb, long _ctx)Unsafe version of:op_set_decode_callback(long, org.lwjgl.util.opus.OPDecodeCBFuncI, long)
-
op_set_decode_callback
public static void op_set_decode_callback(long _of, OPDecodeCBFuncI _decode_cb, long _ctx)Sets the packet decode callback function.If set, this is called once for each packet that needs to be decoded. This can be used by advanced applications to do additional processing on the compressed or uncompressed data. For example, an application might save the final entropy coder state for debugging and testing purposes, or it might apply additional filters before the downmixing, dithering, or soft-clipping performed by
libopusfile, so long as these filters do not introduce any latency.A call to this function is no guarantee that the audio will eventually be delivered to the application. libopusfile may discard some or all of the decoded audio data (i.e., at the beginning or end of a link, or after a seek), however the callback is still required to provide all of it.
- Parameters:
_of- theOggOpusFileon which to set the decode callback_decode_cb- the callback function to call. This may beNULLto disable calling the callback._ctx- the application-provided context pointer to pass to the callback on each call
-
op_set_gain_offset
public static int op_set_gain_offset(long _of, int _gain_type, int _gain_offset_q8)Sets the gain to be used for decoded output.By default, the gain in the header is applied with no additional offset. The total gain (including header gain and/or track gain, if applicable, and this offset), will be clamped to
[-32768,32767]/256dB. This is more than enough to saturate or underflow 16-bit PCM.Note
The new gain will not be applied to any already buffered, decoded output. This means you cannot change it sample-by-sample, as at best it will be updated packet-by-packet. It is meant for setting a target volume level, rather than applying smooth fades, etc.
- Parameters:
_of- theOggOpusFileon which to set the gain offset_gain_type- one of:HEADER_GAIN,ALBUM_GAIN,TRACK_GAINABSOLUTE_GAIN_gain_offset_q8- the gain offset to apply, in1/256thsof a dB- Returns:
- 0 on success or a negative value on error.
EINVALThe_gain_typewas unrecognized.
-
op_set_dither_enabled
public static void op_set_dither_enabled(long _of, boolean _enabled)Sets whether or not dithering is enabled for 16-bit decoding.By default, when libopusfile is compiled to use floating-point internally, calling
op_read(long, java.nio.ShortBuffer, java.nio.IntBuffer)orop_read_stereo(long, java.nio.ShortBuffer)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 usesop_read_float(long, java.nio.FloatBuffer, java.nio.IntBuffer)orop_read_float_stereo(long, java.nio.FloatBuffer), or when the library has been compiled to decode directly to fixed point, this flag has no effect.- Parameters:
_of- theOggOpusFileon which to enable or disable dithering_enabled- a non-zero value to enable dithering, or 0 to disable it
-
nop_read
public static int nop_read(long _of, long _pcm, int _buf_size, long _li)Unsafe version of:op_read(long, java.nio.ShortBuffer, java.nio.IntBuffer)- Parameters:
_buf_size- the number of values that can be stored in_pcm.It is recommended that this be large enough for at least 120 ms of data at 48 kHz per channel (5760 values per channel). Smaller buffers will simply return less data, possibly consuming more memory to buffer the data internally. libopusfile may return less data than requested. If so, there is no guarantee that the remaining data in
_pcmwill be unmodified.
-
op_read
public static int op_read(long _of, java.nio.ShortBuffer _pcm, @Nullable java.nio.IntBuffer _li)Reads more samples from the stream.Note
Although
_buf_sizemust indicate the total number of values that can be stored in_pcm, the return value is the number of samples per channel. This is done because- The channel count cannot be known a priori (reading more samples might advance us into the next link, with a different channel count), so
_buf_sizecannot also be in units of samples per channel - Returning the samples per channel matches the libopus API as closely as we're able
- Returning the total number of values instead of samples per channel would mean the caller would need a division to compute the samples per channel, and might worry about the possibility of getting back samples for some channels and not others, and
- This approach is relatively fool-proof: if an application passes too small a value to
_buf_size, they will simply get fewer samples back, and if they assume the return value is the total number of values, then they will simply read too few (rather than reading too many and going off the end of the buffer)
- Parameters:
_of- theOggOpusFilefrom which to read_pcm- a buffer in which to store the output PCM samples, as signed native-endian 16-bit values at 48 kHz with a nominal range of[-32768,32767). Multiple channels are interleaved using the Vorbis channel ordering. This must have room for at least_buf_sizevalues._li- the index of the link this data was decoded from.You may pass
NULLif you do not need this information. If this function fails (returning a negative value), this parameter is left unset.- Returns:
- the number of samples read per channel on success, or a negative value on failure.
The channel count can be retrieved on success by calling
op_head(_of,*_li). The number of samples returned may be 0 if the buffer was too small to store even a single sample for all channels, or if end-of-file was reached. The list of possible failure codes follows. Most of them can only be returned by unseekable, chained streams that encounter a new link.HOLEThere was a hole in the data, and some samples may have been skipped. Call this function again to continue decoding past the holeEREADAn underlying read operation failed. This may signal a truncation attack from anhttps:sourceEFAULTAn internal memory allocation failedEIMPLAn unseekable stream encountered a new link that used a feature that is not implemented, such as an unsupported channel familyEINVALThe stream was only partially openENOTFORMATAn unseekable stream encountered a new link that did not have any logical Opus streams in itEBADHEADERAn unseekable stream encountered a new link with a required header packet that was not properly formatted, contained illegal values, or was missing altogetherEVERSIONAn unseekable stream encountered a new link with an ID header that contained an unrecognized version numberEBADPACKETFailed to properly decode the next packetEBADLINKWe failed to find data we had seen beforeEBADTIMESTAMPAn unseekable stream encountered a new link with a starting timestamp that failed basic validity checks
- The channel count cannot be known a priori (reading more samples might advance us into the next link, with a different channel count), so
-
nop_read_float
public static int nop_read_float(long _of, long _pcm, int _buf_size, long _li)Unsafe version of:op_read_float(long, java.nio.FloatBuffer, java.nio.IntBuffer)- Parameters:
_buf_size- the number of floats that can be stored in_pcm.It is recommended that this be large enough for at least 120 ms of data at 48 kHz per channel (5760 samples per channel). Smaller buffers will simply return less data, possibly consuming more memory to buffer the data internally. If less than
_buf_sizevalues are returned, libopusfile makes no guarantee that the remaining data in_pcmwill be unmodified.
-
op_read_float
public static int op_read_float(long _of, java.nio.FloatBuffer _pcm, @Nullable java.nio.IntBuffer _li)Reads more samples from the stream.Note
Although
_buf_sizemust indicate the total number of values that can be stored in_pcm, the return value is the number of samples per channel.- The channel count cannot be known a priori (reading more samples might advance us into the next link, with a different channel count), so
_buf_sizecannot also be in units of samples per channel, - Returning the samples per channel matches the libopus API as closely as we're able,
- Returning the total number of values instead of samples per channel would mean the caller would need a division to compute the samples per channel, and might worry about the possibility of getting back samples for some channels and not others, and
- This approach is relatively fool-proof: if an application passes too small a value to
_buf_size, they will simply get fewer samples back, and if they assume the return value is the total number of values, then they will simply read too few (rather than reading too many and going off the end of the buffer).
- Parameters:
_of- theOggOpusFilefrom which to read_pcm- a buffer in which to store the output PCM samples as signed floats at 48 kHz with a nominal range of[-1.0,1.0].Multiple channels are interleaved using the Vorbis channel ordering. This must have room for at least
_buf_sizefloats._li- the index of the link this data was decoded from.You may pass
NULLif you do not need this information. If this function fails (returning a negative value), this parameter is left unset.- Returns:
- the number of samples read per channel on success, or a negative value on failure.
The channel count can be retrieved on success by calling
op_head(_of,*_li). The number of samples returned may be 0 if the buffer was too small to store even a single sample for all channels, or if end-of-file was reached. The list of possible failure codes follows. Most of them can only be returned by unseekable, chained streams that encounter a new link.HOLEThere was a hole in the data, and some samples may have been skipped. Call this function again to continue decoding past the holeEREADAn underlying read operation failed. This may signal a truncation attack from anhttps:sourceEFAULTAn internal memory allocation failedEIMPLAn unseekable stream encountered a new link that used a feature that is not implemented, such as an unsupported channel familyEINVALThe stream was only partially openENOTFORMATAn unseekable stream encountered a new link that did not have any logical Opus streams in itEBADHEADERAn unseekable stream encountered a new link with a required header packet that was not properly formatted, contained illegal values, or was missing altogetherEVERSIONAn unseekable stream encountered a new link with an ID header that contained an unrecognized version numberEBADPACKETFailed to properly decode the next packetEBADLINKWe failed to find data we had seen beforeEBADTIMESTAMPAn unseekable stream encountered a new link with a starting timestamp that failed basic validity checks
- The channel count cannot be known a priori (reading more samples might advance us into the next link, with a different channel count), so
-
nop_read_stereo
public static int nop_read_stereo(long _of, long _pcm, int _buf_size)Unsafe version of:op_read_stereo(long, java.nio.ShortBuffer)- Parameters:
_buf_size- the number of values that can be stored in_pcm.It is recommended that this be large enough for at least 120 ms of data at 48 kHz per channel (11520 values total). Smaller buffers will simply return less data, possibly consuming more memory to buffer the data internally. If less than
_buf_sizevalues are returned, libopusfile makes no guarantee that the remaining data in_pcmwill be unmodified.
-
op_read_stereo
public static int op_read_stereo(long _of, java.nio.ShortBuffer _pcm)Reads more samples from the stream and downmixes to stereo, if necessary.This function is intended for simple players that want a uniform output format, even if the channel count changes between links in a chained stream.
Note
_buf_sizeindicates the total number of values that can be stored in_pcm, while the return value is the number of samples per channel, even though the channel count is known, for consistency withop_read(long, java.nio.ShortBuffer, java.nio.IntBuffer).- Parameters:
_of- theOggOpusFilefrom which to read_pcm- a buffer in which to store the output PCM samples, as signed native-endian 16-bit values at 48 kHz with a nominal range of[-32768,32767).The left and right channels are interleaved in the buffer. This must have room for at least
_buf_sizevalues.- Returns:
- the number of samples read per channel on success, or a negative value on failure.
The number of samples returned may be 0 if the buffer was too small to store even a single sample for both channels, or if end-of-file was reached. The list of possible failure codes follows. Most of them can only be returned by unseekable, chained streams that encounter a new link.
HOLEThere was a hole in the data, and some samples may have been skipped. Call this function again to continue decoding past the holeEREADAn underlying read operation failed. This may signal a truncation attack from anhttps:sourceEFAULTAn internal memory allocation failedEIMPLAn unseekable stream encountered a new link that used a feature that is not implemented, such as an unsupported channel familyEINVALThe stream was only partially openENOTFORMATAn unseekable stream encountered a new link that did not have any logical Opus streams in itEBADHEADERAn unseekable stream encountered a new link with a required header packet that was not properly formatted, contained illegal values, or was missing altogetherEVERSIONAn unseekable stream encountered a new link with an ID header that contained an unrecognized version numberEBADPACKETFailed to properly decode the next packetEBADLINKWe failed to find data we had seen beforeEBADTIMESTAMPAn unseekable stream encountered a new link with a starting timestamp that failed basic validity checks
-
nop_read_float_stereo
public static int nop_read_float_stereo(long _of, long _pcm, int _buf_size)Unsafe version of:op_read_float_stereo(long, java.nio.FloatBuffer)- Parameters:
_buf_size- the number of values that can be stored in_pcm.It is recommended that this be large enough for at least 120 ms of data at 48 kHz per channel (11520 values total). Smaller buffers will simply return less data, possibly consuming more memory to buffer the data internally. If less than
_buf_sizevalues are returned, libopusfile makes no guarantee that the remaining data in_pcmwill be unmodified.
-
op_read_float_stereo
public static int op_read_float_stereo(long _of, java.nio.FloatBuffer _pcm)Reads more samples from the stream and downmixes to stereo, if necessary.This function is intended for simple players that want a uniform output format, even if the channel count changes between links in a chained stream.
Note
_buf_sizeindicates the total number of values that can be stored in_pcm, while the return value is the number of samples per channel, even though the channel count is known, for consistency withop_read_float(long, java.nio.FloatBuffer, java.nio.IntBuffer).- Parameters:
_of- theOggOpusFilefrom which to read_pcm- a buffer in which to store the output PCM samples, as signed floats at 48 kHz with a nominal range of[-1.0,1.0].The left and right channels are interleaved in the buffer. This must have room for at least
_buf_sizevalues.- Returns:
- the number of samples read per channel on success, or a negative value on failure.
The number of samples returned may be 0 if the buffer was too small to store even a single sample for both channels, or if end-of-file was reached. The list of possible failure codes follows. Most of them can only be returned by unseekable, chained streams that encounter a new link.
HOLEThere was a hole in the data, and some samples may have been skipped. Call this function again to continue decoding past the holeEREADAn underlying read operation failed. This may signal a truncation attack from anhttps:sourceEFAULTAn internal memory allocation failedEIMPLAn unseekable stream encountered a new link that used a feature that is not implemented, such as an unsupported channel familyEINVALThe stream was only partially openENOTFORMATAn unseekable stream encountered a new link that that did not have any logical Opus streams in itEBADHEADERAn unseekable stream encountered a new link with a required header packet that was not properly formatted, contained illegal values, or was missing altogetherEVERSIONAn unseekable stream encountered a new link with an ID header that contained an unrecognized version numberEBADPACKETFailed to properly decode the next packetEBADLINKWe failed to find data we had seen beforeEBADTIMESTAMPAn unseekable stream encountered a new link with a starting timestamp that failed basic validity checks
-
-