This will later be used to keep the structural metadata when
remuxing an MXF file and can also be used in Pitivi for example
to know the file structure and to select what should be used
and played.
For the tracks we still resolve the descriptors but the
source package only contains the descriptor it really references
instead of all subdescriptors of multiple descriptors.
This makes it easier later to serialize the structural metadata
again.
By searching for the following position we will add the complete
generic container (i.e. all tracks) at the same position to the
index which should make finding positions for more than one track
a bit faster.
When seeking to a position where no new offset can be
found or after the end of a track don't set the EOS flag
to TRUE as we don't (and can't) push EOS downstream then.
Instead set the current essence track position to then
end of the essence track and let the loop or chain function
set everything to EOS and push EOS downstream.
Also restart the pad's task if resolving metadata failed
(playback will continue as before) and return FALSE from
the seek if no new offset could be found.
When the material package track and source package track
edit rate are different the source package track edit
rate applies to the stored essence and the material track
edit rate only applies to the values in the track's sequence
and components.
Avid uses a custom essence container UL and custom essence element keys
that are fortunately compatible with the generic container essence
elements. Partially fixes bug #561922.
Some files contain multiple tracks with the same track number but different
track id inside the same source package. This is invalid and we simply ignore
the second and following of such traacks now instead of overwriting the
information of the first one.
Avid usually uses a custom essence container label for the essence
descriptors and stores the actual codec that is used inside the
picture essence coding field (and for sound probably in the sound
essence coding field but I have no sample files with sound).
Partially fixes bug #561922.
This is useful for seeking as we usually want to seek to the previous
keyframe. The keyframe detection is done by parsing the MPEG2
elementary stream and if a GOP or I-frame packet is found we
assume a keyframe in this edit unit.
Generate an index table for essence streams during playback
and make sure that only the correct essence elements are
used for played tracks.
Make it possible to have one essence stream used in multiple
playback tracks.
Fix some minor bugs.
When parsing an index table segment without a valid
primer pack in this partition only parse the static
local tags and ignore all dynamic ones.
This allows us to use index table segments in some
broken files.
Add an abstraction to represent essence tracks and
use this everywhere. This will later be used to keep
track of positions and to generate/handle seek tables.
Some random cleanup and renaming.
Allocate memory for the pos tables and slice offsets
of the index entries separately to a) fix alignment in
weird cases and b) to actually have something to free()
in the index table segment reset function.
Header metadata is finished after partition.header_byte_count
bytes after the first byte of the primer pack are handled.
After this there can only be index table segments, filler packets,
essence or the start of the next partition.
This fixes playback of some files that have non-standard metadata
packets in the header metadata.
Store all partitions & primer packs in memory for faster access.
This is later needed for fast seeking.
Pre-fill the list of partitions with the content of the random
index pack.
Don't parse metadata of an partition twice.
Store the MXF metadata in a hash table, keyed by the
instance UID. This simplifies resolval of the metadata
and makes looping over all metadata sets unnecessary
in most cases.
Additionally parse metadata always. If we already have
a metadata set with the same UID replace it only if
the new metadata set is from a later offset. This
fixes metadata parsing of files where following partitions
don't have a complete copy of the previous metadata.