matroskadec: directly use ebml_parse() or ebml_parse_id() where it's enough

Originally committed as revision 14598 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs 2008-08-05 00:42:20 +00:00
parent 66a37e060b
commit c4d3d9ba95

View File

@ -846,6 +846,8 @@ static int matroska_probe(AVProbeData *p)
return 0;
}
static int ebml_parse_id(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
uint32_t id, void *data);
static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
void *data, int once);
@ -881,7 +883,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
if (id == MATROSKA_ID_SEGMENT)
matroska->segment_start = url_ftell(matroska->ctx->pb);
return ebml_parse_nest(matroska, syntax->def.n, data, 0);
case EBML_PASS: return ebml_parse_nest(matroska, syntax->def.n, data, 1);
case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data);
case EBML_STOP: *(int *)data = 1; return 1;
default: url_fskip(pb, length); return 0;
}
@ -1129,7 +1131,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
matroska->ctx = s;
/* First read the EBML header. */
if (ebml_parse_nest(matroska, ebml_syntax, &ebml, 1)
if (ebml_parse(matroska, ebml_syntax, &ebml)
|| ebml.version > EBML_VERSION || ebml.max_size > sizeof(uint64_t)
|| ebml.id_length > sizeof(uint32_t) || strcmp(ebml.doctype, "matroska")
|| ebml.doctype_version > 2) {
@ -1142,7 +1144,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
ebml_free(ebml_syntax, &ebml);
/* The next thing is a segment. */
if (ebml_parse_nest(matroska, matroska_segments, matroska, 1) < 0)
if (ebml_parse(matroska, matroska_segments, matroska) < 0)
return -1;
matroska_execute_seekhead(matroska);
@ -1632,7 +1634,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
MatroskaCluster cluster = { 0 };
EbmlList *blocks_list;
MatroskaBlock *blocks;
int i, res = ebml_parse_nest(matroska, matroska_clusters, &cluster, 1);
int i, res = ebml_parse(matroska, matroska_clusters, &cluster);
blocks_list = &cluster.blocks;
blocks = blocks_list->elem;
for (i=0; !res && i<blocks_list->nb_elem; i++)