MPO ByteArray Fun Time

So, I’m trying to make an MPO encoder. Basically, it takes two BitmapData instances and encodes them as two Exif JPEGs in sequence.

I’m having trouble understanding some bits and pieces of the file structure of an MPO file, and also the differences between the AS3 CoreLabs JPEG encoder which is JFIF and how I should change it to be Exif.

I guess what I’m wondering is where I can find additional resources, or if anyone knows what I’m missing.

Here’s what I have so far:

MPO file specification Doc:
www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-007_E.pdf

Exif Specification Doc:
www.exif.org/Exif2-2.PDF

Exif on WikiPedia:

Exif explanation (most helpful so far):
http://gvsoft.homedns.org/exif/exif-explanation.html

Here’s where I’m stuck, using an MPO file as an example, the first couple bytes look like this:

FFD8 //SOI
FFE1 //APP1 marker attribute start “application marker”
13AC //app1 data size – “5036” (5037 I see the EO1 marker)
4578 69660000 //Exif Header “Exif…”
4D4D // MM size of exif header?? “19789” doens’t point to anything meaningful for me. I’m not sure what this is!

The last word has got me stuck… any ideas?