Commit Graph

687 Commits

Author SHA1 Message Date
Steven Liu cc25a887c5 avformat/matroskadec: fix resource leak
Fixes Coverity CID: 1405453

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2017-05-07 11:29:08 +08:00
James Almer 095147ae06 avformat/matroskadec: export Content Light Level metadata
Based on a patch by Hendrik Leppkes

Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-30 20:04:50 -03:00
Derek Buitenhuis 6ba1c9bf7e webm_dash_manifest_demuxer: Fix initialization range for files with cues at the front
The WebM DASH spec states:
    The Initialization Segment shall not contain Clusters or Cues.
    The Segment Index corresponds to the Cues.

Previously, it included the cues if they were at the front.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-04-23 17:52:58 +01:00
Derek Buitenhuis 8e6b9ef473 webm_dash_manifest_demuxer: Fix UB in cue timestamp string code and make it actually work
Output was apparently not tested for correctness. Passing overlapping
memory to snprintf causes undefined behavior, and usually resulted in
only the very last timestamp being written to metadata, and not a list
at all.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-04-23 17:51:41 +01:00
James Zern 20aeee4fc9 matroskadec,cosmetics: fix a couple typos
Signed-off-by: James Zern <jzern@google.com>
2017-04-17 10:59:31 -07:00
Vignesh Venkatasubramanian 62c27fdba4 webm_dash_manifest: Add option to specify bandwidth
Add an option to webm_dash_manifest demuxer to specify a value for
"bandwidth" field in the DASH manifest. The value is then used by
the muxer. Fixes an existing FIXME in the code.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: James Zern <jzern@google.com>
2017-04-17 10:46:51 -07:00
Clément Bœsch e3287077ec Merge commit '67deba8a416d818f3d95aef0aa916589090396e2'
* commit '67deba8a416d818f3d95aef0aa916589090396e2':
  Use avpriv_report_missing_feature() where appropriate

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-31 10:40:34 +02:00
Clément Bœsch cd4d6cba12 lavf: fix usages of av_get_codec_tag_string() 2017-03-29 14:49:29 +02:00
James Almer 4de591e6fb Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'
* commit '83548fe894cdb455cc127f754d09905b6d23c173':
  lavf: fix usage of AVIOContext.seekable

Merged-by: James Almer <jamrial@gmail.com>
2017-03-21 17:02:30 -03:00
Vittorio Giovara f20bcec4c2 spherical: Change types of bounding and pad to uint32_t
These values are defined to be 32bit in the specification,
so it makes more sense to store them as fixed width.

Based on a patch by Micahel Niedermayer <michael@niedermayer.cc>.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-03-17 13:12:25 -04:00
Vittorio Giovara 9ae3506696 matroskadec: cosmetics: Rearrange checks for projection-depedendent properties 2017-03-07 17:34:32 -05:00
Vittorio Giovara bde9642268 mkv: Export bounds and padding from spherical metadata
Update the fate test as needed.
2017-03-07 11:28:02 -05:00
Carl Eugen Hoyos b8a7dcbde2 lavf/matroskadec: Fix demuxing sipr.
Regression since 2c8d876d
2017-02-28 21:51:26 +01:00
Chris Cunningham ac25840ee3 lavf/matroskadec: fix is_keyframe for early Blocks
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)
2017-02-06 09:33:28 +01:00
James Almer 1ae39429e4 avformat/matroskadec: ProjectionPrivate is optional on Equirectangular projections
This reflects a recent change to the spec draft.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-01-26 19:28:19 -03:00
Michael Niedermayer b347ca9341 avformat/matroskadec: Fix OOM on long streams
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-27 02:48:19 +01:00
James Almer edb4f5da81 avformat/matroskadec: remove the strict unofficial check for Colour elements
Signed-off-by: James Almer <jamrial@gmail.com>
2016-12-10 21:06:45 -03:00
James Almer 4e759072c2 avformat/matroskadec: allocate Colour related fields only if the file contains the relevant master
The demuxer doesn't fill the defaults if the master isn't present.
This results in codecpar->color_space being set with a value of
zero (RGB) on such files.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-12-10 21:05:21 -03:00
James Almer 120471da2d avformat/matroskadec: remove unused variable
Signed-off-by: James Almer <jamrial@gmail.com>
2016-12-08 01:23:24 -03:00
James Almer 8396d54d3c avformat/matroskadec: fix memleak on stream side data failure
Signed-off-by: James Almer <jamrial@gmail.com>
2016-12-08 01:21:11 -03:00
James Almer 445204cd57 avformat/matroskadec: add support for Spherical Video elements
Signed-off-by: James Almer <jamrial@gmail.com>
2016-12-07 22:40:59 -03:00
Rainer Hochecker 7a9db61da3 matroskadec: partly revert "demux relevant subtitle packets after a seek"
This reverts parts of c16582579b. The hard
coded 30 seconds are a lot, and finishing the seek can takes several
seconds when the source is on a network share. Remove this code
entirely, because it does more bad than good.

(Commit message provided by committer, based on the original messages
by the patch author.)

