[FFmpeg-cvslog] avformat/dashenc: add a maxSegmentDuration attribute to the Manifest

James Almer git at videolan.org
Mon Apr 20 19:50:58 EEST 2020


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Apr 15 18:02:44 2020 -0300| [0ea41ee32e7cf5d9bad7abf5b4f659bd1641efdb] | committer: James Almer

avformat/dashenc: add a maxSegmentDuration attribute to the Manifest

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ea41ee32e7cf5d9bad7abf5b4f659bd1641efdb
---

 libavformat/dashenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 5a8cff4034..ef1bedd18d 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -190,6 +190,7 @@ typedef struct DASHContext {
     int frag_type;
     int write_prft;
     int64_t max_gop_size;
+    int64_t max_segment_duration;
     int profile;
     int64_t target_latency;
     int target_latency_refid;
@@ -1189,6 +1190,9 @@ static int write_manifest(AVFormatContext *s, int final)
             avio_printf(out, "\"\n");
         }
     }
+    avio_printf(out, "\tmaxSegmentDuration=\"");
+    write_time(out, c->max_segment_duration);
+    avio_printf(out, "\"\n");
     avio_printf(out, "\tminBufferTime=\"");
     write_time(out, c->ldash && c->max_gop_size ? c->max_gop_size : c->last_duration * 2);
     avio_printf(out, "\">\n");
@@ -1564,6 +1568,8 @@ static int dash_init(AVFormatContext *s)
         os->frag_duration = as->frag_duration;
         os->frag_type = as->frag_type;
 
+        c->max_segment_duration = FFMAX(c->max_segment_duration, as->seg_duration);
+
         if (c->profile & MPD_PROFILE_DVB && (os->seg_duration > 15000000 || os->seg_duration < 960000)) {
             av_log(s, AV_LOG_ERROR, "Segment duration %"PRId64" is outside the allowed range for DVB-DASH profile\n", os->seg_duration);
             return AVERROR(EINVAL);



More information about the ffmpeg-cvslog mailing list