Commit Graph

118 Commits

Author SHA1 Message Date
erankor 0101d29095 mov: fix decryption with edit list
Retain the ranges of frame indexes when applying edit list in
mov_fix_index. The index ranges are then used to keep track of the frame
index of the current sample. In case of a discontinuity in frame indexes
due to edit, update the auxiliary info position accordingly.

Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-01 15:09:38 +01:00
Diego Biurrun 2d7aadf3d9 Add missing #includes for standalone spherical-information-related headers
(cherry picked from commit f912fd767e)
Signed-off-by: James Almer <jamrial@gmail.com>
2016-12-14 13:33:30 -03:00
Vittorio Giovara 4dcdecf471 mov: Export spherical information
This implements Spherical Video V1 and V2, as described in the
spatial-media collection by Google.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-07 14:40:59 -05:00
Vittorio Giovara 7010ebdf1f mov: Evaluate the movie display matrix
This matrix needs to be applied after all others have (currently only
display matrix from trak), but cannot be handled in movie box, since
streams are not allocated yet. So store it in main context, and apply
it when appropriate, that is after parsing the tkhd one.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-11-30 12:18:58 -05:00
Sasi Inguva 4abe1ff08f lavf/mov.c: Use the first sidx for tracks without sidx.
According to spec ISO_IEC_15444_12 "For any media stream for which no segment index is present, referred to as non‐indexed stream, the media stream associated with the first Segment Index box in the segment serves as a reference stream in a sense that it also describes the subsegments for any non‐indexed media stream."

Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-03 19:03:22 +01:00
Rodger Combs 697400eac0
lavf/mov: improve `tref/chap` chapter handling
3 parts:
- Supports multiple chapter streams
- Exports regular text chapter streams as opaque data. This prevents consumers
  from showing chapters as if they were regular subtitle streams.
- Exports video chapter streams as thumbnails, and provides the first one as
  an attached_pic.
2016-10-24 05:47:10 -05:00
Derek Buitenhuis 04f8d31287 mov: Remove ancient heuristic hack
This breaks files with legitimate single-entry edit lists,
and the hack, introduced in f03a081df0,
has no link to any known sample in its commit message.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-08-25 21:12:19 +02:00
Matthieu Bouron 3c058f5701 Merge commit '76729970049fe95659346503f7401a5d869f9959'
* commit '76729970049fe95659346503f7401a5d869f9959':
  mov: Implement support for multiple sample description tables

Notes:
  * The sc->stsc_data[index].id checks have been moved from the mov_read_stsc
  to mov_read_packet before the value is used in mov_change_extradata to
  not break playback of samples with broken stsc entries (see sample of
  ticket #1918).

  * sc->stsc_index is now checked against sc->stsc_count - 1 before it
  is incremented so it remains lesser than sc->stsc_count. Fixes a crash
  with:

  ./ffmpeg -i matrixbench_mpeg2.mpg -t 1 -frag_duration 200k test.mov
  ./ffprobe -show_packets test.mov

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-07-13 16:34:54 +02:00
Vittorio Giovara 7672997004 mov: Implement support for multiple sample description tables
Store data from each stsd in a separate extradata buffer, keep track of
the stsc index for read and seek operations, switch buffers when the
index differs. Decoder is notified with an AV_PKT_DATA_NEW_EXTRADATA
packet side data.

Since H264 supports this notification, and can be reset midstream, enable
this feature only for multiple avcC's. All other stsd types (such as
hvc1 and hev1) need decoder-side changes, so they are left disabled for
now.

This is implemented only in non-fragmented MOVs.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-17 11:38:33 -04:00
erankor dd34e89f31 mov - support seek in encrypted mp4
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-06 17:29:32 +01:00
Derek Buitenhuis 65d29dd274 mov: Add an option to toggle dref opening
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>
2016-01-21 14:32:39 +01:00
Derek Buitenhuis 712d962a6a mov: Add an option to toggle dref opening
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: Michael Niedermayer <michael@niedermayer.cc>
2016-01-20 15:41:58 +01:00
erankor 3f8564fe3c avformat/mov: support cenc (common encryption)
support reading encrypted mp4 using aes-ctr, conforming to ISO/IEC
23001-7.

a new parameter was added:
- decryption_key - 128 bit decryption key (hex)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-31 16:46:36 +01:00
Michael Niedermayer 861f47ddf4 avformat/mov: Enable parser for mp3s by old HandBrake
Fixes Ticket5047

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-13 02:11:56 +01:00
Neil Birkbeck a16243a4aa libavformat/mov.c: allow QuickTime metadata to come after traks
QuickTime metadata can come after trak data. Add indicator for which trak is being parsed (-1 if none) so that global metadata after the trak can be parsed.

Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-05 04:34:24 +01:00
Bryan Huh 85e3c31fd5 avformat/mov: Add option to ignore chapters during parsing
Chapter-indexing can be expensive since chapters may be interspersed
throughout the entire file and may require many seeks - especially
costly when consuming a video over a remote protocol like http.
Furthermore it is often unnecessary, especially when only trying to get
video info (e.g. via ffprobe).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-10 23:45:19 +01:00
Tinglin Liu 9ea812692c mov: Add support parsing QuickTime Metadata Keys.
The Apple dev specification:
    https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html

