Commit Graph

653 Commits

Author SHA1 Message Date
Janne Grunau bb2bab92e7 mov: handle h263 and flv1 for codec_tag 'H','2','6','3'
The sample in https://bugzilla.libav.org/show_bug.cgi?id=393 and
samples/F4V/H263_NM_f.mp4 both have codec_tag H263 for different
codecs. H263 is apparently used by Flash Media Server for Sorensen
Spark videos.

Patch based on commit 5442083b1c by
Carl Eugen Hoyos. Fixes bug 393.
2012-12-19 14:50:14 +01:00
Janne Grunau 8cc2fa1e5d mov: validate number of DataReferenceBox entries against box size
Avoids a 2G memory allocation and parsing of random data in
mov_read_dref(). The fuzzed sample sample.mp4_s224424 triggers this.
2012-12-07 11:43:28 +01:00
Janne Grunau 80b6b31417 mov: compute avg_frame_rate only if duration is known
Fixes an assert in fuzzed sample sample.mp4_s265930.
2012-12-07 11:43:28 +01:00
Justin Ruggles 261e9348ef lavf: add a common function for selecting a pcm codec from parameters 2012-11-28 11:18:50 -05:00
Justin Ruggles a903f8f087 Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
Also reorder some other #include when applicable.
2012-11-11 13:35:12 -05: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
Luca Barbato 9888ffb1ce mov: check for EOF in long lasting loops
A quite widespread pattern in the demuxer is read a 32bit unsigned
integer and then loop till this value is reached.

Checking for EOF prevents pathological situations.
2012-09-18 15:32:52 +02:00
Michael Niedermayer a5ea623b36 mov: stsd entries must be at least 16 byte
Fix near infinite loop in stsd parsing.
Bug found by: Diana Elena Muscalu

The size is unsigned according the specification.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-09-16 16:53:06 +02:00
Michael Niedermayer 9db67bedf0 mov: detect EOF in mov_read_dref()
Avoid a near infinite loop.
Issue discovered by cosminamironesei.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-09-16 16:31:03 +02:00
Samuel Pitoiset 9afb7061f9 mov_chan: Pass a separate AVIOContext for reading
This fixes crashes when called from rtpdec_qt, where
AVFormatContext->pb is null, a crash present since 3bab7cd128.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-07 10:49:35 +03:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Diego Biurrun 0177b7d23a Improve descriptiveness of a number of codec and container long names 2012-07-30 20:46:55 +02:00
Anton Khirnov aba232cfa9 lavf: deprecate r_frame_rate.
According to its description, it is supposed to be the LCM of all the
frame durations. The usability of such a thing is vanishingly small,
especially since we cannot determine it with any amount of reliability.
Therefore get rid of it after the next bump.

Replace it with the average framerate where it makes sense.

FATE results for the wtv and xmv demux tests change. In the wtv case
this is caused by the file being corrupted (or possibly badly cut) and
containing invalid timestamps. This results in lavf estimating the
framerate wrong and making up wrong frame durations.
In the xmv case the file contains pts jumps, so again the estimated
framerate is far from anything sane and lavf again makes up different
frame durations.

