Main Menu

ISOBMFF Standard

Started by clanmills, August 07, 2020, 12:21:32 PM

Previous topic - Next topic

clanmills

Phil:

Hope all's good with you and yours.

I working hard on my book.  It'll be finished by the end of 2020.  I've been working on ISOBMFF this week.  Exiv2 has supported JP2 for a long time.  I've used that a starting point and I now have CR3 and HEIC working.  I'm puzzled by the 'meta' box which is specified as:

8.11.1.2. Syntax
aligned( 8 ) class MetaBox (handler_type)
 extends FullBox('meta', version = 0, 0)
{
 HandlerBox(handler_type) theHandler;

   PrimaryItemBox
   DataInformationBox
   ItemLocationBox
   ItemProtectionBox
   ItemInfoBox
   IPMPControlBox
   ItemReferenceBox
   ItemDataBox
Box other_boxes[];
}


The data in the file is:
       0        0: ___ ftypheic____mif1  ->  00 00 00 20 66 74 79 70 68 65 69 63 00 00 00 00 6d 69 66 31
                                             <  length > <f  t  y  p><h  e  i  c>< minor   >  m  i  f  1
    0x14       20: miafMiHBheic__.4meta  ->  6d 69 61 66 4d 69 48 42 68 65 69 63 00 00 0d 34 6d 65 74 61
                                              m  i  a  f  M  i  H  B  h  e  i  c <  length >  m  e  t  a               
    0x28       40: _______"hdlr________  ->  00 00 00 00 00 00 00 22 68 64 6c 72 00 00 00 00 00 00 00 00
                                             < version?> < length  >  h  d  l  r < version > <  flags  >
    0x3c       60: pict________________  ->  70 69 63 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              p  i  c  t                                           < l e
    0x50       80: _$dinf___.dref______  ->  00 24 64 69 6e 66 00 00 00 1c 64 72 65 66 00 00 00 00 00 00
                                             ngth>  d  i  n  f <  length >  d  r  e  f


Have you any idea why there are 4 nul bytes at between the start of the 'meta' box and the box-chain?

Of, possibly the same question, what is this part of the specification mean:

HandlerBox(handler_type) theHandler;



As you know, I ran into opposition about adding ISOBMFF to Exiv2 v0.27.3 (which shipped as scheduled on 2020-06-30).  At the Zoom meeting, we agreed that I would document ISOBMFF in the book.  If I do another "dot" (Exiv2 v0.27.4) next year, I will be able to add ISOBMFF support at that time.   I remain puzzled about the team's legal objections to supporting ISOBMFF and I don't believe either of the individuals who opposed this feature have changed their opinion.



Phil Harvey

Hi Robin,

I will have to do some research to be able to answer this question.  Give me a few days.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

clanmills

#2
Thanks, Phil.  I thought you might know just like that.  Let me say Thank You for your reply.  Please close this as I don't want to create work for you.

From the output of ISOBMFF-Dump, I think it's either is a 4-byte version or Flags.  However, I'm puzzled that I can't reconcile the data/spec/dump.  I have the code for ISOBMFF-Dump and stepped it in the debugger without learning anything.  I saw it report Flags and Version, however I've no idea how he did it!  And I don't see any mention in the spec of either Version or Flags.

The good news is that when I added a "getLong()" in my tivisitor.cpp code (around which the book is written) when I open the box, everything else works fine and I see Exif, XMP and ICC profile.  I do not see IPTC, however it's possibly not in my test file.  So, the code works and I'm trying to understand why!

[ ISOBMFF::File ]
{
    [ ftyp ]
    {
        - Major brand:       heic
        - Minor version:     0
        - Compatible brands: mif1, miaf, MiHB, heic
    }
    [ meta ]
    {
        - Version: 0
        - Flags:   0x00000000
    }

clanmills

#3
Solved.  Unbelievable.  I powered up Xcode on ISOBMFF and the editor opened here:

    void FullBox::ReadData( Parser & parser, BinaryStream & stream )
    {
        uint32_t vf;
       
        ( void )parser;
       
        vf = stream.ReadBigEndianUInt32();
       
        this->SetVersion( ( uint8_t )( vf >> 24 ) );
        this->SetFlags( vf & 0x00FFFFFF );
    }



The explanation was right in front of my eyes.  He reads a long.  He sets the version with 1 byte and flags with the other three!

And page 20 of the spec says:

Many objects also contain a version number and Plags Pield:
aligned( 8 ) class FullBox(unsigned int(32) boxtype, unsigned int( 8 ) v, bit(24) f) extends Box(boxtype) {
  unsigned int( 8 ) version = v;
  bit(24) flags = f;
}

The semantics of these two Fields are:
version is an integer that speciPies the version of this format of the box.
flags is a map of Plags

By the way, the specification was written by Elmer Fudd.  It says "Plags" for "Flags", "Pields" for "Fields", "speciPies" for "specifies" and other search challenges!

Right.  Clearly the Technology Gods want my book finished and have given me a break!  Onwards and upwards. 

Phil Harvey

Great.  Glad you figured it out.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).