Class MainHeader

java.lang.Object
com.github.kokorin.jaffree.nut.MainHeader

public class MainHeader extends Object
Nut format main header.
  • Field Details

    • majorVersion

      public final long majorVersion
      Nut major version.
    • minorVersion

      public final long minorVersion
      Nut minor version.
    • streamCount

      public final int streamCount
      Number of streams in a file.
    • maxDistance

      public final long maxDistance
      Maximum distance between startcodes. If p1 and p2 are the byte positions of the first byte of two consecutive startcodes, then p2-p1 MUST be less than or equal to max_distance unless the entire span from p1 to p2 comprises a single packet or a syncpoint followed by a single frame. This imposition places efficient upper bounds on seek operations and allows for the detection of damaged frame headers, should a chain of frame headers pass max_distance without encountering any startcode.

      Syncpoints SHOULD be placed immediately before a keyframe if the previous frame of the same stream was a non-keyframe, unless such non-keyframe - keyframe transitions are very frequent.

      SHOULD be set to <=32768. If the stored value is >65536 then max_distance MUST be set to 65536.

      This is also half the maximum frame size without a headerChecksum after the frame header.

    • timeBases

      public final Rational[] timeBases
      Different time bases used in a file.
    • frameCodes

      public final FrameCode[] frameCodes
      Nut frame codes.
    • elisionHeaderSize

      public final long[] elisionHeaderSize
      For frames with a final size <= 4096 this header is prepended to the frame data. That is if the stored frame is 4000 bytes and the elision_header is 96 bytes then it is prepended, if it is 97 byte then it is not.

      elision_header[0] is fixed to a length 0 header.

      The length of each elision_header except header 0 MUST be < 256 and >0.

      The sum of the lengthes of all elision_headers MUST be <=1024.

    • flags

      public final Set<MainHeader.Flag> flags
      Main Header flags.
  • Constructor Details

    • MainHeader

      public MainHeader(long majorVersion, long minorVersion, int streamCount, long maxDistance, Rational[] timeBases, FrameCode[] frameCodes, long[] elisionHeaderSize, Set<MainHeader.Flag> flags)
      Creates MainHeader.
      Parameters:
      majorVersion - nut major version
      minorVersion - nut minor version
      streamCount - stream count
      maxDistance - aximum distance between startcodes
      timeBases - time bases
      frameCodes - frame codes
      elisionHeaderSize - elision header size
      flags - flags
  • Method Details