Commit Graph

353 Commits

Author SHA1 Message Date
Diego Biurrun d92024f18f lavf: more correct printf format specifiers 2014-03-11 13:13:41 +01:00
Diego Biurrun f69befe5ee matroskadec: cosmetics: Fix "attachement" vs. "attachment" typo 2014-03-07 13:54:18 +01:00
Keiji Costantini 84cfce9f99 matroskadec: K&R formatting cosmetics
Also sort #includes into canonical order.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-03-07 13:39:07 +01:00
Aurelien Jacobs 8b516f154a matroskadec: use correct compression parameters for current track CodecPrivate
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-21 20:54:55 +01:00
Anton Khirnov 30be1ea33e matroskadec: pad EBML_BIN data.
It might be passed to code requiring padding, such as lzo decompression.

Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2013-11-21 20:54:30 +01:00
Yusuke Nakamura 959bea13ce matroskadec: Support HEVC demuxing 2013-10-31 20:20:49 +01:00
Anton Khirnov 668643b923 matroskadec: check av_strdup() when setting defaults 2013-09-24 17:11:50 +02:00
Martin Storsjö 569d18aa9d matroskadec: Verify realaudio codec parameters
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:22:30 +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
Martin Storsjö 5bcd3ae5b1 matroskadec: Check that .lang was allocated and set before reading it
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-03 22:57:15 +03:00
Sean McGovern 8835c554ff matroskadec: introduce resync function.
This allows handling matroska files with errors.
Fixes test4.mkv and test7.mkv from the official Matroska test suite,
and by extension Bugzilla #62.

Based on a patch by Reimar Doffinger <Reimar.Doeffinger@gmx.de>

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-06-10 20:51:35 +02:00
Anton Khirnov 9b6f47c448 matroskadec: export full wavpack blocks.
This allows us to get rid of demuxer-specific hacks in the decoder and
will allow streamcopy from matroska once we have a wavpack muxer.
2013-05-28 08:14:35 +02:00
Anton Khirnov 564b7e0c00 matroskadec: silently skip CodecState element.
mkvmerge apparrently uses it for mpeg1/2 video, but it contains the same
information as CodecPrivate, so it can be ignored.
2013-05-27 21:25:53 +02:00
Diego Biurrun e0f8be6413 avformat: Add AVPROBE_SCORE_EXTENSION define and use where appropriate 2013-05-04 21:43:06 +02:00
Luca Barbato 25a80a931a matroska: pass the lace size to the matroska_parse_rm_audio
Each lace must be independent according to the specification.

Fix heap-buffer-overflow in matroska_parse_block for
corrupted real media in mkv files.

Stricter check than fc43c19a56

CC: libav-stable@libav.org
2013-04-03 12:34:38 +02:00
Luca Barbato 8a96df7b70 matroska: fix a corner case in ebml-lace parsing
Make sure we notice when the lace_size[n] is a negative value.

CC: libav-stable@libav.org
2013-04-03 12:33:15 +02:00
Dale Curtis fc43c19a56 matroska: Update the available size after lace parsing
Fix heap-buffer-overflow in matroska_parse_block for
corrupted real media in mkv files.

CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-04-03 12:33:01 +02:00
Luca Barbato 37cb3b180a matroskadec: request a read buffer for the wav header
Solve an infiniloop.

CC: libav-stable@libav.org
2013-03-12 18:58:06 +01:00
Anton Khirnov 85a5bc054c lavf: remove disabled FF_API_R_FRAME_RATE cruft 2013-03-11 18:23:50 +01:00
Anton Khirnov 1afddbe59e avpacket: use AVBuffer to allow refcounting the packets.
This will allow us to avoid copying the packets in many cases.

This breaks ABI.
2013-03-08 07:33:45 +01:00
Dale Curtis ae3d416369 matroska: Fix use after free
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-11 00:12:08 +01:00
Anton Khirnov 34871beb5e matroskadec: do not use avpacket internals 2012-11-02 18:28:56 +01:00
Diego Biurrun 2a91ada828 avutil: Make LZO decoder code configure-time selectable 2012-10-25 11:49:49 +02:00
Diego Biurrun 7e68c91e24 rmdec: Move SIPR code shared with Matroska demuxer to a separate file 2012-10-15 13:34:07 +02:00
Anton Khirnov 87b017a298 matroskadec: fix a sanity check. 2012-09-21 09:15:07 +02:00
Anton Khirnov bdb939ad73 matroskadec: only return corrupt packets that actually contain data
Fixes bug 372.
2012-09-21 09:15:01 +02:00
Luca Barbato 7d8431004a matroskadec: properly support BlockDuration 2012-09-19 20:34:14 +02:00
Luca Barbato c831ebf616 matroskadec: split frame parsing 2012-09-19 20:34:14 +02:00
Luca Barbato 2d0e7713f9 matroskadec: split laces parsing 2012-09-19 20:34:14 +02:00
Luca Barbato 117d8c6d1f matroska: implement support for ProRes
Support Matroska native formatting.

