• Andreas Rheinhardt's avatar
    avformat/matroskadec: Redo level handling · b31c9b72
    Andreas Rheinhardt authored
    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: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    b31c9b72
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...