Top Description Inners Fields Constructors Methods
org.lwjgl.util.opus

public Class OpusEnc

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

This is the documentation for the libopusenc C API.

The libopusenc package provides a convenient high-level API for encoding Ogg Opus files.

Organization

The main API is divided into several sections:

Error Codes

Many of the functions in this library return a negative error code when a function fails.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
OpusEnc.Functions

Contains the function pointers loaded from Opus.getLibrary().

Field Summary

Modifier and TypeField and Description
public static final int
OPE_ALLOC_FAIL

Error codes.

public static final int
OPE_API_VERSION

API version for this header.

public static final int
OPE_BAD_ARG

Error codes.

public static final int
OPE_CANNOT_OPEN

Error codes.

public static final int
OPE_CLOSE_FAIL

Error codes.

public static final int
OPE_GET_COMMENT_PADDING_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_GET_DECISION_DELAY_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_GET_HEADER_GAIN_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_GET_MUXING_DELAY_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_GET_NB_COUPLED_STREAMS_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_GET_NB_STREAMS_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_GET_SERIALNO_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_INTERNAL_ERROR

Error codes.

public static final int
OPE_INVALID_ICON

Error codes.

public static final int
OPE_INVALID_PICTURE

Error codes.

public static final int
OPE_OK

Error codes.

public static final int
OPE_SET_COMMENT_PADDING_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_SET_DECISION_DELAY_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_SET_HEADER_GAIN_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_SET_MUXING_DELAY_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_SET_PACKET_CALLBACK_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_SET_SERIALNO_REQUEST

"Raw" request values -- they should usually not be used.

public static final int
OPE_TOO_LATE

Error codes.

public static final int
OPE_UNIMPLEMENTED

Error codes.

public static final int
OPE_WRITE_FAIL

Error codes.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static int
nope_comments_add(long comments, long tag, long val)

Unsafe version of: comments_add

public static int
nope_comments_add_picture(long comments, long filename, int picture_type, long description)

Unsafe version of: comments_add_picture

public static int
nope_comments_add_picture_from_memory(long comments, long ptr, long
size of picture pointed to by ptr
size
,
int picture_type, long description)

Unsafe version of: comments_add_picture_from_memory

public static int
nope_comments_add_string(long comments, long tag_and_val)

Unsafe version of: comments_add_string

public static int
nope_encoder_continue_new_file(long enc, long path, long comments)

Unsafe version of: encoder_continue_new_file

public static long
nope_encoder_create_callbacks(long callbacks, long user_data, long comments, int rate, int channels, int family, long error)

Unsafe version of: encoder_create_callbacks

public static long
nope_encoder_create_file(long path, long comments, int rate, int channels, int family, long error)

Unsafe version of: encoder_create_file

public static long
nope_encoder_create_pull(long comments, int rate, int channels, int family, long error)

Unsafe version of: encoder_create_pull

public static int
nope_encoder_deferred_init_with_mapping(long enc, int family, int streams, int coupled_streams, long mapping)

Unsafe version of: encoder_deferred_init_with_mapping

public static int
nope_encoder_get_page(long enc, long page, long len, int flush)

Unsafe version of: encoder_get_page

public static int
nope_encoder_write(long enc, long pcm, int samples_per_channel)

Unsafe version of: encoder_write

public static int
nope_encoder_write_float(long enc, long pcm, int samples_per_channel)

Unsafe version of: encoder_write_float

public static long
public static long
nope_strerror(int error)

Unsafe version of: strerror

public static int

Returns:

error code
ope_comments_add
(long
where to add the comments
comments
,
ByteBuffer
tag for the comment (must not contain = char)
tag
,
ByteBuffer
value for the tag
val
)

Add a comment.

public static int

Returns:

error code
ope_comments_add
(long
where to add the comments
comments
,
CharSequence
tag for the comment (must not contain = char)
tag
,
CharSequence
value for the tag
val
)

Add a comment.

public static int

Returns:

error code
ope_comments_add_picture
(long
where to add the comments
comments
,
ByteBuffer
file name for the picture
filename
,
int
type of picture (-1 for default)
picture_type
,
ByteBuffer
description (NULL means no comment)
description
)

Add a picture from a file.

public static int

Returns:

error code
ope_comments_add_picture
(long
where to add the comments
comments
,
CharSequence
file name for the picture
filename
,
int
type of picture (-1 for default)
picture_type
,
CharSequence
description (NULL means no comment)
description
)

Add a picture from a file.

public static int

Returns:

error code
ope_comments_add_picture_from_memory
(long
where to add the comments
comments
,
ByteBuffer
pointer to picture in memory
ptr
,
int
type of picture (-1 for default)
picture_type
,
ByteBuffer
description (NULL means no comment)
description
)

Add a picture already in memory.

public static int

Returns:

error code
ope_comments_add_picture_from_memory
(long
where to add the comments
comments
,
ByteBuffer
pointer to picture in memory
ptr
,
int
type of picture (-1 for default)
picture_type
,
CharSequence
description (NULL means no comment)
description
)

Add a picture already in memory.

public static int

Returns:

error code
ope_comments_add_string
(long
where to add the comments
comments
,
ByteBuffer
string of the form tag=value (must contain = char)
tag_and_val
)

Add a comment as a single tag=value string.

public static int

Returns:

error code
ope_comments_add_string
(long
where to add the comments
comments
,
CharSequence
string of the form tag=value (must contain = char)
tag_and_val
)

Add a comment as a single tag=value string.

