Commit e7ddafd5 authored by David Conrad's avatar David Conrad
Browse files

matroskaenc: Don't write a second seekhead for the clusters; mkvalidate agrees

with me that it's unnecessary.

Originally committed as revision 23478 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent d06735a3
......@@ -80,7 +80,6 @@ typedef struct MatroskaMuxContext {
int64_t duration_offset;
int64_t duration;
mkv_seekhead *main_seekhead;
mkv_seekhead *cluster_seekhead;
mkv_cues *cues;
mkv_track *tracks;
......@@ -725,8 +724,7 @@ static int mkv_write_header(AVFormatContext *s)
// isn't more than 10 elements if we only write one of each other
// currently defined level 1 element
mkv->main_seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 10);
mkv->cluster_seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 0);
if (mkv->main_seekhead == NULL || mkv->cluster_seekhead == NULL)
if (!mkv->main_seekhead)
return AVERROR(ENOMEM);
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));
......@@ -908,9 +906,6 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
}
if (!mkv->cluster_pos) {
ret = mkv_add_seekhead_entry(mkv->cluster_seekhead, MATROSKA_ID_CLUSTER, url_ftell(pb));
if (ret < 0) return ret;
mkv->cluster_pos = url_ftell(s->pb);
mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
......@@ -997,7 +992,7 @@ static int mkv_write_trailer(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb;
int64_t currentpos, second_seekhead, cuespos;
int64_t currentpos, cuespos;
int ret;
// check if we have an audio packet cached
......@@ -1019,14 +1014,9 @@ static int mkv_write_trailer(AVFormatContext *s)
if (!url_is_streamed(pb)) {
cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
second_seekhead = mkv_write_seekhead(pb, mkv->cluster_seekhead);
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES , cuespos);
if (ret < 0) return ret;
if (second_seekhead >= 0) {
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_SEEKHEAD, second_seekhead);
if (ret < 0) return ret;
}
mkv_write_seekhead(pb, mkv->main_seekhead);
// update the duration
......
......@@ -22,12 +22,12 @@ stddev: 0.00 PSNR:999.99 bytes: 1058444/ 1058444
1058444 ./tests/data/acodec/pcm_s16le.wav
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
stddev: 0.00 PSNR:999.99 bytes: 1058444/ 1058444
fca887459876a7fdc4b9580691acd835 *./tests/data/acodec/pcm_s16be.mkv
1060693 ./tests/data/acodec/pcm_s16be.mkv
352a6bcf51d0f3ca4bf27c423a3d4d14 *./tests/data/acodec/pcm_s16be.mkv
1060650 ./tests/data/acodec/pcm_s16be.mkv
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
stddev: 0.00 PSNR:999.99 bytes: 1058444/ 1058444
2817e2a028a9117d4809604fa0f81a80 *./tests/data/acodec/pcm_s16le.mkv
1060693 ./tests/data/acodec/pcm_s16le.mkv
2c089d83b2699c02c9358415e00a9707 *./tests/data/acodec/pcm_s16le.mkv
1060650 ./tests/data/acodec/pcm_s16le.mkv
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
stddev: 0.00 PSNR:999.99 bytes: 1058444/ 1058444
07ffe7ffb78f3648b6524debdde5aec1 *./tests/data/acodec/pcm_s24be.mov
......
5e906a7003f893cf6481f186c92dc16c *./tests/data/lavf/lavf.mkv
320537 ./tests/data/lavf/lavf.mkv
a36c2d9378b9870880556ced1cb89ecf *./tests/data/lavf/lavf.mkv
320478 ./tests/data/lavf/lavf.mkv
./tests/data/lavf/lavf.mkv CRC=0x2a83e6b0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment