FileDocCategorySizeDatePackage
SampleToGroupBox.javaAPI Docmp4parser 1.0-RC-175685Wed Dec 19 20:10:37 GMT 2012com.googlecode.mp4parser.boxes.mp4.samplegrouping

SampleToGroupBox

public class SampleToGroupBox extends com.googlecode.mp4parser.AbstractFullBox
This table can be used to find the group that a sample belongs to and the associated description of that sample group. The table is compactly coded with each entry giving the index of the first sample of a run of samples with the same sample group descriptor. The sample group description ID is an index that refers to a SampleGroupDescription box, which contains entries describing the characteristics of each sample group.

There may be multiple instances of this box if there is more than one sample grouping for the samples in a track. Each instance of the SampleToGroup box has a type code that distinguishes different sample groupings. Within a track, there shall be at most one instance of this box with a particular grouping type. The associated SampleGroupDescription shall indicate the same value for the grouping type.

Version 1 of this box should only be used if a grouping type parameter is needed.

Fields Summary
public static final String
TYPE
private String
groupingType
private String
groupingTypeParameter
List
entries
Constructors Summary
public SampleToGroupBox()


      
        super(TYPE);

    
Methods Summary
protected void_parseDetails(java.nio.ByteBuffer content)

        parseVersionAndFlags(content);
        groupingType = IsoTypeReader.read4cc(content);
        if (this.getVersion() == 1) {
            groupingTypeParameter = IsoTypeReader.read4cc(content);
        }
        long entryCount = IsoTypeReader.readUInt32(content);
        while (entryCount-- > 0) {
            entries.add(new Entry(l2i(IsoTypeReader.readUInt32(content)), l2i(IsoTypeReader.readUInt32(content))));
        }
    
protected voidgetContent(java.nio.ByteBuffer byteBuffer)

        writeVersionAndFlags(byteBuffer);
        byteBuffer.put(groupingType.getBytes());
        if (this.getVersion() == 1) {
            byteBuffer.put(groupingTypeParameter.getBytes());
        }
        IsoTypeWriter.writeUInt32(byteBuffer, entries.size());
        for (Entry entry : entries) {
            IsoTypeWriter.writeUInt32(byteBuffer, entry.getSampleCount());
            IsoTypeWriter.writeUInt32(byteBuffer, entry.getGroupDescriptionIndex());
        }

    
protected longgetContentSize()

        return this.getVersion() == 1 ? entries.size() * 8 + 16 : entries.size() * 8 + 12;
    
public java.util.ListgetEntries()

        return entries;
    
public java.lang.StringgetGroupingType()

        return groupingType;
    
public java.lang.StringgetGroupingTypeParameter()

        return groupingTypeParameter;
    
public voidsetEntries(java.util.List entries)

        this.entries = entries;
    
public voidsetGroupingType(java.lang.String groupingType)

        this.groupingType = groupingType;
    
public voidsetGroupingTypeParameter(java.lang.String groupingTypeParameter)

        this.groupingTypeParameter = groupingTypeParameter;