The new code does not rely on whether the cluster's position is set or not to infer whether a cluster needs to be closed or not (instead, the levels are closed during ebml_parse), so there is no need to reset the cluster's position at all any more. It will be automatically set to the correct value when a cluster is entered.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@googlemail.com> --- libavformat/matroskadec.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index fc8c3f936c..3adcb3e86d 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -747,7 +747,6 @@ static int matroska_reset_status(MatroskaDemuxContext *matroska, { matroska->current_id = id; matroska->num_levels = 1; - matroska->current_cluster.pos = 0; if (position >= 0) return avio_seek(matroska->ctx->pb, position, SEEK_SET); @@ -1679,8 +1678,8 @@ static int matroska_parse_seekhead_entry(MatroskaDemuxContext *matroska, } } - /* Seek back - notice that in all instances where this is used it is safe - * to set the level to 1 and unset the position of the current cluster. */ + /* Seek back - notice that in all instances where this is used + * it is safe to set the level to 1. */ matroska_reset_status(matroska, saved_id, before_pos); return ret; @@ -3535,7 +3534,6 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska) } if (matroska->num_levels == 2) { - int err = 0; /* We are inside a cluster. */ res = ebml_parse(matroska, matroska_cluster_parsing, cluster); @@ -3544,7 +3542,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska) uint8_t* additional = block->additional.size > 0 ? block->additional.data : NULL; - err = matroska_parse_block(matroska, block->bin.buf, block->bin.data, + res = matroska_parse_block(matroska, block->bin.buf, block->bin.data, block->bin.size, block->bin.pos, cluster->timecode, block->duration, is_keyframe, additional, block->additional_id, @@ -3552,14 +3550,8 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska) block->discard_padding); } - if (res == LEVEL_ENDED) - cluster->pos = 0; - ebml_free(matroska_blockgroup, block); memset(block, 0, sizeof(*block)); - - if (err < 0) - return err; } else if (!matroska->num_levels) { matroska->done = 1; return AVERROR_EOF; -- 2.19.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".