Class CompositionTimeToSample

java.lang.Object
org.mp4parser.support.AbstractBox
org.mp4parser.support.AbstractFullBox
org.mp4parser.boxes.iso14496.part12.CompositionTimeToSample
All Implemented Interfaces:
Box, FullBox, ParsableBox

public class CompositionTimeToSample extends AbstractFullBox

4cc = ""ctts""

 aligned(8) class CompositionOffsetBox extends FullBox(‘ctts’, version = 0, 0) {
  unsigned int(32) entry_count;
  int i;
  if (version==0) {
   for (i=0; i < entry_count; i++) {
    unsigned int(32) sample_count;
    unsigned int(32) sample_offset;
   }
  }
  else if (version == 1) {
   for (i=0; i < entry_count; i++) {
    unsigned int(32) sample_count;
    signed int(32) sample_offset;
   }
  }
 }
 

This box provides the offset between decoding time and composition time. In version 0 of this box the decoding time must be less than the composition time, and the offsets are expressed as unsigned numbers such that

CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for sample n.

In version 1 of this box, the composition timeline and the decoding timeline are still derived from each other, but the offsets are signed. It is recommended that for the computed composition timestamps, there is exactly one with the value 0 (zero).

  • Field Details

  • Constructor Details

    • CompositionTimeToSample

      public CompositionTimeToSample()
  • Method Details

    • blowupCompositionTimes

      public static int[] blowupCompositionTimes(List<CompositionTimeToSample.Entry> entries)
      Decompresses the list of entries and returns the list of composition times.
      Parameters:
      entries - composition time to sample entries in compressed form
      Returns:
      decoding time per sample
    • getContentSize

      protected long getContentSize()
      Description copied from class: AbstractBox
      Get the box's content size without its header. This must be the exact number of bytes that getContent(ByteBuffer) writes.
      Specified by:
      getContentSize in class AbstractBox
      Returns:
      Gets the box's content size in bytes
      See Also:
    • getEntries

      public List<CompositionTimeToSample.Entry> getEntries()
    • setEntries

      public void setEntries(List<CompositionTimeToSample.Entry> entries)
    • _parseDetails

      public void _parseDetails(ByteBuffer content)
      Description copied from class: AbstractBox
      Parse the box's fields and child boxes if any.
      Specified by:
      _parseDetails in class AbstractBox
      Parameters:
      content - the box's raw content beginning after the 4-cc field.
    • getContent

      protected void getContent(ByteBuffer byteBuffer)
      Description copied from class: AbstractBox
      Write the box's content into the given ByteBuffer. This must include flags and version in case of a full box. byteBuffer has been initialized with getSize() bytes.
      Specified by:
      getContent in class AbstractBox
      Parameters:
      byteBuffer - the sink for the box's content