Top Description Fields Methods
org.lwjgl.util.opus

public Interface OPDecodeCBFuncI

extends CallbackI
Known Direct Implementers
org.lwjgl.util.opus.OPDecodeCBFunc
Annotations
@FunctionalInterface
@NativeType:op_decode_cb_func
Imports
org.lwjgl.system.*, org.lwjgl.system.libffi.*

Instances of this interface may be passed to the OpusFile#op_set_decode_callback method.

Type


int (*invoke) (
    void *_ctx,
    OpusMSDecoder *_decoder,
    void *_pcm,
    ogg_packet const *_op,
    int _nsamples,
    int _nchannels,
    int _format,
    int _li
)

Field Summary

Modifier and TypeField and Description
public static final FFICIF

Method Summary

Modifier and TypeMethod and Description
public default void
callback(long
a pointer to the memory used for the function's return value.

If the function is declared as returning void, then this value is garbage and should not be used.

Otherwise, the callback must fill the object to which this points, following the same special promotion behavior as LibFFI#ffi_call. That is, in most cases, ret points to an object of exactly the size of the type specified when CIF was constructed. However, integral types narrower than the system register size are widened. In these cases your program may assume that ret points to an ffi_arg object.

ret
,
long
a vector of pointers to memory holding the arguments to the function
args
)

Implements org.lwjgl.system.CallbackI.callback.

The Java method that will be called from native code when the native callback function is invoked.
public default FFICIF
getCallInterface()

Implements org.lwjgl.system.CallbackI.getCallInterface.

Returns the libffi Call Interface for this callback function.
public int

Returns:

a non-negative value on success, or a negative value on error.

Any error codes should be the same as those returned by multistream_decode or multistream_decode_float. Success codes are as follows:

  • 0: Decoding was successful. The application has filled the buffer with exactly _nsamples* _nchannels samples in the requested format.
  • DEC_USE_DEFAULT: No decoding was done. libopusfile should do the decoding by itself instead.
invoke
(long
the application-provided callback context
_ctx
,
long
the decoder to use to decode the packet
_decoder
,
long
the buffer to decode into.

This will always have enough room for _nchannels of _nsamples samples, which should be placed into this buffer interleaved.

_pcm
,
long
the packet to decode. This will always have its granule position set to a valid value.
_op
,
int
the number of samples expected from the packet
_nsamples
,
int
the number of channels expected from the packet
_nchannels
,
int
the desired sample output format. This is either DEC_FORMAT_SHORT or DEC_FORMAT_FLOAT.
_format
,
int
the index of the link from which this packet was decoded
_li
)

Called to decode an Opus packet.

Inherited from org.lwjgl.system.CallbackI:
address

Field Detail

CIFback to summary
public static final FFICIF CIF

Method Detail

callbackback to summary
public default void callback(long ret, long args)

Implements org.lwjgl.system.CallbackI.callback.

Doc from org.lwjgl.system.CallbackI.callback.

The Java method that will be called from native code when the native callback function is invoked.

Parameters
ret:long

a pointer to the memory used for the function's return value.

If the function is declared as returning void, then this value is garbage and should not be used.

Otherwise, the callback must fill the object to which this points, following the same special promotion behavior as LibFFI#ffi_call. That is, in most cases, ret points to an object of exactly the size of the type specified when CIF was constructed. However, integral types narrower than the system register size are widened. In these cases your program may assume that ret points to an ffi_arg object.

args:long

a vector of pointers to memory holding the arguments to the function

Annotations
@Override
getCallInterfaceback to summary
public default FFICIF getCallInterface()

Implements org.lwjgl.system.CallbackI.getCallInterface.

Doc from org.lwjgl.system.CallbackI.getCallInterface.

Returns the libffi Call Interface for this callback function. [INTERNAL API]

Returns:FFICIF

the CIF structure for this callback function

Annotations
@Override
invokeback to summary
public int invoke(long _ctx, long _decoder, long _pcm, long _op, int _nsamples, int _nchannels, int _format, int _li)

Called to decode an Opus packet.

This should invoke the functional equivalent of multistream_decode or multistream_decode_float, except that it returns 0 on success instead of the number of decoded samples (which is known a priori).

Parameters
_ctx:long

the application-provided callback context

_decoder:long

the decoder to use to decode the packet

_pcm:long

the buffer to decode into.

This will always have enough room for _nchannels of _nsamples samples, which should be placed into this buffer interleaved.

_op:long

the packet to decode. This will always have its granule position set to a valid value.

_nsamples:int

the number of samples expected from the packet

_nchannels:int

the number of channels expected from the packet

_format:int

the desired sample output format. This is either DEC_FORMAT_SHORT or DEC_FORMAT_FLOAT.

_li:int

the index of the link from which this packet was decoded

Returns:int

a non-negative value on success, or a negative value on error.

Any error codes should be the same as those returned by multistream_decode or multistream_decode_float. Success codes are as follows:

  • 0: Decoding was successful. The application has filled the buffer with exactly _nsamples* _nchannels samples in the requested format.
  • DEC_USE_DEFAULT: No decoding was done. libopusfile should do the decoding by itself instead.