In some other tests lavf starts making up frame durations from different
frame.
2012-07-29 08:06:30 +02:00
Justin Ruggles 3bab7cd128 avformat: move 'chan' tag parsing to mov_chan.c to share with the CAF demuxer 2012-07-19 13:26:45 -04:00
Ronald S. Bultje 1ce1e6360d mov: use forward declaration of a function instead of a table.
MSVC gives a compile error on the tentative definition of
mov_default_parse_table[].
2012-07-04 07:45:30 -07:00
Anton Khirnov a02b8c695c mov: read itunes cover art. 2012-07-02 16:14:25 +02:00
Carl Eugen Hoyos fbcaceb1ff mov: do not try to read total disc/track number if data atom is too short.
Fixes bug 308.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-06-26 13:12:50 +02:00
Anton Khirnov a7b8ff94b1 mov: make a length variable larger.
Right now, it's uint16_t, but for itunes metadata a 32bit number is
stored in it.
2012-06-24 07:54:29 +02:00
Ronald S. Bultje f1f37c7011 mov: fix operator precedence bug 2012-06-20 15:37:01 +01:00
Martin Storsjö 9e74db6850 mov: Support muxing/demuxing iLBC
The packet size, signalled via block_align, has to be passed via
the container.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-18 22:00:35 +03:00
Mans Rullgard 8aa93e9004 mov: set AVCodecContext.width/height for h264
This is required for correct cropping of files from Canon
cameras.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-09 15:08:51 +01:00
Anton Khirnov 755cd4197d mov: enable parsing for VC-1.
This makes lavf discard broken timestamps for non-B frames in
samples/isom/vc1-wmapro.ism.
2012-05-18 19:38:21 +02:00
Diego Biurrun 59cbc4eee2 mov: make one comment slightly more specific 2012-05-09 23:12:37 +02:00
Diego Biurrun 455245ca8a mov: Remove write-only variable in mov_read_chan().
libavformat/mov.c:597:25: warning: variable ‘cflags’ set but not used
2012-05-07 20:31:23 +02:00
Diego Biurrun 30b1961c66 Mark a number of variables only used in av_dlog() calls as av_unused.
This fixes a number of unused-but-set gcc warnings.
2012-05-06 18:01:31 +02:00
Yusuke Nakamura 546adc1fee mov: Parse EC3SpecificBox (dec3 atom).
Skip to parse fields for additional independent substreams and its
associated dependent substreams since libavcodec's E-AC-3 decoder does not
support them yet.

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-04-27 16:11:46 -04:00
Yusuke Nakamura 94c9bf8887 mov: Treat keyframe indexes as 1-origin if starting at non-zero.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-04-21 14:04:33 -04:00
Yusuke Nakamura ba9869311f mov: Take stps entries into consideration also about key_off.
Splitted files don't start always from a sync sample.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-04-21 14:04:33 -04:00
Dale Curtis c788782c7d mov: free memory on header parsing failure
Call mov_read_close when mov_read_header fails.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-04-14 19:41:52 -07:00
Dale Curtis 4ebd422c04 mov: fix leaking memory with multiple drefs.
Instead of allocating over the original, free first. MOVStreamContext
is zero initialized so no double free will occur. Same style as other
fixes for the same problem in this file.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-04-14 19:41:52 -07: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
Ronald S. Bultje 4f7c7624c0 mov: don't overwrite existing indexes.
Prevents all kind of badness if files contain multiple
indexes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-29 11:36:14 -07:00
Alex Converse 86f2ae06b9 mov: Do not read past the end of the ctts_data table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-22 13:57:12 -07:00
Carl Eugen Hoyos a294a7a1b3 mov: Allow last chunk to have an arbitrary number of samples.
Fixes ticket #673.
(cherry picked from commit 8dcd2a41ec)

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-06 15:25:34 -08:00
Justin Ruggles 237a855caf mov: do not set AVCodecContext.frame_size
It is not necessary.
2012-03-05 13:08:17 -05:00
Anton Khirnov 4f07f8196c lavc: deprecate AVCodecContext.color_table_id.
It's currently only used as temporary storage by the mov demuxer. Make
it use a local variable instead.
2012-02-29 07:25:00 +01:00
Justin Ruggles 3798205a77 mov: set channel layout for AC-3 streams based on the 'dac3' atom info
fixes Bug 225
2012-02-22 20:07:02 -05:00
Martin Storsjö aa96d433e2 movdec: Don't parse all fragments if ignidx is set
In nonseekable files, we already stop parsing the toplevel atoms
after finding moov and one mdat. In large seekable files (or files
that are seekable, but slowly, e.g. http), reading all the fragments
at the start can take a considerable amount of time. This allows
opting out from this behaviour.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-22 10:39:15 +02: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
Martin Storsjö a5c50913a8 movdec: Adjust keyframe flagging in fragmented files
For video, mark the first sample in a trun which doesn't have the
sample-is-non-sync-sample flag set as a keyframe.

In particular, the "sample does not depend on other samples" flag
isn't enough to make it a keyframe, since later frames still can
reference frames prior to that one (the flag only says that that
particular frame doesn't depend on other frames).

This fixes bug 215.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-21 14:19:20 +02: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
Martin Storsjö 167f3b8de7 libavformat: Add an ff_ prefix to some lavf internal symbols
Prefix the functions/tables brktimegm, pcm_read_seek,
dv_offset_reset, voc_get_packet, codec_movaudio_tags,
codec_movvideo_tags.

After this, lavf has no global symbols without the proper prefix.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:17 +02:00
Alex Converse 29a20ac4a1 movdec: Avoid av_malloc(0) in stss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2012-02-03 10:44:04 -08:00
Martin Storsjö 89415b8e3f movdec: Parse the dvc1 atom
Normally, the actual payload data contains sequence headers, too,
and the parser can extract this and set it as extradata. However,
the data in the dvc1 atom is the "official" extradata for the file.

This is required for proper stream copy of vc1 from ismv to ismv.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-02 21:39:27 +02:00
Janne Grunau 7f19bdc2a2 movdec: fix dts generation in fragmented files
Do not use AVStream's duration for dts generation since it contains in
some cases the duration of the whole file instead of duration of the
samples in the moov. This happens if the mdhd holds the duration of the
whole file but has no entries or a zero duration in its stts.
2012-02-02 17:39:13 +01:00
Martin Storsjö 75ab1e62d4 movdec: Ignore sample_degradation_priority bits when checking first_sample_flags
This makes the first packet of a track fragment run to get
the keyframe flag set properly if sample_degradation_priority
is nonzero.

This makes the keyframes flag be set properly for ismv files
created by Microsoft.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-31 00:13:31 +02:00
Anton Khirnov 6e9651d106 lavf: remove AVFormatParameters from AVFormatContext.read_header signature 2012-01-27 10:51:57 +01:00
Martin Storsjö bc7d05177f movdec: Calculate an average bit rate for fragmented streams, too
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-25 12:15:41 +02:00