Commit 0ea41ee3 authored by James Almer's avatar James Almer

avformat/dashenc: add a maxSegmentDuration attribute to the Manifest

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent fd0f110a
...@@ -190,6 +190,7 @@ typedef struct DASHContext { ...@@ -190,6 +190,7 @@ typedef struct DASHContext {
int frag_type; int frag_type;
int write_prft; int write_prft;
int64_t max_gop_size; int64_t max_gop_size;
int64_t max_segment_duration;
int profile; int profile;
int64_t target_latency; int64_t target_latency;
int target_latency_refid; int target_latency_refid;
...@@ -1189,6 +1190,9 @@ static int write_manifest(AVFormatContext *s, int final) ...@@ -1189,6 +1190,9 @@ static int write_manifest(AVFormatContext *s, int final)
avio_printf(out, "\"\n"); avio_printf(out, "\"\n");
} }
} }
avio_printf(out, "\tmaxSegmentDuration=\"");
write_time(out, c->max_segment_duration);
avio_printf(out, "\"\n");
avio_printf(out, "\tminBufferTime=\""); avio_printf(out, "\tminBufferTime=\"");
write_time(out, c->ldash && c->max_gop_size ? c->max_gop_size : c->last_duration * 2); write_time(out, c->ldash && c->max_gop_size ? c->max_gop_size : c->last_duration * 2);
avio_printf(out, "\">\n"); avio_printf(out, "\">\n");
...@@ -1564,6 +1568,8 @@ static int dash_init(AVFormatContext *s) ...@@ -1564,6 +1568,8 @@ static int dash_init(AVFormatContext *s)
os->frag_duration = as->frag_duration; os->frag_duration = as->frag_duration;
os->frag_type = as->frag_type; 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)) { 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); 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); return AVERROR(EINVAL);
......
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