diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-17 11:36:23 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-17 11:57:09 +0100 |
commit | b32cb08b7f43ee017034061eb50273c3596014d5 (patch) | |
tree | 0ccd7f63ef588b27160bebc906d180a5a49dc7db | |
parent | 3ba105029279bf43e6338849f360f1ce9a2973a0 (diff) | |
parent | 2f628d5943c12389c07d652d23d3916997f9f0f6 (diff) | |
download | ffmpeg-b32cb08b7f43ee017034061eb50273c3596014d5.tar.gz |
Merge commit '2f628d5943c12389c07d652d23d3916997f9f0f6'
* commit '2f628d5943c12389c07d652d23d3916997f9f0f6':
dashenc: Write segment timelines properly if the timeline has gaps
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/dashenc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index e8823119ed..ec3ceac9af 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -208,20 +208,24 @@ static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext avio_printf(out, "duration=\"%"PRId64"\" ", c->last_duration); avio_printf(out, "initialization=\"%s\" media=\"%s\" startNumber=\"%d\">\n", c->init_seg_name, c->media_seg_name, c->use_timeline ? start_number : 1); if (c->use_timeline) { + int64_t cur_time = 0; avio_printf(out, "\t\t\t\t\t<SegmentTimeline>\n"); for (i = start_index; i < os->nb_segments; ) { Segment *seg = os->segments[i]; int repeat = 0; avio_printf(out, "\t\t\t\t\t\t<S "); - if (i == start_index) + if (i == start_index || seg->time != cur_time) avio_printf(out, "t=\"%"PRId64"\" ", seg->time); avio_printf(out, "d=\"%d\" ", seg->duration); - while (i + repeat + 1 < os->nb_segments && os->segments[i + repeat + 1]->duration == seg->duration) + while (i + repeat + 1 < os->nb_segments && + os->segments[i + repeat + 1]->duration == seg->duration && + os->segments[i + repeat + 1]->time == os->segments[i + repeat]->time + os->segments[i + repeat]->duration) repeat++; if (repeat > 0) avio_printf(out, "r=\"%d\" ", repeat); avio_printf(out, "/>\n"); i += 1 + repeat; + cur_time += (1 + repeat) * seg->duration; } avio_printf(out, "\t\t\t\t\t</SegmentTimeline>\n"); } |