Class OpusHead
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.util.opus.OpusHead
-
- All Implemented Interfaces:
java.lang.AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
public class OpusHead extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResourceOgg Opus bitstream information. This contains the basic playback parameters for a stream, and corresponds to the initial ID header packet of an Ogg Opus stream.Layout
struct OpusHead { intversion(); intchannel_count(); unsigned intpre_skip(); opus_uint32input_sample_rate(); intoutput_gain(); intmapping_family(); intstream_count(); intcoupled_count(); unsigned charmapping()[255]; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpusHead.BufferAn array ofOpusHeadstructs.
-
Field Summary
Fields Modifier and Type Field Description static intALIGNOFThe struct alignment in bytes.static intCHANNEL_COUNT
COUPLED_COUNT
INPUT_SAMPLE_RATE
MAPPING
MAPPING_FAMILY
OUTPUT_GAIN
PRE_SKIPThe struct member offsets.static intSIZEOFThe struct size in bytes.static intSTREAM_COUNT
VERSIONThe struct member offsets.
-
Constructor Summary
Constructors Constructor Description OpusHead(java.nio.ByteBuffer container)Creates aOpusHeadinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OpusHeadcalloc()Returns a newOpusHeadinstance allocated withmemCalloc.static OpusHead.Buffercalloc(int capacity)Returns a newOpusHead.Bufferinstance allocated withmemCalloc.static OpusHead.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newOpusHead.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static OpusHeadcalloc(org.lwjgl.system.MemoryStack stack)Returns a newOpusHeadinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.intchannel_count()the number of channels, in the range1...255.intcoupled_count()the number of coupled Opus streams in each Ogg packet, in the range0...127.static OpusHeadcreate()Returns a newOpusHeadinstance allocated withBufferUtils.static OpusHead.Buffercreate(int capacity)Returns a newOpusHead.Bufferinstance allocated withBufferUtils.static OpusHeadcreate(long address)Returns a newOpusHeadinstance for the specified memory address.static OpusHead.Buffercreate(long address, int capacity)Create aOpusHead.Bufferinstance at the specified memory.static OpusHeadcreateSafe(long address)static OpusHead.BuffercreateSafe(long address, int capacity)intinput_sample_rate()the sampling rate of the original input.static OpusHeadmalloc()Returns a newOpusHeadinstance allocated withmemAlloc.static OpusHead.Buffermalloc(int capacity)Returns a newOpusHead.Bufferinstance allocated withmemAlloc.static OpusHead.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newOpusHead.Bufferinstance allocated on the specifiedMemoryStack.static OpusHeadmalloc(org.lwjgl.system.MemoryStack stack)Returns a newOpusHeadinstance allocated on the specifiedMemoryStack.java.nio.ByteBuffermapping()the mapping from coded stream channels to output channels.bytemapping(int index)the mapping from coded stream channels to output channels.intmapping_family()the channel mapping family, in the range0...255.static intnchannel_count(long struct)Unsafe version ofchannel_count().static intncoupled_count(long struct)Unsafe version ofcoupled_count().static intninput_sample_rate(long struct)Unsafe version ofinput_sample_rate().static java.nio.ByteBuffernmapping(long struct)Unsafe version ofmapping().static bytenmapping(long struct, int index)Unsafe version ofmapping.static intnmapping_family(long struct)Unsafe version ofmapping_family().static intnoutput_gain(long struct)Unsafe version ofoutput_gain().static intnpre_skip(long struct)Unsafe version ofpre_skip().static intnstream_count(long struct)Unsafe version ofstream_count().static intnversion(long struct)Unsafe version ofversion().intoutput_gain()the gain to apply to the decoded output, in dB, as aQ8value in the range-32768...32767.intpre_skip()the number of samples that should be discarded from the beginning of the streamintsizeof()intstream_count()the number of Opus streams in each Ogg packet, in the range1...255.intversion()the Ogg Opus format version, in the range0...255.
-
-
-
Constructor Detail
-
OpusHead
public OpusHead(java.nio.ByteBuffer container)
Creates aOpusHeadinstance at the current position of the specifiedByteBuffercontainer. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Detail
-
sizeof
public int sizeof()
- Specified by:
sizeofin classorg.lwjgl.system.Struct
-
version
public int version()
the Ogg Opus format version, in the range0...255.The top 4 bits represent a "major" version, and the bottom four bits represent backwards-compatible "minor" revisions. The current specification describes version 1. This library will recognize versions up through 15 as backwards compatible with the current specification. An earlier draft of the specification described a version 0, but the only difference between version 1 and version 0 is that version 0 did not specify the semantics for handling the version field.
-
channel_count
public int channel_count()
the number of channels, in the range1...255.
-
pre_skip
public int pre_skip()
the number of samples that should be discarded from the beginning of the stream
-
input_sample_rate
public int input_sample_rate()
the sampling rate of the original input.All Opus audio is coded at 48 kHz, and should also be decoded at 48 kHz for playback (unless the target hardware does not support this sampling rate). However, this field may be used to resample the audio back to the original sampling rate, for example, when saving the output to a file.
-
output_gain
public int output_gain()
the gain to apply to the decoded output, in dB, as aQ8value in the range-32768...32767.The libopusfile API will automatically apply this gain to the decoded output before returning it, scaling it by
pow(10,output_gain/(20.0*256)). You can adjust this behavior withOpusFile.op_set_gain_offset(long, int, int).
-
mapping_family
public int mapping_family()
the channel mapping family, in the range0...255.Channel mapping family 0 covers mono or stereo in a single stream. Channel mapping family 1 covers 1 to 8 channels in one or more streams, using the Vorbis speaker assignments. Channel mapping family 255 covers 1 to 255 channels in one or more streams, but without any defined speaker assignment.
-
stream_count
public int stream_count()
the number of Opus streams in each Ogg packet, in the range1...255.
-
coupled_count
public int coupled_count()
the number of coupled Opus streams in each Ogg packet, in the range0...127.This must satisfy
0 <= coupled_count <= stream_countandcoupled_count + stream_count <= 255. The coupled streams appear first, before all uncoupled streams, in an Ogg Opus packet.
-
mapping
public java.nio.ByteBuffer mapping() public byte mapping(int index)
the mapping from coded stream channels to output channels.Let
index=mapping[k]be the value for channelk. Ifindex < 2*coupled_count, then it refers to the left channel from stream(index/2)if even, and the right channel from stream(index/2)if odd. Otherwise, it refers to the output of the uncoupled stream(index-coupled_count).
-
malloc
public static OpusHead malloc()
Returns a newOpusHeadinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static OpusHead calloc()
Returns a newOpusHeadinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static OpusHead create()
Returns a newOpusHeadinstance allocated withBufferUtils.
-
create
public static OpusHead create(long address)
Returns a newOpusHeadinstance for the specified memory address.
-
createSafe
@Nullable public static OpusHead createSafe(long address)
-
malloc
public static OpusHead.Buffer malloc(int capacity)
Returns a newOpusHead.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static OpusHead.Buffer calloc(int capacity)
Returns a newOpusHead.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static OpusHead.Buffer create(int capacity)
Returns a newOpusHead.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static OpusHead.Buffer create(long address, int capacity)
Create aOpusHead.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
@Nullable public static OpusHead.Buffer createSafe(long address, int capacity)
-
malloc
public static OpusHead malloc(org.lwjgl.system.MemoryStack stack)
Returns a newOpusHeadinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
public static OpusHead calloc(org.lwjgl.system.MemoryStack stack)
Returns a newOpusHeadinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
public static OpusHead.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newOpusHead.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
calloc
public static OpusHead.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newOpusHead.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
nversion
public static int nversion(long struct)
Unsafe version ofversion().
-
nchannel_count
public static int nchannel_count(long struct)
Unsafe version ofchannel_count().
-
npre_skip
public static int npre_skip(long struct)
Unsafe version ofpre_skip().
-
ninput_sample_rate
public static int ninput_sample_rate(long struct)
Unsafe version ofinput_sample_rate().
-
noutput_gain
public static int noutput_gain(long struct)
Unsafe version ofoutput_gain().
-
nmapping_family
public static int nmapping_family(long struct)
Unsafe version ofmapping_family().
-
nstream_count
public static int nstream_count(long struct)
Unsafe version ofstream_count().
-
ncoupled_count
public static int ncoupled_count(long struct)
Unsafe version ofcoupled_count().
-
nmapping
public static java.nio.ByteBuffer nmapping(long struct)
Unsafe version ofmapping().
-
nmapping
public static byte nmapping(long struct, int index)Unsafe version ofmapping.
-
-