This way if an index table segment is present multiple times, we can always use
the proper one instead of the invalid one.
Fixes seeking in the sample of ticket #5671.
Signed-off-by: Marton Balint <cus@passwd.hu>
Without this check some crafted files might crash because a packet might be
demuxed which have no corresponding mxf track.
Signed-off-by: Marton Balint <cus@passwd.hu>
Fixes: out of array access
Fixes: mxf-crash-1c2e59bf07a34675bfb3ada5e1ec22fa9f38f923
Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
For clip wrapped essences this should work. Also, since index_edit_rate can now
be different from track edit rate, remove overriding track edit rate.
Signed-off-by: Marton Balint <cus@passwd.hu>
Also make sure we set a valid track index sid and a valid track edit rate in
order for the index to be useful.
Signed-off-by: Marton Balint <cus@passwd.hu>
Consider edit rate when determining edit_units_per_packet and also make sure
that checks are done in edit rate time base and not in stream time base.
Fixes some errors reported with the sample in ticket #5863.
Signed-off-by: Marton Balint <cus@passwd.hu>
Obviously this is still not perfect, but better then it was. Using the first
index table and mxf->current_edit_unit is still hardcoded in many places, so
this change has hopefully the less chance of breaking anything that works
now.
Signed-off-by: Marton Balint <cus@passwd.hu>
Use body_offset of the partitions to search for the partition with the given
offset in the essence. This makes the function find the correct partition for
non frame-wrapped essences as well, where only the essence data is part of the
the edit unit byte count, not the KLV-s.
Signed-off-by: Marton Balint <cus@passwd.hu>
In order to do that we have to parse the EssenceContainerData and assign the
proper body_sid and index_sid to the tracks from the corresponding source
packages.
This fixes packets returned in the wrong stream for some OP1-b files.
Based on a patch by Alex Mogurenko from https://github.com/da8eat/FFmpeg
Reference: http://mogurenko.com/2018/01/02/mxf-op1b-ffmpeg-part1/
Signed-off-by: Marton Balint <cus@passwd.hu>
The reference point for a KAG is the first byte of the key of a Partition Pack.
Fixes ticket #2817.
Fixes ticket #5317.
Signed-off-by: Marton Balint <cus@passwd.hu>
The current edit unit cannot be reliably determined for the last packet of a
video stream, because we can't query the start offset of the next edit unit
from the index. This caused missing timestamps for the last video packet.
Therefore from now on, we allow setting the PTS even if we are not sure of the
current edit unit if mxf_set_current_edit_unit returned a specific failure, and
the assumed current edit unit is the last.
Fixes last packet timestamp of:
ffprobe -fflags nofillin -show_packets tests/data/lavf/lavf.mxf -select_streams v
Signed-off-by: Marton Balint <cus@passwd.hu>
Fixes: 20170829B.mxf
Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Fixes: 20170829A.mxf
Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>