1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-02 03:06:28 +02:00
Commit Graph

432 Commits

Author SHA1 Message Date
Marton Balint
e37741d26a avformat/mxfdec: add support for opAtom without index
Clip wrapped code is capable of doing some magic for such files.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-07-04 21:52:21 +02:00
Marton Balint
5861bc9e75 avformat/mxfdec: guess constant byte count indexes based on track duration
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>
2018-07-04 21:52:21 +02:00
Marton Balint
c6fff3d32f avformat/mxfdec: take into account index_edit_rate
Fixes samples/ffmpeg-bugs/roundup/issue591/02785736.mxf
Fixes samples/ffmpeg-bugs/trac/ticket1916/pcm_s24le_to_pcm_s16le.mxf

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-07-04 21:52:21 +02:00
Marton Balint
afd09131ff avformat/mxfdec: fix indentation and rename mxf_read_packet_old
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-07-04 21:52:21 +02:00
Marton Balint
00a2652df3 avformat/mxfdec: add support for clip wrapped essences
Also use common code with opAtom.

Fixes ticket #2776.
Partially fixes ticket #5671.
Fixes ticket #5866.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-07-04 21:52:21 +02:00
Marton Balint
404dc6bab5 avformat/mxfdec: avoid index_table->nb_ptses overflow in mxf_compute_ptses_fake_index
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
865e0c2d66 avformat/mxfdec: compute sample_count for all streams on seek
sample_count will be used for per-stream current_edit_unit.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
e7b1a83718 avformat/mxfdec: add support for returning the partition for mxf_edit_unit_absolute_offset and mxf_absolute_bodysid_offset
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
1cea0e73d2 avformat/mxfdec: make current_edit_unit a parameter of mxf_compute_samples
No change in functionality.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
ae64c68208 avformat/mxfdec: make edit_units_per_packet a track property
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
f217be2cb8 avformat/mxfdec: simply use the first essence element for non frame-wrapped partition essence offset
Also add the canopus essence element to the list of the recognized essence
element keys.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
6345770eeb avformat/mxfdec: compute both essence_offset and essence_length in mxf_compute_essence_containers
Also compute the correct essence_offset and essence_length for all clip wrapped
essences.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
459282389c avformat/mxfdec: extend mxf_handle_missing_index_segment for all clip wrapped essences
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>
2018-06-24 20:42:35 +02:00
Marton Balint
3cb19ba97e avformat/mxfdec: add some essence container uls from SMPTE draft
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
7ec90b168b avformat/mxfdec: add support for determining essence wrapping scheme
Some code is based on bmxlib-libmxf/mxf/mxf_utils.c.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
bfa0b50441 avformat/mxfdec: store next_klv in KLVPacket
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-24 20:42:35 +02:00
Marton Balint
2bd26dea66 avformat/mxfdec: add support for recognizing timed text streams
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-08 23:21:20 +02:00
Marton Balint
d48fb904fa avformat/mxfdec: remove check for NULL MXFTrack in mxf_set_pts
It cannot happen for video streams.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-08 23:20:27 +02:00
Marton Balint
5d3f78383e avformat/mxfdec: only disallow seek on metadata streams
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-08 23:20:27 +02:00
Marton Balint
f9e77586cb avformat/mxfdec: recognize SMPTE 436 VBI data
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-08 23:20:27 +02:00
Marton Balint
183db8a80b avformat/mxfdec: use MXFCodecUL struct to store essence description for data_essence_container_uls
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-08 23:20:27 +02:00
Marton Balint
1616b1be5a avformat/mxfdec: add some missing picture_essence_container_uls
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-05-30 23:02:59 +02:00
Marton Balint
e7498792b6 avformat/mxfdec: use int math for sample count calculation
This also changes the rounding to nearest.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-05-30 23:02:59 +02:00
Marton Balint
f932e49aab avformat/mxfdec: fix klv_decode_ber_length return value usage
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-05-30 23:02:59 +02:00
Marton Balint
cf5ffe0183 avformat/mxfdec: do not allow more partitions than INT_MAX/2
Some math (e.g: partition binary search) overflows if we have that many
parititions.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-09 20:37:49 +01:00
Marton Balint
90756e67a0 avformat/mxfdec: use binary search in mxf_absolute_bodysid_offset
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-09 20:37:49 +01:00
Marton Balint
3aaf97e773 avformat/mxfdec: fix opAtom audio demuxing
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>
2018-03-09 20:37:49 +01:00
Marton Balint
f50741147c avformat/mxfdec: always use a stream which matches the first index table when seeking
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>
2018-03-01 22:03:53 +01:00
Marton Balint
e8e1c22f21 avformat/mxfdec: compute sample_count after seek from index for audio streams
This fixes audio timestamps if the audio streams are not frame wrapped with the
video.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-01 22:03:53 +01:00
Marton Balint
0827c78e98 avformat/mxfdec: use body_offset of the partitions in mxf_absolute_bodysid_offset
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>
2018-03-01 22:03:53 +01:00
Marton Balint
5b36379eb6 avformat/mxfdec: set index_duration from the track using the index
Also use original_duration as index_duration is in edit units.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-01 22:03:53 +01:00
Marton Balint
c46e430c5b avformat/mxfdec: fix sorting of index segments
Fixes ticket #5320.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-01 22:03:53 +01:00
Marton Balint
9492bb58ee avformat/mxfdec: use both body_sid and track_number to find the track of a packet
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>
2018-03-01 22:03:53 +01:00
Marton Balint
9ec3e61fc3 avformat/mxfdec: use full UMID to resolve source package
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-01 22:03:53 +01:00
Marton Balint
5c2fd59700 avformat/mxfdec: use the first system item if available for calculating essence_offset
Also add an additional system item key.

