Revision e7ddafd5

View differences:

libavformat/matroskaenc.c
80 80
    int64_t         duration_offset;
81 81
    int64_t         duration;
82 82
    mkv_seekhead    *main_seekhead;
83
    mkv_seekhead    *cluster_seekhead;
84 83
    mkv_cues        *cues;
85 84
    mkv_track       *tracks;
86 85

  
......
725 724
    // isn't more than 10 elements if we only write one of each other
726 725
    // currently defined level 1 element
727 726
    mkv->main_seekhead    = mkv_start_seekhead(pb, mkv->segment_offset, 10);
728
    mkv->cluster_seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 0);
729
    if (mkv->main_seekhead == NULL || mkv->cluster_seekhead == NULL)
727
    if (!mkv->main_seekhead)
730 728
        return AVERROR(ENOMEM);
731 729

  
732 730
    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));
......
908 906
    }
909 907

  
910 908
    if (!mkv->cluster_pos) {
911
        ret = mkv_add_seekhead_entry(mkv->cluster_seekhead, MATROSKA_ID_CLUSTER, url_ftell(pb));
912
        if (ret < 0) return ret;
913

  
914 909
        mkv->cluster_pos = url_ftell(s->pb);
915 910
        mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
916 911
        put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
......
997 992
{
998 993
    MatroskaMuxContext *mkv = s->priv_data;
999 994
    ByteIOContext *pb = s->pb;
1000
    int64_t currentpos, second_seekhead, cuespos;
995
    int64_t currentpos, cuespos;
1001 996
    int ret;
1002 997

  
1003 998
    // check if we have an audio packet cached
......
1019 1014

  
1020 1015
    if (!url_is_streamed(pb)) {
1021 1016
        cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
1022
        second_seekhead = mkv_write_seekhead(pb, mkv->cluster_seekhead);
1023 1017

  
1024 1018
        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES    , cuespos);
1025 1019
        if (ret < 0) return ret;
1026
        if (second_seekhead >= 0) {
1027
            ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_SEEKHEAD, second_seekhead);
1028
            if (ret < 0) return ret;
1029
        }
1030 1020
        mkv_write_seekhead(pb, mkv->main_seekhead);
1031 1021

  
1032 1022
        // update the duration
tests/ref/acodec/pcm
22 22
1058444 ./tests/data/acodec/pcm_s16le.wav
23 23
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
24 24
stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
25
fca887459876a7fdc4b9580691acd835 *./tests/data/acodec/pcm_s16be.mkv
26
 1060693 ./tests/data/acodec/pcm_s16be.mkv
25
352a6bcf51d0f3ca4bf27c423a3d4d14 *./tests/data/acodec/pcm_s16be.mkv
26
 1060650 ./tests/data/acodec/pcm_s16be.mkv
27 27
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
28 28
stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
29
2817e2a028a9117d4809604fa0f81a80 *./tests/data/acodec/pcm_s16le.mkv
30
 1060693 ./tests/data/acodec/pcm_s16le.mkv
29
2c089d83b2699c02c9358415e00a9707 *./tests/data/acodec/pcm_s16le.mkv
30
 1060650 ./tests/data/acodec/pcm_s16le.mkv
31 31
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
32 32
stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
33 33
07ffe7ffb78f3648b6524debdde5aec1 *./tests/data/acodec/pcm_s24be.mov
tests/ref/lavf/mkv
1
5e906a7003f893cf6481f186c92dc16c *./tests/data/lavf/lavf.mkv
2
  320537 ./tests/data/lavf/lavf.mkv
1
a36c2d9378b9870880556ced1cb89ecf *./tests/data/lavf/lavf.mkv
2
  320478 ./tests/data/lavf/lavf.mkv
3 3
./tests/data/lavf/lavf.mkv CRC=0x2a83e6b0

Also available in: Unified diff