Finding the footer of an MXF file is not always easy, the general algorithm to use is as follows:
As you can see it is much easier to find the footer if either the FooterPosition property in the header is used or the file contains a Random Index Pack. So, if it is not possible to complete FooterPosition when encoding an MXF file add a RIP.
- Check the FooterPosition property in the header partition pack
- Next, check for a Random Index Pack at the end of the file (read the last 4 bytes of the file which should be the size of the RIP, seek back this many bytes and see if you find a RIP key) the last entry will be for the footer
- Next, scan backwards through the file, byte-by-byte looking for the footer key, if you find it validate that it is a footer not just the bytes that make up the footer key as part of some other data field.
- If all else fails you may have to scan every KLV from the start of the file - this is not likely to be quick!