Commit Graph

248 Commits

Author SHA1 Message Date
Tom Finegan
2d0912837c Colour element: TransferFunction renamed to TransferCharacteristics.
Change-Id: I02e8d9b375d3aeba26d99866df90e25e1605143f
2016-02-18 12:03:41 -08:00
Tom Finegan
f2fc28e044 Colour element: Matrix renamed to MatrixCoefficients.
Change-Id: I148e81be6c23f0d0e61dc5820a1ae80f685af57f
2016-02-18 12:03:36 -08:00
Tom Finegan
d7fc382dea Track updates to the proposed Matroska Colour spec.
https://mailarchive.ietf.org/arch/msg/cellar/cCjxCohD-2xM93ijoFVaYYMLFas

Changes:
- ChromaSubsampling replaced by ChromaSubsamplingHorz,
  and ChromaSubsamplingVert.
- CbSubsamplingHorz and CbSubsamplingVert added.

Change-Id: I0848f9f41b3162afb5485b82704620d9e03f9b5e
2016-02-12 11:28:30 -08:00
Tom Finegan
1dab7f34ff mkvparser: Avoid crash when encountering a Colour element.
Change-Id: Iadf55bf2a7cd5535a8c2309c2d8cb6c834d30aee
2016-02-11 16:43:00 -08:00
Tom Finegan
ae4ae7ef77 mkvparser: Make omitted values detectable in the Colour element.
Add constants that allow users to determine when an element or value
was omitted from Colour and its child elements.

Change-Id: If909274850127938a456f2d0a1e490dcbb9c1bde
2016-02-10 09:14:34 -08:00
Vignesh Venkatasubramanian
939a64dc2d Signal E_BUFFER_NOT_FULL in EBMLHeader::Parse
When trying to read the ebml id, signal E_BUFFER_NOT_FULL if it
occurs rather than returning E_FILE_FORMAT_INVALID (helps in case
of incremental parsing). Makes this return path consistent with
other return paths in the function.

Change-Id: I4b6ce3f0ba856959fa97f0f6ffb61994f3f2ffc6
2016-02-08 16:10:50 -08:00
Tom Finegan
fb1406ec3b mkvparser: Add support for the Colour element and its children.
Change-Id: Idffafaee221e2949c21f56c81df6e4d1c3e959a5
2016-02-08 09:23:57 -08:00
Tom Finegan
48b1e9a4a0 mkvparser: clang format run
Change-Id: Ib416e3ea3a955090bf4269113b36e15922107438
2016-02-04 09:56:48 -08:00
Vignesh Venkatasubramanian
5c83bbec9a Fix ParseElementHeader to support 0 payload elements
BUG=https://bugs.chromium.org/p/webm/issues/detail?id=1125

Please see the bug description for more details. This patch fixes
parsing of the file attached in the bug.

Change-Id: I2e929b6ef0ee92ea6d034b501b44a62784edf9f1
2016-01-05 13:35:00 -08:00
James Zern
1ad314e297 mkvparser: EBMLHeader::Parse: remove dead init
Change-Id: Ie06b44c3b7fd948d11aa86ae521a196ea668312b
2015-10-13 16:10:55 -07:00
James Zern
476366249e mkvparser: fix type warnings
Change-Id: Ia77a9a4e694986ece4c2e0f86f2857f320432f48
2015-09-11 18:56:09 -07:00
James Zern
267f71c76e mkvparser: SafeArrayAlloc fix type warning
num_bytes has been validated so it's safe to cast to size_t for use with
new

Change-Id: If1a6c5521dd6fbcb7e30f434b81daa3b26bd0386
2015-09-11 18:56:09 -07:00
James Zern
f1a99d5f25 mkvparser: s/LONG_LONG_MAX/LLONG_MAX/ for compatibility
Change-Id: If3b80bfd08f02ec9cba0be223ff95991564f6fd7
2015-09-11 18:56:09 -07:00
James Zern
bff1aa512d mkvparser: add msvc compatibility for isnan/isinf
fixes build errors related to these functions on visual studio prior to
2013

Change-Id: I8272f9065195e5447055aad7d0f899afa0294ea9
2015-09-11 18:55:03 -07:00
Tom Finegan
714f3c4e4f mkvparser: validate results in EBMLHeader::Parse.
Return an error when DocType, DocTypeReadVersion, DocTypeVersion
EBMLMaxIDLength or EBMLMaxSizeLength are invalid or cannot be
handled by mkvparser.

Update samples to respect the return value from EBMLHeader::Parse.

BUG=https://code.google.com/p/webm/issues/detail?id=1057

Change-Id: I9337f13c1d5fa366b1101e48fe6bc46eb5b2ee97
2015-09-05 08:06:45 -07:00
Tom Finegan
cec98d4110 mkvparser: Correct the ReadID implementation.
Return real, known MKV IDs when reading them. Previously
IDs were treated as EBML integer values. This was both
wrong and confusing. Wrong because this results in values
that are not part of the Matroska spec, and confusing
because the code was littered with magic numbers
representing the invented IDs.

