Commit Graph

1176 Commits

Author SHA1 Message Date
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
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
Martin Storsjö 7cad1bf075 mov: Allow more than one keyframe per trun
The previous restriction was partially designed to fix certain
(broken) samples from bug 215. There should be no restriction on the
number of keyframes per fragment or trun.

The spec suggests that all frames lacking MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC
are key frames, but we require the flag MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES
to be unset as well. This works for (possibly broken) media that never
sets the NON_SYNC flag and should also be correct for any spec-compliant
file.

For files that never set either of the flags, all samples are marked
as keyframes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-09-06 21:24:37 +03:00
Michael Niedermayer 9ed53d5a8a avformat/mov: Change the type of the r/g/b variables
Fixes integer overflow
Fixes: unknown_unknown_31b_795_cov_1818643045_raybauduc.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-03 22:17:00 +02:00
Michael Niedermayer 053e80f6ea avformat/mov: Fix integer overflow in FFABS
Fixes: unknown_unknown_19e_414_cov_764838672_bellhamlam.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-03 09:20:57 +02:00
Carl Eugen Hoyos 33908f0837 lavf/mov: Support unusual alac files without frma and alac atoms.
Fixes ticket #4747.
2015-08-27 03:29:29 +02:00
Ronald S. Bultje 6471040f56 FF_OPT_TYPE_* -> AV_OPT_TYPE_*. 2015-08-18 11:48:49 -04:00
Ronald S. Bultje 229843aa35 Replace av_dlog with ff_dlog.
ff_dlog checks compilability, and is non-public. av_dlog is deprecated
and no longer exists if FF_API_DLOG=0.
2015-08-18 10:24:01 -04:00
Vesselin Bontchev 336822edf4 avformat/mov: fix regression in processing .aax files
Commit 0a551cbe introduced "activation_bytes" option, and not specifying
this option (while calling ffmpeg / ffprobe) causes the program to quit
early. Before this commit, ffprobe was capable of processing metadata in
.aax files.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-02 03:40:38 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Michael Niedermayer 94d68a41fa Merge commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615'
* commit '7c6eb0a1b7bf1aac7f033a7ec6d8cacc3b5c2615':
  lavc: AV-prefix all codec flags

Conflicts:
	doc/examples/muxing.c
	ffmpeg.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/ac3enc_float.c
	libavcodec/atrac1.c
	libavcodec/atrac3.c
	libavcodec/atrac3plusdec.c
	libavcodec/dcadec.c
	libavcodec/ffv1enc.c
	libavcodec/h264.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb.c
	libavcodec/imc.c
	libavcodec/libmp3lame.c
	libavcodec/libtheoraenc.c
	libavcodec/libtwolame.c
	libavcodec/libvpxenc.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegaudiodec_template.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/nellymoserdec.c
	libavcodec/nellymoserenc.c
	libavcodec/nvenc.c
	libavcodec/on2avc.c
	libavcodec/options_table.h
	libavcodec/opus_celt.c
	libavcodec/pngenc.c
	libavcodec/ra288.c
	libavcodec/ratecontrol.c
	libavcodec/twinvq.c
	libavcodec/vc1_block.c
	libavcodec/vc1_loopfilter.c
	libavcodec/vc1_mc.c
	libavcodec/vc1dec.c
	libavcodec/vorbisdec.c
	libavcodec/vp3.c
	libavcodec/wma.c
	libavcodec/wmaprodec.c
	libavcodec/x86/hpeldsp_init.c
	libavcodec/x86/me_cmp_init.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:10:35 +02:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01: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
Vittorio Giovara f1840b070d Revert "mov: Double-check that alias path is not an absolute path"
This reverts commit 9286de0459.
The change broke support for legit absolute file paths.

Reported-by: Maksym Veremeyenko <verem@m1stereo.tv>.
2015-07-17 01:44:22 +01:00
Michael Niedermayer 8f2c045a0e avformat/mov: Implement a same origin policy for references instead of only allowing a subset of relative pathes in references
Fixes Ticket4671

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-15 12:47:09 +02:00
Michael Niedermayer c9c7263e58 avformat/mov: Fix opening relative references
Possibly fixes Ticket4671

the removed check is wrong and insufficient

Based on patch by Maksym Veremeyenko <verem@m1.tv>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-15 01:12:45 +02:00
Michael Niedermayer 15629129dd avformat/mov: Fix deallocation when MOVStreamContext failed to allocate
Fixes: 260813283176b57b3c9974fe284eebc3_signal_sigsegv_7ffff713351a_991_xtrem_e2_m64q15_a32sxx.3gp with memlimit of 262144

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-14 14:15:42 +02:00
Michael Niedermayer 488cc05192 avformat/mov: Use ff_configure_buffers_for_index()
Fixes Ticket2513
Fixes Ticket4432

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-13 12:38:21 +02:00
Michael Niedermayer ba77fb61f7 Merge commit 'd80811c94e068085aab797f9ba35790529126f85'
* commit 'd80811c94e068085aab797f9ba35790529126f85':
  riff: Use the correct logging context

Conflicts:
	libavformat/asfdec_o.c
	libavformat/avidec.c
	libavformat/dxa.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/riff.h
	libavformat/riffdec.c
	libavformat/wavdec.c
	libavformat/wtvdec.c
	libavformat/xwma.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 15:22:37 +02:00
