FooterPartition offset specified in RIP takes precedence over any value written
in PartitionPacks. This fixes the same issue f06f6da tries to fix without
introducing an extra variable.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Without this patch the demuxer can get stuck in a loop if PreviousPartition
points somewhere where there's no PartitionPack, or if klv_read_packet() syncs
back up to the current partition.
This should fix Ticket3278 properly and unbreak Ticket4040.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
If the buffer provided to strftime is too small, the buffer contents
are indeterminate - it does not guarantee actually null terminating
the buffer.
Signed-off-by: Martin Storsjö <martin@martin.st>
Update mxf_set_audio_pts to use the container-provided information.
The UL is marked as "to be changed in the future", but the current
samples in the wild do use it.
Some files set the PreviousPartition field to point to its own offset.
If we are parsing forward the Previous partition is immediately known
and its value could be used, otherwise we can safely point to the
header.
Reported-By: Jean Baptiste Kempf <jb@videolan.org>
The MSVCRT version of strftime calls the invalid parameter handler
if the struct values in struct tm are invalid. In case no invalid
parameter handler is set for the process, the process is aborted.
This fixes fate failures on MSVC builds since 570af382.
Based on a patch by Hendrik Leppkes.
Signed-off-by: Martin Storsjö <martin@martin.st>
Get the last partition offset and use it when footer partition
offset is missing.
Footer partition may not be present and even if present footer
partition offset may not be set in any partition except last one.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Extrapolate audio timestamps based on the number of samples demuxed.
Deal with some MXF nastiness involving fractional number of
samples per EditUnit when seeking (the specs handwave this away).
Further fixes from Tomas Härdin.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Such files have IndexTableSegments which when parsed cover EditUnit
ranges like this:
[0,1)
[249,250)
[249,377)
[0,249)
where each interval is
[IndexStartPosition, IndexStartPosition + IndexDuration)
This would be reduced to a sparse index like:
[0,1), [249,250)
instead of the full range:
[0,249), [249,377)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7fc9ba2fd98e_82_02785736.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The header parser uses forward and backward parsing, making the
bulletproof prevention of loops difficult, thus this simple
detection code.
If someone improves the forward/backward parsing so it cannot loop
then this commit should be reverted
Fixes Ticket3278
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>