Class OpusDecoder
- java.lang.Object
-
- com.sedmelluq.lava.common.natives.NativeResourceHolder
-
- com.sedmelluq.discord.lavaplayer.natives.opus.OpusDecoder
-
public class OpusDecoder extends com.sedmelluq.lava.common.natives.NativeResourceHolderA wrapper around the native methods of OpusDecoderLibrary.
-
-
Constructor Summary
Constructors Constructor Description OpusDecoder(int sampleRate, int channels)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intdecode(java.nio.ByteBuffer directInput, java.nio.ShortBuffer directOutput)Encode the input buffer to output.protected voidfreeResources()static intgetPacketFrameSize(int sampleRate, byte[] buffer, int offset, int length)Get the frame size from an opus packet
-
-
-
Method Detail
-
decode
public int decode(java.nio.ByteBuffer directInput, java.nio.ShortBuffer directOutput)Encode the input buffer to output.- Parameters:
directInput- Input byte bufferdirectOutput- Output sample buffer- Returns:
- Number of bytes written to the output
-
freeResources
protected void freeResources()
- Specified by:
freeResourcesin classcom.sedmelluq.lava.common.natives.NativeResourceHolder
-
getPacketFrameSize
public static int getPacketFrameSize(int sampleRate, byte[] buffer, int offset, int length)Get the frame size from an opus packet- Parameters:
sampleRate- The sample rate of the packetbuffer- The buffer containing the packetoffset- Packet offset in the bufferlength- Packet length in the buffer- Returns:
- Frame size
-
-