Revision f06a4886

View differences:

libavformat/matroskadec.c
1247 1247
    return -1;
1248 1248
}
1249 1249

  
1250
static int
1251
matroska_parse_index (MatroskaDemuxContext *matroska)
1252
{
1253
    return ebml_parse(matroska, matroska_index, matroska, MATROSKA_ID_CUES, 0);
1254
}
1255

  
1256
static int
1257
matroska_parse_metadata (MatroskaDemuxContext *matroska)
1258
{
1259
    return ebml_parse(matroska, matroska_tags, matroska, MATROSKA_ID_TAGS, 0);
1260
}
1261

  
1262 1250
static void
1263 1251
matroska_execute_seekhead(MatroskaDemuxContext *matroska)
1264 1252
{
......
1268 1256
    uint32_t level_up = matroska->level_up;
1269 1257
    offset_t before_pos = url_ftell(matroska->ctx->pb);
1270 1258
    MatroskaLevel level;
1271
    uint32_t id;
1272
    int i, res;
1259
    int i;
1273 1260

  
1274 1261
    for (i=0; i<seekhead_list->nb_elem; i++) {
1275 1262
        if (seekhead[i].pos <= before_pos
......
1296 1283
        matroska->levels[matroska->num_levels] = level;
1297 1284
        matroska->num_levels++;
1298 1285

  
1299
        /* check ID */
1300
        if (!(id = ebml_peek_id (matroska,
1301
                                 &matroska->level_up)))
1302
            goto finish;
1303
        if (id != seekhead[i].id) {
1304
            av_log(matroska->ctx, AV_LOG_INFO,
1305
                   "We looked for ID=0x%x but got "
1306
                   "ID=0x%x (pos=%"PRIu64")",
1307
                   (int)seekhead[i].id, id, seekhead[i].pos +
1308
                   matroska->segment_start);
1309
            goto finish;
1310
        }
1311

  
1312
        /* read master + parse */
1313
        switch (id) {
1314
        case MATROSKA_ID_CUES:
1315
            if (!(res = matroska_parse_index(matroska)) ||
1316
                url_feof(matroska->ctx->pb)) {
1317
                matroska->index_parsed = 1;
1318
                res = 0;
1319
            }
1320
            break;
1321
        case MATROSKA_ID_TAGS:
1322
            if (!(res = matroska_parse_metadata(matroska)) ||
1323
                url_feof(matroska->ctx->pb)) {
1324
                matroska->metadata_parsed = 1;
1325
                res = 0;
1326
            }
1327
            break;
1328
        }
1286
        ebml_parse_id(matroska, matroska_segment, seekhead[i].id, matroska);
1329 1287

  
1330
    finish:
1331 1288
        /* remove dummy level */
1332 1289
        while (matroska->num_levels) {
1333 1290
            uint64_t length = matroska->levels[--matroska->num_levels].length;

Also available in: Unified diff