Commit Graph

1285 Commits

Author SHA1 Message Date
Matthew Gregan 2d73d25670 Add experimental demuxing support for FLAC in ISO BMFF (MP4).
Based on the draft spec at https://git.xiph.org/?p=flac.git;a=blob;f=doc/isoflac.txt

Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 15:38:34 -03:00
James Almer eb3a59c903 avformat/mov: reuse existing err variable
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-19 00:54:58 -03:00
James Almer 77f033eb98 avformat/mov: use av_stream_add_side_data() for displaymatrix side data
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 22:20:36 -03:00
Hendrik Leppkes d8ffdefbdc Merge commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f'
* commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f':
  mov: Save number of stsd elements after stream extradata allocation

Mostly noop, see 8b43ee4054

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-14 12:41:32 +01:00
James Almer 66453b1fba avformat/mov: zero initialize codec_name in mov_parse_stsd_video()
Fixes valgrind warning about "Conditional jump or move depends on uninitialised value(s)"

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-12 20:52:22 -03:00
Sasi Inguva c8dc11bb9e lavf/mov.c: Fallback to finding non-keyframe in fix_index, if keyframe search fails.
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-10 17:44:47 +01:00
Vittorio Giovara a765ba647d avformat/mov: Read multiple stsd from DV
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-08 14:07:41 +01:00
Andreas Cadhalpun 9d36602abc mov: validate sidx timescale
A negative timescale doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun a398f054fd mov: validate time_scale
A negative timescale doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01:00
Andreas Cadhalpun fc022e77ee mov: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

fate-aac-al07_96 fails if sample_rate == 0 is rejected in
ff_mov_read_stsd_entries.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-07 00:51:49 +01: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
Andreas Cadhalpun 9d83b209d8 mov: immediately return from mov_fix_index without old index entries
If there are no index entries, e_old = st->index_entries is only one
byte large, since it was created by av_realloc called with size 0.

