Package org.mp4parser.support
Class AbstractBox
java.lang.Object
org.mp4parser.support.AbstractBox
- All Implemented Interfaces:
Box,ParsableBox
- Direct Known Subclasses:
AbstractFullBox,AC3SpecificBox,AmrSpecificBox,AppleDataBox,AppleGPSCoordinatesBox,AvcConfigurationBox,AvcNalUnitStorageBox,BitRateBox,DoViConfigurationBox,DTSSpecificBox,EC3SpecificBox,FileTypeBox,FontTableBox,FreeSpaceBox,GenericMediaHeaderTextAtom,HevcConfigurationBox,ItemDataBox,MLPSpecificBox,OriginalFormatBox,PixelAspectRationAtom,PriotityRangeBox,SegmentTypeBox,TierBitRateBox,TierInfoBox,TimeCodeBox,TrackLoadSettingsAtom,TrackReferenceTypeBox,UnknownBox,UserBox,WebVTTConfigurationBox,WebVTTSourceLabelBox,XtraBox
A basic on-demand parsing box. Requires the implementation of three methods to become a fully working box:
additionally this new box has to be put into the
isoparser2-default.properties file so that
it is accessible by the PropertyBoxParserImpl-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractBox(String type) protectedAbstractBox(String type, byte[] userType) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void_parseDetails(ByteBuffer content) Parse the box's fields and child boxes if any.voidWrites the complete box - size | 4-cc | content - to the givenwritableByteChannel.protected abstract voidgetContent(ByteBuffer byteBuffer) Write the box's content into the givenByteBuffer.protected abstract longGet the box's content size without its header.longgetSize()Gets the full size of the box including header and content.getType()The box's 4-cc type.byte[]booleanisParsed()Check if details are parsed.voidparse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) Parses the box excluding the already parsed header (size, 4cc, [long-size], [user-type]).final voidParses the raw content of the box.
-
Field Details
-
type
-
-
-
Constructor Details
-
AbstractBox
-
AbstractBox
-
-
Method Details
-
getContentSize
protected abstract long getContentSize()Get the box's content size without its header. This must be the exact number of bytes thatgetContent(ByteBuffer)writes.- Returns:
- Gets the box's content size in bytes
- See Also:
-
getContent
Write the box's content into the givenByteBuffer. This must include flags and version in case of a full box.byteBufferhas been initialized withgetSize()bytes.- Parameters:
byteBuffer- the sink for the box's content
-
_parseDetails
Parse the box's fields and child boxes if any.- Parameters:
content- the box's raw content beginning after the 4-cc field.
-
parse
@DoNotParseDetail public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException Parses the box excluding the already parsed header (size, 4cc, [long-size], [user-type]). The remaining size of the box is thecontentSize,contentSizenumber of bytes should be read from the box source (readableByteChannel). If you need theheaderbuffer at a later stage you have to create a copy.- Specified by:
parsein interfaceParsableBox- Parameters:
dataSource- the source for this boxheader- the box' already parsed header (create copy if you need it later as it will be overwritten)contentSize- remaining bytes of this boxboxParser- use it to parse sub-boxes.- Throws:
IOException- in case of an error during a read operation
-
getBox
Description copied from interface:BoxWrites the complete box - size | 4-cc | content - to the givenwritableByteChannel.- Specified by:
getBoxin interfaceBox- Parameters:
os- the box's sink- Throws:
IOException- in case of problems with theChannel
-
parseDetails
public final void parseDetails()Parses the raw content of the box. It surrounds the actual parsing which is done -
getSize
public long getSize()Gets the full size of the box including header and content. -
getType
Description copied from interface:BoxThe box's 4-cc type. -
getUserType
-
isParsed
public boolean isParsed()Check if details are parsed.- Returns:
truewhenever the contentByteBufferis notnull
-