Commit Graph

1121 Commits

Author SHA1 Message Date
Michael Niedermayer 2025e803cd avformat/mov: Do not read ACLR into extradata for H.264
Fixes regression decoding AVCI
Fixes Ticket4493

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-30 00:02:47 +02:00
Chris Watkins 0703c44692 avformat/mov.c: Use %d to print an enum, not PRIu8
Using the PRIu8 format specifier to print an enum value causes a
compiler warning, so use %d instead.

Fixes ticket #4467.

Signed-off-by: Chris Watkins <watk@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-21 23:48:07 +02:00
Michael Niedermayer e48a0a6c3f avformat/mov: remove per packet timestamp print trace, theres generic code doing this in utils.c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 17:25:04 +02:00
Michael Niedermayer 4d50d53a6d Merge commit '9286de045968ad456d4e752651eec22de5e89060'
* commit '9286de045968ad456d4e752651eec22de5e89060':
  mov: Double-check that alias path is not an absolute path

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 11:03:32 +02:00
Michael Niedermayer 82d9c4e578 Merge commit '376589e5dd72aa2dd42500f456fca303fcdcad85'
* commit '376589e5dd72aa2dd42500f456fca303fcdcad85':
  mov: Read alternate absolute path in dref alis

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 05:51:40 +02:00
Michael Niedermayer 40d552dae6 Merge commit '1a3eb042c704dea190c644def5b32c9cee8832b8'
* commit '1a3eb042c704dea190c644def5b32c9cee8832b8':
  Replace av_dlog with normal av_log at trace level

Conflicts:
	ffplay.c
	libavdevice/fbdev_dec.c
	libavfilter/avfilter.c
	libavfilter/internal.h
	libavfilter/setpts.c
	libavfilter/src_movie.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fieldorder.c
	libavformat/assdec.c
	libavformat/avidec.c
	libavformat/flvdec.c
	libavformat/http.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/mov.c
	libavformat/mpegenc.c
	libavformat/mpegts.c
	libavformat/mpegtsenc.c
	libavformat/mux.c
	libavformat/mxfdec.c
	libavformat/nsvdec.c
	libavformat/oggdec.c
	libavformat/r3d.c
	libavformat/rtspdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 03:19:47 +02:00
Vittorio Giovara 9286de0459 mov: Double-check that alias path is not an absolute path
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).
2015-04-19 22:50:24 +01:00
Vittorio Giovara 376589e5dd mov: Read alternate absolute path in dref alis
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.
2015-04-19 22:48:14 +01:00
Vittorio Giovara 1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Michael Niedermayer 98c7d305a7 Merge commit 'be089af38f65dc8b1fe3564f98020fc815577edb'
* commit 'be089af38f65dc8b1fe3564f98020fc815577edb':
  mov: Rely on box type rather than file type for colr atom

Conflicts:
	libavformat/mov.c

See: 0276b95242
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-09 20:19:27 +02:00
Vittorio Giovara be089af38f mov: Rely on box type rather than file type for colr atom
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>
2015-04-09 13:46:54 +02:00
Carl Eugen Hoyos 072198166e lavf/mov: Do not overread iTunes metadata.
Fixes ticket #4425.
2015-04-04 17:35:06 +02:00
Jochen Strunk 0276b95242 avformat/mov: check color parameter type explicitly.
Fixes ticket #4387.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Note, Vittorio Giovara had submitted a very similar fix to me privately
a few hours before this, iam applying Jochens because it comes with a
commit message too and i had not yet applied Vittorios, but For sake
of credit, Vittorio independently solved this first
2015-03-24 14:06:03 +01:00
Michael Niedermayer dfea1acb21 Merge commit 'e4fe535d12f4f30df2dd672e30304af112a5a827'
* commit 'e4fe535d12f4f30df2dd672e30304af112a5a827':
  mov: Write the display matrix in order

Conflicts:
	libavformat/mov.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-24 01:14:31 +01:00
