[01/14] dashenc: Fix writing of timelines that don't start at t=0

Message ID 1419862828-30060-1-git-send-email-martin@martin.st
State Committed
Commit b91a5757fcbf723da99b05b298a6f820271dbc2b
Headers show

Commit Message

Martin Storsjö Dec. 29, 2014, 2:20 p.m.
When writing an explicit time, reset the cur_time variable to this
value as well. This avoids writing excessive time attributes for each
segment in the timeline, as long as the segments are continuous.
---
 libavformat/dashenc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Derek Buitenhuis Dec. 29, 2014, 4:55 p.m. | #1
On 12/29/2014 2:20 PM, Martin Storsjö wrote:
> When writing an explicit time, reset the cur_time variable to this
> value as well. This avoids writing excessive time attributes for each
> segment in the timeline, as long as the segments are continuous.
> ---
>  libavformat/dashenc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

OK.

- Derek

Patch

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index b4fd194..7dd08ec 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -214,8 +214,10 @@  static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext
                 Segment *seg = os->segments[i];
                 int repeat = 0;
                 avio_printf(out, "\t\t\t\t\t\t<S ");
-                if (i == start_index || seg->time != cur_time)
+                if (i == start_index || seg->time != cur_time) {
+                    cur_time = seg->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 &&