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>
Generate extradata with SPS/PPS based on container dimensions.
Authors of this commit are: Reimar and Thomas Mundt
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Fixes audio packet pts values in some files generated by AVID TRMG 3.01.
Signed-off-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
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: Paul B Mahol <onemda@gmail.com>
Fixes sync in some samples (e.g. bugs 7581 and 8374 in VLC).
Based on a commit by Matthieu Bouron <matthieu.bouron@gmail.com>
Reported-by: Jean-Baptiste Kempf <jb@videolan.org>
CC: libav-stable@libav.org
The caller does not expect this and there are variables left that index to otherwise
deallocated data.
This reverts a hunk from "avformat: Use av_reallocp_array() where suitable"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The code that copies any extradata from the MXFDescriptor to the codec does
not set the size, which it should otherwise the copied data is useless.
Attached it a patch to correct this.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
If no metadata follows MXF essence, that is essence ends with EOF,
"Operation not permitted" error was produced and a non-zero code
was returned from ffmpeg executable.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Some implementations of strftime do not like invalid values for
month/day, so ensure it doesn't happen.
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Correct bit mask for month/day/hour/min/sec values.
For reference the timestamp format specified in S377M is as follow:
year (int16), month (uint8), day (uint8), hour (uint8), sec (uint8),
msec (uint8).
A value of 0 for every fields means timestamp "unknown".
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
MSVC lacks support for %T and %F, but the standard specifies them
only as shorthands to the long variants.
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Fixes audio packet pts values in some files generated by AVID TRMG 3.01.
Signed-off-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>