Vittorio Giovara e4fe535d12 mov: Write the display matrix in order
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.
2015-03-23 20:53:28 +00:00
Derek Buitenhuis 414d6547f3 mov: Add option to keep exact packet sequence after seeking
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.
2015-03-18 14:30:07 +00:00
Derek Buitenhuis 8692d74b73 mov: Add option to keep exact packet sequence after seeking
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.
2015-03-18 14:28:56 +00:00
Michael Niedermayer 13f8bbfb70 avformat/mov: fix mis-detection of jpeg2000
Fixes demuxer choice for Ticket 2792

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-17 19:05:44 +01:00
Vittorio Giovara 423f5d50e4 mov: Fix little endian audio detection
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
2015-03-17 13:34:23 +00:00
Michael Niedermayer 1e4d0498df avformat/mov: Disallow ".." in dref unless use_absolute_path is set
as this kind of allows to circumvent it to some extend.
We also could add a separate parameter or value to choose this

Found-by: ramiro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-16 03:47:56 +01:00
Michael Niedermayer 8003816e16 avformat/mov: Check for string truncation in mov_open_dref()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-14 21:57:04 +01:00
Michael Niedermayer 21a53dd08d avformat/mov: Use sizeof(filename) instead of a literal number
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-14 21:56:46 +01:00
Michael Niedermayer cb39fe9336 Merge commit '91eee2af87278b3c2008f7a86d2cdfe6934e9f42'
* commit '91eee2af87278b3c2008f7a86d2cdfe6934e9f42':
  Revert "mov: Change DTS-based seek into CTS-based seek."

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-02 20:52:34 +01:00
Michael Niedermayer 82fe4072ea Revert "avformat/mov: Bypass av_add_index_entry()"
Next commit will revert the PTS seeking so this is not needed anymore

This reverts commit 38e641a060.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-02 20:46:17 +01:00
Martin Storsjö 91eee2af87 Revert "mov: Change DTS-based seek into CTS-based seek."
This reverts commit 4abfa387b8.

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>
2015-03-02 14:15:12 +02:00
Christophe Gisquet 60bdc868b9 lavf/mov: correct printf specifier
The type is int64_t.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-27 16:55:34 +01:00
Michael Niedermayer bbbc8c6188 avformat/mov: Check ctts_count before use
Fixes out of array read
Fixes: asan_heap-oob_ae74b5_3610_cov_1739568095_test.3g2

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 13:31:34 +01:00
Michael Niedermayer 4d1b017c38 avformat/mov: Check av_add_index_entry() return value
Fixes NULL pointer dereference
Fixes: signal_sigsegv_b060e0_3794_cov_1293954059_vc1-wmapro.ism

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-23 22:48:35 +01:00
Kevin Wheatley fb3fb1d0d4 avformat/mov: Add simple ACLR atom reading to set the color range of the incomming track for codec's like DNxHD that utilise AVID's proprietary atom.
On input ACLR will be used to set colour range no matter which codec
it is associated with.
No change for when it will be output.

