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

RateShareEntry

public class RateShareEntry extends GroupEntry
Each sample of a track may be associated to (zero or) one of a number of sample group descriptions, each of which defines a record of rate-share information. Typically the same rate-share information applies to many consecutive samples and it may therefore be enough to define two or three sample group descriptions that can be used at different time intervals.

The grouping type 'rash' (short for rate share) is defined as the grouping criterion for rate share information. Zero or one sample-to-group box ('sbgp') for the grouping type 'rash' can be contained in the sample table box ('stbl') of a track. It shall reside in a hint track, if a hint track is used, otherwise in a media track.

Target rate share may be specified for several operation points that are defined in terms of the total available bitrate, i.e., the bitrate that should be shared. If only one operation point is defined, the target rate share applies to all available bitrates. If several operation points are defined, then each operation point specifies a target rate share. Target rate share values specified for the first and the last operation points also specify the target rate share values at lower and higher available bitrates, respectively. The target rate share between two operation points is specified to be in the range between the target rate shares of those operation points. One possibility is to estimate with linear interpolation.

Fields Summary
public static final String
TYPE
private short
operationPointCut
private short
targetRateShare
private List
entries
private int
maximumBitrate
private int
minimumBitrate
private short
discardPriority
Constructors Summary
Methods Summary
public booleanequals(java.lang.Object o)

        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        RateShareEntry that = (RateShareEntry) o;

        if (discardPriority != that.discardPriority) {
            return false;
        }
        if (maximumBitrate != that.maximumBitrate) {
            return false;
        }
        if (minimumBitrate != that.minimumBitrate) {
            return false;
        }
        if (operationPointCut != that.operationPointCut) {
            return false;
        }
        if (targetRateShare != that.targetRateShare) {
            return false;
        }
        if (entries != null ? !entries.equals(that.entries) : that.entries != null) {
            return false;
        }

        return true;
    
public java.nio.ByteBufferget()

        ByteBuffer buf = ByteBuffer.allocate(operationPointCut == 1?13:(operationPointCut * 6 + 11 ));
        buf.putShort(operationPointCut);
        if (operationPointCut == 1) {
            buf.putShort(targetRateShare );
        } else {
            for (Entry entry : entries) {
                buf.putInt(entry.getAvailableBitrate());
                buf.putShort(entry.getTargetRateShare());
            }
        }
        buf.putInt(maximumBitrate);
        buf.putInt(minimumBitrate);
        IsoTypeWriter.writeUInt8(buf, discardPriority);
        buf.rewind();
        return buf;
    
public shortgetDiscardPriority()

        return discardPriority;
    
public java.util.ListgetEntries()

        return entries;
    
public intgetMaximumBitrate()

        return maximumBitrate;
    
public intgetMinimumBitrate()

        return minimumBitrate;
    
public shortgetOperationPointCut()

        return operationPointCut;
    
public shortgetTargetRateShare()

        return targetRateShare;
    
public inthashCode()

        int result = (int) operationPointCut;
        result = 31 * result + (int) targetRateShare;
        result = 31 * result + (entries != null ? entries.hashCode() : 0);
        result = 31 * result + maximumBitrate;
        result = 31 * result + minimumBitrate;
        result = 31 * result + (int) discardPriority;
        return result;
    
public voidparse(java.nio.ByteBuffer byteBuffer)



    
        
        operationPointCut = byteBuffer.getShort();
        if (operationPointCut == 1) {
            targetRateShare = byteBuffer.getShort();
        } else {
            int entriesLeft = operationPointCut;
            while (entriesLeft-- > 0) {
                entries.add(new Entry(l2i(IsoTypeReader.readUInt32(byteBuffer)), byteBuffer.getShort()));
            }
        }
        maximumBitrate = l2i(IsoTypeReader.readUInt32(byteBuffer));
        minimumBitrate = l2i(IsoTypeReader.readUInt32(byteBuffer));
        discardPriority = (short) IsoTypeReader.readUInt8(byteBuffer);
    
public voidsetDiscardPriority(short discardPriority)

        this.discardPriority = discardPriority;
    
public voidsetEntries(java.util.List entries)

        this.entries = entries;
    
public voidsetMaximumBitrate(int maximumBitrate)

        this.maximumBitrate = maximumBitrate;
    
public voidsetMinimumBitrate(int minimumBitrate)

        this.minimumBitrate = minimumBitrate;
    
public voidsetOperationPointCut(short operationPointCut)

        this.operationPointCut = operationPointCut;
    
public voidsetTargetRateShare(short targetRateShare)

        this.targetRateShare = targetRateShare;