Commit Graph

101 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
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
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
Michael Niedermayer 5864ce13d1 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mp3dec: read Xing frame TOC index
  mp3dec: use named constants for Xing header flags
  libx264: add support for nal-hrd, required for Blu-ray streams.
  mov: support random access point grouping
  matroskadec: properly support BlockDuration

Conflicts:
	libavcodec/libx264.c
	libavformat/isom.h
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 21:46:35 +02:00
Yusuke Nakamura d17d0ec8c2 mov: support random access point grouping
Frames described by this grouping are the starter of a closed or
an open GOP.
This is useful for open GOP of H.264 stream which is not described
by sync sample atom.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-09-19 20:34:15 +02:00
Michael Niedermayer fa85118510 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mov_chan: Pass a separate AVIOContext for reading
  af_asyncts: check return value from lavr when flushing.
  mss2: simplify loop in decode_rle()
  mss12: avoid unnecessary division in arith*_get_bit()
  mss2: do not try to read too many palette entries
  mpegvideo: set AVFrame fields to NULL after freeing the base memory
  configure: Set the right cc_e flags for msvc

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-07 13:50:24 +02:00
Michael Niedermayer 7a72695c05 Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
* commit '36ef5369ee9b336febc2c270f8718cec4476cb85':
  Replace all CODEC_ID_* with AV_CODEC_ID_*
  lavc: add AV prefix to codec ids.

Conflicts:
	doc/APIchanges
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	ffprobe.c
	ffserver.c
	libavcodec/8svx.c
	libavcodec/avcodec.h
	libavcodec/dnxhd_parser.c
	libavcodec/dvdsubdec.c
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/libvorbisenc.c
	libavcodec/mjpeg_parser.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/pcm.c
	libavcodec/r210dec.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/version.h
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavformat/asfdec.c
	libavformat/asfenc.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/caf.c
	libavformat/electronicarts.c
	libavformat/flacdec.c
	libavformat/flvdec.c
	libavformat/flvenc.c
	libavformat/framecrcenc.c
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/matroska.c
	libavformat/matroskadec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/movenc.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegts.c
	libavformat/mxf.c
	libavformat/mxfdec.c
	libavformat/mxfenc.c
	libavformat/nsvdec.c
	libavformat/nut.c
	libavformat/oggenc.c
	libavformat/pmpdec.c
	libavformat/rawdec.c
	libavformat/rawenc.c
	libavformat/riff.c
	libavformat/sdp.c
	libavformat/utils.c
	libavformat/vocenc.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 22:45:46 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Michael Niedermayer e4c00aca96 Merge remote-tracking branch 'qatar/master'
* qatar/master: (38 commits)
  alac: cosmetics: general pretty-printing and comment clean up
  alac: calculate buffer size outside the loop in allocate_buffers()
  alac: change some data types to plain int
  alac: cosmetics: rename some variables and function names
  alac: multi-channel decoding support
  alac: split element parsing into a separate function
  alac: support a read sample size of up to 32
  alac: output in planar sample format
  alac: add 32-bit decoding support
  alac: simplify channel interleaving
  alac: use AVPacket fields directly in alac_decode_frame()
  alac: fix check for valid max_samples_per_frame
  alac: use get_sbits() to read LPC coefficients instead of casting
  alac: move the current samples per frame to the ALACContext
  alac: avoid using a double-negative when checking if the frame is compressed
  alac: factor out output_size check in predictor_decompress_fir_adapt()
  alac: factor out loading of next decoded sample in LPC prediction
  alac: use index into buffer_out instead of incrementing the pointer
  alac: simplify lpc coefficient adaptation
  alac: reduce the number of local variables needed in lpc prediction
  ...

Conflicts:
	libavcodec/alac.c
	libavformat/cafdec.c
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-19 23:31:04 +02:00
Michael Niedermayer ad8dabfe9c mov/aac: skip initial aac padding
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-17 17:09:19 +02:00
Clément Bœsch 0d96ec19eb mov: parse tref atom. 2012-06-11 07:35:14 +02:00
Michael Niedermayer 7432bcfe5a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  vsrc_buffer: fix check from 7ae7c41.
  libxvid: Reorder functions to avoid forward declarations; make functions static.
  libxvid: drop some pointless dead code
  wmal: vertical alignment cosmetics
  wmal: Warn about missing bitstream splicing feature and ask for sample.
  wmal: Skip seekable_frame_in_packet.
  wmal: Drop unused variable num_possible_block_size.
  avfiltergraph: make the AVFilterInOut alloc/free API public
  graphparser: allow specifying sws flags in the graph description.
  graphparser: fix the order of connecting unlabeled links.
  graphparser: add avfilter_graph_parse2().
  vsrc_buffer: allow using a NULL buffer to signal EOF.
  swscale: handle last pixel if lines have an odd width.
  qdm2: fix a dubious pointer cast
  WMAL: Do not try to read rawpcm coefficients if bits is invalid
  mov: Fix detecting there is no sync sample.
  tiffdec: K&R cosmetics
  avf: has_duration does not check the global one
  dsputil: fix optimized emu_edge function on Win64.

