anchor.diff:  (defclass atom-mdia (mp4-atom) ())
   (defmethod initialize-instance :after ((me atom-mdia) &key (mp4-file nil) &allow-other-keys)
     (read-container-atoms mp4-file me))
  +(defclass atom-stbl (mp4-atom) ())
  +(defmethod initialize-instance :after ((me atom-stbl) &key (mp4-file nil) &allow-other-keys)
  +  (read-container-atoms mp4-file me))
  +
  +(defclass atom-hdlr (mp4-atom)
  +  ((version :accessor version) ; 1 byte
  +   (flags   :accessor flags)   ; 3 bytes
  +   (qtype   :accessor qtype)   ; 4 bytes
  +   (mtype   :accessor mtype)   ; 4 bytes
  +   (resv    :accessor resv)    ; 4 bytes
  +   (rflag   :accessor rflag)   ; 4 bytes
  +   (rmask   :accessor rmask)   ; 4 bytes
  +   (mhdlr   :accessor mhdlr))) ; null-terminated string (XXX but we're reading it as octets)
  +
  +(defmethod initialize-instance :after ((me atom-hdlr) &key (mp4-file nil) &allow-other-keys)
  +  (with-slots (version flags qtype mtype resv rflag rmask mhdlr atom-size) me
  +	(setf version  (stream-read-u8 mp4-file))
  +	(setf flags    (stream-read-u24 mp4-file))
  +	(setf qtype    (stream-read-u32 mp4-file))
  +	(setf mtype    (stream-read-u32 mp4-file))
  +	(setf resv     (stream-read-u32 mp4-file))
  +	(setf rflag    (stream-read-u32 mp4-file))
  +	(setf rmask    (stream-read-u32 mp4-file))
  +	(setf mhdlr    (stream-read-sequence mp4-file (- atom-size 32))))) ; 32 is 8-bytes of header plus fields above
  +
  +(defclass atom-mdhd (mp4-atom)
  +  ((version  :accessor version)
  +   (flags    :accessor flags)
  +   (c-time   :accessor c-time)
  +   (m-time   :accessor m-time)
  +   (scale    :accessor scale)
  +   (duration :accessor duration)
  +   (lang     :accessor lang)
  +   (quality  :accessor quality)))
  +(defmethod initialize-instance :after ((me atom-mdhd) &key (mp4-file nil) &allow-other-keys)
  +  (with-slots (version flags c-time m-time scale duration lang quality) me
  +	(setf version  (stream-read-u8 mp4-file))
  +	(setf flags    (stream-read-u24 mp4-file))
  +	(setf c-time   (stream-read-u32 mp4-file))
  +	(setf m-time   (stream-read-u32 mp4-file))
  +	(setf scale    (stream-read-u32 mp4-file))
  +	(setf duration (if (= 0 version) (stream-read-u32 mp4-file) (stream-read-u64 mp4-file)))
  +	(setf lang     (stream-read-u16 mp4-file))
  +	(setf quality  (stream-read-u16 mp4-file))))
  +
  +(defclass atom-stsd (mp4-atom)
  +  ((flags       :accessor flags)
  +   (version     :accessor version)
  +   (num-entries :accessor num-entries)))
  +
  +(defmethod initialize-instance :after ((me atom-stsd) &key (mp4-file nil) &allow-other-keys)
  +  (log5:with-context "atom-stsd"
  +	(with-slots (flags version num-entries) me
  +	  (setf version (stream-read-u8 mp4-file))
  +	  (setf flags (stream-read-u24 mp4-file))
  +	  (setf num-entries (stream-read-u32 mp4-file))
  +	  (log-mp4-atom "atom-stsd: version = ~d, flags = ~x, num-fields = ~d" version flags num-entries))))
  +
  +(defclass atom-mp4a (mp4-atom)
  +  ((reserved    :accessor reserved)    ; 6 bytes
  +   (d-ref-idx   :accessor d-ref-idx)   ; 2 bytes
  +   (version     :accessor version)     ; 2 bytes
  +   (revision    :accessor revision)    ; 2 bytes
  +   (vendor      :accessor vendor)      ; 4 bytes
  +   (num-chans   :accessor num-chans)   ; 2 bytes
  +   (samp-size   :accessor samp-size)   ; 2 bytes
  +   (comp-id     :accessor comp-id)     ; 2 bytes
  +   (packet-size :accessor packet-size) ; 2 bytes
  +   (samp-rate   :accessor samp-rate))) ; 4 bytes
  +
  +(defmethod initialize-instance :after ((me atom-mp4a) &key (mp4-file nil) &allow-other-keys)
  +  (log5:with-context "atom-mp4a"
  +	(with-slots (reserved d-ref-idx version revision vendor num-chans samp-size comp-id packet-size samp-rate) me
  +	  (setf reserved    (stream-read-sequence mp4-file 6))
  +	  (setf d-ref-idx   (stream-read-u16 mp4-file))
  +	  (setf version	    (stream-read-u16 mp4-file))
  +	  (setf revision    (stream-read-u16 mp4-file))
  +	  (setf vendor	    (stream-read-u32 mp4-file))
  +	  (setf num-chans   (stream-read-u16 mp4-file))
  +	  (setf samp-size   (stream-read-u16 mp4-file))
  +	  (setf comp-id	    (stream-read-u16 mp4-file))
  +	  (setf packet-size (stream-read-u16 mp4-file))
  +	  (setf samp-rate   (stream-read-u32 mp4-file)) ; fixed 16.16 floating point number
  +
  +	  (read-container-atoms mp4-file me))))
  +
  +
  +(defun read-container-atoms (mp4-file parent-atom)
  +  "loop through a container atom and add it's children to it"
  +  (with-slots (atom-children atom-file-position atom-of-interest atom-size atom-type atom-decoded) parent-atom
  +	(atom-read-loop mp4-file (+ atom-file-position atom-size)
  +					(lambda ()
  +					  (let ((child (make-mp4-atom mp4-file atom-type)))
  +						(log-mp4-atom "read-container-atoms: adding new child ~a" (vpprint child nil))
  +						(addc parent-atom child))))))
  +
  +(defclass atom-meta (mp4-atom)
  +  ((version  :accessor version)
  +   (flags    :accessor flags)))
  +(defmethod initialize-instance :after ((me atom-meta) &key (mp4-file nil) &allow-other-keys)
  +   (with-slots (version flags) me
  +	 (setf version  (stream-read-u8 mp4-file))
  +	 (setf flags    (stream-read-u24 mp4-file))
  +	 (read-container-atoms mp4-file me)))
   
   (defun find-atom-class (id)
     "Search by concatenating 'atom-' with ID and look for that symbol in this package"
  
positive.code:   (stream-read-sequence mp4-file (- (atom-size atom) 16)))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUDIO PROPERTY ATOMS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; (defclass mp4-hdlr-atom (atom-raw-mixin mp4-atom)())  ; XXX need to get real format for this...
  
  ;;; song length is seconds is (float duration) / (float scale)
  ;; (defclass atom-mdhd (mp4-atom)
  ;;   ((version  :accessor version)
  ;;    (flags    :accessor flags)
  ;;    (c-time   :accessor c-time)
  ;;    (m-time   :accessor m-time)
  ;;    (scale    :accessor scale)
  ;;    (duration :accessor duration)
  ;;    (lang     :accessor lang)
  ;;    (quality  :accessor quality)))
  
  ;; (defmethod initialize-instance :after ((me atom-mdhd) &key (mp4-file nil) &allow-other-keys)
  ;;   (with-slots (version flags c-time m-time scale duration lang quality) me
  ;; 	(setf version  (stream-read-u8 mp4-file))
  ;; 	(setf flags    (stream-read-u24 mp4-file))
  ;; 	(setf c-time   (stream-read-u32 mp4-file))
  ;; 	(setf m-time   (stream-read-u32 mp4-file))
  ;; 	(setf scale    (stream-read-u32 mp4-file))
  ;; 	(setf duration (if (= 0 version) (stream-read-u32 mp4-file) (stream-read-u64 mp4-file)))
  ;; 	(setf lang     (stream-read-u16 mp4-file))
  ;; 	(setf quality  (stream-read-u16 mp4-file))))
  
  ;; (defclass atom-stsd (mp4-atom)
  ;;   ((flags       :accessor flags)
  ;;    (version     :accessor version)
  ;;    (num-entries :accessor num-entries)))
  
  ;; (defmethod initialize-instance :after ((me atom-stsd) &key (mp4-file nil) &allow-other-keys)
  ;;   (log5:with-context "atom-stsd"
  ;; 	(with-slots (flags version num-entries)
  ;; 	  (setf version (stream-read-u8 mp4-file))
  ;; 	  (setf flags (stream-read-u24 mp4-file))
  ;; 	  (setf num-entries (stream-read-u32 mp4-file))
  ;; 	  (log-mp4-atom "atom-stsd: version = ~d, flags = ~x, num-fields = ~d" version flags num-entries))))
  
  ;; (defclass atom-mp4a (mp4-atom)
  ;;   ((reserved    :accessor reserved)    ; 6 bytes
  ;;    (d-ref-idx   :accessor d-ref-idx)   ; 2 bytes
  ;;    (version     :accessor version)     ; 2 bytes
  ;;    (revision    :accessor revision)    ; 2 bytes
  ;;    (vendor      :accessor vendor)      ; 4 bytes
  ;;    (num-chans   :accessor num-chans)   ; 2 bytes
  ;;    (samp-size   :accessor samp-size)   ; 2 bytes
  ;;    (comp-id     :accessor comp-id)     ; 2 bytes
  ;;    (packet-size :accessor packet-size) ; 2 bytes
  ;;    (samp-rate   :accessor samp-rate)   ; 4 bytes
  
  ;; (defmethod initialize-instance :after ((me atom-mp4a) &key (mp4-file nil) &allow-other-keys)
  ;;   (log5:with-context "atom-mp4a"
  ;; 	(with-slots (reserved d-ref-idx version revision vendor num-chans samp-size comp-id packet-size samp-rate) me
  ;; 	  (setf reserved   (stream-read-sequence mp4-file 6))
  ;; 	  (setf d-ref-idx  (stream-read-u16 mp4-file))
  ;; 	  (setf version	   (stream-read-u16 mp4-file))
  ;; 	  (setf revision   (stream-read-u16 mp4-file))
  ;; 	  (setf vendor	   (stream-read-u32 mp4-file))
  ;; 	  (setf num-chans  (stream-read-u16 mp4-file))
  ;; 	  (setf samp-size  (stream-read-u16 mp4-file))
  ;; 	  (setf comp-id	   (stream-read-u16 mp4-file))
  ;; 	  (setf packet-size (stream-read-u16 mp4-file))
  ;; 	  (setf samp-rate  (stream-read-u32 mp4-file)))))
  
  (defun read-container-atoms (mp4-file parent-atom)
    "loop through a container atom and add it's children to it"
    (with-slots (atom-children atom-file-position atom-of-interest atom-size atom-type atom-decoded) parent-atom
  	(atom-read-loop mp4-file (+ atom-file-position atom-size)
  					(lambda ()
  					  (let ((child (make-mp4-atom mp4-file atom-type)))
  						(log-mp4-atom "read-container-atoms: adding new child ~a" (vpprint child nil))
  						(add atom-children child))))))
  
  (defclass atom-meta (mp4-atom)
    ((version  :accessor version)
     (flags    :accessor flags)))
  (defmethod initialize-instance :after ((me atom-meta) &key (mp4-file nil) &allow-other-keys)
     (with-slots (version flags) me
  	 (setf version  (stream-read-u8 mp4-file))
  	 (setf flags    (stream-read-u24 mp4-file))
  	 (read-container-atoms mp4-file me)))
  
  (defclass atom-moov (mp4-atom) ())
  (defmethod initialize-instance :after ((me atom-moov) &key (mp4-file nil) &allow-other-keys)
    (read-container-atoms mp4-file me))
  
negative.code: 					  (lambda ()
  						(let ((child (make-mp4-atom mp4-file atom-type)))
  						  ;(log-mp4-atom "adding new child ~a" (vpprint child nil))
  						  (addc me child))))))
    ;(log-mp4-atom "returning ilst atom: ~a" (vpprint me nil))
    )
  
  