summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
Commit message (Collapse)AuthorAge
* mov: Also export loci altitudeMichael Niedermayer2016-05-19
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: Append place name instead of overwriting for lociMichael Niedermayer2016-05-19
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: Fix parsing short lociMichael Niedermayer2016-05-19
| | | | | | | | | | Previously, we required the minimum number of bytes required for the full box. Don't strictly require the astronomical body and additional notes fields, but do require an altitude field (which currently isn't parsed). This matches the initial length check at the start of the function (which doesn't know about the variable length place field). Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: Print reason of loci parsing failureMichael Niedermayer2016-05-19
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: Add a comment referring to the standard that defines the loci boxMartin Storsjö2016-05-19
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* Drop pointless assert.h #includesDiego Biurrun2016-05-03
|
* mov: Check the entries value when parsing dref boxesLuca Barbato2016-03-11
| | | | | | | | | And properly reset the entries count when resetting the entries. CC: libav-stable@libav.org Bug-Id: 929 Bug-Id: CVE-2016-3062
* mov: Trim dref absolute pathVittorio Giovara2016-03-05
| | | | | | | | | | | | | Samples produced by Omneon (Harmonic) store external references with paths ending with 0s. Such movs cannot be loaded properly since every 0 is converted to '/', to keep the same parsing code for dref type 2 and type 18: this makes the external reference point to a non-existing direactory, rather than to the actual referenced file. Add a brief trimming loop that drops all ending 0s before trying to parse the external reference path. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* mov: Force the full parsing of mp3Luca Barbato2016-02-19
| | | | | | | | | | | Some muxer might or might not fit incomplete mp3 frames in their packets. Bug-Id: 899 CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* mov: Fix the format specifier type for sizeVittorio Giovara2016-02-16
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* mov: Use the correct type for sizeLuca Barbato2016-02-14
| | | | | | An AVIO offset is int64_t. Bug-Id: 921
* lavf: allow custom IO for all filesAnton Khirnov2016-01-24
| | | | | | | | | | | | | | Some (de)muxers open additional files beyond the main IO context. Currently, they call avio_open() directly, which prevents the caller from using custom IO for such streams. This commit adds callbacks to AVFormatContext that default to avio_open2()/avio_close(), but can be overridden by the caller. All muxers and demuxers using AVIO are switched to using those callbacks instead of calling avio_open()/avio_close() directly. (de)muxers that use the URLProtocol layer directly instead of AVIO remain unconverted for now. This should be fixed in later commits.
* mov: Add an option to toggle dref openingDerek Buitenhuis2016-01-21
| | | | | | | | | This feature is mostly only used by NLE software, and is both of dubious value being enabled by default, and a possible security risk. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* avformat: expose av_stream_new_side_data helperJohn Stebbins2015-11-18
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* mov: Drop dref when unable to parseVittorio Giovara2015-11-12
| | | | | | | Some entries might be either empty or contain types we do not parse (eg. 'url '). In both cases, if an 'alis' is not the first entry, external references are not loaded, so make sure that the array starts with an 'alis' dref.
* mov: Correctly store dref pathsVittorio Giovara2015-11-12
| | | | | | | | | | Rather than reading the alternate absolute path version from dref type 18, make sure that 0s are considered as '/'. These values are sometimes present in the full path, and are mistakenly interpreted as line terminators othewise. With the correct handling of this dref type, parsing type 18 is not needed any more.
* mov: detect cover art pictures by contentwm42015-11-03
| | | | | | | | | | | | I've got some m4a samples that had jpeg cover art marked as png. Since these files were supposedly written by iTunes, and other software can read it (e.g. clementine does), this should be worked around. Since png has a very simple to detect header, while it's apparently a real pain to detect jpeg in the general case, try to detect png and assume jpeg otherwise. Not bothering with bmp, as I have no test case. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* lavc: Make AVPacket.duration int64, and deprecate convergence_durationwm42015-09-29
| | | | | | | | | Note that convergence_duration had another meaning, one which was in practice never used. The only real use for it was a 64 bit replacement for the duration field. It's better just to make duration 64 bits, and to get rid of it. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* mov: Allow more than one keyframe per trunMartin Storsjö2015-09-06
| | | | | | | | | | | | | | | | | The previous restriction was partially designed to fix certain (broken) samples from bug 215. There should be no restriction on the number of keyframes per fragment or trun. The spec suggests that all frames lacking MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC are key frames, but we require the flag MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES to be unset as well. This works for (possibly broken) media that never sets the NON_SYNC flag and should also be correct for any spec-compliant file. For files that never set either of the flags, all samples are marked as keyframes. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-27
| | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* Revert "mov: Double-check that alias path is not an absolute path"Vittorio Giovara2015-07-17
| | | | | | | This reverts commit 9286de045968ad456d4e752651eec22de5e89060. The change broke support for legit absolute file paths. Reported-by: Maksym Veremeyenko <verem@m1stereo.tv>.
* riff: Use the correct logging contextLuca Barbato2015-07-11
|
* mov: Log format rather than fourcc in stsd in trace modeVittorio Giovara2015-07-01
| | | | This will fix remaining format warnings.
* mov: Adjust variable types to fix format warningsVittorio Giovara2015-07-01
|
* mp3: enable packed main_data decoding in MP4nu7742015-06-20
| | | | | | | | | | | | | | | | 14496-3 suggests packing main_data of MP3 that is usually scattered into multiple frames due to bit reservoir. However, after packing main_data into a access unit, bitrate index in the MPEG audio frame header doesn't match with actual frame size. In order to accept this, this patch removes unnecessary frame size checking on mp3 decoder. Also, mov demuxer was changed to use MP3 parser only on special cases (QT MOV with specific sample description) to avoid re-packetizing. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* mov: Check memory allocationVittorio Giovara2015-06-08
| | | | | CC: libav-stable@libav.org Bug-Id: CID 1292518
* mov: always check avio_read return valueAndreas Cadhalpun2015-05-31
| | | | | | | | | | | If avio_read fails, the buffer can contain uninitialized data. This fixes 'Conditional jump or move depends on uninitialised value(s)' valgrind warnings, and addresses a few memleaks. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* mov: reject zero bytes_per_frame with non-zero samples_per_frameAndreas Cadhalpun2015-05-31
| | | | | | | In this case the mov demuxer can return a large number of empty packets. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* mov: Correctly allocate ctts_dataLuca Barbato2015-05-31
| | | | | | It can be reallocated. CC: libav-stable@libav.org
* mov: Fix two memleaksAndreas Cadhalpun2015-05-31
| | | | | | | Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org> CC: libav-stable@libav.org
* mov: Double-check that alias path is not an absolute pathVittorio Giovara2015-04-19
| | | | | | | nlvl_to and nlvl_from can be set to 1 if both alias and target files are in the same directory, so actually check the first character of the string. We can do this because MacOS filepaths (alis type 2) are always converted to UNIX filepaths (alis type 18).
* mov: Read alternate absolute path in dref alisVittorio Giovara2015-04-19
| | | | | | | Absolute paths can be stored in alis type 2 and 18 according to my research: the first is the canonical MacOS filepath, with path level separated by colons, and the volume name within the filepath, while the second should be the absolute filesystem path from the mount point.
* Replace av_dlog with normal av_log at trace levelVittorio Giovara2015-04-19
| | | | This applies to every library where performance is not critical.
* mov: Rely on box type rather than file type for colr atomVittorio Giovara2015-04-09
| | | | | | | | Although it's not allowed to use only allows 'nclc' in ISOM files, there are samples that do not always respect this rule. This change prevents atom overread and a spurious color range initialization. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* mov: Write the display matrix in orderVittorio Giovara2015-03-23
| | | | | | | | | | This will allow to copy the matrix as is and it is just cleaner to keep the matrix in the same order specified by the mov standard (which is also explicitly described in the documentation). In order to preserve compatibility, flip the angle sign in the display API av_display_rotation_set() and av_display_rotation_get(), and improve the documentation mentioning the rotation direction.
* mov: Add option to keep exact packet sequence after seekingDerek Buitenhuis2015-03-18
| | | | | | | | | | | | | | The current behavior may produce a different sequence of packets after seeking, compared to demuxing linearly from the beginning. This is because the MOV demuxer seeks in each stream individually, based on timestamp, which may set each stream at a slightly different position than if the file would have been read sequentially. This makes implementing certain operations, such as segmenting, quite hard, and slower than need be. Therefore, add an option which retains the same packet sequence after seeking, as when a file is demuxed linearly.
* mov: Fix little endian audio detectionVittorio Giovara2015-03-17
| | | | | | | | | | Set this field to TRUE if the audio component is to operate on little-endian data, and FALSE otherwise. However TRUE and FALSE are not defined. Since this flag is just a boolean, interpret all values except for 0 as little endian. Sample-Id: 64bit_FLOAT_Little_Endian.mov
* Revert "mov: Change DTS-based seek into CTS-based seek."Martin Storsjö2015-03-02
| | | | | | | | | | | This reverts commit 4abfa387b8234736f6e0e541951e3d5eb60eb843. This commit broke playback of fragmented mp4 files with b-frames. While investigating this, it turned out that the general framework isn't ready for a PTS-based index yet. Revert this change until a better thought out solution is in place. Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: Change DTS-based seek into CTS-based seek.Yusuke Nakamura2015-02-15
| | | | | | | | | | | | | CTS-based seek is reasonable since player requests frames in output order not coded order. This change fixes seek to a keyframe within consecutive keyframes. Let's say P[0|-1] and P[1|0], here x and y inside [x|y] are PTS and DTS respectively, and both two frames are a keyframe. If you try to seek on PTS=0, i.e. P[0|-1], you'll get P[1|0] if the demuxer is DTS based. This is obviously undesirable. Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: Fix compilation with DEBUG enabledDiego Biurrun2015-02-14
|
* mov: Implement parsing of the "HandlerName" from the MP4 HDLR atomHendrik Leppkes2015-02-03
| | | | | | | | | | | | | | | | | This atom typically is used for a track title. The handler name is stored as a Pascal string in the QT specs (first byte is the length of the string), so do not export it. A second length check based on the first character is added to avoid overwriting an already specified handler_name (it happens with YouTube videos for instance, the handler_name get masked), or specifying an empty string metadata. The Pascal string fix and the second length check are written by Clément Bœsch <clement.boesch@smartjog.com>. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* mov: export audio service type as side dataAnton Khirnov2015-01-27
|
* mov: Do not compute negative SAR valuesVittorio Giovara2015-01-23
| | | | | | | | This partially reverts cf70ba37ba74089a18295b29e77dead0a3222c9e, since it didn't take into account when rotation is 0, but there is another valid operation (eg. translation) in the matrix. Found-by: Michael Niedermayer <michaelni@gmx.at>
* mov: Check angle rather than full matrix when updating SARVittorio Giovara2015-01-14
| | | | | | | | | | | | When the display matrix is not the identity one, but the rotation angle is zero, there is no need to update the sample aspect ratio. Otherwise, it is possible to obtain negative values which interferes with transcoding in later stages. This kind of behaviour is reproducible on mov files with "major_brand: MSNV". CC: libav-stable@libav.org Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* mov: avoid a memleak when multiple stss boxes are presentAnton Khirnov2014-12-19
| | | | | CC: libav-stable@libav.org Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
* mov: Fix handling of zero-length metadata valuesMartin Storsjö2014-12-15
| | | | | | | | | | | | | | | | Since 3cec81f4d4, a zero-length metadata value would try to allocate 2*0 bytes, where av_malloc() returns NULL. Always add one to the allocated length, to allow space for a null terminator in the zero-length case. Incidentally, this fixes fate-alac on RVCT 4.0, where a compiler bug seems to mess up the mov muxer to the point that it writes the wrong sort of metadata. Previously this bug was undetected, but since 3cec81f4d4 such mov files started returning AVERROR(ENOMEM) in the mov demuxer. Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: further expand the list of parsed metadata tagsDave Rice2014-12-08
| | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* mov: expand the list of parsed metadata tagsVittorio Giovara2014-12-08
| | | | Based on L-Smash code by Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>.