Commit Graph

1620 Commits

Author SHA1 Message Date
Vignesh Venkatasubramanian
f2724d2b69 avformat/mov: Add avif to list of supported extensions
AVIF still and animations are now supported by the MOV parser.
Add the "avif" extension to the list of supported extensions to
AVInputFormat.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2022-04-25 15:42:11 +05:30
Leo Izen
3ac23440ef avformat/image2: add Jpeg XL as image2 format
This commit adds support to libavformat for muxing
and demuxing Jpeg XL images as image2 streams.
2022-04-23 19:51:46 +02:00
Vignesh Venkatasubramanian
499e245b85 avformat/mov: Add support for still image AVIF parsing
This patch supports AVIF still images conforming to the
final specification that have exactly one item (i.e. no alpha channel).
The iloc box is parsed and the mov index populated.

Partially fixes #7621.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2022-04-23 13:26:34 +05:30
Marton Balint
8dd5bb7280 avformat/mov: fix timecode with high frame rate content
60 fps content have "Number of Frames" set to 30 in the tmcd atom, but the
frame duration / timescale reflects the original video frame rate.

Therefore we multiply the frame count with the quotient of the rounded timecode
frame rate and the "Number of Frames" per second to get a frame count in the original
(higher) frame rate.

Note that the frames part in the timecode will be in high frame rate which will
make the timecode different to e.g. MediaInfo which seems to show the 30 fps
timecode even for 120 fps content.

Regression since 428b4aacb1.

Fixes ticket #9710.
Fixes ticket #9492.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-22 22:54:56 +02:00
Martin Storsjö
a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the
list of enabled components has changed, but not the other properties
of the build, set in config.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:49 +02:00
Vittorio Giovara
6f8b8e6332 mov: Implement spatial audio support
As defined by Google's Spatial Audio RFC.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:47 -03:00
Vittorio Giovara
b828c3954e mov: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:34 -03:00
Clément Bœsch
1a502b99e8 avformat/mov: reindent after previous commit 2022-03-04 15:50:51 +01:00
Clément Bœsch
ab77b878f1 avformat/mov: fix seeking with HEVC open GOP files
This was tested with medias recorded from an iPhone XR and an iPhone 13.

Here is how a typical stream looks like in coding order:

    ┌────────┬─────┬─────┬──────────┐
    │ sample | PTS | DTS | keyframe |
    ├────────┼─────┼─────┼──────────┤
    ┊        ┊     ┊     ┊          ┊
    │   53   │ 560 │ 510 │    No    │
    │   54   │ 540 │ 520 │    No    │
    │   55   │ 530 │ 530 │    No    │
    │   56   │ 550 │ 540 │    No    │
    │   57   │ 600 │ 550 │    Yes   │
    │ * 58   │ 580 │ 560 │    No    │
    │ * 59   │ 570 │ 570 │    No    │
    │ * 60   │ 590 │ 580 │    No    │
    │   61   │ 640 │ 590 │    No    │
    │   62   │ 620 │ 600 │    No    │
    ┊        ┊     ┊     ┊          ┊

In composition/display order:

    ┌────────┬─────┬─────┬──────────┐
    │ sample | PTS | DTS | keyframe |
    ├────────┼─────┼─────┼──────────┤
    ┊        ┊     ┊     ┊          ┊
    │   55   │ 530 │ 530 │    No    │
    │   54   │ 540 │ 520 │    No    │
    │   56   │ 550 │ 540 │    No    │
    │   53   │ 560 │ 510 │    No    │
    │ * 59   │ 570 │ 570 │    No    │
    │ * 58   │ 580 │ 560 │    No    │
    │ * 60   │ 590 │ 580 │    No    │
    │   57   │ 600 │ 550 │    Yes   │
    │   63   │ 610 │ 610 │    No    │
    │   62   │ 620 │ 600 │    No    │
    ┊        ┊     ┊     ┊          ┊

Sample/frame 58, 59 and 60 are B-frames which actually depends on the
key frame (57). Here the key frame is not an IDR but a "CRA" (Clean
Random Access).

Initially, I thought I could rely on the sdtp box (independent and
disposable samples), but unfortunately:

    sdtp[54] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[55] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[56] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[57] is_leading:0 sample_depends_on:2 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[58] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[59] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[60] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[61] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[62] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0

The information that might have been useful here would have been
is_leading, but all the samples are set to 0 so this was unusable.

Instead, we need to rely on sgpd/sbgp tables. In my case the video track
contained 3 sgpd tables with the following grouping types: tscl, sync
and tsas. In the sync table we have the following 2 entries (only):

    sgpd.sync[1]: sync nal_unit_type:0x14
    sgpd.sync[2]: sync nal_unit_type:0x15

(The count starts at 1 because 0 carries the undefined semantic, we'll
see that later in the reference table).

