Class 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 (see SampleTableBox).
    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.
    • Constructor Detail

      • MediaDataBox

        public MediaDataBox()
    • Method Detail

      • getType

        public String getType()
        Description copied from interface: Box
        The box's 4-cc type.
        Specified by:
        getType in interface Box
        Returns:
        the 4 character type of the box
      • getBox

        public void getBox​(WritableByteChannel writableByteChannel)
                    throws IOException
        Description copied from interface: Box
        Writes the complete box - size | 4-cc | content - to the given writableByteChannel.
        Specified by:
        getBox in interface Box
        Parameters:
        writableByteChannel - the box's sink
        Throws:
        IOException - in case of problems with the Channel
      • getSize

        public long getSize()
        Specified by:
        getSize in interface Box
      • 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 the contentSize, contentSize number of bytes should be read from the box source (readableByteChannel). If you need the header buffer at a later stage you have to create a copy.
        Specified by:
        parse in interface ParsableBox
        Parameters:
        dataSource - the source for this box
        header - the box' already parsed header (create copy if you need it later as it will be overwritten)
        contentSize - remaining bytes of this box
        boxParser - use it to parse sub-boxes.
        Throws:
        IOException - in case of an error during a read operation