Rework mov_read_extradata function to allow detection of truncated
atom reads by callers.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-19 15:42:55 +01:00
Michael Niedermayer 38e641a060 avformat/mov: Bypass av_add_index_entry()
The new mov code uses a temporally non sorted index since 4abfa387b8
and can thus no longer be filled with av_add_index_entry() which expects the index to be sorted.
Reverting 4abfa387b8 and this commit would be
a alternative fix as would be various other options.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-16 01:30:47 +01:00
Michael Niedermayer f9e76d66e9 Merge commit '4abfa387b8234736f6e0e541951e3d5eb60eb843'
* commit '4abfa387b8234736f6e0e541951e3d5eb60eb843':
  mov: Change DTS-based seek into CTS-based seek.

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-16 01:28:02 +01:00
Yusuke Nakamura 4abfa387b8 mov: Change DTS-based seek into CTS-based seek.
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>
2015-02-15 21:26:04 +02:00
Diego Biurrun 36cf8eb448 mov: Fix compilation with DEBUG enabled 2015-02-14 10:45:16 -08:00
Michael Niedermayer ad1549aec3 avformat/mov: print a warning if parsing udta failed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 13:02:24 +01:00
Michael Niedermayer 849ad5175b avformat/mov: Heuristically detect raw udta
Fixes tkhd+moov fragment provided by koda

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-13 04:30:29 +01:00
Michael Niedermayer 5763f67502 avformat/mov: Check dimensions before setting aspect
Fixes division by 0
Fixes: asan_heap-uaf_143f420_728_cov_1441472032_HDV_0113.MP4

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-09 14:52:15 +01:00
Michael Niedermayer a83e0639c0 Merge commit 'e3528d2a7bf29ba148d7ac1678552ce0089cd14f'
* commit 'e3528d2a7bf29ba148d7ac1678552ce0089cd14f':
  mov: Implement parsing of the "HandlerName" from the MP4 HDLR atom

Conflicts:
	libavformat/mov.c

See: b76bc01034
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 22:19:46 +01:00
Hendrik Leppkes e3528d2a7b mov: Implement parsing of the "HandlerName" from the MP4 HDLR atom
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>
2015-02-03 15:15:12 +00:00
Michael Niedermayer ed91c8651a avformat/mov: simplify pasp value before setting SAR
This avoids a 65536:65536 SAR

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 14:11:20 +01:00
Paul B Mahol cc1357a173 avformat/mov: remove unneeded #include, there are no assert()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-01-31 08:57:07 +00:00
Michael Niedermayer 6d34665c76 Merge commit '32125781487411ed3b1b28b32063d6cd4024d4fc'
* commit '32125781487411ed3b1b28b32063d6cd4024d4fc':
  mov: export audio service type as side data

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-27 18:32:23 +01:00
Anton Khirnov 3212578148 mov: export audio service type as side data 2015-01-27 09:21:28 +01:00
Vittorio Giovara 4c5fa628da mov: Do not compute negative SAR values
This partially reverts cf70ba37ba, 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>
2015-01-23 14:54:59 +00:00
Jon Morley 47372caac5 libavformat/mov.c: Handle timecode from tmcd atom in counter mode
When the timecode value is in counter mode then it is important to use
the timescale and frameduration to calculate the timecode fps.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-23 13:14:15 +01:00
Michael Niedermayer e32b07aea4 avformat/mov: Stricter sanity checks on the display_matrix
Fixes "broken" tkhd
Found-by: koda
Tested-by: koda
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-22 19:52:52 +01:00
Michael Niedermayer cc18ea8de0 avformat/mov: Do not set aspect ratios that would contain zeros
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 04:26:16 +01:00
Michael Niedermayer 47795505ac avformat/mov: rewrite aspect from matrix code
The original code was intended purely for rotation == 0
In cf70ba37ba the condition was
changed to use it only for rotation != 0
which broke the cases for which it was intended to be used
as well as breaking cases for which it was not intended to be
used.
This changes the code so it could work for the more general
case and fixes the regressions
If you have sample files that are not handled correctly
please open tickets or mail me!

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 04:22:00 +01:00
Michael Niedermayer 89b6382bec Merge commit 'cf70ba37ba74089a18295b29e77dead0a3222c9e'
* commit 'cf70ba37ba74089a18295b29e77dead0a3222c9e':
  mov: Check angle rather than full matrix when updating SAR

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 04:00:51 +01:00
Vittorio Giovara cf70ba37ba mov: Check angle rather than full matrix when updating SAR
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>
2015-01-14 17:17:23 +01:00
Carl Eugen Hoyos a5334d4081 Handle r10k endianess atom DpxE.
Fixes playback and remuxing of r10k_full-range_big-endian.mov.

Reported, analyzed and tested by Olaf Matthes, olaf matthes gmx de
2015-01-11 12:15:03 +01:00