Class MpegReader
- java.lang.Object
-
- com.sedmelluq.discord.lavaplayer.container.mpeg.reader.MpegReader
-
public class MpegReader extends java.lang.ObjectHandles reading parts of an MP4 file
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMpegReader.ChainChild element processing helper class.
-
Field Summary
Fields Modifier and Type Field Description java.io.DataInputdataThe input as a DataInputSeekableInputStreamseekThe input as a seekable stream
-
Constructor Summary
Constructors Constructor Description MpegReader(SeekableInputStream inputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MpegReader.Chainin(MpegSectionInfo parent)Start a child element handling chainMpegSectionInfonextChild(MpegSectionInfo parent)Reads the header of the next child element.MpegVersionedSectionInfoparseFlags(MpegSectionInfo section)Parse the flags and version for the specified sectionintreadCompressedInt()java.lang.StringreadFourCC()Read a FourCC as a stringjava.lang.StringreadTerminatedString()Read a null-terminated UTF string.java.lang.StringreadUtfString(int size)Read an UTF string with a specified size.voidskip(MpegSectionInfo section)Skip to the end of a section.
-
-
-
Field Detail
-
data
public final java.io.DataInput data
The input as a DataInput
-
seek
public final SeekableInputStream seek
The input as a seekable stream
-
-
Constructor Detail
-
MpegReader
public MpegReader(SeekableInputStream inputStream)
- Parameters:
inputStream- Input as a seekable stream
-
-
Method Detail
-
nextChild
public MpegSectionInfo nextChild(MpegSectionInfo parent) throws java.io.IOException
Reads the header of the next child element. Assumes position is at the start of a header or at the end of the section.- Parameters:
parent- The section from which to read child sections from- Returns:
- The element if there were any more child elements
- Throws:
java.io.IOException- When network exception is happened
-
skip
public void skip(MpegSectionInfo section)
Skip to the end of a section.- Parameters:
section- The section to skip
-
readFourCC
public java.lang.String readFourCC() throws java.io.IOExceptionRead a FourCC as a string- Returns:
- The FourCC string
- Throws:
java.io.IOException- When reading the bytes from input fails
-
readUtfString
public java.lang.String readUtfString(int size) throws java.io.IOExceptionRead an UTF string with a specified size.- Parameters:
size- Size in bytes.- Returns:
- The string read from the stream
- Throws:
java.io.IOException- On read error
-
readTerminatedString
public java.lang.String readTerminatedString() throws java.io.IOExceptionRead a null-terminated UTF string.- Returns:
- The string read from the stream
- Throws:
java.io.IOException- On read error
-
readCompressedInt
public int readCompressedInt() throws java.io.IOException- Throws:
java.io.IOException
-
parseFlags
public MpegVersionedSectionInfo parseFlags(MpegSectionInfo section) throws java.io.IOException
Parse the flags and version for the specified section- Parameters:
section- The section where the flags and version should be parsed- Returns:
- The section info with version info
- Throws:
java.io.IOException- On a read error
-
in
public MpegReader.Chain in(MpegSectionInfo parent)
Start a child element handling chain- Parameters:
parent- The parent chain- Returns:
- The chain
-
-