Luca Barbato d80811c94e riff: Use the correct logging context 2015-07-11 18:45:44 +02:00
Michael Niedermayer 55a04a5d7a Merge commit 'a1e2caa93e4f8102666a21222f01b74838b6497f'
* commit 'a1e2caa93e4f8102666a21222f01b74838b6497f':
  mov: Log format rather than fourcc in stsd in trace mode

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-01 04:15:27 +02:00
Michael Niedermayer 35c8dda5c2 Merge commit '2eef75fd7e1ac96ab9ca63bb4523078c908bc9b1'
* commit '2eef75fd7e1ac96ab9ca63bb4523078c908bc9b1':
  mov: Adjust variable types to fix format warnings

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-01 04:06:42 +02:00
Vittorio Giovara a1e2caa93e mov: Log format rather than fourcc in stsd in trace mode
This will fix remaining format warnings.
2015-07-01 00:13:58 +01:00
Vittorio Giovara 2eef75fd7e mov: Adjust variable types to fix format warnings 2015-07-01 00:13:58 +01:00
Michael Niedermayer ae215e2b42 Merge commit '6ec688e1bc76dd93151cbca1c340162ae4b10d77'
* commit '6ec688e1bc76dd93151cbca1c340162ae4b10d77':
  mp3: enable packed main_data decoding in MP4

Conflicts:
	libavcodec/mpegaudiodec_template.c

Only the parts needed to support the available sample are merged
the remaining error checks are left in place

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 20:32:06 +02:00
nu774 6ec688e1bc mp3: enable packed main_data decoding in MP4
14496-3 suggests packing main_data of MP3 that is usually scattered
into multiple frames due to bit reservoir.

However, after packing main_data into a access unit, bitrate index
in the MPEG audio frame header doesn't match with actual frame size.

In order to accept this, this patch removes unnecessary frame size
checking on mp3 decoder.

Also, mov demuxer was changed to use MP3 parser only on special cases
(QT MOV with specific sample description) to avoid re-packetizing.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-06-20 12:18:01 +03:00
Michael Niedermayer 3d6635749a Merge commit '6308cd4868d2bd5fdf8bfa8dd10856c9a91874f5'
* commit '6308cd4868d2bd5fdf8bfa8dd10856c9a91874f5':
  mov: Check memory allocation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 22:56:51 +02:00
Vittorio Giovara 6308cd4868 mov: Check memory allocation
CC: libav-stable@libav.org
Bug-Id: CID 1292518
2015-06-08 13:03:39 +01:00
Michael Niedermayer 9614df4b15 avformat/mov: Retry same packet on IO failure to avoid loosing a packet
Based on patch by: Zhang Rui <bbcallen@gmail.com>
Reviewed-by: Zhang Rui <bbcallen@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-03 17:37:09 +02:00
Michael Niedermayer 9e1cdfb89b Merge commit '5c720657c23afd798ae0db7c7362eb859a89ab3d'
* commit '5c720657c23afd798ae0db7c7362eb859a89ab3d':
  mov: always check avio_read return value

Conflicts:
	libavformat/mov.c

See: b71528d896
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 00:59:44 +02:00
Michael Niedermayer 348319f543 Merge commit 'a8a90906fb0ad0f8d3c68a97f182528ee3b5198c'
* commit 'a8a90906fb0ad0f8d3c68a97f182528ee3b5198c':
  mov: Correctly allocate ctts_data

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 00:35:39 +02:00
Andreas Cadhalpun 5c720657c2 mov: always check avio_read return value
If avio_read fails, the buffer can contain uninitialized data.

This fixes 'Conditional jump or move depends on uninitialised value(s)'
valgrind warnings, and addresses a few memleaks.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-05-31 13:05:13 +02:00
Luca Barbato a8a90906fb mov: Correctly allocate ctts_data
It can be reallocated.

CC: libav-stable@libav.org
2015-05-31 13:05:12 +02:00
Andreas Cadhalpun cffb9ea81b mov: reject zero bytes_per_frame with non-zero samples_per_frame
In this case the mov demuxer can return a large number of empty packets.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-05-31 13:05:12 +02:00
Andreas Cadhalpun f261a55d72 mov: Fix two memleaks
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

CC: libav-stable@libav.org
2015-05-31 13:05:12 +02:00
Michael Niedermayer 08b7d19def avformat/mov: Also export loci altitude
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-30 15:28:31 +02:00
Michael Niedermayer 1607f77494 avformat/mov: Append place name instead of overwriting for loci
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-30 15:23:19 +02:00
Andreas Cadhalpun 153639cb9c mov: fix DTS calculation for samples with negative stts duration
A negative sample duration is invalid according to the spec, but there
are samples that use it for the DTS calculation, e.g.:
http://files.1f0.de/samples/mp4-negative-stts-problem.mp4

These currently get out of A/V sync.

Also change the logging type to AV_LOG_WARNING, because decoding the
sample can continue.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-05-29 19:35:58 +02:00
Michael Niedermayer e1b0019568 avformat/mov: Avoid float usage in yuv_to_rgba()
This avoids the possibility for rounding/precision differences between platforms

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-29 12:16:08 +02:00
Andreas Cadhalpun 83a04f8cc1 mov: reject zero bytes_per_frame with non-zero samples_per_frame
In this case the mov demuxer can return a large number of empty packets.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-05-26 00:28:02 +02:00
Michael Niedermayer 8ce564ea28 avformat/mov: Mark avio context of decompressed atoms as seekable
Fixes Ticket4329

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-25 01:26:55 +02:00
Andreas Cadhalpun b71528d896 mov: always check avio_read return value
If avio_read fails, the buffer can contain uninitialized data.

This fixes 'Conditional jump or move depends on uninitialised value(s)'
valgrind warnings.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-05-24 15:08:21 +02:00
Andreas Cadhalpun 8e77f8ab4a mov: fix two memleaks
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-05-24 15:08:21 +02:00
Zhang Rui c886dd2f58 avformat/mov: check result of avio_seek
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 18:48:18 +02:00