Commit Graph

672 Commits

Author SHA1 Message Date
Alexandra Khirnova 5626f994f2 avformat: Use av_reallocp() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-18 18:28:38 +02:00
Martin Storsjö 7f8d41eb09 mov: Don't use a negative duration for setting other fields
Some files have the duration set to -1 in the mdhd atom, more
or less legitimately. (We produce such files ourselves, for the
initial duration in fragmented mp4 files.)

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:33:37 +03:00
Alexandra Khirnova f369b9356c avformat: Use av_reallocp_array() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-10 12:38:32 +02:00
Luca Barbato 5b41eb91e0 mov: Parse tmcd extradata 2013-08-25 13:49:13 +02:00
Luca Barbato 0b5af5cf12 mov: Refactor multiple stsd skipping in mov_mov_skip_multiple_stsd 2013-08-24 17:02:23 +02:00
Luca Barbato 08504380dd mov: Refactor codec specific final steps in mov_finalize_stsd_codec 2013-08-24 17:02:23 +02:00
Luca Barbato dc518a3ae2 mov: Refactor subtitle specific parsing in mov_parse_stsd_subtitle 2013-08-24 17:02:23 +02:00
Luca Barbato ef196beeb5 mov: Refactor audio specific parsing in mov_parse_stsd_audio 2013-08-24 17:02:23 +02:00
Luca Barbato a3b53ff062 mov: Refactor video specific parsing in mov_parse_stsd_video 2013-08-24 17:02:23 +02:00
Luca Barbato bf98562505 mov: Refactor codec id selection in mov_codec_id 2013-08-24 17:02:23 +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
Martin Storsjö 31931520df mov: Do not allow updating the time scale after it has been set
The time scale is set in mdhd, and later validated in the
enclosing trak atom once all of its children have been parsed.

A loose mdhd atom outside of a trak atom could update the time
scale of the last stream without any validation.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-15 21:38:58 +03:00
Martin Storsjö 5b4eb243bc mov: Seek back if overreading an individual atom
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-15 21:37:44 +03:00
Diego Biurrun 2832ea26f3 Remove commented-out debug #define cruft 2013-05-16 00:23:30 +02:00
Diego Biurrun e0f8be6413 avformat: Add AVPROBE_SCORE_EXTENSION define and use where appropriate 2013-05-04 21:43:06 +02:00
Diego Biurrun ac9362c5d9 Move misplaced file author information where it belongs 2013-04-11 02:42:11 +02:00
Diego Biurrun 1ecdf8912b avformat: av_log_ask_for_sample() ---> avpriv_request_sample() 2013-03-13 20:42:21 +01:00
Anton Khirnov 85a5bc054c lavf: remove disabled FF_API_R_FRAME_RATE cruft 2013-03-11 18:23:50 +01:00
Anton Khirnov 56daf10e03 mov: use the format context for logging.
CC:libav-stable@libav.org
2013-02-23 13:05:16 +01:00
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