Class MutableMatroskaBlock
- java.lang.Object
-
- com.sedmelluq.discord.lavaplayer.container.matroska.format.MutableMatroskaBlock
-
- All Implemented Interfaces:
MatroskaBlock
public class MutableMatroskaBlock extends java.lang.Object implements MatroskaBlock
An implementation ofMatroskaBlockwhich can be reused by loading the next block into it by callingparseHeader(MatroskaFileReader, MatroskaElement, int). Does not reallocate any objects unless it encounters a block with more than twice as many frames as seen before, or a frame more than twice as long as before.
-
-
Constructor Summary
Constructors Constructor Description MutableMatroskaBlock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetFrameCount()java.nio.ByteBuffergetNextFrameBuffer(MatroskaFileReader reader, int index)The reader must already be positioned at the frame that is to be read next.intgetTimecode()intgetTrackNumber()booleanisKeyFrame()booleanparseHeader(MatroskaFileReader reader, MatroskaElement element, int trackFilter)Parses the Matroska block header data into the fields of this instance.
-
-
-
Method Detail
-
getTimecode
public int getTimecode()
- Specified by:
getTimecodein interfaceMatroskaBlock- Returns:
- The timecode of this block relative to its cluster
-
getTrackNumber
public int getTrackNumber()
- Specified by:
getTrackNumberin interfaceMatroskaBlock- Returns:
- The track number which this block is for
-
isKeyFrame
public boolean isKeyFrame()
- Specified by:
isKeyFramein interfaceMatroskaBlock- Returns:
- Whether this block is a keyframe
-
getFrameCount
public int getFrameCount()
- Specified by:
getFrameCountin interfaceMatroskaBlock- Returns:
- The number of frames in this block
-
getNextFrameBuffer
public java.nio.ByteBuffer getNextFrameBuffer(MatroskaFileReader reader, int index) throws java.io.IOException
Description copied from interface:MatroskaBlockThe reader must already be positioned at the frame that is to be read next.- Specified by:
getNextFrameBufferin interfaceMatroskaBlock- Parameters:
reader- The reader to use to read the block contents into a buffer.index- The index of the frame to get the buffer for.- Returns:
- A buffer where the range between position and limit contains the data for the specific frame. The contents of this buffer are only valid until the next call to this method.
- Throws:
java.io.IOException- On read error.
-
parseHeader
public boolean parseHeader(MatroskaFileReader reader, MatroskaElement element, int trackFilter) throws java.io.IOException
Parses the Matroska block header data into the fields of this instance. On success of this method, this instance effectively represents that block.- Parameters:
reader- The reader to use.element- The block EBML element.trackFilter- The ID of the track to read data for from the block.- Returns:
trueof a block if it contains data for the requested track,falseotherwise.- Throws:
java.io.IOException- On read error.
-
-