aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskadec.c
Commit message (Collapse)AuthorAgeFilesLines
* lavf/matroskadec: fix is_keyframe for early BlocksChris Cunningham2017-02-061-3/+7
| | | | | | | | | | | | | | | | | | Blocks are marked as key frames whenever the "reference" field is zero. This breaks for non-keyframe Blocks with a reference timestamp of zero. The likelihood of reference timestamp being zero is increased by a longstanding bug in muxing that encodes reference timestamp as the absolute time of the referenced frame (rather than relative to the current Block timestamp, as described in MKV spec). Now using INT64_MIN to denote "no reference". Reported to chromium at http://crbug.com/497889 (contains sample) (cherry picked from commit ac25840ee32888f0c13118edeb9404a123cd3a79) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* matroskadec: fix NULL pointer dereference in webm_dash_manifest_read_headerAndreas Cadhalpun2016-11-171-0/+5
| | | | | | | | | The code assumes that s->streams[0] is valid. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit ff100c9dd97d2f1f456ff38b192edf84f9744738) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avformat/matroskadec: fix BitsPerChannel element's default valueJames Almer2016-10-181-1/+1
| | | | | | | The element is currently ignored, so there's no effective functionality change with this. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: clarify some Colour element defaults using enum valuesJames Almer2016-10-181-6/+6
| | | | | | | This way it's more clear what the default values refer to, as Undetermined/Unspecified is 0 for some, 2 for others. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: support parsing Chroma Location elementsJames Almer2016-10-181-0/+8
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* matroskadec: fix NULL pointer dereferenceAndreas Cadhalpun2016-10-171-1/+1
| | | | | | | The problem was introduced in commit 1273bc6. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* Partially revert "avformat/matroskadec: set aspect ratio only when ↵James Almer2016-10-161-1/+1
| | | | | | | | | | | DisplayWidth and DisplayHeight are in pixels" The code works just fine regardless of unit, so only make sure DisplayUnit is not "unknown". Found-by: Nicolas George <george@nsup.org> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: set aspect ratio only when DisplayWidth and ↵James Almer2016-10-151-6/+9
| | | | | | | | | | | | | DisplayHeight are in pixels A missing DisplayUnit element or one with the default value of 0 means DisplayWidth and DisplayHeight should be interpreted as pixels. The current code setting st->sample_aspect_ratio is wrong when DisplayUnit is anything else. Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: workaround the field_order bug in the Matroska muxerJames Almer2016-10-131-4/+11
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: check for more reserved values on some Colour elementsJames Almer2016-10-061-2/+4
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: set AVCodecParameters.field_order on progressive videoJames Almer2016-09-271-0/+2
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: retain error codes in matroska_resync() and ↵Sophia Wang2016-09-281-6/+9
| | | | | | | matroska_read_packet() Signed-off-by: Sophia Wang <skw@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: fix decoded creation_time timestampsMarton Balint2016-08-281-6/+1
| | | | | | | | | | | Use proper ISO 8601 timestamps which also signal that they are in UTC. This changes the format of creation_time and modification_date metadata values from 2016-06-01 22:30:00 to 2016-01-01T22:30:00.000000Z Fixes ticket #5673. Signed-off-by: Marton Balint <cus@passwd.hu>
* libavformat/matroskadec: Add test for seeking with codec delay.Chris Cunningham2016-07-301-1/+1
| | | | | | Also cleanup parens for the skip_to_timecode check. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat/matroskadec: fix unsigned overflow to improve seekingChris Cunningham2016-07-231-1/+4
| | | | | | | | | When seeking a file where codec delay is greater than 0, the timecode can become negative after offsetting by the codec delay. Failing to cast to a signed int64 will cause the check against skip_to_timecode to evaluate true for these negative values. This breaks the "skip_to" seek mechanism. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskadec: Call matroska_read_close() on header parsing errorMichael Niedermayer2016-06-241-2/+7
| | | | | | | Fixes memleak Fixes Ticket5169 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskadec: force 48kHz sample rate when rescaling Opus inital paddingJames Almer2016-06-071-1/+2
| | | | | | | | | | | Mkvtoolnix stores the sample rate of the original stream as reported by the "OpusHead" stream header instead of 48kHz, the actual sample rate of the Opus stream. Ignoring the stored sample rate and forcing 48kHz preserves the correct initial padding when remuxing such files. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskadec: Fix rounding error with codec_delayMichael Niedermayer2016-06-061-3/+4
| | | | | | Fixes Ticket5509 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '5f0226668124aa7ae4db501ba7f4ace4c770f3d1'Derek Buitenhuis2016-05-081-2/+29
|\ | | | | | | | | | | | | * commit '5f0226668124aa7ae4db501ba7f4ace4c770f3d1': matroska: Support interlaced content correctly Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * matroska: Support interlaced content correctlyLuca Barbato2016-03-311-1/+27
| | | | | | | | The matroska specification now has two elements for it.
| * matroska: Support V_QUICKTIME as written in the specificationLuca Barbato2016-03-151-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | Check if the size is written the first 4 bytes and read the next 4 as fourcc candidate, fallback checking the initial for 4 bytes. "The CodecPrivate contains all additional data that is stored in the 'stsd' (sample description) atom in the QuickTime file after the mandatory video descriptor structure (starting with the size and FourCC fields)" CC: libav-stable@libav.org
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-101-71/+70
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-231-59/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
| * mkv: Force the full parsing of mp3Luca Barbato2016-02-191-0/+2
| | | | | | | | | | | | | | Some muxer might or might not fit incomplete mp3 frames in their packets. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | lavf/matroskadec: Add early support for some of the new colour elements.Neil Birkbeck2016-03-041-0/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding early support for a subset of the proposed colour elements according to the latest version of spec: https://mailarchive.ietf.org/arch/search/?email_list=cellar&gbt=1&index=hIKLhMdgTMTEwUTeA4ct38h0tmE I've left out elements for pix_fmt related things as there still seems to be some discussion around these, and the max_cll/max_fall are currently not propagated as there is not yet side data for them. The new elements are exposed under strict experimental mode. Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/matroskadec: Process QuickTime palette per trackMats Peterson2016-02-271-8/+11
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/matroskadec: Get sample size from private dataMats Peterson2016-01-161-2/+8
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/matroskadec: Use av_realloc() in get_qt_codec()Mats Peterson2016-01-121-3/+3
| | | | | | | | | | | | | | Use av_realloc() rather than av_malloc() when normalizing noncompliant private data in get_qt_codec(). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/matroskadec: Normalize noncompliant A_QUICKTIME/V_QUICKTIME private dataMats Peterson2016-01-111-13/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new static function get_qt_codec() that takes care of the initial retrieval of the fourcc and codec ID for A_QUICKTIME and V_QUICKTIME. It also normalizes noncompliant private data found in some older files that incorrectly starts with the fourcc by expanding/shifting the data by 4 bytes, and storing the data size at the start. This is necessary in order for the rest of the code in the A_QUICKTIME and V_QUICKTIME blocks (and most likely other code as well) to correctly parse the private data. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/matroskadec: A_QUICKTIME and fourcc 0x00000000Mats Peterson2016-01-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many older QuickTime files, the audio format, or "fourcc", is 0x00000000. The QuickTime File Format Specification states the following regarding this situation: "This format descriptor should not be used, but may be found in some files. Samples are assumed to be stored in either 'raw ' or 'twos' format, depending on the sample size field in the sound description." MPlayer handles this logic by itself, but FFmpeg/FFplay currently does not. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/matroskadec: correct codec_tag for "SMI" SVQ3 filesMats Peterson2016-01-061-2/+4
| | | | | | | | | | | | This corrects the codec_tag for some SVQ3 files Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/matroskadec: palettized QuickTime video in MatroskaMats Peterson2015-12-281-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Palettized QuickTime video in Matroska has hitherto not been recognized whatsoever, and the "palette" used has been completely random. The patch for matroskadec.c fixes this issue by adding a palette side data packet in matroska_deliver_packet(), much in the same way as it's done in mov.c. Video samples for testing are available at https://drive.google.com/open?id=0B3_pEBoLs0faWElmM2FnLTZYNlk. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'febfb49a70e82f5ac46dc7ea34dabd4d56b19b31'Hendrik Leppkes2015-12-181-2/+2
|\| | | | | | | | | | | | | * commit 'febfb49a70e82f5ac46dc7ea34dabd4d56b19b31': matroskadec: Fix sample_aspect_ratio for stereo matroska content Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * matroskadec: Fix sample_aspect_ratio for stereo matroska contentAaron Colwell2015-12-071-2/+34
| | | | | | | | | | | | | | | | | | matroskaenc applies divisors to the display width/height when generating stereo content. This patch adds the corresponding multipliers to matroskadec so that the original sample aspect ratio can be recovered. Signed-off-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavf/matroskadec: Set codec_tag also for audio codecs.Carl Eugen Hoyos2015-12-121-0/+2
| | | | | | | | | | This was already done for "A_MS/ACM" mkv files and it is done for mov files but was not done for A_QUICKTIME" mkv files.
* | Merge commit 'a0fa6d06b848f26b16ba12f0a9a4a85b93ab8022'Hendrik Leppkes2015-12-071-6/+37
|\| | | | | | | | | | | | | * commit 'a0fa6d06b848f26b16ba12f0a9a4a85b93ab8022': matroska: Warn when metadata references a non-existent element Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * matroska: Warn when metadata references a non-existent elementLuca Barbato2015-11-281-6/+37
| | | | | | | | | | | | Avoid some confusion when the information is not present. Bug-Id: 902
* | avformat: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-041-1/+1
| |
* | avformat/matroskadec: Fix sample_aspect_ratio for stereo matroska contentAaron Colwell2015-12-021-2/+32
| | | | | | | | | | | | | | | | matroskaenc.c applies divisors to the display width/height when generating stereo content. This patch adds the corresponding multipliers to matroskadec.c so that the original sample aspect ratio can be recovered. Signed-off-by: wm4 <nfxjfg@googlemail.com>
* | avformat/matroskadec: Check subtitle stream before dereferencingMichael Niedermayer2015-11-171-0/+1
| | | | | | | | | | | | | | | | Unrecognized streams are not allocated Fixes: flicker-1.color1.vp91447030769.08.webm Found-by: Chris Cunningham <chcunningham@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-271-2/+2
| |
* | Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'Hendrik Leppkes2015-10-271-1/+1
|\| | | | | | | | | | | | | * commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457': avpacket: Replace av_free_packet with av_packet_unref Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * avpacket: Replace av_free_packet with av_packet_unrefLuca Barbato2015-10-261-2/+2
| | | | | | | | | | | | | | `av_packet_unref` matches the AVFrame ref-counted API and can be used as a drop in replacement. Deprecate `av_free_packet`.
* | lavf/matroskadec: drop indexes that appear brokenRodger Combs2015-10-091-4/+5
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d'Hendrik Leppkes2015-09-291-20/+6
|\| | | | | | | | | | | | | * commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d': lavc: Make AVPacket.duration int64, and deprecate convergence_duration Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavc: Make AVPacket.duration int64, and deprecate convergence_durationwm42015-09-291-2/+6
| | | | | | | | | | | | | | | | | | Note that convergence_duration had another meaning, one which was in practice never used. The only real use for it was a 64 bit replacement for the duration field. It's better just to make duration 64 bits, and to get rid of it. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavf/matroska: ignore ChapCountry ID for nowRodger Combs2015-09-201-2/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/matroskadec: Fully parse and repack MP3 packetsRodger Combs2015-08-161-1/+3
| | | | | | | | | | | | Fixes https://trac.ffmpeg.org/ticket/4776 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-271-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-271-5/+5
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>