Fixes parsing of ffmpeg-bugs/trac/ticket2817/warehouse.mxf

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-01 22:03:53 +01:00
Marton Balint
e9b0e42e77 avformat/mxfdec: fix essence_offset calculation
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>
2018-03-01 22:03:53 +01:00
Marton Balint
d54a04b69b avformat/mxfdec: fix indentation
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-01 22:03:53 +01:00
Marton Balint
5a93a85fd0 avformat/mxfdec: fix last packet timestamps
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>
2017-12-03 21:06:47 +01:00
Carl Eugen Hoyos
4590d073cc lavf/mxfdec: Search all components of material track for source package.
Fixes ticket #5925.

Reviewed-by: Marton
2017-10-03 23:29:20 +02:00
James Almer
318778de9e Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'
* commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3':
  Mark some arrays that never change as const.

Merged-by: James Almer <jamrial@gmail.com>
2017-09-26 16:02:40 -03:00
Marton Balint
01911b9b3c avformat/mxfdec: use the common packet pts setter function for opatom files
Fixes ticket #6631.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-09-23 19:07:54 +02:00
Marton Balint
7f80b065a6 avformat/mxfdec: factorize packet pts setter function
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-09-23 19:07:54 +02:00
孙浩(晓黑)
9d00fb9d70 avformat/mxfdec: Fix Sign error in mxf_read_primer_pack()
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>
2017-09-01 01:48:39 +02:00
孙浩(晓黑)
900f39692c avformat/mxfdec: Fix DoS issues in mxf_read_index_entry_array()
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>
2017-09-01 01:48:35 +02:00
James Almer
4de591e6fb Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'
* commit '83548fe894cdb455cc127f754d09905b6d23c173':
  lavf: fix usage of AVIOContext.seekable

Merged-by: James Almer <jamrial@gmail.com>
2017-03-21 17:02:30 -03:00
Anton Khirnov
fd9212f2ed Mark some arrays that never change as const. 2017-02-01 10:42:59 +01:00
Andreas Cadhalpun
fdb8c455b6 mxfdec: fix NULL pointer dereference in mxf_read_packet_old
Metadata streams have priv_data set to NULL.

Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-23 00:40:52 +01:00
Andreas Cadhalpun
0efb610611 mxfdec: fix NULL pointer dereference
Metadata streams have priv_data set to NULL.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-05 18:56:41 +01:00
Michael Niedermayer
fecb3e82a4 avformat/mxfdec: Check size to avoid integer overflow in mxf_read_utf16_string()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-21 20:06:29 +02:00
Michael Niedermayer
c495f4ffde avformat/mxfdec: Fix mixed declaration and code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-21 20:06:29 +02:00