mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-06-01 06:09:32 +02:00
Add availabilityEndTime to DASH manifest
This commit is contained in:
parent
c3237ae747
commit
8b97be9593
|
@ -236,6 +236,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
||||||
static u_char buffer[NGX_RTMP_DASH_BUFSIZE];
|
static u_char buffer[NGX_RTMP_DASH_BUFSIZE];
|
||||||
static u_char avaliable_time[NGX_RTMP_DASH_GMT_LENGTH];
|
static u_char avaliable_time[NGX_RTMP_DASH_GMT_LENGTH];
|
||||||
static u_char publish_time[NGX_RTMP_DASH_GMT_LENGTH];
|
static u_char publish_time[NGX_RTMP_DASH_GMT_LENGTH];
|
||||||
|
static u_char end_time[NGX_RTMP_DASH_GMT_LENGTH];
|
||||||
static u_char buffer_depth[sizeof("P00Y00M00DT00H00M00.00S")];
|
static u_char buffer_depth[sizeof("P00Y00M00DT00H00M00.00S")];
|
||||||
static u_char frame_rate[(NGX_INT_T_LEN * 2) + 2];
|
static u_char frame_rate[(NGX_INT_T_LEN * 2) + 2];
|
||||||
|
|
||||||
|
@ -267,7 +268,8 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
||||||
" type=\"dynamic\"\n" \
|
" type=\"dynamic\"\n" \
|
||||||
" xmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n" \
|
" xmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n" \
|
||||||
" availabilityStartTime=\"%s\"\n" \
|
" availabilityStartTime=\"%s\"\n" \
|
||||||
" publishTime=\"%s\"\n" \
|
" availabilityEndTime=\"%s\"\n" \
|
||||||
|
" publishTime=\"%s\"\n" \
|
||||||
" minimumUpdatePeriod=\"PT%uiS\"\n" \
|
" minimumUpdatePeriod=\"PT%uiS\"\n" \
|
||||||
" minBufferTime=\"PT%uiS\"\n" \
|
" minBufferTime=\"PT%uiS\"\n" \
|
||||||
" timeShiftBufferDepth=\"%s\"\n" \
|
" timeShiftBufferDepth=\"%s\"\n" \
|
||||||
|
@ -360,16 +362,24 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
||||||
ctx->start_time.gmtoff < 0 ? '-' : '+',
|
ctx->start_time.gmtoff < 0 ? '-' : '+',
|
||||||
ngx_abs(ctx->start_time.gmtoff / 60),
|
ngx_abs(ctx->start_time.gmtoff / 60),
|
||||||
ngx_abs(ctx->start_time.gmtoff % 60)) = 0;
|
ngx_abs(ctx->start_time.gmtoff % 60)) = 0;
|
||||||
|
|
||||||
if (publish_time[0] == '\0'){
|
if (publish_time[0] == '\0'){
|
||||||
*ngx_sprintf(publish_time, "%s", avaliable_time) = 0;
|
*ngx_sprintf(publish_time, "%s", avaliable_time) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_libc_localtime(ctx->start_time.sec +
|
ngx_libc_localtime(ctx->start_time.sec +
|
||||||
(ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->timestamp +
|
(ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->timestamp +
|
||||||
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration) /
|
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration) /
|
||||||
1000, &tm);
|
1000, &tm);
|
||||||
|
|
||||||
|
*ngx_sprintf(end_time, "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
|
||||||
|
tm.tm_year + 1900, tm.tm_mon + 1,
|
||||||
|
tm.tm_mday, tm.tm_hour,
|
||||||
|
tm.tm_min, tm.tm_sec,
|
||||||
|
ctx->start_time.gmtoff < 0 ? '-' : '+',
|
||||||
|
ngx_abs(ctx->start_time.gmtoff / 60),
|
||||||
|
ngx_abs(ctx->start_time.gmtoff % 60)) = 0;
|
||||||
|
|
||||||
depth_msec = (ngx_uint_t) (
|
depth_msec = (ngx_uint_t) (
|
||||||
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->timestamp +
|
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->timestamp +
|
||||||
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration -
|
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration -
|
||||||
|
@ -387,6 +397,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
||||||
|
|
||||||
p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_HEADER,
|
p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_HEADER,
|
||||||
avaliable_time,
|
avaliable_time,
|
||||||
|
end_time,
|
||||||
publish_time,
|
publish_time,
|
||||||
(ngx_uint_t) (dacf->fraglen / 1000),
|
(ngx_uint_t) (dacf->fraglen / 1000),
|
||||||
(ngx_uint_t) (dacf->fraglen / 1000),
|
(ngx_uint_t) (dacf->fraglen / 1000),
|
||||||
|
|
Loading…
Reference in a new issue