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

MovieHeaderBox

public class MovieHeaderBox extends com.googlecode.mp4parser.AbstractFullBox
Box Type: 'mvhd'
Container: {@link MovieBox} ('moov')
Mandatory: Yes
Quantity: Exactly one

This box defines overall information which is media-independent, and relevant to the entire presentation considered as a whole.

Fields Summary
private long
creationTime
private long
modificationTime
private long
timescale
private long
duration
private double
rate
private float
volume
private long[]
matrix
private long
nextTrackId
private int
previewTime
private int
previewDuration
private int
posterTime
private int
selectionTime
private int
selectionDuration
private int
currentTime
public static final String
TYPE
Constructors Summary
public MovieHeaderBox()


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

        parseVersionAndFlags(content);
        if (getVersion() == 1) {
            creationTime = IsoTypeReader.readUInt64(content);
            modificationTime = IsoTypeReader.readUInt64(content);
            timescale = IsoTypeReader.readUInt32(content);
            duration = IsoTypeReader.readUInt64(content);
        } else {
            creationTime = IsoTypeReader.readUInt32(content);
            modificationTime = IsoTypeReader.readUInt32(content);
            timescale = IsoTypeReader.readUInt32(content);
            duration = IsoTypeReader.readUInt32(content);
        }
        rate = IsoTypeReader.readFixedPoint1616(content);
        volume = IsoTypeReader.readFixedPoint88(content);
        IsoTypeReader.readUInt16(content);
        IsoTypeReader.readUInt32(content);
        IsoTypeReader.readUInt32(content);
        matrix = new long[9];
        for (int i = 0; i < 9; i++) {
            matrix[i] = IsoTypeReader.readUInt32(content);
        }

        previewTime = content.getInt();
        previewDuration = content.getInt();
        posterTime = content.getInt();
        selectionTime = content.getInt();
        selectionDuration = content.getInt();
        currentTime = content.getInt();

        nextTrackId = IsoTypeReader.readUInt32(content);

    
protected voidgetContent(java.nio.ByteBuffer byteBuffer)

        writeVersionAndFlags(byteBuffer);
        if (getVersion() == 1) {
            IsoTypeWriter.writeUInt64(byteBuffer, creationTime);
            IsoTypeWriter.writeUInt64(byteBuffer, modificationTime);
            IsoTypeWriter.writeUInt32(byteBuffer, timescale);
            IsoTypeWriter.writeUInt64(byteBuffer, duration);
        } else {
            IsoTypeWriter.writeUInt32(byteBuffer, creationTime);
            IsoTypeWriter.writeUInt32(byteBuffer, modificationTime);
            IsoTypeWriter.writeUInt32(byteBuffer, timescale);
            IsoTypeWriter.writeUInt32(byteBuffer, duration);
        }
        IsoTypeWriter.writeFixedPoint1616(byteBuffer, rate);
        IsoTypeWriter.writeFixedPoint88(byteBuffer, volume);
        IsoTypeWriter.writeUInt16(byteBuffer, 0);
        IsoTypeWriter.writeUInt32(byteBuffer, 0);
        IsoTypeWriter.writeUInt32(byteBuffer, 0);


        for (int i = 0; i < 9; i++) {
            IsoTypeWriter.writeUInt32(byteBuffer, matrix[i]);
        }


        byteBuffer.putInt(previewTime);
        byteBuffer.putInt(previewDuration);
        byteBuffer.putInt(posterTime);
        byteBuffer.putInt(selectionTime);
        byteBuffer.putInt(selectionDuration);
        byteBuffer.putInt(currentTime);

        IsoTypeWriter.writeUInt32(byteBuffer, nextTrackId);
    
protected longgetContentSize()

        long contentSize = 4;
        if (getVersion() == 1) {
            contentSize += 28;
        } else {
            contentSize += 16;
        }
        contentSize += 80;
        return contentSize;
    
public longgetCreationTime()

        return creationTime;
    
public intgetCurrentTime()

        return currentTime;
    
public longgetDuration()

        return duration;
    
public long[]getMatrix()

        return matrix;
    
public longgetModificationTime()

        return modificationTime;
    
public longgetNextTrackId()

        return nextTrackId;
    
public intgetPosterTime()

        return posterTime;
    
public intgetPreviewDuration()

        return previewDuration;
    
public intgetPreviewTime()

        return previewTime;
    
public doublegetRate()

        return rate;
    
public intgetSelectionDuration()

        return selectionDuration;
    
public intgetSelectionTime()

        return selectionTime;
    
public longgetTimescale()

        return timescale;
    
public floatgetVolume()

        return volume;
    
public voidsetCreationTime(long creationTime)

        this.creationTime = creationTime;
    
public voidsetCurrentTime(int currentTime)

        this.currentTime = currentTime;
    
public voidsetDuration(long duration)

        this.duration = duration;
    
public voidsetMatrix(long[] matrix)

        this.matrix = matrix;
    
public voidsetModificationTime(long modificationTime)

        this.modificationTime = modificationTime;
    
public voidsetNextTrackId(long nextTrackId)

        this.nextTrackId = nextTrackId;
    
public voidsetPosterTime(int posterTime)

        this.posterTime = posterTime;
    
public voidsetPreviewDuration(int previewDuration)

        this.previewDuration = previewDuration;
    
public voidsetPreviewTime(int previewTime)

        this.previewTime = previewTime;
    
public voidsetRate(double rate)

        this.rate = rate;
    
public voidsetSelectionDuration(int selectionDuration)

        this.selectionDuration = selectionDuration;
    
public voidsetSelectionTime(int selectionTime)

        this.selectionTime = selectionTime;
    
public voidsetTimescale(long timescale)

        this.timescale = timescale;
    
public voidsetVolume(float volume)

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

        StringBuilder result = new StringBuilder();
        result.append("MovieHeaderBox[");
        result.append("creationTime=").append(getCreationTime());
        result.append(";");
        result.append("modificationTime=").append(getModificationTime());
        result.append(";");
        result.append("timescale=").append(getTimescale());
        result.append(";");
        result.append("duration=").append(getDuration());
        result.append(";");
        result.append("rate=").append(getRate());
        result.append(";");
        result.append("volume=").append(getVolume());
        for (int i = 0; i < matrix.length; i++) {
            result.append(";");
            result.append("matrix").append(i).append("=").append(matrix[i]);
        }
        result.append(";");
        result.append("nextTrackId=").append(getNextTrackId());
        result.append("]");
        return result.toString();