Commit Graph

1218 Commits

Author SHA1 Message Date
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
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
Eran Kornblau 1bbfaba196 avformat/mov: dont print frma warning when format is the same
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-05 01:11:04 +01:00
Anton Khirnov 9f61abc811 lavf: allow custom IO for all files
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.
2016-01-24 16:45: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
Mats Peterson a51c8a68ad lavf/mov: Don't limit fourcc 0 -> raw/twos to version 0 sample descriptions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-16 11:42:46 +01:00
Mats Peterson b58cfa616c lavf/mov: Confine 0x00000000 to raw/twos fourcc mapping to version 0 sample descriptions
Confine the 0x00000000 to 'raw '/'twos' fourcc mapping to old version 0
sound sample descriptions, since they are the only valid sample
descriptions for this type of mapping.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-15 03:38:43 +01:00
Michael Niedermayer 47cd85e1e5 avformat/mov: Simplify format checking code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-08 14:52:53 +01:00
Mats Peterson 13d02d3dc8 lavf/mov: Audio and fourcc 0x00000000
In many older QuickTime files, the audio format, or "fourcc", is
0x00000000. The QuickTime File Format Specification states the following
regarding this situation:

"This format descriptor should not be used, but may be found in some
files. Samples are assumed to be stored in either 'raw ' or 'twos'
format, depending on the sample size field in the sound description."

MPlayer handles this logic by itself, but FFmpeg/FFplay currently does
not.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-08 14:52:53 +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
Mats Peterson 57631f1851 avformat: factor ff_get_qtpalette() out of mov.c
This consists mainly of moving the palette handling from
the mov_parse_stsd_video() function to a new ff_get_qtpalette() function
in the new file qtpalette.c, which will be shared by both matroskadec.c and
mov.c.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-28 02:47:26 +01:00
Michael Niedermayer d3b6a9abac avformat/mov: Update handbrake_version threshold for full mp3 parsing
Fixes: Endangered\ Species\ 1x01\ Collecting\ Merl.mp4

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-22 16:21:47 +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
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Ganesh Ajjanagadde 7324af651f avformat/mov: use hypot()
This simplifies the code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-22 16:14:47 -05:00
Derek Buitenhuis ad317c94c5 Merge commit '7f4ec4364bc4a73036660c1c6a3c4801db524e9e'
* commit '7f4ec4364bc4a73036660c1c6a3c4801db524e9e':
  avformat: expose av_stream_new_side_data helper

  Conflicts:
      libavformat/internal.h

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-22 17:19:10 +00:00
Derek Buitenhuis f7c3ec3a01 Merge commit 'b5f963bfec1f452c37eee900c7b11f065d10dd60'
* commit 'b5f963bfec1f452c37eee900c7b11f065d10dd60':
  mov: Drop dref when unable to parse

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-19 14:11:45 +00:00
Derek Buitenhuis 218f46fc99 Merge commit '303f931938c618668f7f83c646a1850bef84641e'
* commit '303f931938c618668f7f83c646a1850bef84641e':
  mov: Correctly store dref paths

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-19 14:10:40 +00:00
John Stebbins 7f4ec4364b avformat: expose av_stream_new_side_data helper
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-11-18 11:36:27 +01:00
Ganesh Ajjanagadde 8adff79b6d avformat/mov: remove redundant assignment
This is possibly undefined behavior based on sequence point rules, but I
have not studied the spec at that level of detail.

Fixes: CID 1338321.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-16 07:42:48 -05:00
Ganesh Ajjanagadde f0197e1637 avformat/mov: fix memory leak
Fixes: CID 1338328.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-16 07:41:33 -05:00
Vittorio Giovara b5f963bfec mov: Drop dref when unable to parse
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.
2015-11-12 04:39:14 +01:00
Vittorio Giovara 303f931938 mov: Correctly store dref paths
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.
2015-11-12 04:39:14 +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
Hendrik Leppkes df06cb5611 Merge commit 'f128b8e19ac7f702adae899ab91cc1e80f238761'
* commit 'f128b8e19ac7f702adae899ab91cc1e80f238761':
  mov: detect cover art pictures by content

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-10 18:01:36 +01:00
wm4 f128b8e19a mov: detect cover art pictures by content
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>
2015-11-03 15:03:12 +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
Michael Niedermayer 573334da82 avformat/mov: Autodetect mp3s which need parsing
mp3 packets all have the same duration and number of samples
if their duration indicated in the container varies then thats an
indication that they are not 1 mp3 packet each.
If this autodetection fails for some case then please contact us
and provide a testcase.

Fixes Ticket4938
2015-10-23 11:01:43 +02:00
Ganesh Ajjanagadde d59bfcd112 avformat/mov: fix integer overflow
Partially fixes Ticket 4727.

-duration is not a safe expression, since duration can be INT_MIN.
One might ask how it can become INT_MIN.
Although it is true that line 2574 is no longer reached with INT_MIN due
to commit 053e80f6ea (which fixed another
integer overflow issue), mov_update_dts_shift is called on line 3549 as
well, right after a read of untrusted data.
One can do the fix locally there, but that function is already a huge
mess. Changing mov_update_dts_shift is likely better.

This changes duration to INT_MIN + 1 in such cases. This should not make any
practical difference since such streams are anyway fuzzer files.

Tested with FATE.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-13 19:41:07 -04:00
Rodger Combs 4ab5666759 lavf/mov: add support for sidx fragment indexes
Fixes trac #3842
2015-10-09 21:18:28 -05:00
Andreas Cadhalpun 8d6625642d doc: fix spelling errors
Reviewed-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-09 22:09:08 +02:00
Shawn Singh 733475160a libavformat/mov.c: Add parsing for DDTS atom for DTS audio
The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E.
This is useful for DTS-HD formats, some of which cannot be
decoded by dcadec.c or libdcadec.

Signed-off-by: Shawn Singh <shawnsingh@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-30 05:05:17 +02:00
wm4 948f3c19a8 lavc: Make AVPacket.duration int64, and deprecate convergence_duration
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>
2015-09-29 14:33:00 +02:00
Clément Bœsch a84613b4c2 avformat/mov: use AV_OPT_TYPE_BOOL for export_{all,xmp} options 2015-09-12 18:24:49 +02:00
Hendrik Leppkes f4ce8cea73 Merge commit '7cad1bf0759ada2a1fc3e80bb232a5377dd4fda4'
* commit '7cad1bf0759ada2a1fc3e80bb232a5377dd4fda4':
  mov: Allow more than one keyframe per trun

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-08 14:46:02 +02:00