Currently uses mkvmuxer::MkvId; A TODO in the code addresses this.
Additional IDs have been added that were not previously in the enum:
mkvparser parses many elements that we do not write in the muxer.

Change-Id: I5db2b4d70d786d5239d2e2a0cbff4e7f8d844aa6
2015-09-04 09:55:59 -07:00
Tom Finegan
d26ec6909d mkvparser: Cluster::Parse clean up.
- Remove "// weird"'s.
- Remove commented out asserts.
- Asserts to error checks.
- Use ReadID to read IDs.

Change-Id: I029a268e4fa45931e3c6a72e41448f0b8fb2d0c3
2015-08-31 14:32:53 -07:00
Tom Finegan
f2029be5f4 mkvparser: Disallow EBML IDs equal to 0.
Change-Id: Ia272b1505dc62fdadf06348365a6aef058b081d8
2015-08-31 14:23:38 -07:00
Tom Finegan
19f5694277 mkvparser: Cluster::Load clean up.
- Remove "// weird"'s.
- Remove needless extra scoping.
- Asserts to error checks.

Change-Id: I5c4d1bbc59d9debe95e1e35e63ff0679335048ff
2015-08-31 13:59:35 -07:00
Tom Finegan
27a07c1fd1 mkvparser: Segment::Load asserts to error checks.
Change-Id: Ia47a24786789d6f94a786f76e313318e013f4f40
2015-08-31 13:38:35 -07:00
Tom Finegan
d0313dd7ce mkvparser: Segment::PreloadCluster asserts to error checks.
Change-Id: I3a2e2226f30ee047f96f5136c52e4cb9081d42c8
2015-08-31 13:36:15 -07:00
Tom Finegan
b108695b9b mkvparser: Segment::AppendCluster asserts to error checks.
Change-Id: Id6bb378b22a7c6397e3d950c2fdd84396279e881
2015-08-31 12:40:24 -07:00
Tom Finegan
4630f80f79 mkvparser: Segment::DoLoadClusterUnknownSize asserts to error checks.
Change-Id: I4597416261efb9202d2307e1ac4abfeb38e7c515
2015-08-31 12:38:20 -07:00
Tom Finegan
841a9b5fd9 mkvparser: Segment assert clean up.
- Remove asserts from ~Segment, CreateInstance, and DoLoadCluster.
- Adds new return constant (E_PARSE_FAILED == -1); most places in
  mkvparser that return -1 are the result of an internal inconsistency
  and/or misusing the API. In those cases E_FILE_FORMAT_INVALID is not
  appropriate as a return value because it's misleading to libwebm users.

Change-Id: I0d46e831b3475d69432b8745066de3329419fa11
2015-08-31 12:38:09 -07:00
Tom Finegan
0735bb5bdc mkvparser: Make mkvparser namespace usage uniform.
Instead of being weird and defining the first few functions
in mkvparser by explicitly prepending the namespace, open the
namespace immediately and define all functions within it.

Change-Id: I9a44a0fda8b04f89c8f874a2a6edc78f1b8e5bcc
2015-08-28 14:26:46 -07:00
Tom Finegan
93b24c4195 mkvparser: Fix include order.
Change-Id: Ia03ce824c78c19f5ab62c736069ea0972b8c93ea
2015-08-28 11:06:03 -07:00
Tom Finegan
1c5bd949d0 mkvparser: Cues, change asserts to error checks.
Change-Id: I116845b792aa5bb9a35341097cbd393300539f79
2015-08-26 12:51:05 -07:00
Tom Finegan
7f77201dca Merge "mkvparser: Add ReadID." 2015-08-26 19:49:11 +00:00
James Zern
795fd568b6 mkvparser: set kMaxAllocSize explicitly
removes the need for the unrelated INT32_MAX and fixes the build
(stdint.h was missing)

Change-Id: Idf3315097982aec6fb28030bd2327ba6cff14668
2015-08-25 20:29:50 -07:00
Tom Finegan
23bb18b76d mkvparser: Add ReadID.
Enforce ID rules in one place instead of every time
an ID is read.

Change-Id: I6e39a2e2dbafa2d5926dea790dd563cc3a48f67e
2015-08-25 13:37:35 -07:00
Tom Finegan
7b57e37fde mkvparser: add SafeArrayAlloc.
A new wrapper that makes array allocations safer by
limiting allocated size.

BUG=23430787

Change-Id: I901ee61dc2b601e8c0b5bf13f7499b5d2479ba7a
2015-08-25 13:06:27 -07:00
Tom Finegan
83a1f68944 mkvparser: Remove buf_t typedef.
- It is useless.
- It masks errors; buf_t was unsigned char*, but const buf_t was
  not seen by the compiler as const unsigned char*, which allowed
  passing a const pointer as a mutable argument to
  IMkvReader::Read at every site where buf_t was in use.

