mxfdemux : Refactor handling of index table, offset handling and different essence wrappings
This is a rather big MR, but contains a much needed cleanup and refactoring for better MXF handling.
The full details are available in each commits for this MR, but boils down to the following key points:
-
Avoid fetching full KLV unless needed, this both reduces drastically the amount of data pulled, and also allows sub-klv tracking (needed for non-frame wrapping of essences)
-
Use Index Table Segments as-is for tracking, timing (including pts vs dts), keyframe position, ... We previously only used a subset of the information contained within, resulting in either no accurate seeking available, or convoluted code elsewhere. If reordering is present, we do a very small reverse-temporal-order table to quickly convert DTS to PTS. also helps with non-frame wrapping of essences
-
Position in the individual essence tracks is tracked more accurately, avoiding re-fetching even more data when dealing with non-interleaved multi-essence files (which requires going back/forth in the file).
-
Several checks for invalid files. MXF is complex enough of a format to properly deal with valid files, the code would be 10 times bigger if we start dealing with such files, so explicitly error on those files and state why.
-
Handle new AES/BWF audio wrapping types.
-
Improve seeking accuracy.
-
Misc fixes found along the way (don't double-seek, handle some corner-case in some files)
-
debug statements sprinkled everywhere, including a summary "topology" debug report to quickly figure out the layout/content of the file