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

HandlerBox

public class HandlerBox extends com.googlecode.mp4parser.AbstractFullBox
This box within a Media Box declares the process by which the media-data in the track is presented, and thus, the nature of the media in a track. This Box when present in a Meta Box, declares the structure or format of the 'meta' box contents. See ISO/IEC 14496-12 for details.
see
MetaBox
see
MediaBox

Fields Summary
public static final String
TYPE
public static final Map
readableTypes
private String
handlerType
private String
name
private long
a
private long
b
private long
c
private boolean
zeroTerm
private long
shouldBeZeroButAppleWritesHereSomeValue
Constructors Summary
public HandlerBox()


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

        parseVersionAndFlags(content);
        shouldBeZeroButAppleWritesHereSomeValue = IsoTypeReader.readUInt32(content);
        handlerType = IsoTypeReader.read4cc(content);
        a = IsoTypeReader.readUInt32(content);
        b = IsoTypeReader.readUInt32(content);
        c = IsoTypeReader.readUInt32(content);
        if (content.remaining() > 0) {
            name = IsoTypeReader.readString(content, content.remaining());
            if (name.endsWith("\0")) {
                name = name.substring(0, name.length() - 1);
                zeroTerm = true;
            } else {
                zeroTerm = false;
            }
        } else {
            zeroTerm = false; //No string at all, not even zero term char
        }
    
protected voidgetContent(java.nio.ByteBuffer byteBuffer)

        writeVersionAndFlags(byteBuffer);
        IsoTypeWriter.writeUInt32(byteBuffer, shouldBeZeroButAppleWritesHereSomeValue);
        byteBuffer.put(IsoFile.fourCCtoBytes(handlerType));
        IsoTypeWriter.writeUInt32(byteBuffer, a);
        IsoTypeWriter.writeUInt32(byteBuffer, b);
        IsoTypeWriter.writeUInt32(byteBuffer, c);
        if (name != null) {
            byteBuffer.put(Utf8.convert(name));
        }
        if (zeroTerm) {
            byteBuffer.put((byte) 0);
        }
    
protected longgetContentSize()

        if (zeroTerm) {
            return 25 + Utf8.utf8StringLengthInBytes(name);
        } else {
            return 24 + Utf8.utf8StringLengthInBytes(name);
        }

    
public java.lang.StringgetHandlerType()

        return handlerType;
    
public java.lang.StringgetHumanReadableTrackType()

        return readableTypes.get(handlerType) != null ? readableTypes.get(handlerType) : "Unknown Handler Type";
    
public java.lang.StringgetName()

        return name;
    
public voidsetHandlerType(java.lang.String handlerType)

        this.handlerType = handlerType;
    
public voidsetName(java.lang.String name)
You are required to add a '\0' string termination by yourself.

param
name the new human readable name

        this.name = name;
    
public java.lang.StringtoString()

        return "HandlerBox[handlerType=" + getHandlerType() + ";name=" + getName() + "]";