The NAL unit types presented here correspond to:

    libavcodec/hevc.h:    HEVC_NAL_IDR_N_LP       = 20,
    libavcodec/hevc.h:    HEVC_NAL_CRA_NUT        = 21,

In parallel, the sbgp sync table contains the following:

    ┌────┬───────┬─────┐
    │ id │ count │ gdi │
    ├────┼───────┼─────┤
    │  0 │   1   │  1  │
    │  1 │   56  │  0  │
    │  2 │   1   │  2  │
    │  3 │   59  │  0  │
    │  4 │   1   │  2  │
    │  5 │   59  │  0  │
    │  6 │   1   │  2  │
    │  7 │   59  │  0  │
    │  8 │   1   │  2  │
    │  9 │   59  │  0  │
    │ 10 │   1   │  2  │
    │ 11 │   11  │  0  │
    └────┴───────┴─────┘

The gdi column (group description index) directly refers to the index in
the sgpd.sync table. This means the first frame is an IDR, then we have
batches of undefined frames interlaced with CRA frames. No IDR ever
appears again (tried on a 30+ seconds sample).

With that information, we can build an heuristic using the presentation
order.

A few things needed to be introduced in this commit:

1. min_sample_duration is extracted from the stts: we need the minimal
   step between sample in order to PTS-step backward to a valid point
2. In order to avoid a loop over the ctts table systematically during a
   seek, we build an expanded list of sample offsets which will be used
   to translate from DTS to PTS
3. An open_key_samples index to keep track of all the non-IDR key
   frames; for now it only supports HEVC CRA frames. We should probably
   add BLA frames as well, but I don't have any sample so I prefered to
   leave that for later

It is entirely possible I missed something obvious in my approach, but I
couldn't come up with a better solution. Also, as mentioned in the diff,
we could optimize is_open_key_sample(), but the linear scaling overhead
should be fine for now since it only happens in seek events.

Fixing this issue prevents sending broken packets to the decoder. With
FFmpeg hevc decoder the frames are skipped, with VideoToolbox the frames
are glitching.
2022-03-04 15:50:51 +01:00
Clément Bœsch
e05e4398c3 avformat/mov: add parsing for the sgpd sync box
sgpd means Sample Group Description Box.

For now, only the sync grouping type is parsed, but the function can
easily be adjusted to support other flavours.