Basically the structure is like:
    |--meta
    |----hdlr
    |----keys
    |----ilst

1) The handler type in the metadata handler atom is ‘mdta’.
2) The key and value are stored separately for each key-value pair.
   The 'keys' atom stores the key table, while 'ilst' atom stores the
   values corresponding to the indices in the key table.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-26 14:32:05 +00:00
Rodger Combs 4ab5666759 lavf/mov: add support for sidx fragment indexes
Fixes trac #3842
2015-10-09 21:18:28 -05:00
Vesselin Bontchev 0a551cbe97 Add support for Audible AAX (and AAX+) files
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-19 20:28:39 +02: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
Clément Bœsch 55faf56c72 avformat/mov: move edit list heuristics into mov_build_index()
mov_read_elst() is now only responsible from storing the table in a data
structure; this is consistent with other table readers functions.
2015-01-02 11:38:21 +01:00
Michael Niedermayer caa7a3914f avformat/mov: check atom nesting depth
Fixes call stack overflow
Fixes: case1_call_stack_overflow.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-16 23:37:24 +01:00
Michael Niedermayer 0dcebe2620 Merge commit 'b704b648f9ecb830874627db958a37e004107d1b'
* commit 'b704b648f9ecb830874627db958a37e004107d1b':
  mov: parse XMP metadata on demand

Conflicts:
	libavformat/isom.h
	libavformat/version.h

See: 054c506e3d

The default is left unchanged at enabled
We can change the default if people prefer but i do not want to do that
in a merge.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 22:59:16 +01:00
Vittorio Giovara b704b648f9 mov: parse XMP metadata on demand
The Extensible Metadata Platform tag can contain various kind of data
which are not strictly related to the video file, such as history of edits
and saves from the project file. So display XMP metadata only when the
user explicitly requires it.

Based on a patch by Marek Fort <marek.fort@chyronhego.com>.
2014-12-08 13:53:30 +00:00
Carl Eugen Hoyos 7a4be4315f Support muxing 4k AVC Intra in mov.
Reported and tested by Rens Dijkshoorn, rens onlinemedia nl
2014-12-02 23:35:40 +01:00
Michael Niedermayer 781a5a392c Merge commit 'e352b293712ff7cbde67eba3ce3f8510b037de09'
* commit 'e352b293712ff7cbde67eba3ce3f8510b037de09':
  mov: Add an option for exporting all metadata

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 22:13:20 +01:00
Vittorio Giovara e352b29371 mov: Add an option for exporting all metadata 2014-12-02 15:28:22 +00:00
Michael Niedermayer 1b54e6b12b avformat/mov: auodetect "use_mfra_for"
Reviewed-by: Mika Raento <mikie@iki.fi>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-15 20:17:23 +02:00
Mika Raento a59808dd57 mov.c: allow reading fragment start dts/pts from fragmented mp4
This introduces a new option to the mov demuxer: -use_mfra_for
(pts|dts). When it's given and moofs and a MFRA are present, the MFRA's
TFRAs are read for fragment start times.

Unfortunately some programs that produce fragmented mp4s use the TFRA
time field for dts and some for pts. There is no realistic way to detect
which is the case, hence the responsibility is punted onto the user.
This also means that no behavioural change is enabled by default - you
must pass either dts or pts for anything to happen.

Without this change, timestamps for some discontinuous fragmented mp4 are
wrong, and cause audio/video desync and are not usable for generating
HLS.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-13 12:20:55 +02:00
Michael Niedermayer b07dc81a9e Merge commit '86dfcfd0e30d6645eea2c63c1c60a0550e7c97ea'
* commit '86dfcfd0e30d6645eea2c63c1c60a0550e7c97ea':
  mov: Drop unused parameter from ff_mov_read_esds()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-19 18:27:51 +02:00
Diego Biurrun 86dfcfd0e3 mov: Drop unused parameter from ff_mov_read_esds()
This is cleaner and avoids an uninitialized variable warning with MSVC.
2014-08-19 06:22:07 -07:00
Michael Niedermayer fb318def5d Merge commit '20f95f21f9b9595608ba668a6eca78f2d508be67'
* commit '20f95f21f9b9595608ba668a6eca78f2d508be67':
  mov: Support default-base-is-moof.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-01 16:31:57 +02:00
