FileDocCategorySizeDatePackage
Mp4MetaBox.javaAPI DocJaudiotagger 2.0.41910Wed Mar 30 16:11:44 BST 2011org.jaudiotagger.audio.mp4.atom

Mp4MetaBox

public class Mp4MetaBox extends AbstractMp4Box
This MP4 MetaBox is the parent of metadata, it usually contains four bytes of data that needs to be processed before we can examine the children. But I also have a file that contains meta (and no udta) that does not have this children data.

Fields Summary
public static final int
FLAGS_LENGTH
Constructors Summary
public Mp4MetaBox(Mp4BoxHeader header, ByteBuffer dataBuffer)

param
header header info
param
dataBuffer data of box (doesn't include header data)


                          
        
    
        this.header = header;
        this.dataBuffer = dataBuffer;
    
Methods Summary
public static org.jaudiotagger.audio.mp4.atom.Mp4MetaBoxcreateiTunesStyleMetaBox(int childrenSize)
Create an iTunes style Meta box

Useful when writing to mp4 that previously didn't contain an mp4 meta atom

param
childrenSize
return

        Mp4BoxHeader metaHeader = new Mp4BoxHeader(Mp4AtomIdentifier.META.getFieldName());
        metaHeader.setLength(Mp4BoxHeader.HEADER_LENGTH + Mp4MetaBox.FLAGS_LENGTH + childrenSize);
        ByteBuffer metaData = ByteBuffer.allocate(Mp4MetaBox.FLAGS_LENGTH);     
        Mp4MetaBox metaBox = new Mp4MetaBox(metaHeader,metaData);
        return metaBox;
    
public voidprocessData()

        //4-skip the meta flags and check they are the meta flags
        byte[] b = new byte[FLAGS_LENGTH];
        dataBuffer.get(b);
        if (b[0] != 0)
        {
            throw new CannotReadException(ErrorMessage.MP4_FILE_META_ATOM_CHILD_DATA_NOT_NULL.getMsg());
        }