FFmpeg/libavformat
Andreas Rheinhardt b31c9b72e5 avformat/matroskadec: Redo level handling
This commit changes how levels are handled: If the level used for
ebml_parse ends directly after an element that has been consumed, then
ebml_parse ends the level itself (and any known-length levels that end
there as well) and informs the caller via the return value; if the
current level is of unknown-length, then the level is ended as soon as
an element that is not valid on the current level, but on a higher
level is encountered (or if EOF has been encountered).

This is designed for situations where one wants to parse master elements
incrementally, i.e. not in one go via ebml_parse_nest.

The (incremental) parsing of clusters still mixes levels by using a
syntax list that contains elements from different levels and the level
is still ended manually via a call to ebml_level_end if the last cluster
was an unknown-length cluster (known-length clusters are already ended
when their last element is read), but only if the next element is a
cluster, too. A  different level 1 element following an unknown-length
cluster will currently simply be presumed to be part of the earlier
cluster. Fixing this will be done in a future patch. The modifications
to matroska_parse_cluster contained in this patch are only intended not
to cause regressions.

Nevertheless, the fact that known-length levels are automatically ended
in ebml_parse when their last element has been read already fixes a bogus
error message introduced in 9326117b that was emitted when a known-length
cluster is followed by another level 1 element other than a cluster in
which case the cluster's level was not ended (which only happened when
a new cluster has been encountered) so that the length check (introduced
in 9326117b) failed for the level 1 element as it is of course not
contained in the previous cluster. Most Matroska files were affected by
this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-07-16 16:16:58 -03:00
..
2019-05-20 11:58:12 -07:00
2019-05-20 11:58:12 -07:00
2018-05-06 15:07:28 +08:00
2017-09-20 03:31:48 +02:00
2017-10-19 22:07:21 +02:00
2019-07-03 10:35:16 +08:00
2019-03-20 18:38:48 +01:00
2019-05-20 11:58:12 -07:00
2019-06-14 13:21:38 +08:00
2019-07-03 21:07:38 +10:00
2019-05-20 11:58:12 -07:00
2019-06-10 21:35:20 +02:00
2018-09-11 21:48:49 +01:00
2018-02-11 20:03:33 +01:00
2018-02-11 20:03:33 +01:00
2018-05-21 19:43:04 -03:00
2018-05-21 19:43:04 -03:00
2019-03-20 18:38:48 +01:00
2018-03-07 22:26:53 +01:00
2019-06-14 21:36:39 +02:00
2019-06-29 19:22:19 +02:00
2019-06-21 18:28:00 +02:00
2019-07-14 22:17:43 +02:00