Home | History | Annotate | Download | only in boxes
      1 package com.coremedia.iso.boxes;
      2 
      3 import com.googlecode.mp4parser.AbstractFullBox;
      4 
      5 import java.nio.ByteBuffer;
      6 
      7 /**
      8  * The optional composition shift least greatest atom summarizes the calculated
      9  * minimum and maximum offsets between decode and composition time, as well as
     10  * the start and end times, for all samples. This allows a reader to determine
     11  * the minimum required time for decode to obtain proper presentation order without
     12  * needing to scan the sample table for the range of offsets. The type of the
     13  * composition shift least greatest atom is cslg.
     14  */
     15 public class CompositionShiftLeastGreatestAtom extends AbstractFullBox {
     16     public CompositionShiftLeastGreatestAtom() {
     17         super("cslg");
     18     }
     19 
     20     // A 32-bit unsigned integer that specifies the calculated value.
     21     int compositionOffsetToDisplayOffsetShift;
     22 
     23     // A 32-bit signed integer that specifies the calculated value.
     24     int leastDisplayOffset;
     25 
     26     // A 32-bit signed integer that specifies the calculated value.
     27     int greatestDisplayOffset;
     28 
     29     //A 32-bit signed integer that specifies the calculated value.
     30     int displayStartTime;
     31 
     32     //A 32-bit signed integer that specifies the calculated value.
     33     int displayEndTime;
     34 
     35 
     36     @Override
     37     protected long getContentSize() {
     38         return 24;
     39     }
     40 
     41     @Override
     42     public void _parseDetails(ByteBuffer content) {
     43         parseVersionAndFlags(content);
     44         compositionOffsetToDisplayOffsetShift = content.getInt();
     45         leastDisplayOffset = content.getInt();
     46         greatestDisplayOffset = content.getInt();
     47         displayStartTime = content.getInt();
     48         displayEndTime = content.getInt();
     49     }
     50 
     51     @Override
     52     protected void getContent(ByteBuffer byteBuffer) {
     53         writeVersionAndFlags(byteBuffer);
     54         byteBuffer.putInt(compositionOffsetToDisplayOffsetShift);
     55         byteBuffer.putInt(leastDisplayOffset);
     56         byteBuffer.putInt(greatestDisplayOffset);
     57         byteBuffer.putInt(displayStartTime);
     58         byteBuffer.putInt(displayEndTime);
     59     }
     60 
     61 
     62     public int getCompositionOffsetToDisplayOffsetShift() {
     63         return compositionOffsetToDisplayOffsetShift;
     64     }
     65 
     66     public void setCompositionOffsetToDisplayOffsetShift(int compositionOffsetToDisplayOffsetShift) {
     67         this.compositionOffsetToDisplayOffsetShift = compositionOffsetToDisplayOffsetShift;
     68     }
     69 
     70     public int getLeastDisplayOffset() {
     71         return leastDisplayOffset;
     72     }
     73 
     74     public void setLeastDisplayOffset(int leastDisplayOffset) {
     75         this.leastDisplayOffset = leastDisplayOffset;
     76     }
     77 
     78     public int getGreatestDisplayOffset() {
     79         return greatestDisplayOffset;
     80     }
     81 
     82     public void setGreatestDisplayOffset(int greatestDisplayOffset) {
     83         this.greatestDisplayOffset = greatestDisplayOffset;
     84     }
     85 
     86     public int getDisplayStartTime() {
     87         return displayStartTime;
     88     }
     89 
     90     public void setDisplayStartTime(int displayStartTime) {
     91         this.displayStartTime = displayStartTime;
     92     }
     93 
     94     public int getDisplayEndTime() {
     95         return displayEndTime;
     96     }
     97 
     98     public void setDisplayEndTime(int displayEndTime) {
     99         this.displayEndTime = displayEndTime;
    100     }
    101 }
    102