Class MediaDataBox
- java.lang.Object
-
- org.mp4parser.boxes.iso14496.part12.MediaDataBox
-
- All Implemented Interfaces:
Box,ParsableBox
public final class MediaDataBox extends Object implements ParsableBox
4cc = ""mdat""
This box contains the media data. In video tracks, this box would contain video frames. A presentation may contain zero or more Media Data Boxes. The actual media data follows the type field; its structure is described by the metadata (seeSampleTableBox).
In large presentations, it may be desirable to have more data in this box than a 32-bit size would permit. In this case, the large variant of the size field is used.
There may be any number of these boxes in the file (including zero, if all the media data is in other files). The metadata refers to media data by its absolute offset within the file (seeStaticChunkOffsetBox); so Media Data Box headers and free space may easily be skipped, and files without any box structure may also be referenced and used.
-
-
Constructor Summary
Constructors Constructor Description MediaDataBox()
-
Method Summary
Modifier and Type Method Description voidgetBox(WritableByteChannel writableByteChannel)Writes the complete box - size | 4-cc | content - to the givenwritableByteChannel.longgetSize()StringgetType()The box's 4-cc type.voidparse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser)Parses the box excluding the already parsed header (size, 4cc, [long-size], [user-type]).
-
-
-
Field Detail
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getBox
public void getBox(WritableByteChannel writableByteChannel) throws IOException
Description copied from interface:BoxWrites the complete box - size | 4-cc | content - to the givenwritableByteChannel.- Specified by:
getBoxin interfaceBox- Parameters:
writableByteChannel- the box's sink- Throws:
IOException- in case of problems with theChannel
-
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
-
-