Ogg Vorbis audio decoder.
Individual stb_vorbis* handles are not thread-safe; you cannot decode from them from multiple threads at the same time. However, you can have multiple
stb_vorbis* handles and decode from them independently in multiple threads.
This API allows you to get blocks of data from any source and hand them to stb_vorbis. you have to buffer them; stb_vorbis will tell you how much it used, and you have to give it the rest next time; and stb_vorbis may not have enough data to work with and you will need to give it the same data again PLUS more. Note that the Vorbis specification does not bound the size of an individual frame.
This API assumes stb_vorbis is allowed to pull data from a source -- either a block of memory containing the _entire_ vorbis stream, or a FILE * that you or it create, or possibly some other reading mechanism if you go modify the source to replace the FILE * case with some kind of callback to your code. (But if you don't support seeking, you may just want to go ahead and use pushdata.)
| Modifier and Type | Field and Description |
|---|---|
| public static final int | VORBIS__no_error
Error code. |
| public static final int | VORBIS_bad_packet_type
Error code. |
| public static final int | VORBIS_cant_find_last_page
Error code. |
| public static final int | VORBIS_continued_packet_flag_invalid
Error code. |
| public static final int | VORBIS_feature_not_supported
Error code. |
| public static final int | VORBIS_file_open_failure
Error code. |
| public static final int | VORBIS_incorrect_stream_serial_number
Error code. |
| public static final int | VORBIS_invalid_api_mixing
Error code. |
| public static final int | VORBIS_invalid_first_page
Error code. |
| public static final int | VORBIS_invalid_setup
Error code. |
| public static final int | VORBIS_invalid_stream
Error code. |
| public static final int | VORBIS_invalid_stream_structure_version
Error code. |
| public static final int | VORBIS_missing_capture_pattern
Error code. |
| public static final int | VORBIS_need_more_data
Error code. |
| public static final int | VORBIS_ogg_skeleton_not_supported
Error code. |
| public static final int | VORBIS_outofmem
Error code. |
| public static final int | VORBIS_seek_failed
Error code. |
| public static final int | VORBIS_seek_invalid
Error code. |
| public static final int | VORBIS_seek_without_length
Error code. |
| public static final int | VORBIS_too_many_channels
Error code. |
| public static final int | VORBIS_unexpected_eof
Error code. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static native void | |
| public static native int | nstb_vorbis_decode_filename(long filename, long channels, long sample_rate, long output)
Unsafe version of: |
| public static native int | nstb_vorbis_decode_filename(long filename, int[] channels, int[] sample_rate, long output)
Array version of: |
| public static native int | nstb_vorbis_decode_frame_pushdata(long f, long datablock, int
the length of datablock_length_in_bytes, long channels, long output, long samples)datablock, in bytesUnsafe version of: |
| public static native int | nstb_vorbis_decode_frame_pushdata(long f, long datablock, int datablock_length_in_bytes, int[] channels, long output, int[] samples)
Array version of: |
| public static native int | nstb_vorbis_decode_memory(long mem, int
the len, long channels, long sample_rate, long output)data length, in bytesUnsafe version of: |
| public static native int | nstb_vorbis_decode_memory(long mem, int len, int[] channels, int[] sample_rate, long output)
Array version of: |
| public static native void | |
| public static native void | |
| public static native int | |
| public static native int | |
| public static native int | |
| public static native int | nstb_vorbis_get_frame_float(long f, int[] channels, long output)
Array version of: |
| public static native int | nstb_vorbis_get_frame_short(long f, int
the number of channels num_c, long buffer, int num_samples)Unsafe version of: |
| public static native int | nstb_vorbis_get_frame_short_interleaved(long f, int num_c, long buffer, int
the size of num_shorts)bufferUnsafe version of: |
| public static native int | nstb_vorbis_get_frame_short_interleaved(long f, int num_c, short[] buffer, int num_shorts)
Array version of: |
| public static native void | |
| public static native int | |
| public static native int | nstb_vorbis_get_samples_float(long f, int
the number of channels to decode channels, long buffer, int num_samples)Unsafe version of: |
| public static native int | nstb_vorbis_get_samples_float_interleaved(long f, int channels, long buffer, int
the size of num_floats)bufferUnsafe version of: |
| public static native int | nstb_vorbis_get_samples_float_interleaved(long f, int channels, float[] buffer, int num_floats)
Array version of: |
| public static native int | nstb_vorbis_get_samples_short(long f, int
the number of channels channels, long buffer, int num_samples)Unsafe version of: |
| public static native int | nstb_vorbis_get_samples_short_interleaved(long f, int channels, long buffer, int
the size of num_shorts)bufferUnsafe version of: |
| public static native int | nstb_vorbis_get_samples_short_interleaved(long f, int channels, short[] buffer, int num_shorts)
Array version of: |
| public static native long | nstb_vorbis_open_filename(long filename, long error, long alloc_buffer)
Unsafe version of: |
| public static native long | nstb_vorbis_open_filename(long filename, int[] error, long alloc_buffer)
Array version of: |
| public static native long | nstb_vorbis_open_memory(long mem, int
the len, long error, long alloc_buffer)data length, in bytesUnsafe version of: |
| public static native long | nstb_vorbis_open_memory(long mem, int len, int[] error, long alloc_buffer)
Array version of: |
| public static native long | nstb_vorbis_open_pushdata(long datablock, int
the length of datablock_length_in_bytes, long datablock_memory_consumed_in_bytes, long error, long alloc_buffer)datablock, in bytesUnsafe version of: |
| public static native long | nstb_vorbis_open_pushdata(long datablock, int datablock_length_in_bytes, int[] datablock_memory_consumed_in_bytes, int[] error, long alloc_buffer)
Array version of: |
| public static native int | |
| public static native int | |
| public static native int | |
| public static native int | |
| public static native float | |
| public static void | stb_vorbis_close(long
an ogg vorbis file decoder f)Closes an ogg vorbis file and free all memory in use |
| public static int | Returns: the number of samples decoded, or -1 if the file could not be opened or was not an ogg vorbis filethe file name filename, IntBuffer returns the number of channels channels, IntBuffer returns the sample rate sample_rate, PointerBuffer returns a pointer to the decoded data output)Decode an entire file and output the data interleaved into a |
| public static int | Returns: the number of samples decoded, or -1 if the file could not be opened or was not an ogg vorbis filethe file name filename, IntBuffer returns the number of channels channels, IntBuffer returns the sample rate sample_rate, PointerBuffer returns a pointer to the decoded data output)Decode an entire file and output the data interleaved into a |
| public static ShortBuffer | Returns: the number of samples decoded, or -1 if the file could not be opened or was not an ogg vorbis filethe file name filename, IntBuffer returns the number of channels channels, IntBuffer returns the sample rate sample_rate)Decode an entire file and output the data interleaved into a |
| public static int | stb_vorbis_decode_filename(ByteBuffer filename, int[] channels, int[] sample_rate, PointerBuffer output)
Array version of: |
| public static int | stb_vorbis_decode_filename(CharSequence filename, int[] channels, int[] sample_rate, PointerBuffer output)
Array version of: |
| public static int | Returns: the number of bytes we used from datablock. Possible cases:
Note that after opening a file, you will ALWAYS get one N-bytes,0-sample frame, because Vorbis always "discards" the first frame. an ogg vorbis file decoder f, ByteBuffer the data block containing the audio sample data datablock, IntBuffer place to write number of channels, PointerBuffer float * buffersplace to write float ** array of float * buffers output, IntBuffer place to write number of output samples samples)Decodes a frame of audio sample data if possible from the passed-in data block. |
| public static int | stb_vorbis_decode_frame_pushdata(long f, ByteBuffer datablock, int[] channels, PointerBuffer output, int[] samples)
Array version of: |
| public static int | stb_vorbis_decode_memory(ByteBuffer
the data to decode mem, IntBuffer returns the number of channels channels, IntBuffer returns the sample rate sample_rate, PointerBuffer returns a pointer to the decoded data output)In-memory version of |
| public static ShortBuffer | stb_vorbis_decode_memory(ByteBuffer
the data to decode mem, IntBuffer returns the number of channels channels, IntBuffer returns the sample rate sample_rate)In-memory version of |
| public static int | stb_vorbis_decode_memory(ByteBuffer mem, int[] channels, int[] sample_rate, PointerBuffer output)
Array version of: |
| public static void | stb_vorbis_flush_pushdata(long
an ogg vorbis file decoder f)Inform stb_vorbis that your next datablock will not be contiguous with previous ones (e.g. you've seeked in the data); future attempts to decode frames will cause stb_vorbis to resynchronize (as noted above), and once it sees a valid Ogg page (typically 4-8KB, as large as 64KB), it will begin decoding the next frame. |
| public static STBVorbisComment | stb_vorbis_get_comment(long
an ogg vorbis file decoder f, STBVorbisComment __result)Returns ogg comments. |
| public static int | stb_vorbis_get_error(long
an ogg vorbis file decoder f)Returns the last error detected (clears it, too). |
| public static int | stb_vorbis_get_file_offset(long
an ogg vorbis file decoder f)Returns the current seek point within the file, or offset from the beginning of the memory buffer. |
| public static int | Returns: the number of samples per channelan ogg vorbis file decoder f, IntBuffer returns the number of channels. Can be channels, PointerBuffer NULL -- it is always the same as the number of channels reported by get_info.returns a pointer to an array of float* buffers, one per channel. These outputs will be overwritten on the next call to
output)stb_vorbis_get_frame_*.Decodes the next frame and return the number of samples. |
| public static int | stb_vorbis_get_frame_float(long f, int[] channels, PointerBuffer output)
Array version of: |
| public static int | Returns: the number of samples per channelan ogg vorbis file decoder f, PointerBuffer the output buffer, an array of pointers with length buffer, int num_c, each pointing to a short array with length num_samplesthe number of samples num_samples)Decodes the next frame and returns the number of samples per channel. |
| public static int | Returns: the number of samples per channelan ogg vorbis file decoder f, int the number of channels num_c, ShortBuffer the output buffer buffer)Interleaved version of |
| public static int | stb_vorbis_get_frame_short_interleaved(long f, int num_c, short[] buffer)
Array version of: |
| public static STBVorbisInfo | stb_vorbis_get_info(long
an ogg vorbis file decoder f, STBVorbisInfo __result)Returns general information about the specified file. |
| public static int | stb_vorbis_get_sample_offset(long
an ogg vorbis file decoder f)Returns the offset (in samples) from the beginning of the file that will be returned by the next decode, if it is known, or -1 otherwise. |
| public static int | Returns: the number of samples stored per channel; it may be less than requested at the end of the file. If there are no more samples in the file, returns 0.an ogg vorbis file decoder f, PointerBuffer the output buffer, an array of pointers with length buffer, int channels, each pointing to a float array with length num_samplesthe number of samples to decode num_samples)Gets |
| public static int | Returns: the number of samples stored per channel; it may be less than requested at the end of the file. If there are no more samples in the file, returns 0.an ogg vorbis file decoder f, int the number of channels channels, FloatBuffer the output buffer buffer)Interleaved version of |
| public static int | stb_vorbis_get_samples_float_interleaved(long f, int channels, float[] buffer)
Array version of: |
| public static int | Returns: the number of samples stored per channel; it may be less than requested at the end of the file. If there are no more samples in the file, returns 0.an ogg vorbis file decoder f, PointerBuffer the output buffer, an array of pointers with length buffer, int channels, each pointing to a short array with length num_samplesthe number of samples num_samples)Gets |
| public static int | Returns: the number of samples stored per channel; it may be less than requested at the end of the file. If there are no more samples in the file, returns 0.an ogg vorbis file decoder f, int the number of channels channels, ShortBuffer the output buffer buffer)Interleaved version of |
| public static int | stb_vorbis_get_samples_short_interleaved(long f, int channels, short[] buffer)
Array version of: |
| public static long | Returns: the ogg vorbis decoder. On failure, returnsNULL and sets *error.the file name filename, IntBuffer returns an error code error, STBVorbisAlloc an alloc_buffer)STBVorbisAlloc structCreates an ogg vorbis decoder from a file name. |
| public static long | Returns: the ogg vorbis decoder. On failure, returnsNULL and sets *error.the file name filename, IntBuffer returns an error code error, STBVorbisAlloc an alloc_buffer)STBVorbisAlloc structCreates an ogg vorbis decoder from a file name. |
| public static long | stb_vorbis_open_filename(ByteBuffer filename, int[] error, STBVorbisAlloc alloc_buffer)
Array version of: |
| public static long | stb_vorbis_open_filename(CharSequence filename, int[] error, STBVorbisAlloc alloc_buffer)
Array version of: |
| public static long | Returns: the ogg vorbis decoder. On failure, returnsNULL and sets *error.the data to decode mem, IntBuffer returns an error code error, STBVorbisAlloc an alloc_buffer)STBVorbisAlloc structCreates an ogg vorbis decoder from an ogg vorbis stream in memory (note this must be the entire stream!). |
| public static long | stb_vorbis_open_memory(ByteBuffer mem, int[] error, STBVorbisAlloc alloc_buffer)
Array version of: |
| public static long | Returns: On success, returns anstb_vorbis *, does not set error, returns the amount of data parsed/consumed on this call in
*datablock_memory_consumed_in_bytes; On failure, returns NULL on error and sets *error, does not change
*datablock_memory_consumed. If it returns NULL and *error is need_more_data, then the input block was incomplete and you need to pass
in a larger block from the start of the file.the data block containing the ogg vorbis headers datablock, IntBuffer returns the amount of data parsed/consumed, in bytes datablock_memory_consumed_in_bytes, IntBuffer returns the error code error, STBVorbisAlloc an alloc_buffer)STBVorbisAlloc structCreates a vorbis decoder by passing in the initial data block containing the ogg&vorbis headers (you don't need to do parse them, just provide the first N bytes of the file -- you're told if it's not enough, see below) |
| public static long | stb_vorbis_open_pushdata(ByteBuffer datablock, int[] datablock_memory_consumed_in_bytes, int[] error, STBVorbisAlloc alloc_buffer)
Array version of: |
| public static boolean | stb_vorbis_seek(long
an ogg vorbis file decoder f, int the sample index sample_number)Seeks in the Vorbis file to (approximately) |
| public static boolean | stb_vorbis_seek_frame(long
an ogg vorbis file decoder f, int the sample index sample_number)Seeks in the Vorbis file to (approximately) |
| public static boolean | |
| public static int | stb_vorbis_stream_length_in_samples(long
an ogg vorbis file decoder f)Returns the total length of the vorbis stream, in samples. |
| public static float | stb_vorbis_stream_length_in_seconds(long
an ogg vorbis file decoder f)Returns the total length of the vorbis stream, in samples. |