summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-04-15 18:02:44 -0300
committerJames Almer <jamrial@gmail.com>2020-04-20 13:49:15 -0300
commit0ea41ee32e7cf5d9bad7abf5b4f659bd1641efdb (patch)
tree4731561ff9415c6d7cd40f20bb040f713fab45b4
parentfd0f110a37cbfc4f57d656a9ae7b52175f85f041 (diff)
avformat/dashenc: add a maxSegmentDuration attribute to the Manifest
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/dashenc.c6
1 files changed, 6 insertions, 0 deletions
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);