Revision 7a2a4840

View differences:

libavformat/matroskaenc.c
288 288
 * be written at the location reserved for it. Otherwise, it is written
289 289
 * at the current location in the file.
290 290
 *
291
 * @return The file offset where the seekhead was written.
291
 * @return The file offset where the seekhead was written,
292
 * -1 if an error occurred.
292 293
 */
293 294
static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
294 295
{
......
299 300
    currentpos = url_ftell(pb);
300 301

  
301 302
    if (seekhead->reserved_size > 0)
302
        url_fseek(pb, seekhead->filepos, SEEK_SET);
303
        if (url_fseek(pb, seekhead->filepos, SEEK_SET) < 0)
304
            return -1;
303 305

  
304 306
    metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size);
305 307
    for (i = 0; i < seekhead->num_entries; i++) {
......
731 733
    put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, 0);
732 734
    mkv->cluster_pts = 0;
733 735

  
736
    if (url_is_streamed(s->pb))
737
        mkv_write_seekhead(pb, mkv->main_seekhead);
738

  
734 739
    mkv->cues = mkv_start_cues(mkv->segment_offset);
735 740
    if (mkv->cues == NULL)
736 741
        return AVERROR(ENOMEM);
......
896 901

  
897 902
        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES    , cuespos);
898 903
        if (ret < 0) return ret;
899
        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_SEEKHEAD, second_seekhead);
900
        if (ret < 0) return ret;
904
        if (second_seekhead >= 0) {
905
            ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_SEEKHEAD, second_seekhead);
906
            if (ret < 0) return ret;
907
        }
901 908
        mkv_write_seekhead(pb, mkv->main_seekhead);
902 909

  
903 910
        // update the duration

Also available in: Unified diff