Thus accessing e_old[0].timestamp causes a heap buffer overflow.

Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-01 18:45:34 +01:00
Carl Eugen Hoyos f73a3aacbb lavf/mov: Only search for invalid moov in free if compliance < STRICT. 2016-11-01 11:37:34 +01:00
Sasi Inguva 5e965582d5 lavf/mov.c: Use the correct timescale when seeking for audio.
Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-10-31 13:43:43 +00:00
Rodger Combs 490c6bda0e
lavf/mov: reindent
Reviewed-By: Michael Niedermayer <michael@niedermayer.cc>
2016-10-24 05:47:10 -05: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
Jean Caillé 6498549fd7 lavf/mov: support gopro hero moments udta tag
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-19 13:25:21 +02:00
James Almer ea201ad14c avformat/mov: pass the demuxer's AVFormatContext to avpriv_request_sample()
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-18 23:09:02 -03:00
Hendrik Leppkes 656feb641d mov: move stsd finalization to an appropriate place
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.
Fixes trac ticket #5826
2016-10-17 12:49:36 +02:00
Jean Caillé 4599e11651 lavf/mov: support gopro firmware udta tag
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-15 00:59:08 +02:00
Carl Eugen Hoyos fcce25ee5d lavf/mov: Read display aspect ratio from ares atom also for dnxhd.
Fixes aspect ratio of sample in ticket #2125.
Fixes aspect ratio of sample in ticket #5325.
2016-09-29 15:29:03 +02:00
Sasi Inguva dba2db6c0e lavf/mov.c: Make audio timestamps strictly monotonically increasing inside an edit list.
Fixes gapless decoding. Adjust skip_samples field correctly in case of DISCARDed audio frames.

Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-29 02:25:41 +02:00
Sasi Inguva ca6cae73db lavf/mov: Add support for edit list parsing.
Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-19 19:52:05 +02:00
Matthew Gregan 7b3bc365f9 avformat/mov: Enable stream parsing for VP9.
MP4 media containing VP9 using superframes (such as
https://github.com/Netflix/vp9-dash/raw/master/DASH-Samples/Fountain_2997_0560kbps_640x480_4x3PAR.ivf_DashUnencrypted.ismv)
does not decode correctly with the built-in VP9 decoder because
superframes are passed to the decoder whole rather than split into
individual frames.

Signed-off-by: Matthew Gregan <kinetik@flim.org>
2016-09-08 22:20:46 -04:00
Sergey Volk 347cb14b7c avformat/mov: Fix potential integer overflow in mov_read_keys
Actual allocation size is computed as (count + 1)*sizeof(meta_keys), so
we need to check that (count + 1) won't cause overflow.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-08 11:35:44 +02:00
Thomas Hebb a37e6dd2ba avformat/mov: aax: pass proper AVClass to av_log()
av_log() expects its first parameter to be a pointer to a struct whose
first element is a pointer to an AVClass. In what I can only imagine is
a typo, one call to av_log() in the AAX decryption code instead passes
a pointer to an AVSHA struct, which doesn't even contain a pointer as
its first element, much less a pointer to an AVClass. Change the call to
pass the current MOVContext, as surrounding calls do.

The incorrect AVClass was causing mpv to emit the warning "av_log
callback called with bad parameters" when playing an .aax file.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-28 20:54:22 +02:00
Marton Balint 13b90ff2c1 avformat: fix decoded creation_time timestamps
Use proper ISO 8601 timestamps which also signal that they are in UTC.

This changes the format of creation_time and modification_date metadata values
from 2016-06-01 22:30:00 to 2016-01-01T22:30:00.000000Z

Fixes ticket #5673.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-08-28 15:55:32 +02:00
Derek Buitenhuis 425be3c810 mov: Remove old b-frame/video delay heuristic
This was added before edts support existed, and is no longer
valid.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-08-25 21:12:30 +02: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
Steven Robertson a3cab3d433 libavformat/mov: Accept known codepoints in 'colr'
This change relaxes the whitelist on reading color metadata in MOV/BMFF
containers. The whitelist on writing values is still in place.

As a consequence it also fixes an apparent bug in reading 'nclc' values.
The 'nclc' spec [1] is in harmony with ISO 23001-8 for the values it
lists, but the code getting removed was remapping 5->6 and 6->7 for
primaries, which is incorrect, and was remapping 6->5 for color matrix
("colorspace" in the code), which is equivalent but an unnecessary
inconsistency. This logic error doesn't appear in movenc.

Removing the whitelist allows proper conversion when the source codec
relies on the container for proper signaling of newer codepoints, such
as DNxHR and VP9. If converting to a codec or container that has updated
its spec to include the new codepoints, the metadata will be preserved.
If going back to MOV/BMFF, the output whitelist will still kick in, so
this won't result in out-of-spec files being created.

[1] https://developer.apple.com/library/mac/technotes/tn2162/_index.html

Signed-off-by: Steven Robertson <steven@strobe.cc>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-21 02:58:24 +02:00
Michael Niedermayer 8b43ee4054 avformat/mov: Check STSD atom more completely
Fixes out of array read
Fixes: 13262c363a28da8d6bdcc472aed6e9dc/asan_heap-oob_cfb5e2_3733_31cf3fcc783295c34222eb070a784f84.3gp

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-20 20:16:52 +02:00
Michael Niedermayer ae0192ef5f avformat/mov: Check extradata before access
Fixes NULL ptr dereference
Fixes Ticket5778

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-16 19:47:23 +02:00
Michael Niedermayer 803c058a6f avformat/mov: Enable mp3 parsing if a packet needs it
Fixes Ticket5689

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-06 22:43:19 +02:00
Michael Niedermayer 38cc5c298c avformat/mov: Do not allocate empty extradata
Fixes Ticket5723

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 21:55:18 +02:00
Matthieu Bouron 6c8942cdfb lavf/mov: fix stream extradata_size allocation
Fixes CID 1363963.
2016-07-14 09:18:39 +02:00
Matthieu Bouron 354336490d Merge commit '846a3e78a535f05ee61bb23a160f3378f041f751'
* commit '846a3e78a535f05ee61bb23a160f3378f041f751':
  mov: Support prores with multiple stsd

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-07-13 16:56:20 +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
Vadim Kalinsky e370aad67d avformat/mov: Skip non-key frames if AVDISCARD_NONKEY is set.
Github: Closes #222
2016-06-30 12:00:13 +02:00
Vittorio Giovara 029cf99c51 mov: Save number of stsd elements after stream extradata allocation
Avoid freeing an unallocated array in mov_read_close() in case
of a malloc failure.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-06-29 15:25:42 -04:00
Michael Niedermayer 8a3221cc67 avformat/mov: Check sample size
Fixes integer overflow
Fixes: poc.mp4

Found-by: ajax secure <ajax4sec@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-29 00:30:55 +02:00
Paul B Mahol d693392886 avformat/mov: parse rtmd track timecode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-06-27 10:27:25 +02:00
Clément Bœsch 9c4af99583 Merge commit '704d2bd18be8f134cb9ab19463a3c4eb63233dbd'
* commit '704d2bd18be8f134cb9ab19463a3c4eb63233dbd':
  mov: Print reason of loci parsing failure

See 9e4f0cfc8f

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-24 10:45:57 +02:00
Clément Bœsch 6dd80591b8 Merge commit 'd34826c33d401929b2ff8aee161fd39ad0a73613'
* commit 'd34826c33d401929b2ff8aee161fd39ad0a73613':
  mov: Add a comment referring to the standard that defines the loci box

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-24 10:44:00 +02:00
David Murmann c3b0af7456 avformat/mov: add more datatypes in metadata handling
Implement variable sized big-endian integers, since these are found
in files created by ARRI cameras.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-23 11:40:32 +02:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Matthieu Bouron acfab2dce6 lavf/mov: ignore ctts entries that do not apply to a least one sample
Fixes packet pts of samples which contain ctts entries with count <= 0.
2016-06-20 15:43:14 +02:00
Vittorio Giovara 846a3e78a5 mov: Support prores with multiple stsd
This function needs to return false, or data in the additional tables
will be skipped, and the decoder will not be able to decode frames
associated with them.
2016-06-17 11:38:33 -04: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
Carl Eugen Hoyos a64a030ba0 lavf/mov: Support one more Avid compression id for AVCI50.
Reported by forum user lexidata.
2016-05-28 11:57:37 +02:00
Michael Niedermayer 4c82ccad2b avformat/mov: Avoid "Unintended sign extension"
Fixes CID1361957

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-24 04:37:50 +02:00