summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-08-05 00:41:46 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-08-05 00:41:46 +0000
commit4dc9e183dd9fd6544b5e11ff25052449af8671b0 (patch)
tree327037ece0bbd902eab41c4879b0a0c907622626 /libavformat/matroskadec.c
parent3856e7c4aa77e1675ec7124823a1bb4cfbe5a06a (diff)
matroskadec: expand useless ebml_peek_id() wrapper
Originally committed as revision 14587 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 60a571bbe5..2e34994f8d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -577,28 +577,6 @@ ebml_read_element_length (MatroskaDemuxContext *matroska,
}
/*
- * 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_id(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
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 @@ static int ebml_parse(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
}
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;
}