Change-Id: I293015e11c69d992e76c88ac02052a5a9a2b2c9c
2015-08-25 10:47:17 -07:00
James Zern
507471457e Merge changes Ia1265a63,I799d54df,Icfc582e4,I3425f608
* changes:
  Block::Parse: replace pos asserts w/checks
  Cluster::ParseBlockGroup: replace pos asserts w/checks
  Tags::*::Parse: replace pos asserts w/checks
  Chapters::*::Parse: replace pos asserts w/checks
2015-08-25 06:28:43 +00:00
James Zern
b18110541a Merge changes Ie4318152,I1e65f30f
* changes:
  Block::Parse: use int64 to aggregate laced frame sizes
  UnserializeFloat: check result for Inf/NaN
2015-08-25 06:25:04 +00:00
James Zern
06b4337ed8 Block::Parse: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks

BUG=23431751

Change-Id: Ia1265a639086c790a2ed542f34c2f438c153b036
2015-08-24 19:59:08 -07:00
James Zern
b366a98053 Cluster::ParseBlockGroup: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks
+ harmonize error return -1 -> E_FILE_FORMAT_INVALID

BUG=23431751

Change-Id: I799d54df62d93388b52ac325b836ab28e0860992
2015-08-24 19:59:04 -07:00
James Zern
2857b2350c Tags::*::Parse: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks
+ harmonize error return -1 -> E_FILE_FORMAT_INVALID

BUG=23431751

Change-Id: Icfc582e414a7d02ae0675ef14c047922c4a12036
2015-08-24 19:59:00 -07:00
James Zern
f1b2cfa03e Chapters::*::Parse: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks

BUG=23431751

Change-Id: I3425f6083456b5ab4f40497e3a192569b494dfa9
2015-08-24 19:56:07 -07:00
Tom Finegan
ca8062959a Merge "mkvparser: Cues::PreloadCuePoint now returns bool." 2015-08-25 02:22:05 +00:00
James Zern
6b4b297220 Block::Parse: use int64 to aggregate laced frame sizes
this is compared against a final total which is also int64

BUG=23488728

Change-Id: Ie4318152f9f9ae049a35d0b2724ccad129316981
2015-08-24 17:00:34 -07:00
James Zern
c0d2c9852b UnserializeFloat: check result for Inf/NaN
fail in either case

BUG=23488728

Change-Id: I1e65f30ff1cf857a5d1eb4bdedc3f842423cf15f
2015-08-24 16:49:22 -07:00
Tom Finegan
1a6dc4f210 mkvparser: Cues::PreloadCuePoint now returns bool.
Check allocations and fail appropriately.

Change-Id: Ie16d258a47e46b5e15c5c6275ea83ebead8b0f49
2015-08-24 16:20:13 -07:00
Tom Finegan
275ac22cae mkvparser: Cluster::Create clean up.
- Asserts to error condition check and return.
- Use nothrow new.

Change-Id: Iff9da5806e6f3240e7ea9f9e90ccdf729848a778
2015-08-24 16:19:10 -07:00
James Zern
064f2eed62 Segment::PreloadCluster(): return a bool status
BUG=23430793

Change-Id: I10aab67e94961868be806ee7ee9df550a5187e5a
2015-08-22 11:02:55 -07:00
James Zern
3778408b2a Segment::AppendCluster(): return a bool status
BUG=23430793

Change-Id: I6072234bfe211153ad143ccf7a3c6bbfa8cd166e
2015-08-22 11:01:47 -07:00
James Zern
e86d046c07 mkvparser: check Cluster::Create() return
BUG=23430793

Change-Id: Ie932dd2ee82d41368616999ab75ba3b213008642
2015-08-22 10:47:03 -07:00
James Zern
f9885b5882 mkvparser: check allocations
some unchecked new's are left in a few void functions, they'll be
addressed in a separate commit

BUG=23430793

Change-Id: I4953e70f4e7b0401a293c6b87c02445960e9ff9e
2015-08-22 10:47:03 -07:00
James Zern
21ee398281 mkvparser: Segment::Load fail w/missing info/tracks
convert asserts to error returns

BUG=23430793

Change-Id: Ifbfb5a2e7cd41344acc9c8d7afdf183b28dc2cd2
2015-08-22 10:47:03 -07:00
James Zern
08fb6546e8 Merge changes I264e68b2,Ife6190a4,Ibf37245f,I06efadb5,I88b5dfec, ...
* changes:
  mkvparser/Cluster: convert asserts to failure returns
  mkvparser/Tracks: convert asserts to failure returns
  mkvparser/Track: convert asserts to failure returns
  mkvparser/ContentEncoding: convert asserts to failure returns
  mkvparser/Cues: convert asserts to failure returns
  mkvparser/SeekHead: convert asserts to failure returns
  mkvparser/Segment: convert asserts to failure returns
2015-08-22 05:52:07 +00:00
James Zern
c8960955db mkvparser/Cluster: convert asserts to failure returns
Change-Id: I264e68b24eeb0f719a9d60b4cb0454e38110dd39
2015-08-21 22:49:57 -07:00