On demuxing prepend a Frame container atom (32bit big endian encoded
frame size and 'icpf' string).
On muxing remove it.
2012-09-19 20:34:14 +02:00
Moritz Bunkus 8071dca3d5 matroska: implement support for ALAC
Support Matroska native formatting.

On demuxing reconstruct the 36-bytes QuickTime atom that the ALAC
decoder expects by prepending the "atom size", "tag" and
"tag version" fields missing from the Matroska's CodecPrivate
element.

On muxing remove the initial 12 bytes

Sample files are available:
http://www.bunkus.org/videotools/mkvtoolnix/samples/alac/alac-in-matroska.mka
and the CoreAudio file it was created from with today's mkvmerge:
http://www.bunkus.org/videotools/mkvtoolnix/samples/alac/alac-in-matroska-source.caf

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-09-19 20:34:14 +02:00
Luca Barbato 870e75524a matroskadec: validate lace_size when parsed
Stricter validation, explicitly exit on misparsing and some error
forwarding from the ebml parsing functions used.
2012-09-19 20:34:14 +02:00
Luca Barbato c9a39cec70 matroskadec: return meaningful errors in matroska_decode_buffer 2012-09-19 20:34:14 +02:00
Dale Curtis df1d84121b matroskadec: fix incorrect unsigned->signed conversion 2012-09-19 20:34:14 +02:00
Luca Barbato 8d4dd55c37 matroskadec: refactor matroska_decode_buffer
Make MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP behave like
the other encodings and spare few lines of boilerplate code.
2012-09-19 20:34:14 +02:00
Luca Barbato 581281e242 matroskadec: check realloc in lzo encoding
Make all the compression encodings behave the same way.
2012-09-19 20:34:13 +02:00
Luca Barbato cd4739c4f2 matroska: honor error_recognition on unknown doctypes 2012-09-19 20:34:13 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Diego Biurrun 6774247a9d avformat: Drop pointless "format" from container long names 2012-07-30 13:59:06 +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
Anton Khirnov 721113bed2 matroskadec: return more correct error code on read error. 2012-07-22 09:14:05 +02:00
Anton Khirnov 5b7a88f0ba matroskadec: honor error_recognition when encountering unknown elements. 2012-07-09 07:43:11 +02:00
Luca Barbato 0ca4642ec5 mkv: mark corrupted packets and return them
Do return error if memory allocation or I/O fails.
2012-04-29 20:22:09 -07:00
Luca Barbato 721af294d9 mkv: forward EMBL block data error
Do not return 0 on error.
2012-04-29 20:22:09 -07:00
Dale Curtis 7521c4bab2 matroska: Clear prev_pkt between seeks.
The new incremental parser doesn't always clear prev_pkt,
however the packet queue is cleared when seeking. Which leads
to a use-after-free.

Verified using Valgrind.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-04-23 14:21:42 -04:00
Dale Curtis 8336eb6f85 matroska: Add incremental parsing of clusters.
Reduces the amount of upfront data required for cluster parsing
thus decreasing latency on seek and startup.

The change in the seek-lavf_mkv FATE test is due to incremental
parsing no longer reading as much data as the old parser and
thus not having that additional data to generate index entries
based on keyframes.  Index entries are added correctly as the
file is parsed.

All FATE tests pass and Chrome has been using this patch for ~6
months without issue.

Currently incremental parsing is not supported for files with
SSA tracks since they require merging packets between clusters.
In this case the code falls back to non-incremental parsing.

Signed-off-by: Aaron Colwell <acolwell@chromium.org>
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-04-22 17:23:50 -07:00
Mans Rullgard 3c58300269 matroska: do not set invalid default duration if frame rate is zero
If a video track specifies a zero frame rate (invalid but occurs),
this results in a division by zero and subsequent undefined conversion
to integer.  Setting the default duration from the frame rate only
if the latter is greater than zero avoids such problems.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-04-18 13:48:20 +01:00
Luca Barbato ac97d47d9b mkv: use av_reduce instead of av_d2q for framerate estimation
It avoids some rounding errors.
2012-04-17 16:37:42 -07:00
Luca Barbato 204bcdf56c mkv: report average framerate as minimal as well
This is in line with other demuxers and overall seems more correct
than assuming codec time base.
2012-04-17 15:47:22 -07:00
Dale Curtis 3116858853 matroska: Fix leaking memory allocated for laces.
During error conditions matroska_parse_block may exit without
freeing the memory allocated for laces.

Found via valgrind: http://pastebin.com/E54k8QFU

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-04-12 21:32:01 -07:00