anchor.diff:  ;;; Copyright (c) 2013, Mark VandenBrink. All rights reserved.
   (in-package #:mp4-atom)
   
  -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ATOMS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  +;;;; ATOMS
   ;;;
  -;;; A word about atoms (aka "boxes").  There are three kinds of atoms: ones that are containers, ones
  -;;; that are data, and ones that are both. A lot of the source code for taggers out there mostly ignore
  -;;; the third class and treat "container atoms that also have data" as a big blob of data that they
  -;;; rummage around in via indices.  Seems sort of broken, IMHO, so we'll try to handle all three if
  +;;; A word about atoms (aka "boxes").  There are three kinds of atoms: ones that
  +;;; are containers, ones that are data, and ones that are both. A lot of the
  +;;; taggers out there mostly ignore third class and treat "container atoms that
  +;;; also have data" as a big blob of data that they rummage around in via
  +;;; indices.  Seems sort of broken, IMHO, so we'll try to handle all three if
   ;;; at all possible.
   ;;;
   
  -(defun as-int (str)
  -  "Given a 4-byte string, return an integer type equivalent.
  -(ie (as-int \"hdlr\" == +audioprop-hdlr+))"
  -  (declare #.utils:*standard-optimize-settings*)
  -  (declare (type (simple-array character 1) str))
  -
  -  (let ((int 0))
  -    (declare (fixnum int))
  -    (setf (ldb (byte 8 24) int) (char-code (aref str 0))
  -          (ldb (byte 8 16) int) (char-code (aref str 1))
  -          (ldb (byte 8 8) int)  (char-code (aref str 2))
  -          (ldb (byte 8 0) int)  (char-code (aref str 3)))
  -
  -    int))
  -
  -(defun as-string (atom-type)
  -  "The inverse of as-int: given an integer, return the
  -string representation"
  -  (declare #.utils:*standard-optimize-settings*)
  -  (declare (fixnum atom-type))
  -  (with-output-to-string (s nil)
  -    (write-char (code-char (ldb (byte 8 24) atom-type)) s)
  -    (write-char (code-char (ldb (byte 8 16) atom-type)) s)
  -    (write-char (code-char (ldb (byte 8 8)  atom-type)) s)
  -    (write-char (code-char (ldb (byte 8 0)  atom-type)) s)))
  -(utils:memoize 'as-string)
  -
   (defun mk-atom-class-name (name)
     "Create an atom class name by concatenating ATOM- with NAME"
  -(declare #.utils:*standard-optimize-settings*)
  -  (string-upcase (concatenate 'string "atom-" (as-string name))))
  -
  +  (declare #.utils:*standard-optimize-settings*)
  +  (string-upcase (concatenate 'string "atom-" name)))
   (utils:memoize 'mk-atom-class-name)
   
   (eval-when (:compile-toplevel :load-toplevel :execute)
  +  (defun as-string (atom-type)
  +    "Given an integer, return the string representation"
  +    (declare #.utils:*standard-optimize-settings*)
  +    (with-output-to-string (s nil)
  +      (write-char (code-char (ldb (byte 8 24) atom-type)) s)
  +      (write-char (code-char (ldb (byte 8 16) atom-type)) s)
  +      (write-char (code-char (ldb (byte 8 8)  atom-type)) s)
  +      (write-char (code-char (ldb (byte 8 0)  atom-type)) s)))
  +
     (defun as-octet (c)
       "Used below so that we can create atom 'types' from char/ints"
       (declare #.utils:*standard-optimize-settings*)
  
positive.code:            flags   (stream-read-u24 mp4-file)))
    (call-next-method))
  
  (defun find-atom-class (id)
    "Search by concatenating 'atom-' with ID and look for that symbol in this package"
    (declare #.utils:*standard-optimize-settings*)
    (let ((found-class-symbol (find-symbol (mk-atom-class-name id) :MP4-ATOM)))
  
      ;; if we found the class name, return the class (to be used for MAKE-INSTANCE)
  
negative.code: root.moov.trak.mdia.minf.stbl.mp4a, and root.moov.trak.mdia.minf.stbl.mp4a.esds"
    (declare #.utils:*standard-optimize-settings*)
  
    (let ((mdhd
            (tree:find-tree
             (mp4-atoms mp4-file)
             (lambda (x)
               (string= (atom-type (tree:data x)) +audioprop-mdhd+))))
          (mp4a (tree:find-tree
                 (mp4-atoms mp4-file)
                 (lambda (x)
                   (string= (atom-type (tree:data x)) +audioprop-mp4a+))))
          (esds (tree:find-tree
                 (mp4-atoms mp4-file)
                 (lambda (x)
                   (string= (atom-type (tree:data x)) +audioprop-esds+)))))
  
      (if (and mdhd mp4a esds)
          (values (tree:data (first mdhd))
  