Signed-off-by: Rainer Hochecker <fernetmenta@online.de>
Signed-off-by: wm4 <nfxjfg@googlemail.com>
2016-12-02 13:59:17 +01:00
Michael Schenk 18b9466937 matroskadec: prevent access of elements after freeing
Using the decode interrupt feature of ffmpeg may cause crashes by
accessing previously freed pointers in matroska_read_close.

To prevent this reset nb_elem to zero after freeing the elements,
because ffmpeg normally tests for nb_elem.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-30 01:15:38 +01:00
Andreas Cadhalpun ff100c9dd9 matroskadec: fix NULL pointer dereference in webm_dash_manifest_read_header
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>
2016-11-08 20:17:31 +01:00
Diego Biurrun 67deba8a41 Use avpriv_report_missing_feature() where appropriate 2016-11-08 17:54:34 +01:00
James Almer 70c6a1bcf0 avformat/matroskadec: fix DiscardPadding element parsing
If the value is negative then it means padding at the start of the packet
instead of at the end.

Based on a patch by Hendrik Leppkes.

Reviewed-by: James Zern <jzern-at-google.com@ffmpeg.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-08 13:43:53 -03:00
James Almer 0ad71ed6f9 avformat/matroskadec: fix BitsPerChannel element's default value
The element is currently ignored, so there's no effective functionality
change with this.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-18 23:55:32 -03:00
James Almer f5cfc0cc54 avformat/matroskadec: clarify some Colour element defaults using enum values
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>
2016-10-18 23:55:05 -03:00
James Almer 47ee6f1a59 avformat/matroskadec: support parsing Chroma Location elements
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-18 20:39:07 -03:00
Andreas Cadhalpun eb751f06db matroskadec: fix NULL pointer dereference
The problem was introduced in commit 1273bc6.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-17 15:50:26 +02:00
James Almer 8b59ce0342 Partially revert "avformat/matroskadec: set aspect ratio only when 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>
2016-10-16 14:19:05 -03:00
James Almer bad8bbc26a avformat/matroskadec: set aspect ratio only when DisplayWidth and 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>
2016-10-15 20:42:07 -03:00
James Almer 1273bc6d26 avformat/matroskadec: workaround the field_order bug in the Matroska muxer
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-13 14:22:07 -03:00
James Almer a4044498f7 avformat/matroskadec: check for more reserved values on some Colour elements
Signed-off-by: James Almer <jamrial@gmail.com>
2016-10-06 13:49:29 -03:00
Anton Khirnov 83548fe894 lavf: fix usage of AVIOContext.seekable
It is supposed to be a flag. The only currently defined value is
AVIO_SEEKABLE_NORMAL, but other ones may be added in the future.
However all the current lavf code treats this field as a bool (mainly
for historical reasons).
Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
2016-09-30 16:54:33 +02:00
James Almer 29b6c2be29 avformat/matroskadec: set AVCodecParameters.field_order on progressive video
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-27 20:30:11 -03:00
Sophia Wang 8c83062acb avformat/matroskadec: retain error codes in matroska_resync() and matroska_read_packet()
Signed-off-by: Sophia Wang <skw@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-28 01:24:51 +02:00
Marton Balint 13b90ff2c1 avformat: fix decoded creation_time timestamps
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>
2016-08-28 15:55:32 +02:00
Chris Cunningham 52ec4cc09b libavformat/matroskadec: Add test for seeking with codec delay.
Also cleanup parens for the skip_to_timecode check.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-30 01:02:41 +02:00
Chris Cunningham d59820f6fe libavformat/matroskadec: fix unsigned overflow to improve seeking
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>
2016-07-23 10:32:28 +02:00
Anton Khirnov 40f74dc87a matroskadec: export CodecDelay 2016-07-03 09:13:29 +02:00
Michael Niedermayer f573acc424 avformat/matroskadec: Call matroska_read_close() on header parsing error
Fixes memleak
Fixes Ticket5169

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-24 18:39:53 +02:00
James Almer 49b0246635 avformat/matroskadec: force 48kHz sample rate when rescaling Opus inital padding
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>
2016-06-07 20:32:25 -03:00
Michael Niedermayer b5bc436ebc avformat/matroskadec: Fix rounding error with codec_delay
Fixes Ticket5509

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-06 05:01:34 +02:00
Derek Buitenhuis f3972b3b7d Merge commit '5f0226668124aa7ae4db501ba7f4ace4c770f3d1'
* commit '5f0226668124aa7ae4db501ba7f4ace4c770f3d1':
  matroska: Support interlaced content correctly

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-08 22:58:18 +01:00
Diego Biurrun 5afb94c817 Mark read-only tables as static 2016-05-05 10:48:34 +02:00
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* 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>
2016-04-10 20:59:55 +01:00
Luca Barbato 5f02266681 matroska: Support interlaced content correctly
The matroska specification now has two elements for it.
2016-03-31 18:03:21 +02:00
Luca Barbato 8b4b1c1eea matroska: Support V_QUICKTIME as written in the specification
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
2016-03-15 16:06:35 +01:00
Neil Birkbeck bbda13a771 lavf/matroskadec: Add early support for some of the new colour elements.
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>
2016-03-04 23:11:51 +01:00