Class OggOpusReader
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
io.github.kosmx.emotes.common.tools.LittleEndianInputStream
io.github.kosmx.emotes.common.opus.OggOpusReader
- All Implemented Interfaces:
Closeable, AutoCloseable
Pulls Opus packets out of an Ogg stream. Page boundaries and packet boundaries are unrelated:
a packet is a run of segments ending at the first one shorter than 255, and it may cross pages.
-
Field Summary
Fields inherited from class FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintendTrim()The last page a packet ended on keeps only what its granule position gained over the one before it.@Nullable Integervoidmark(int limit) booleanRewinding the bytes would leave the page and packet state pointing at the wrong ones.intintpreSkip()byte @Nullable []voidreset()@Nullable IntegerMethods inherited from class LittleEndianInputStream
readBytes, readInt, readUnsignedByte, readUnsignedShortMethods inherited from class InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
OggOpusReader
- Throws:
IOException
-
-
Method Details
-
markSupported
public boolean markSupported()Rewinding the bytes would leave the page and packet state pointing at the wrong ones.- Overrides:
markSupportedin classFilterInputStream
-
mark
public void mark(int limit) - Overrides:
markin classFilterInputStream
-
reset
- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
channelCount
public int channelCount() -
preSkip
public int preSkip() -
outputGain
public int outputGain() -
trackGain
-
loopStart
- Returns:
- the
LOOPSTARTtag in samples, null when the track is not meant to loop
-
endTrim
public int endTrim()The last page a packet ended on keeps only what its granule position gained over the one before it.- Returns:
- the padding at the end, in samples, final once the last packet has been read
-
readPacket
- Returns:
- the next audio packet, or null once the stream is over
- Throws:
IOException
-