Conflicts:
	doc/APIchanges
	libavcodec/libxvid_rc.c
	libavcodec/libxvidff.c
	libavcodec/tiff.c
	libavcodec/wmalosslessdec.c
	libavfilter/avfiltergraph.h
	libavfilter/graphparser.c
	libavfilter/version.h
	libavfilter/vsrc_buffer.c
	libswscale/output.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-14 22:37:43 +02:00
Yusuke Nakamura accea4d9d8 mov: Fix detecting there is no sync sample.
Stss atom without entries doesn't mean every sample is a sync sample.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-13 23:08:34 +03:00
Reimar Döffinger 50059bde77 MOV: Fix old-style muxed raw-audio data.
This patch fixes the sample from trac issue #522.
The issue is that the mov demuxer insists on using its
calculated sample_size (which is nonsense for old-style tracks)
instead of the one encoded in the track.
The old raw audio code should be using the value in stsz, because
the size of a single sample never makes sense for the size of
a full audio packet, whereas the new code will multiply the
sample size by the chunk size, so it should use the calculated value.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-03-31 12:37:42 +02:00
Michael Niedermayer e99f1a8cc8 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dxva2: don't check for DXVA_PictureParameters->wDecodedPictureIndex
  img2: split muxer and demuxer into separate files
  rm: prevent infinite loops for index parsing.
  aac: fix infinite loop on end-of-frame with sequence of 1-bits.
  mov: Add more HDV and XDCAM FourCCs.
  lavf: don't set AVCodecContext.has_b_frames in compute_pkt_fields().
  rmdec: when using INT4 deinterleaving, error out if sub_packet_h <= 1.
  cdxl: correctly synchronize video timestamps to audio
  mlpdec_parser: fix a few channel layouts.
  Add channel names to channel_names[] array for channels added in b2890f5
  movenc: Buffer the mdat for the initial moov fragment, too
  flvdec: Ignore the index if the ignidx flag is set
  flvdec: Fix indentation
  movdec: Don't parse all fragments if ignidx is set
  movdec: Restart parsing root-level atoms at the right spot
  prores: use natural integer type for the codebook index
  mov: Add support for MPEG2 HDV 720p24 (hdv4)
  swscale: K&R formatting cosmetics (part I)
  swscale: variable declaration and placement cosmetics

Conflicts:
	configure
	libavcodec/aacdec.c
	libavcodec/mlp_parser.c
	libavformat/flvdec.c
	libavformat/img2.c
	libavformat/isom.h
	libavformat/mov.c
	libavformat/movenc.c
	libswscale/rgb2rgb.c
	libswscale/rgb2rgb_template.c
	libswscale/yuv2rgb.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-23 04:31:55 +01:00
Martin Storsjö 383a3b64cb movdec: Restart parsing root-level atoms at the right spot
If parsing moov+mdat in a non-seekable file, we currently
abort parsing directly after parsing the header of the mdat
atom. If we want to continue parsing later (if looking to
parse later fragments), we need to skip past the content of the
mdat atom, otherwise we end up parsing the content of the mdat
atom as root level atoms.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-22 10:39:14 +02:00
Michael Niedermayer 4a519b6e03 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mov: Use defines for sample flags in fragments
  mov: Use defines for trun flags
  mov: Use defines for tfhd flags
  proresenc: force bitrate not to exceed given limit
  vc1parse: call vc1_init_common().
  wma: don't return 0 on invalid packets.
  asf: prevent packet_size_left from going negative if hdrlen > pktlen.
  mjpegb: don't return 0 at the end of frame decoding.
  rtpdec: Identify incorrectly signalled H263
  vp8dsp: split long line.
  aiff: don't skip block_align==0 check on COMM-after-SSND files.
  dpcm: ignore extra unpaired bytes in stereo streams.
  mp3on4: require a minimum framesize.
  mpc7: assign an error level + context to av_log() msg.
  huffyuv: error out on bit overrun.
  dct-test: Add the missing ff_ prefix to the altivec functions
  dct-test: Remove a stray declaration of a nonexistent function
  movenc: Write the unknown duration as 64 bit fields in ismv
  movenc: Write track durations with all bits set if duration is unknown

Conflicts:
	libavcodec/dct-test.c
	libavcodec/wmadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-19 01:47:10 +01:00
Martin Storsjö 5be805d38c mov: Use defines for sample flags in fragments
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-18 21:13:36 +02:00
Martin Storsjö 3eec23f3cd mov: Use defines for trun flags
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-18 21:13:35 +02:00
Martin Storsjö 73328f24fa mov: Use defines for tfhd flags
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-18 21:13:33 +02:00