public static long

Returns:

deep copy of input
ope_comments_copy
(long
comments object to copy
comments
)

Create a deep copy of a comments object.

public static long

Returns:

newly-created comments object
ope_comments_create
()

Create a new comments object.

public static void
ope_comments_destroy(long
comments object to destroy
comments
)

Destroys a comments object.

public static int

Returns:

error code
ope_encoder_chain_current
(long
encoder
enc
,
long
comments associated with the stream
comments
)

Ends the stream and create a new stream within the same file.

public static int

Returns:

error code
ope_encoder_continue_new_callbacks
(long
encoder
enc
,
long
pointer to be associated with the new stream and passed to the callbacks
user_data
,
long
comments associated with the stream
comments
)

Ends the stream and create a new file (callback-based).

public static int

Returns:

error code
ope_encoder_continue_new_file
(long
encoder
enc
,
ByteBuffer
path where to write the new file
path
,
long
comments associated with the stream
comments
)

Ends the stream and create a new file.

public static int

Returns:

error code
ope_encoder_continue_new_file
(long
encoder
enc
,
CharSequence
path where to write the new file
path
,
long
comments associated with the stream
comments
)

Ends the stream and create a new file.

public static long

Returns:

newly-created encoder
ope_encoder_create_callbacks
(OpusEncCallbacks
callback functions
callbacks
,
long
pointer to be associated with the stream and passed to the callbacks
user_data
,
long
comments associated with the stream
comments
,
int
input sampling rate (48 kHz is faster)
rate
,
int
number of channels
channels
,
int
mapping family (0 for mono/stereo, 1 for surround)
family
,
IntBuffer
error code (NULL if no error is to be returned)
error
)

Create a new OggOpus stream to be handled using callbacks

public static long

Returns:

newly-created encoder
ope_encoder_create_file
(ByteBuffer
path where to create the file
path
,
long
comments associated with the stream
comments
,
int
input sampling rate (48 kHz is faster)
rate
,
int
number of channels
channels
,
int
mapping family (0 for mono/stereo, 1 for surround)
family
,
IntBuffer
error code (NULL if no error is to be returned)
error
)

Create a new OggOpus file.

public static long

Returns:

newly-created encoder
ope_encoder_create_file
(CharSequence
path where to create the file
path
,
long
comments associated with the stream
comments
,
int
input sampling rate (48 kHz is faster)
rate
,
int
number of channels
channels
,
int
mapping family (0 for mono/stereo, 1 for surround)
family
,
IntBuffer
error code (NULL if no error is to be returned)
error
)

Create a new OggOpus file.

public static long

Returns:

newly-created encoder
ope_encoder_create_pull
(long
comments associated with the stream
comments
,
int
input sampling rate (48 kHz is faster)
rate
,
int
number of channels
channels
,
int
mapping family (0 for mono/stereo, 1 for surround)
family
,
IntBuffer
error code (NULL if no error is to be returned)
error
)

Create a new OggOpus stream to be used along with encoder_get_page.

private static int

Returns:

error code
ope_encoder_ctl
(long
encoder
enc
)

Sets encoder options.

public static int

Returns:

error code
ope_encoder_ctl
(long
encoder
enc
,
int
use a request macro
request
)

Sets encoder options.

public static int

Returns:

error code
ope_encoder_ctl
(long
encoder
enc
,
Opus.CTLRequest
use a request macro
request
)

Sets encoder options.

public static int

Returns:

error code
ope_encoder_deferred_init_with_mapping
(long
encoder
enc
,
int
mapping family (0 for mono/stereo, 1 for surround)
family
,
int
total number of streams
streams
,
int
number of coupled streams
coupled_streams
,
ByteBuffer
channel mapping
mapping
)

Deferred initialization of the encoder to force an explicit channel mapping.

public static void
ope_encoder_destroy(long
encoder
enc
)

Deallocates the obect.

public static int

Returns:

error code
ope_encoder_drain
(long
encoder
enc
)

Finalizes the stream, but does not deallocate the object.

public static int

Returns:

error code
ope_encoder_flush_header
(long
encoder
enc
)

Write out the header now rather than wait for audio to begin.

public static boolean

Returns:

1 if there is a page available, 0 if not
ope_encoder_get_page
(long
encoder
enc
,
PointerBuffer
next available encoded page
page
,
IntBuffer
size (in bytes) of the page returned
len
,
boolean
if non-zero, forces a flush of the page (if any data available)
flush
)

Get the next page from the stream (only if using encoder_create_pull).

public static int

Returns:

error code
ope_encoder_write
(long
encoder
enc
,
ShortBuffer
linear 16-bit PCM values in the [-32768,32767] range (interleaved if multiple channels)
pcm
,
int
number of samples for each channel
samples_per_channel
)

Add/encode any number of 16-bit linear samples to the stream.

public static int

Returns:

error code
ope_encoder_write_float
(long
encoder
enc
,
FloatBuffer
floating-point PCM values in the +/-1 range (interleaved if multiple channels)
pcm
,
int
number of samples for each channel
samples_per_channel
)

Add/encode any number of float samples to the stream.

public static int

Returns:

an integer representing the ABI version
ope_get_abi_version
()

ABI version for this header.

public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static String

Returns:

a string describing the version of this library
ope_get_version_string
()

Returns a string representing the version of libopusenc being used at run time.

public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static Opus.CTLRequest
public static String

Returns:

error string
ope_strerror
(int
error number
error
)

Converts a libopusenc error code into a human readable string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait