Revision 24c3da16

View differences:

libavformat/matroskadec.c
1420 1420

  
1421 1421
static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
1422 1422
                                int size, int64_t pos, uint64_t cluster_time,
1423
                                uint64_t duration, int is_keyframe)
1423
                                uint64_t duration, int is_keyframe,
1424
                                int64_t cluster_pos)
1424 1425
{
1425 1426
    MatroskaTrack *track;
1426 1427
    int is_video_key_frame = is_keyframe, res = 0;
......
1545 1546
        uint64_t timecode = AV_NOPTS_VALUE;
1546 1547

  
1547 1548
        if (cluster_time != (uint64_t)-1
1548
            && (block_time >= 0 || cluster_time >= -block_time))
1549
            && (block_time >= 0 || cluster_time >= -block_time)) {
1549 1550
            timecode = cluster_time + block_time;
1551
            if (is_keyframe)
1552
                av_add_index_entry(st, cluster_pos, timecode,
1553
                                   0, 0, AVINDEX_KEYFRAME);
1554
        }
1550 1555

  
1551 1556
        for (n = 0; n < laces; n++) {
1552 1557
            if (st->codec->codec_id == CODEC_ID_RA_288 ||
......
1641 1646
    MatroskaCluster cluster = { 0 };
1642 1647
    EbmlList *blocks_list;
1643 1648
    MatroskaBlock *blocks;
1644
    int i, res, key_frame = 0;
1649
    int i, res;
1645 1650
    offset_t pos = url_ftell(matroska->ctx->pb);
1646 1651
    if (matroska->has_cluster_id){
1647 1652
        /* For the first cluster we parse, its ID was already read as
......
1659 1664
            res=matroska_parse_block(matroska,
1660 1665
                                     blocks[i].bin.data, blocks[i].bin.size,
1661 1666
                                     blocks[i].bin.pos,  cluster.timecode,
1662
                                     blocks[i].duration, !blocks[i].reference);
1663
            key_frame |= res > 0;
1667
                                     blocks[i].duration, !blocks[i].reference,
1668
                                     pos);
1664 1669
        }
1665
    if (key_frame)
1666
        av_add_index_entry(matroska->vstream, pos,
1667
                           cluster.timecode, 0, 0, AVINDEX_KEYFRAME);
1668 1670
    ebml_free(matroska_cluster, &cluster);
1669 1671
    if (res < 0)  matroska->done = 1;
1670 1672
    return res;

Also available in: Unified diff