summaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
Commit message (Collapse)AuthorAgeFilesLines
* lavf/mov: add log context dump in log messageJun Zhao2019-11-081-15/+15
| | | | | | | add log context dump in log message. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/mov: parse sdtp atom and set the pkt disposable flag accordinglyMatthieu Bouron2019-10-121-0/+41
| | | | | | Allows the creation of the sdtp atom while remuxing MP4 to MP4. This atom is required by Apple devices (iPhone, Apple TV) in order to accept 2160p medias.
* lavf/mov: Fix timestamp rescale on sidx atomJun Li2019-09-261-1/+1
| | | | | | Fix #5090 Fix the timestamp rescale issue, from sidx timebase to stream's timebase.
* avformat/mov: Check for EOF in mov_read_meta()Michael Niedermayer2019-09-171-1/+4
| | | | | | | | Fixes: Timeout (195sec -> 2ms) Fixes: 16735/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5090676403863552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix memleakAndreas Rheinhardt2019-09-171-1/+3
| | | | | | | | | | | When the mov/mp4 demuxer encounters an error during decrypting a packet, it returns the error, yet doesn't free the packet, so that the packet leaks. This has been fixed in this commit. Fixes the memleaks from ticket #8150. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: improve timecode calculationPaul B Mahol2019-08-281-2/+2
| | | | | Fixes timecode calculation for NTSC frame rates. Fixes ticket #5978.
* avformat/mov: add demuxing support for Dolby TrueHD streamsJames Almer2019-08-241-0/+34
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: fix return code for trun box with no sample entriesGyan Doshi2019-07-221-2/+2
| | | | | | | A value of zero for sample_count in trun box is not prohibited by 14496-12 section 8.8.8. 4a9d32baca disallowed this which led the demuxer to error out when reading the header of valid files.
* avformat/mov: Set fragment.found_tfhd only after TFHD has been parsedMichael Niedermayer2019-06-251-2/+1
| | | | | | | | | Fixes: Assertion failure Fixes: crbug971646.mp4 Reported-by: Matt Wolenetz <wolenetz@google.com> Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: set AVFMT_SEEK_TO_PTS flagGyan Doshi2019-05-031-1/+1
| | | | | Ever since 59ad504696, the demuxer expects its seek arg to be PTS and adjusts internally to search index by DTS.
* avformat/mov: Skip stsd adjustment without chunksMichael Niedermayer2019-04-241-0/+2
| | | | | | | | | Fixes: Assertion failure Fixes: clusterfuzz-testcase-minimized-media_pipeline_integration_fuzzer-5683096400822272 Found-by: Clusterfuzz Reported-by: Dan Sanders <sandersd@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat/mov: limit nb_frames_for_fps to INT_MAXDan Sanders2019-04-231-2/+2
| | | | | | It's this or add overflow detection in mov_read_header(). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix potential integer overflow in entry check in mov_read_trun()Michael Niedermayer2019-03-251-1/+1
| | | | | | No testcase Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-211-1/+1
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* mov: Fix start_time for streams with empty edits in the middleJustin Ruggles2019-02-261-1/+3
| | | | | | | | | Empty edits can occur at any position within the edit list except for at the end. Empty edits in the middle should not impact the reported stream start_time or the video PTS adjustment, so only include empty edits at the start of the list in empty_edits_sum_duration. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* avformat/mov: Do not use reference stream in mov_read_sidx() if there is no ↵Michael Niedermayer2019-02-141-1/+1
| | | | | | | | | | reference stream Fixes: NULL pointer dereference Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-5634316373721088 Reported-by: Chris Cunningham <chcunningham@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: fix hang while seek on a kind of fragmented mp4Charles Liu2019-02-111-9/+12
| | | | | | | | | | | | | | | | | | | Binary searching would hang if the fragment items do NOT have timestamp for the specified stream. For example, a fmp4 consists of separated 'moof' boxes for each track, and separated 'sidx' for each segment, but no 'mfra' box. Then every fragment item only have the timestamp for one of its tracks. Example: ffmpeg -f lavfi -i testsrc -f lavfi -i sine -movflags dash+frag_keyframe+skip_trailer+separate_moof -t 1 out.mp4 ffmpeg -ss 0.5 -i out.mp4 -f null none Also fixes the hang in ticket #7572, but not the reason for having AV_NOPTS_VALUE timestamps there. Signed-off-by: Charles Liu <liuchh83@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mov: don't rescale mastering display values from the SmDm atomJames Almer2019-02-111-14/+10
| | | | | | | Simplifies code. Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: validate chunk_count vs stsc_datachcunningham2019-02-081-2/+12
| | | | | | | | | | Bad content may contain stsc boxes with a first_chunk index that exceeds stco.entries (chunk_count). This ammends the existing check to include cases where chunk_count == 0. It also patches up the case when stsc refers to unknown chunks, but stts has no samples (so we can simply ignore stsc). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov.c: require tfhd to begin parsing trunchcunningham2019-02-081-0/+10
| | | | | | | | | | Detecting missing tfhd avoids re-using tfhd track info from the previous moof. For files with multiple tracks, this may make a mess of the avindex and fragindex, which can later trigger av_assert0 in mov_read_trun(). Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: Do not fail hard for more invalid atoms.Carl Eugen Hoyos2019-01-141-9/+9
| | | | | | This is what several other players do and what FFmpeg already does for the sidx atom. Fixes ticket #7679.
* mov: Remove duration-of-last-frame heuristic hackDerek Buitenhuis2019-01-021-6/+0
| | | | | | | | | | | | | | | This breaks totally valid files that get caught in its heuristic. This, according to the commit message, is my own doing, having asked Michael to implement this check and providing a sample that was "wrong". I am now atoning for my sins, and removing this hack, having seen the light (aka that this was silly to do in the first place). Resotores correct behavior on valid files. This reverts commit 8e5e84c2a2a21a979b48e80c5a8dd44754ab3f21. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* libavformat/mov: Fix NULL-dereference read for some encrypted content.Jacob Trimble2018-12-201-3/+3
| | | | | | | | | | | | When reading frames, we need to use the fragment for the correct stream. Sometimes the "current" fragment is not the same as the one the frame is for. Found by Chromium's ClusterFuzz: https://crbug.com/906392 and https://crbug.com/915524 Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Simplify get_stream_info_time()Michael Niedermayer2018-12-191-10/+6
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: document the dvh1 codec switch based on hvcC availabilityJan Ekström2018-12-171-0/+5
|
* lavf/mov: ensure only one tkhd per trakchcunningham2018-12-161-1/+11
| | | | | | | | | | Chromium fuzzing produced a whacky file with extra tkhds. This caused an AVStream that was already in use to be corrupted by assigning it a new id, which blows up later in mov_read_trun because the MOVFragmentStreamInfo.index_entry now points OOB. Reviewed-by: Baptiste Coudurier <baptiste.coudurier@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Use QT format for audio sample descriptors depending on stsd version.Justin Ruggles2018-09-091-3/+3
| | | | | | | | | | | | | | | | | ISOBMFF does not allow AudioSampleEntryV1 in stsd version 0, so assume the descriptor format is QTFF SoundDescriptionV1. ISOBMFF does not define a version 2. This fixes audio decoding for some MP4 files generated with Apple tools. The additional fields present in SoundDescriptionV1/V2 need to be read in order to correctly read additional boxes that contain information required for decoding the stream. Fixes #7376. Also see: https://github.com/HandBrake/HandBrake/issues/1555 Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavf/mov: factor out setting codec_idJohn Stebbins2018-09-081-4/+1
| | | | | | Since it is performed in all cases now. Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/mov: add AVCodecTag entry for GoPro metadataJohn Stebbins2018-09-081-0/+3
| | | | | | This allows for validation of the track type Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: Error on too large stsd entry counts.Dale Curtis2018-09-011-1/+2
| | | | | | | | | | | | Entries are always at least 8 bytes per the parsing code, so if we see an impossible entry count avoid massive allocations. This is similar to an existing check in mov_read_stsc(). Since ff_mov_read_stsd_entries() does eof checks, an alternative approach could be to clamp the entry count to atom.size / 8. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Correct opus-in-mp4 pre-skip to be uint16_t versus int16_t.Dale Curtis2018-08-231-1/+1
| | | | | | | | | This field is a uint16_t, see docs: http://opus-codec.org/docs/opus_in_isobmff.html#4.3.2 Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Allow saio/saiz in clear content.Jacob Trimble2018-08-221-0/+6
| | | | | | | | | | | | | | If there is a saio/saiz in clear content, we shouldn't create the encryption index if we don't already have one. Otherwise it will confuse the cenc_filter. The changed method is also used for senc atoms, but they should not appear in clear content. Found by Chromium's ClusterFuzz: https://crbug.com/873432 Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/av1: update ff_isom_write_av1c() to the latest revision of the specJames Almer2018-08-171-10/+8
| | | | | | | | | | This will get ISOBMFF and Matroska up to date with the revised AV1 Codec Configuration Box spec. For now keep propagating raw OBUs as extradata until all libavcodec modules are adapted to handle AV1CodecConfigurationRecord formatted extradata. Tested-by: Thomas Daede <bztdlinux@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/mov.c: Set start_time for all streams (in case of edit lists).Sasi Inguva2018-08-111-2/+2
| | | | | | | | | Fixes vorbis mp4 audio files, with edit list specified. Since st->skip_samples is not set in case of vorbis , ffmpeg computes the start_time as negative. Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: Force HEVC codec_id for code-point dvh1 and an hvcC atom.Carl Eugen Hoyos2018-08-091-0/+2
| | | | | | | The mp4 registration authority accepted a code-point for Dolby Vision HEVC that was already used as a fourcc for DVCPRO 100. Fixes ticket #7347.
* avformat/mov: Check default_encrypted_sample before use in ↵Michael Niedermayer2018-07-261-0/+5
| | | | | | | | | | mov_read_sample_encryption_info() Fixes: 2018-0721-sample Fixes: null pointer dereference Found-by: Nikita Knyzhov (knnikita@yandex.ru) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: add support for AV1 streamsJames Almer2018-07-201-0/+31
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: only set handler_name from mdia->hdlrGyan Doshi2018-07-161-1/+2
| | | | | | 6 FATE references updated. Fixes #7104
* avformat/mov: Simplify last element computation in mov_estimate_video_delay()Michael Niedermayer2018-07-131-3/+2
| | | | | | Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Break out of inner loop early in mov_estimate_video_delay()Michael Niedermayer2018-07-131-0/+2
| | | | | | | | | | 0.266 <- 0.299 sec (this is time ffmpeg so containing alot other things) Sample for benchmark was: ffmpeg -f rawvideo -pix_fmt yuv420p -s 32x32 -i /dev/zero -t 24:00:00.00 out.mp4 Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Eliminate variable buf_size from mov_estimate_video_delay()Michael Niedermayer2018-07-121-11/+8
| | | | | | Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: remove modulo operations from mov_estimate_video_delay()Michael Niedermayer2018-07-121-3/+7
| | | | | | | | 0.324 <-0.491 sec Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Expose encryption info to the app.Jacob Trimble2018-07-041-1/+119
| | | | | | | | | | This exposes encryption info from the container to the app. This includes key ID, IV, and subsample byte ranges. The info is passed using the new side-data AV_PKT_DATA_ENCRYPTION_DATA and AV_PKT_DATA_ENCRYPTION_INIT_DATA. Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: Do not fail hard for truncated stsz atoms.Carl Eugen Hoyos2018-06-191-1/+2
| | | | Fixes ticket #6433.
* avformat/mov: Only set pkt->duration to non negative valuesMichael Niedermayer2018-06-141-1/+3
| | | | | Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Add check for per-sample IV size.Jacob Trimble2018-06-131-2/+7
| | | | | | | Found by Chrome's ClusterFuzz: http://crbug.com/849062. Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix reading saio/saiz for clear content.Jacob Trimble2018-06-091-16/+55
| | | | | | | | | | | This validates that the common encryption saio/saiz atoms only appear when the data is actually encrypted. This also ignores those atoms in clear content. Found by Chrome's ClusterFuzz: http://crbug.com/850389 Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov.c: Set st->start_time for video streams explicitly.Sasi Inguva2018-06-061-4/+16
| | | | | | | If start_time is not set, ffmpeg takes the duration from the global movie instead of the per stream duration. Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov.c: Fix timestamps to be strictly monotonic for video also.Sasi Inguva2018-06-051-4/+5
| | | | | | | | | | | We already do this for audio, but it should be done for video too. If we don't, seeking back to the start of the file, for example, can become quite broken, since the first N packets will have repeating and nonmonotonic PTS, yet they need to be decoded even if they are to be discarded. Signed-off-by: Sasi Inguva <isasi@isasi.mtv.corp.google.com> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* libavformat/mov: Fix heap buffer overflow.Jacob Trimble2018-06-021-3/+3
| | | | | | | Found by Chrome's ClusterFuzz: https://crbug.com/847060 Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
OpenPOWER on IntegriCloud