summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
Commit message (Collapse)AuthorAge
* avformat/mov: Fix integer overflows related to sample_durationMichael Niedermayer2018-03-12
| | | | | | | | | | 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-10
| | | | | | | | 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-09
| | | | | Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: Fix stts_data memory allocationXiaohan Wang2018-03-09
| | | | | | | | | 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-07
| | | | | | | | 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-05
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-03
| | | | | | 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-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-10
| | | | | | | | 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-06
| | | | | | | | | | | | | 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-28
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/mov: Use av_fast_realloc() in mov_read_stts().Carl Eugen Hoyos2018-01-01
| | | | | 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-21
| | | | 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-20
| | | | | Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix the the typoMichael Niedermayer2017-12-18
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mov: modify code indentationtiejun.peng2017-12-09
| | | | | 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-09
| | | | | 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-04
|
* lavf/mov: fix huge alloc in mov_read_cttsJohn Stebbins2017-12-01
| | | | | | | | | | 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-28
| | | | | | | 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-28
| | | | | | | | | 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-28
| | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* libavformat/mov: Replace duplicate stream_nb check by assertMichael Niedermayer2017-11-27
| | | | | 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-25
| | | | | | 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-23
|
* avformat/mov: Increment stsd_count while processing stsd data; avoids leaks.Dale Curtis2017-11-22
| | | | | | | | | | 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-21
| | | | | 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-20
| | | | | 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-18
| | | | | | | | | | | 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-18
| | | | | | | | | 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-16
| | | | 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-14
| | | | | | | | | 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-11
| | | | | | Partially fixes t/6699. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'defe307fb22beca60a632e976ab97e5edd4aee25'James Almer2017-11-11
|\ | | | | | | | | | | | | | | | | | | | | | | * 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-31
| | | | | | | | | | | | | | | | | | | | | | 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-31
| | | | | | | | Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>
| * mov: log and return early on non-positive stsd entry countsSean McGovern2017-07-30
| | | | | | | | Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>
* | lavf/mov.c: Refine edit list start seek, based on PTS computed from CTTS.Sasi Inguva2017-11-04
| | | | | | | | | | | | Partially fixes t/6699. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavformat/mov.c: use calculated dts offset when seeking in streamsJonas Licht2017-10-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Subtract the calculated dts offset from the requested timestamp before seeking. This fixes an error "Error while filtering: Operation not permitted" observed with a short file which contains only one key frame and starts with negative timestamps. Then, av_index_search_timestamp() returns a valid negative timestamp, but mov_seek_stream bails out with AVERROR_INVALIDDATA. Fixes ticket #6139. Signed-off-by: Jonas Licht <jonas.licht@fem.tu-ilmenau.de> Signed-off-by: Peter Große <pegro@friiks.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/mov.c: Fix parsing of edit list atoms with invalid elst entry count.Sasi Inguva2017-10-28
| | | | | | | | | | Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '604fbb3132e88727e496c96c92cfe02748c25a1a'James Almer2017-10-26
|\| | | | | | | | | | | | | * commit '604fbb3132e88727e496c96c92cfe02748c25a1a': mov: Move code shared with CAF to a separate file Merged-by: James Almer <jamrial@gmail.com>
| * mov: Move code shared with CAF to a separate fileDiego Biurrun2017-04-03
| |
| * spherical: Change types of bounding and pad to uint32_tVittorio Giovara2017-03-23
| | | | | | | | | | | | | | | | | | These values are defined to be 32bit in the specification, so it makes more sense to store them as fixed width. Based on a patch by Micahel Niedermayer <michael@niedermayer.cc>. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * mov: Export bounds and padding from spherical metadataVittorio Giovara2017-03-07
| | | | | | | | | | | | Update the fate test as needed. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * mov: Validate cubemap layoutVittorio Giovara2017-03-07
| |
* | mov: fix decode of fragments that overlap in timeJohn Stebbins2017-10-23
| | | | | | | | | | | | | | | | | | | | | | | | When keyframe intervals of dash segments are not perfectly aligned, fragments in the stream can overlap in time. The previous sorting by timestamp causes packets to be read out of decode order and results in decode errors. Insert new "trun" index entries into index_entries in the order that the trun are referenced by the sidx. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mov: Set start_pad correctly in mov_fix_index()Dale Curtis2017-10-21
| | | | | | | | | | | | | | | | | | | | | | Sets the correct start padding value when an edit list is present. A new fate test is added, fate-mov-440hz-10ms, to ensure this is handled correctly. 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>
* | Merge commit '0f8512c4a87b89b4694053d8ffda48066ee1da62'James Almer2017-10-17
|\| | | | | | | | | | | | | * commit '0f8512c4a87b89b4694053d8ffda48066ee1da62': mov: Validate spherical metadata version Merged-by: James Almer <jamrial@gmail.com>
| * mov: Validate spherical metadata versionVittorio Giovara2017-03-07
| |
* | Merge commit '236577230051ad61ec67fa2d68e817d54232d2a0'James Almer2017-10-17
|\| | | | | | | | | | | | | * commit '236577230051ad61ec67fa2d68e817d54232d2a0': mov: Ignore old spherical metadata when newer version is present Merged-by: James Almer <jamrial@gmail.com>