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 TRAK =
      new AtomType(new byte[] {'t', 'r', 'a', 'k' });

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

  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);
  }
}

@@ -181,24 +181,117 @@
 y', 'p' %7D);%0A
+  public static final AtomType MDIA =%0A      new AtomType(new byte%5B%5D %7B 'm', 'd', 'i', 'a' %7D);%0A
   public sta
@@ -620,16 +620,22 @@
 OV, TRAK
+, MDIA
  %7D;%0A%0A  p

Add mdia atom.