Yusuke Nakamura 20f95f21f9 mov: Support default-base-is-moof.
default-base-is-moof shall be set to track fragments compatible with DASH
Media Segments. So, this is a fundamental support for ISOBMFF ver. DASH.
This is meaningful only when base-data-offset-present is absent and two or
more track fragments are present in a movie fragment.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-07-01 14:36:06 +03:00
Carl Eugen Hoyos 26b0d7198e Read mov files where the moov atom is hidden within a free atom.
Fixes ticket #1551 / issue 2226.
2014-05-31 16:57:27 +02:00
Michael Niedermayer 07941c2cb2 Merge commit '853cc025d63ee2539fc0460dab62c5b9a3fd2043'
* commit '853cc025d63ee2539fc0460dab62c5b9a3fd2043':
  mov: store display matrix in a stream side data

Conflicts:
	libavformat/isom.h
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-19 19:21:53 +02:00
Vittorio Giovara 853cc025d6 mov: store display matrix in a stream side data
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-05-19 13:13:16 +02:00
Michael Niedermayer 28bc1d94b7 avformat/mov: redesign the fps calculation
This uses STTS and TRUN information to calculate the fps
It seems to work with more files than the previous code

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-22 00:33:38 +01:00
Michael Niedermayer 074bae745d Merge commit 'ecf442a58b09bdb1dc1d2c3904b82ac5f79b2878'
* commit 'ecf442a58b09bdb1dc1d2c3904b82ac5f79b2878':
  lavf: improve support for AVC-Intra files.

Conflicts:
	libavformat/internal.h
	libavformat/isom.c
	libavformat/mxfdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-14 21:04:44 +01:00
Reimar Döffinger ecf442a58b lavf: improve support for AVC-Intra files.
Generate extradata with SPS/PPS based on container dimensions.

Authors of this commit are: Reimar and Thomas Mundt

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-14 18:59:39 +01:00
Michael Niedermayer c6f4a3a708 Merge commit '1f70a5ad284b33e8b3e2b40a5cb33055419781b7'
* commit '1f70a5ad284b33e8b3e2b40a5cb33055419781b7':
  mov: use tkhd enabled flag to set the default track

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-23 13:27:34 +02:00
John Stebbins 1f70a5ad28 mov: use tkhd enabled flag to set the default track
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-23 09:24:22 +02:00
Alexandre Sicard 70b922f371 avformat/mov: read stream bitrates from isml manifest
This allows to read a live isml movie and segment it using the
smoothstreaming muxer, which requires the bitrates to be known for each stream.

Signed-off-by: Alexandre Sicard <alexandre.sicard@smartjog.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-08 17:36:45 +02:00
Michael Niedermayer 5292dac34c avformat/mov: Rename alt_sample_size so its name matches what it is
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-25 18:47:36 +02:00
Michael Niedermayer 0a84174f2d mov: prevent double free if the caller replaces the io context.
Fixes Ticket2148

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-22 05:15:47 +01:00
Clément Bœsch 8d398f40b4 lavf/mov: simplify timecode track ref.
There can be only one track reference. The multiple tref handling is
handled at a different level.
2013-01-01 16:20:10 +01:00
Michael Niedermayer 55c49afc42 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  yuv4mpeg: return proper error codes.
  Give all anonymously typedeffed structs in headers a name
  fate: Add parseutils test
  parseutils-test: Drop random colors from parsing test
  vf_pad/scale: use double precision for aspect ratios.
  build: error on variable-length arrays
  ppc: swscale: rework yuv2planeX_altivec()
  ppc: fmtconvert: kill VLA in float_to_int16_interleave_altivec()
  x86: dsputil: kill VLA in gmc_mmx()
  libspeexenc: Updated commentary to reflect recent changes
  libspeexenc: Add an option for enabling DTX
  doc/APIchanges: fill in missing dates and hashes.
  lavr: bump major to 1 and declare it stable.
  lavr: change the type of the data buffers to uint8_t**.
  lavc: deprecate the audio resampling API.

Conflicts:
	cmdutils.h
	configure
	doc/APIchanges
	ffplay.c
	libavcodec/dwt.h
	libavcodec/libspeexenc.c
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c
	libavformat/asf.h
	tests/fate/libavutil.mak
	tests/ref/fate/parseutils

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-06 13:45:08 +02:00
Diego Biurrun e4cbf7529b Give all anonymously typedeffed structs in headers a name
Anonymous structs cannot be forward declared and have no benefit.
2012-10-06 09:27:11 +02:00
Michael Niedermayer f7f5370b4b mov: add option to ignore edit lists.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-02 14:18:46 +02:00
Clément Bœsch c4dba58f47 isom: fix redundant redeclaration of ff_mov_read_chan().
Silence a GCC warning. A leftover of the disabled version is still
available in lavf/isom.c.
2012-10-02 00:26:15 +02:00