Class MediaDataBox
java.lang.Object
org.mp4parser.boxes.iso14496.part12.MediaDataBox
- All Implemented Interfaces:
Closeable,AutoCloseable,Box,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 (see
StaticChunkOffsetBox);
so Media Data Box headers and free space may easily be skipped, and files without any box structure may
also be referenced and used.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidgetBox(WritableByteChannel writableByteChannel) Writes the complete box - size | 4-cc | content - to the givenwritableByteChannel.longgetSize()getType()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 Details
-
TYPE
- See Also:
-
-
Constructor Details
-
MediaDataBox
public MediaDataBox()
-
-
Method Details
-
getType
Description copied from interface:BoxThe box's 4-cc type. -
getBox
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
-
getSize
public long getSize() -
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
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-