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

SampleSizeBox

public class SampleSizeBox extends com.googlecode.mp4parser.AbstractFullBox
This box containes the sample count and a table giving the size in bytes of each sample. Defined in ISO/IEC 14496-12.

Fields Summary
private long
sampleSize
private long[]
sampleSizes
public static final String
TYPE
int
sampleCount
Constructors Summary
public SampleSizeBox()


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

        parseVersionAndFlags(content);
        sampleSize = IsoTypeReader.readUInt32(content);
        sampleCount = l2i(IsoTypeReader.readUInt32(content));

        if (sampleSize == 0) {
            sampleSizes = new long[(int) sampleCount];

            for (int i = 0; i < sampleCount; i++) {
                sampleSizes[i] = IsoTypeReader.readUInt32(content);
            }
        }
    
protected voidgetContent(java.nio.ByteBuffer byteBuffer)

        writeVersionAndFlags(byteBuffer);
        IsoTypeWriter.writeUInt32(byteBuffer, sampleSize);

        if (sampleSize == 0) {
            IsoTypeWriter.writeUInt32(byteBuffer, sampleSizes.length);
            for (long sampleSize1 : sampleSizes) {
                IsoTypeWriter.writeUInt32(byteBuffer, sampleSize1);
            }
        } else {
            IsoTypeWriter.writeUInt32(byteBuffer, sampleCount);
        }

    
protected longgetContentSize()

        return 12 + (sampleSize == 0 ? sampleSizes.length * 4 : 0);
    
public longgetSampleCount()

        if (sampleSize > 0) {
            return sampleCount;
        } else {
            return sampleSizes.length;
        }

    
public longgetSampleSize()
Returns the field sample size. If sampleSize > 0 every sample has the same size. If sampleSize == 0 the samples have different size as stated in the sampleSizes field.

return
the sampleSize field

        return sampleSize;
    
public longgetSampleSizeAtIndex(int index)

        if (sampleSize > 0) {
            return sampleSize;
        } else {
            return sampleSizes[index];
        }
    
public long[]getSampleSizes()

        return sampleSizes;
    
public voidsetSampleSize(long sampleSize)

        this.sampleSize = sampleSize;
    
public voidsetSampleSizes(long[] sampleSizes)

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

        return "SampleSizeBox[sampleSize=" + getSampleSize() + ";sampleCount=" + getSampleCount() + "]";