Commit Graph

1253 Commits

Author SHA1 Message Date
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
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
Michael Niedermayer
bc43131997 mov: Also export loci altitude
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-19 10:46:53 +03:00
Michael Niedermayer
94d8141c8c mov: Append place name instead of overwriting for loci
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-19 10:46:52 +03:00
Michael Niedermayer
f126365cda mov: Fix parsing short loci
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>
2016-05-19 10:46:51 +03:00
Michael Niedermayer
704d2bd18b mov: Print reason of loci parsing failure
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-19 10:46:45 +03:00
Martin Storsjö
d34826c33d mov: Add a comment referring to the standard that defines the loci box
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-19 10:46:39 +03:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Diego Biurrun
0f40c90984 Drop pointless assert.h #includes 2016-05-03 15:45:10 +02:00
Paul B Mahol
323b8c95e4 avformat: add AVFormatContext to ff_get_extradata()
Needed for av_log() inside that function.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-04-14 18:21:08 +02:00
Derek Buitenhuis
bdd6275691 Merge commit '7e01d48cfd168c3dfc663f03a3b6a98e0ecba328'
* commit '7e01d48cfd168c3dfc663f03a3b6a98e0ecba328':
  mov: Check the entries value when parsing dref boxes

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-13 17:30:47 +01:00
Derek Buitenhuis
feb1f7abc5 Merge commit 'd40cb726d271b0284642a1ba159eb26a5c579f77'
* commit 'd40cb726d271b0284642a1ba159eb26a5c579f77':
  mov: Trim dref absolute path

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-13 16:21:12 +01:00
Derek Buitenhuis
6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Marton Balint
65efcaeb84 avformat/mov: read start_pad from edit list start time if codec is aac
Related to ticket #2324, #2325.

Stream duration still need to be fixed...

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-03-20 19:51:28 +01:00
Luca Barbato
7e01d48cfd mov: Check the entries value when parsing dref boxes
And properly reset the entries count when resetting the entries.

CC: libav-stable@libav.org

Bug-Id: 929
Bug-Id: CVE-2016-3062
2016-03-11 14:29:13 +01:00
Carl Eugen Hoyos
144ef773c7 Use correct msvc type specifiers for ptrdiff_t and size_t. 2016-03-09 14:00:22 +01: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
Vittorio Giovara
d40cb726d2 mov: Trim dref absolute path
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>
2016-03-05 08:23:18 -05:00
Carl Eugen Hoyos
2355b7458e lavf/mov: Set display aspect ratio for avid dv.
Fixes ticket #5271.
2016-03-02 02:03:46 +01:00
Marton Balint
e22bd239c0 avformat/mov: do not leak memory on ffio_read_size failure
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-28 23:00:45 +01:00
Marton Balint
4840effe42 avformat/mov: merge mov_read_custom functions
This also fixes reading gapless metadata when the entries do not start with the
mean atom. Such samples can be found here:
https://hydrogenaud.io/index.php/topic,93310.0.html

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-28 23:00:45 +01:00
Rodger Combs
22dbc1caaf lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac #5216 2016-02-28 15:00:34 -06:00
Rodger Combs
3617e69d50 lavf/mov: fix sidx with edit lists 2016-02-28 15:00:34 -06:00
Michael Niedermayer
5870f2a1dc Revert "Merge commit '3ef98937f512184f80d3bd30015f5ec83dc11eb0'"
This broke packed_maindata.mp3.mp4
Its unknown to me what this commit would have fixed

Reviewed-by: James Almer <jamrial@gmail.com>

This reverts commit 79127dbbef, reversing
changes made to 9fad1ce7c9.
2016-02-24 21:24:38 +01:00
Derek Buitenhuis
79127dbbef Merge commit '3ef98937f512184f80d3bd30015f5ec83dc11eb0'
* commit '3ef98937f512184f80d3bd30015f5ec83dc11eb0':
  mov: Force the full parsing of mp3

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-24 18:06:40 +00:00
Derek Buitenhuis
f6d633d726 Merge commit 'b92962436bdcfae478c8598dca397a397762eef8'
* commit 'b92962436bdcfae478c8598dca397a397762eef8':
  mov: Fix the format specifier type for size

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-24 17:21:17 +00:00
Anton Khirnov
9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
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.
2016-02-23 17:01:58 +01:00
Luca Barbato
3ef98937f5 mov: Force the full parsing of mp3
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>
2016-02-19 17:35:26 +01:00
Derek Buitenhuis
00bd237499 mov: Fix leftover merge conflict cruft
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-16 20:09:56 +00:00
Derek Buitenhuis
4e3185d208 Merge commit '5eb562831b3a9bea8026c413ef1338e06450d005'
This commit is a no-op.

* commit '5eb562831b3a9bea8026c413ef1338e06450d005':
  mov: Use the correct type for size

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-16 20:07:08 +00:00
Vittorio Giovara
b92962436b mov: Fix the format specifier type for size
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2016-02-16 18:25:47 +01:00
Luca Barbato
5eb562831b mov: Use the correct type for size
An AVIO offset is int64_t.

Bug-Id: 921
2016-02-14 11:44:38 +01:00
Derek Buitenhuis
bc9a5965c8 Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'
This also deprecates our old duplicated callbacks.

* commit '9f61abc8111c7c43f49ca012e957a108b9cc7610':
  lavf: allow custom IO for all files

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-10 14:42:41 +00:00
Thierry Foucu
020b75806f lavf/mov: Extend extracting XMP in mov files using UUID Box
The UUID is based on http://www.adobe.com/devnet/xmp.html

The patch is made according to XMP SPECIFICATION PART 3 - STORAGE IN
FILES See Table 8

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-09 01:31:15 +01:00