FileDocCategorySizeDatePackage
MetaBox.javaAPI Docmp4parser 1.0-RC-173224Wed Dec 19 20:10:38 GMT 2012com.coremedia.iso.boxes

MetaBox

public class MetaBox extends com.googlecode.mp4parser.AbstractContainerBox
A common base structure to contain general metadata. See ISO/IEC 14496-12 Ch. 8.44.1.

Fields Summary
private int
version
private int
flags
public static final String
TYPE
Constructors Summary
public MetaBox()


      
        super(TYPE);
    
Methods Summary
public void_parseDetails(java.nio.ByteBuffer content)

        int pos = content.position();
        content.get(new byte[4]);
        String isHdlr = IsoTypeReader.read4cc(content);
        if ("hdlr".equals(isHdlr)) {
            //  this is apple bullshit - it's NO FULLBOX
            content.position(pos);
            version = -1;
            flags = -1;
        } else {
            content.position(pos);
            version = IsoTypeReader.readUInt8(content);
            flags = IsoTypeReader.readUInt24(content);
        }
        while (content.remaining() >= 8) {
            try {
                boxes.add(boxParser.parseBox(new ByteBufferByteChannel(content), this));
            } catch (IOException e) {
                throw new RuntimeException("Sebastian needs to fix 7518765283");
            }
        }
        if (content.remaining() > 0) {
            throw new RuntimeException("Sebastian needs to fix it 90732r26537");
        }
    
protected voidgetContent(java.nio.ByteBuffer byteBuffer)

        if (isMp4Box()) {
            IsoTypeWriter.writeUInt8(byteBuffer, version);
            IsoTypeWriter.writeUInt24(byteBuffer, flags);
        }
        writeChildBoxes(byteBuffer);
    
public longgetContentSize()

        if (isMp4Box()) {
            // it's a fullbox
            return 4 + super.getContentSize();
        } else {
            // it's an apple metabox
            return super.getContentSize();
        }
    
public longgetNumOfBytesToFirstChild()

        if (isMp4Box()) {
            // it's a fullbox
            return 12;
        } else {
            // it's an apple metabox
            return 8;
        }
    
public booleanisMp4Box()

        return version != -1 && flags != -1;
    
public voidsetMp4Box(boolean mp4)

        if (mp4) {
            version = 0;
            flags = 0;
        } else {
            version = -1;
            flags = -1;
        }