Mercurial > libavformat.hg
changeset 3667:0735d792bad2 libavformat
matroskadec: expand useless ebml_peek_id() wrapper
author | aurel |
---|---|
date | Tue, 05 Aug 2008 00:41:46 +0000 |
parents | 0e60f2b18452 |
children | 16d9cf401425 |
files | matroskadec.c |
diffstat | 1 files changed, 6 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/matroskadec.c Tue Aug 05 00:41:43 2008 +0000 +++ b/matroskadec.c Tue Aug 05 00:41:46 2008 +0000 @@ -577,28 +577,6 @@ } /* - * Return: the ID of the next element, or 0 on error. - * Level_up contains the amount of levels that this - * next element lies higher than the previous one. - */ -static uint32_t -ebml_peek_id (MatroskaDemuxContext *matroska, - int *level_up) -{ - uint32_t id; - int res; - - res = ebml_read_element_id(matroska, &id); - if (res < 0) - return 0; - - if (res > 0 && level_up) - *level_up = ebml_read_element_level_up(matroska); - - return id; -} - -/* * Seek to a given offset. * 0 is success, -1 is failure. */ @@ -1045,7 +1023,7 @@ static int ebml_parse(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, void *data, uint32_t expected_id, int once) { - int i, res = 0; + int i, res = 0, res2; uint32_t id = 0; for (i=0; syntax[i].id; i++) @@ -1071,10 +1049,12 @@ } while (!res) { - if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR(EIO); + res2 = ebml_read_element_id(matroska, &id); + if (res2 < 0) break; - } else if (matroska->level_up) { + if (res2 > 0) + matroska->level_up = ebml_read_element_level_up(matroska); + if (matroska->level_up) { matroska->level_up--; break; }