The sbgp (Sample to Group Box) sync_group table built in previous commit
contains references to this table through the group_description_index
field.
2022-03-04 15:50:51 +01:00
Clément Bœsch
eb947471b2 avformat/mov: add support for sync group in sbgp box 2022-03-04 15:50:51 +01:00
Clément Bœsch
954f488ea3 avformat/mov: prepare sbgp parsing for other grouping types 2022-03-04 15:50:51 +01:00
Michael Niedermayer
4419433d77 avformat/mov: Disallow empty sidx
It appears this is not allowed "Each Segment Index box documents how a (sub)segment is divided into one or more subsegments
(which may themselves be further subdivided using Segment Index boxes)."
Fixes: Null pointer dereference
Fixes: Ticket9517

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-02 17:51:35 +01:00
Michael Niedermayer
8ee0e4abcb avformat/mov: Corner case encryption error cleanup in mov_read_senc()
Fixes: memleak
Fixes: 42341/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4566632823914496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-02-15 21:25:43 +01:00
Michael Niedermayer
d8d9d506a3 avformat/mov: Check size before subtraction
Fixes: signed integer overflow: -9223372036854775808 - 8 cannot be represented in type 'long'
Fixes: 43542/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5237670148702208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-02-01 16:50:27 +01:00
Andreas Rheinhardt
c8b11b28d1 avformat/mov: Fix endian-dependent parsing
MOVAtom.type is always read as a little-endian number
(despite MOV/ISOBMFF being big-endian).
Fixes the matroska-dovi-write-config8 FATE-test on big-endian
arches (which runs into the "index out of range" warning message).

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-21 11:52:45 +01:00
Andreas Rheinhardt
d7a75d2163 avcodec/ac3tab: Unavpriv ac3_channel_layout_tab
It is small (16 B) and therefore the overhead of exporting it more
than outweighs the size savings from not having duplicated symbols:
When the symbol is no longer avpriv, one saves twice the size of
the string containing the symbols name (2x30 byte), two entries
in .dynsym (24 bytes each on x64), one entry in the importing libraries
.got and .rela.dyn (8 + 24 bytes on x64) and two entries for the
symbol version (2 bytes each) and one hash value in the exporting
library (4 bytes).
(The exact numbers are of course different for other platforms
(e.g. when using dlls), but given that the strings saved alone
more than outweigh the array size it can be presumed that this
is beneficial for all platforms.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 13:16:49 +01:00
quietvoid
9906f9ae3b avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc
To avoid duplicating code. The implementation in dovi_isom is identical.

Signed-off-by: quietvoid <tcChlisop0@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 04:29:36 +01:00
Gyan Doshi
9cfc7a2440 avformat/mov: add option max_stts_delta
Very high stts sample deltas may occasionally be intended but usually
they are written in error or used to store a negative value for dts correction
when treated as signed 32-bit integers.

This option lets the user set an upper limit, beyond which the delta is clamped to 1.
Values greater than the limit if negative when cast to int32 are used to adjust onward dts.

Unit is the track time scale. Default is UINT_MAX - 48000*10 which
allows upto a 10 second dts correction for 48 kHz audio streams while
accommodating 99.9% of uint32 range.

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-31 14:44:20 +05:30
Michael Niedermayer
562021e2fd avformat/mov: Check next offset in mov_read_dref()
Fixes: signed integer overflow: 9223372036200463215 + 1109914409 cannot be represented in type 'long'
Fixes: 41480/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6553086177443840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Andreas Rheinhardt
17a93fd377 avformat/mov: Simplify data->hex conversion
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 14:17:39 +01:00
Michael Niedermayer
b5ba74053c avformat/mov: Disallow duplicate smdm
Fixes: memleak
Fixes: 39879/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5327819907923968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Michael Niedermayer
59b4e7cbd8 avformat/mov: Check for EOF in mov_read_glbl()
Fixes: Infinite loop
Fixes: 41351/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5433895854669824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Michael Niedermayer
3a64a4c582 avformat/mov: Check channels for mov_parse_stsd_audio()
Fixes: signed integer overflow: -776522110086937600 * 16 cannot be represented in type 'long'
Fixes: 40563/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644829447127040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-29 17:15:07 +01:00
Gyan Doshi
203b0e3561 avformat/mov: make STTS duration unsigned int
As per 8.6.1.2.2 of ISO/IEC 14496-12:2015(E), STTS sample offsets
are to be always stored as uint32_t. So far, they have been signed ints
which led to desync in files with very large offsets.

The MOVStts struct was used to store CTTS offsets as well. These can be
negative in version 1. So a new struct MOVCtts was created and all
declarations for CTTS usage changed to MOVCtts.
2021-11-22 15:18:42 +05:30
Thilo Borgmann
c42d513ede lavf/mov: Change default to prefer TFDT time and allow for fallback to SIDX or TFDT 2021-11-05 16:22:04 +01:00
Limin Wang
3c3ef41593 avformat/mov: support dvwC box for Dolby Vision
By <<Dolby Vision Streams Within the ISO Base Media File Format Version 2.2>>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-28 09:25:31 +08:00
Derek Buitenhuis
7216458c96 avformat/mov: Do not hard fail if bit rate calculation overflows unless in explode mode
bit_rate is not a critical field, and we shouln't hard fail if we
can't caluclate it due to a large timebase - it needlessly breaks
valid files.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-10-21 14:34:36 +01:00
Derek Buitenhuis
a987b5c9ee avformat/mov: Use av_rescale when calculating bit rate
It is less susceptible to overflows.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-10-21 14:34:36 +01:00
Nachiket Tarate
ef0f5d1be6 libavformat/mov: add support for 'cens', 'cbc1' and 'cbcs' encryption schemes specified in Common Encryption (CENC) standard
correct implementation of 'cenc' encryption scheme to support
decryption of partial cipher blocks at the end of subsamples

https://www.iso.org/standard/68042.html

Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2021-10-13 11:23:44 +08:00
Jan Ekström
7a446b1179 avformat/{isom,mov,movenc}: add support for CMAF DASH roles
This information is coded in a standard MP4 KindBox and utilizes the
scheme and values as per the DASH role scheme defined in MPEG-DASH.
Other schemes are technically allowed, but where multiple schemes
define the same concepts, the DASH scheme should be utilized.

Such flagging is additionally utilized by the DASH-IF CMAF ingest
specification, enabling an encoder to inform the following component
of the roles of the incoming media streams.

A test is added for this functionality in a similar manner to the
matroska test.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2021-10-04 17:55:27 +03:00
Michael Niedermayer
451ceb5131 avformat/mov: Fix last mfra check
Fixes: signed integer overflow: 9223372036854775360 + 536870912 cannot be represented in type 'long'
Fixes: 37940/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6095637855207424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:22:18 +02:00
Nicolas Gaullier
8a3f8afa4e avformat/mov: Set AVSTREAM_PARSE_HEADERS flag for H264
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-23 10:35:09 -03:00
Andreas Rheinhardt
1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt
40bdd8cc05 avformat: Avoid allocation for AVStreamInternal
Do this by allocating AVStream together with the data that is
currently in AVStreamInternal; or rather: Put AVStream at the
beginning of a new structure called FFStream (which encompasses
more than just the internal fields and is a proper context in its own
right, hence the name) and remove AVStreamInternal altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-17 13:22:25 +02:00
Michael Niedermayer
9a222f140e avformat/mov: Check for duplicate clli
Fixes: memleak
Fixes: 35261/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4869656287510528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-14 17:34:33 +02:00
Michael Niedermayer
4de4bc06fd avformat/mov: Check dts for overflow in mov_read_trun()
Fixes: signed integer overflow: 9223372034248226491 + 3275247799 cannot be represented in type 'long'
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-4538729166077952

Reported-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-29 21:34:38 +02:00
Andreas Rheinhardt
45bfe8b838 avformat/avio: Move internal AVIOContext fields to avio_internal.h
Currently AVIOContext's private fields are all over AVIOContext.
This commit moves them into a new structure in avio_internal.h instead.
Said structure contains the public AVIOContext as its first element
in order to avoid having to allocate a separate AVIOContextInternal
which is costly for those use cases where one just wants to access
an already existing buffer via the AVIOContext-API.
For these cases ffio_init_context() can't fail and always returned zero,
which was typically not checked. Therefore it has been made to not
return anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-25 23:01:54 +02:00
Gyan Doshi
d905af0c24 avformat/mov: add AVFMT_SHOW_IDS flag
The MOV muxer can store streamids as track ids but they aren't
visible when probing the result via lavf/dump or ffprobe due to
lack of this flag in the demuxer.
2021-08-22 17:55:31 +05:30
Soft Works
6a4f851df7 libavformat/mov: Change log line from debug to trace
It's creating too much noise, even for debug

Signed-off-by: softworkz <softworkz@hotmail.com>
2021-08-07 11:24:59 -03:00
Andreas Rheinhardt
65f9a8e4b8 avformat/mov: Remove pointless EOF checks
9888ffb1ce added checks for EOF
in loops in the mov demuxer as a precaution against timeouts;
yet there is no I/O in the loop when parsing the STSZ atom
as the values are read from an already read buffer. So remove said
checks.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-28 22:26:54 +02:00
Andreas Rheinhardt
c2d853c1aa avformat/mov: Fix crash with too big STSZ atoms
mov_read_stsz() did not ensure that every bit of a buffer is addressable
by an int as is required by the get_bits API, leading to a crash in
ticket #9344. Fix this by restricting the size more thoroughly.

The file from said ticket will then be considered invalid; in the
future, we might read and process the data in chunks to actually support
such files.

Fixes ticket #9344.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-28 22:26:54 +02:00
Michael Niedermayer
200406d930 avformat/mov: Fix incorrect overflow detection in mov_read_sidx()
Fixes: signed integer overflow: 9223372036854775807 + 1442840321 cannot be represented in type 'long'
Fixes: 33670/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644379491106816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-28 19:15:26 +02:00
Michael Niedermayer
7666d588ba avformat/mov: Avoid undefined overflow in time_offset calculation
Fixes: signed integer overflow: 8511838621821575200 - -3954125146725285889 cannot be represented in type 'long'
Fixes: 33414/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6610119325515776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-22 23:33:26 +02:00
Michael Niedermayer
c52c99a18f avformat/mov: do not ignore errors in mov_metadata_hmmt()
Fixes: Timeout
Fixes: 35637/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6311060272447488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Martin Storsjö
13ec6624b3 mov: Don't export unknown/unhandled metadata types as if they were UTF8
They can be other incompatible text encodings (such as UTF-16),
or even binary data.

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-07-15 10:25:39 +03:00
Martin Storsjö
a99dd5f6a4 mov: Pick up "com.apple.quicktime.artwork" as cover art
Signed-off-by: Martin Storsjö <martin@martin.st>
2021-07-15 10:25:35 +03:00
Andreas Rheinhardt
c6e9672b50 avformat/mov: Simplify cleanup after read_header failure
By default, a demuxer's read_close function is not called automatically
if an error happens when reading the header; instead it is up to the
demuxer to clean up after itself in this case. The mov demuxer did this
by calling its read_close function when it encountered some errors when
reading the header.

This commit changes this by setting the FF_FMT_INIT_CLEANUP flag so that
mov_read_close() is automatically called when an error happens when
reading the header.

(Btw: mov_read_close() is not idempotent: Calling it twice is
dangerouos, because MOVContext.frag_index.item will be av_freep'ed,
yet MOVContext.frag_index.nb_items won't be reset. So the calls to
mov_read_close() have to be removed before the switch to freeing
generically.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 23:50:02 +02:00
Michael Niedermayer
f54d85cee6 avformat/mov: Check for duplicate mdcv
Fixes: memleak
Fixes: 34932/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5456227658235904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-06-12 14:22:42 +02:00
Gyan Doshi
071930de72 avformat/mov: add option to use tfdt for fragment timestamps. 2021-06-02 10:46:04 +05:30