summaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
Commit message (Collapse)AuthorAgeFilesLines
...
* avformat/mov: replace a value error by clipping into valid range in ↵Michael Niedermayer2018-05-221-3/+11
| | | | | | | | mov_read_stsc() Fixes: #7165 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Only fail for STCO/STSC contradictions if both existMichael Niedermayer2018-05-211-1/+1
| | | | | | | | Fixes regression with playback of GF9720Repeal20the20Eighth20with20Helen20Linehan.m4a See: crbug 822666 Found-by: "Mattias Wadman <mattias.wadman@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Break out early if chunk_count is 0 in mov_build_index()Michael Niedermayer2018-05-211-0/+3
| | | | | | | | | Without this some operations might overflow (undefined behavior) even though the index adding loop would never execute No testcase known Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mov: Properly abide by the track's media durationDerek Buitenhuis2018-04-261-3/+3
| | | | | | | | | | | | | | | | | The track's media duration from the mdhd atom takes precedence over both the stts and elst atom for calculating and setting the track's total duraion. Technically, we shouldn't be using the stts atom at all for calculating stream durations. This fixes incorrect stream and final packet durations on files with edit lists that are longer than the media duration. The FATE changes are expected, and output is more correct (the AAC frame is not 1028 samples). Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat/mov: Fix parsing of saio/siaz atoms in encrypted content.Jacob Trimble2018-04-211-0/+237
| | | | | | | This doesn't support saio atoms with more than one offset. Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Remove old encryption info methods.Jacob Trimble2018-04-191-91/+0
| | | | | Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix memory leak in encryption info.Jacob Trimble2018-04-191-0/+1
| | | | | Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Increase support for common encryption.Jacob Trimble2018-04-191-81/+313
| | | | | | | | | | | | | | | | | | - Parse schm atom to get different encryption schemes. - Allow senc atom to appear in track fragments. - Allow 16-byte IVs. - Allow constant IVs (specified in tenc). - Allow only tenc to specify encryption (i.e. no senc/saiz/saio). - Use sample descriptor to detect clear fragments. This doesn't support: - Different sample descriptor holding different encryption info. - Only first sample descriptor can be encrypted. - Encrypted sample groups (i.e. seig). - Non-'cenc' encryption scheme when using -decryption_key. Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix extradata memleakMichael Niedermayer2018-04-121-0/+6
| | | | | | | | Fixes: crbug 822705 Reported-by: Matt Wolenetz <wolenetz@google.com> Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix parsing of tfdt when using sample descriptors.Jacob Trimble2018-04-051-1/+1
| | | | | Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: parse multiple iTunes cover imagesTimo Teräs2018-04-011-0/+4
| | | | | | | | | Multiple cover images are supported by having multiple data atoms inside the covr atom. AtomicParsley and mutagen amongst others support and document this construct. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Move +1 in check to avoid hypothetical overflow in ↵Michael Niedermayer2018-03-261-1/+1
| | | | | | add_ctts_entry() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Check STSC and remove invalid entriesMichael Niedermayer2018-03-201-0/+20
| | | | | | | | | | | Fixes assertion failure Fixes: crbug 822547, crbug 822666 and crbug 823009 Affects: aark15sd_9A62E2FA.mp4 Found-by: ClusterFuzz Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix integer overflows related to sample_durationMichael Niedermayer2018-03-121-5/+15
| | | | | | | | | | Fixes: runtime error: signed integer overflow: -9166684017437101870 + -2495066639299164439 cannot be represented in type Fixes: Chromium bug 791349 Reported-by: Matt Wolenetz <wolenetz@google.com> Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov.c: Use the correct offset to shift timestamp when seeking.Sasi Inguva2018-03-101-11/+16
| | | | | | | | Fixes seek for files with empty edits and files with negative ctts (dts_shift > 0). Added fate samples and tests. Signed-off-by: Sasi Inguva <isasi@isasi.mtv.corp.google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: print the projection type when reporting it as unsupportedJames Almer2018-03-091-1/+1
| | | | | Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: Fix stts_data memory allocationXiaohan Wang2018-03-091-1/+1
| | | | | | | | | In this loop, |i| is the "index". And the memory allocated should be at least the current "count", which is |i + 1|. BUG=801821 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix integer overflow in mov_get_stsc_samples()Michael Niedermayer2018-03-071-3/+4
| | | | | | | | Fixes: runtime error: signed integer overflow: 5 * -2147483647 cannot be represented in type 'int' Fixes: Chromium bug 817338 Reviewed-by: Matt Wolenetz <wolenetz@google.com> Reported-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Initialize a potential gap in ctts_data in mov_build_indexMatt Wolenetz2018-03-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | mov_read_ctts ignores ctts entries having count <= 0. Generally, the aggregate of all ctts entries' count fields resulting from mov_read_ctts can be less than the corresponding sample_count. mov_build_index attempts to normalize any existing ctts_data counts to be 1, to make a 1-1 mapping of a ctts_data entry to a sample. That 1-1 mapping left a tail of uninitialized ctts_data entries when the aggregate, normalized ctts_count < sample_count. Even more generally, later usage of ctts_data may depend on the entire ctts_allocated_size having been initialized. This change memsets the entire allocation of the normalized ctts_data in mov_build_index, to prevent use of uninitialized data later. BUG=816787 Change-Id: I7fd7db255e3aeed076ee32c90cb2df211741c052 Reviewed-on: https://chromium-review.googlesource.com/947110 Reviewed-by: Xiaohan Wang <xhwang@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Add manu/modl to mov_read_udta_string.Tianqiang Liu2018-03-031-0/+2
| | | | | | Documentation: http://mp4ra.org/atoms.html Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* ffmpeg: Fix memset size on ctts_data in mov_read_trun() (round 2)Xiaohan Wang2018-03-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The allocated size of sc->ctts_data is (st->nb_index_entries + entries) * sizeof(*sc->ctts_data). The size to memset at offset sc->ctts_data + sc->ctts_count should be (st->nb_index_entries + entries - sc->ctts_count) * sizeof(*sc->ctts_data)) The current code missed |entries| I believe, which was introduced in https://patchwork.ffmpeg.org/patch/5541/. However, after offline discussion, it seems the original code is much more clear to read (before https://patchwork.ffmpeg.org/patch/5541/). Hence this CL revert the memset logic to it's previous state by remembering the |old_ctts_allocated_size|, and only memset the newly allocated entries. BUG=812567 Change-Id: Ibe94c7138e5818bfaae76866bfa6619a9b8a2b6b Reviewed-on: https://chromium-review.googlesource.com/934925 Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix ctts_index calculationXiaohan Wang2018-02-101-1/+1
| | | | | | | | An index should never be equal to the count. Hence we must make sure *ctts_index < ctts_count. Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: add VP8 codec supportJames Almer2018-02-061-0/+1
| | | | | | | | | | | | | Demuxing only. Muxing is disabled as altref frame handling is not defined in the spec, and there's no way to know the presence of such frames during stream initialization. Based on a patch by Steven Liu. Fixes ticket #7000 Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: migrate to AVFormatContext->urlMarton Balint2018-01-281-1/+1
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/mov: Use av_fast_realloc() in mov_read_stts().Carl Eugen Hoyos2018-01-011-4/+13
| | | | | Avoids large allocations for short files with invalid stts entry. Fixes bugzilla 1102.
* avformat/mov: simplify parsing of mdcv atom using av_make_q()James Almer2017-12-211-14/+8
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/mov.c: Guess video codec delay based on PTS while parsing MOV header.Sasi Inguva2017-12-201-0/+56
| | | | | Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix the the typoMichael Niedermayer2017-12-181-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: modify code indentationtiejun.peng2017-12-091-7/+7
| | | | | Signed-off-by: tiejun.peng <tiejun.peng@foxmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: add some useful warning log of eoftiejun.peng2017-12-091-10/+33
| | | | | Signed-off-by: tiejun.peng <tiejun.peng@foxmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: Fix missing newline.Carl Eugen Hoyos2017-12-041-1/+2
|
* lavf/mov: fix huge alloc in mov_read_cttsJohn Stebbins2017-12-011-4/+27
| | | | | | | | | | An invalid file may cause huge alloc. Delay expansion of ctts entries until the number of samples is known in mov_build_index. Fixes: 23 Found-by: zhao dongzhuo, AD-lab of Venustech Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: return correct value in mov_read_cmovPan Bian2017-11-281-0/+1
| | | | | | | On some failure paths, the error code is not correctly set. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: set correct error code in mov_read_customPan Bian2017-11-281-1/+3
| | | | | | | | | In function mov_read_custom(), it returns 0 on the path that av_malloc() returns a NULL pointer. 0 indicates success. An error code should be assigned to ret. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mov: Support mdcv and clli boxes for mastering display an color light levelVittorio Giovara2017-11-281-0/+71
| | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* libavformat/mov: Replace duplicate stream_nb check by assertMichael Niedermayer2017-11-271-2/+1
| | | | | Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: fix crash in mov_read_sidxJohn Stebbins2017-11-251-1/+1
| | | | | | Use correct index into streams Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: Read aspect ratio from AVID jpeg2000 mov files.Carl Eugen Hoyos2017-11-231-0/+1
|
* avformat/mov: Increment stsd_count while processing stsd data; avoids leaks.Dale Curtis2017-11-221-3/+4
| | | | | | | | | | In the event of ff_mov_read_stsd_entries() failure, sc->stsd_count is not updated, even if the function allocates extradata memory. Instead update the sc->stsd_count as entries are parsed so that mov_read_close() can do the right thing. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Propagate errors in mov_switch_root.Jacob Trimble2017-11-211-2/+5
| | | | | Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: Do not mix variable declaration and code.Carl Eugen Hoyos2017-11-201-1/+2
| | | | | Fixes a warning: libavformat/mov.c:1195:5: warning: ISO C90 forbids mixed declarations and code
* lavf/mov: don't read outside frag_index boundsJohn Stebbins2017-11-181-0/+4
| | | | | | | | | | | Potentially fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=786269#c1 In theory, the crash can be triggered by an invalid stream that has either tfdt or trun outside of the moof Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Fix leak of frame_duration_buffer in mov_fix_index().Dale Curtis2017-11-181-0/+1
| | | | | | | | | Should be unconditionally freed at the end of mov_fix_index() in case it hasn't been used during the fix up. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Sasi Inguva <isasi-at-google.com@ffmpeg.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Check size of STSC allocationFredrik Hubinette2017-11-161-0/+2
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov.c: Don't correct edit list start to zero, when we can't find a ↵Sasi Inguva2017-11-141-3/+1
| | | | | | | | | frame before edit list start. After c2a8f0fcbe57ea9ccaa864130f078af10516c3c1 this can happen on normal edit lists starting on a B-frame. Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov.c: Parse upto 2 keyframes after the edit list end in mov_fix_index.Sasi Inguva2017-11-111-11/+21
| | | | | | Partially fixes t/6699. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'defe307fb22beca60a632e976ab97e5edd4aee25'James Almer2017-11-111-2/+5
|\ | | | | | | | | | | | | | | | | | | | | | | * commit 'defe307fb22beca60a632e976ab97e5edd4aee25': mov: move stsd finalization to an appropriate place mov: Do not set stsd_count if mov_read_stsd() fails mov: log and return early on non-positive stsd entry counts See 8b43ee4054af799e388d380b379a13a60849c1b5 656feb641de3cd5b9cb4e33ffd3f0ad4664c36d2 Merged-by: James Almer <jamrial@gmail.com>
| * mov: move stsd finalization to an appropriate placeSean McGovern2017-07-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | mov_finalize_stsd_codec() parses stream information from the ALAC extradata, so run it after the extradata processing is completed in mov_read_stsd(). Fixes playback of 96kHz ALAC streams muxed by qaac or the reference alac encoder. Adapted from an FFmpeg patch by Hendrik Leppkes <h.leppkes@gmail.com> Bug-Id: 1072
| * mov: Do not set stsd_count if mov_read_stsd() failsSean McGovern2017-07-311-8/+17
| | | | | | | | Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>
| * mov: log and return early on non-positive stsd entry countsSean McGovern2017-07-301-0/+5
| | | | | | | | Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>
OpenPOWER on IntegriCloud