package com.hotcats.mp4artextractor.data.atom;

import java.util.Arrays;

public class AtomType {

  public static final AtomType FTYP =
      new AtomType(new byte[] { 'f', 't', 'y', 'p' });
  public static final AtomType MDAT =
      new AtomType(new byte[] { 'm', 'd', 'a', 't' });
  public static final AtomType MOOV =
      new AtomType(new byte[] { 'm', 'o', 'o', 'v' });

  public static final AtomType[] RECURSIVE_ATOMS = { MOOV };

  private final byte[] bytes;

  public AtomType(byte[] bytes) {
    this.bytes = bytes;
  }

  @Override
  public boolean equals(Object o) {
    if (o instanceof AtomType) {
      AtomType other = (AtomType) o;
      return Arrays.equals(this.bytes, other.bytes);
    }
    return false;
  }

  @Override
  public int hashCode() {
    return Arrays.hashCode(bytes);
  }

  @Override
  public String toString() {
    return new String(bytes) + " - " + Arrays.toString(bytes);
  }
}

@@ -370,16 +370,108 @@
  'v' %7D);
+%0A  public static final AtomType TRAK =%0A      new AtomType(new byte%5B%5D %7B't', 'r', 'a', 'k' %7D);
 %0A%0A  publ
@@ -521,16 +521,22 @@
 = %7B MOOV
+, TRAK
  %7D;%0A%0A  p

Add trak atom.