Commit 1920382a authored by Peter Große's avatar Peter Große Committed by Martin Storsjö

dashenc: add option to provide UTC timing source

If set, adds a UTCTiming tag in the manifest.

This is part of the recommendations listed in the "Guidelines for
Implementations: DASH-IF Interoperability Points" [1][2]
Section 4.7 describes means for the Availability Time Synchronization.

A usable default is "https://time.akamai.com/?iso"

[1] http://dashif.org/guidelines/
[2] http://dashif.org/wp-content/uploads/2016/12/DASH-IF-IOP-v4.0-clean.pdf
    (current version as of writing)
Signed-off-by: 's avatarPeter Große <pegro@friiks.de>
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent ba6a49e6
...@@ -94,6 +94,7 @@ typedef struct DASHContext { ...@@ -94,6 +94,7 @@ typedef struct DASHContext {
const char *single_file_name; const char *single_file_name;
const char *init_seg_name; const char *init_seg_name;
const char *media_seg_name; const char *media_seg_name;
const char *utc_timing_url;
} DASHContext; } DASHContext;
static int dash_write(void *opaque, uint8_t *buf, int buf_size) static int dash_write(void *opaque, uint8_t *buf, int buf_size)
...@@ -490,6 +491,9 @@ static int write_manifest(AVFormatContext *s, int final) ...@@ -490,6 +491,9 @@ static int write_manifest(AVFormatContext *s, int final)
av_free(escaped); av_free(escaped);
} }
avio_printf(out, "\t</ProgramInformation>\n"); avio_printf(out, "\t</ProgramInformation>\n");
if (c->utc_timing_url)
avio_printf(out, "\t<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:http-xsdate:2014\" value=\"%s\"/>\n", c->utc_timing_url);
if (c->window_size && s->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) { if (c->window_size && s->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) {
OutputStream *os = &c->streams[0]; OutputStream *os = &c->streams[0];
int start_index = FFMAX(os->nb_segments - c->window_size, 0); int start_index = FFMAX(os->nb_segments - c->window_size, 0);
...@@ -981,6 +985,7 @@ static const AVOption options[] = { ...@@ -981,6 +985,7 @@ static const AVOption options[] = {
{ "single_file_name", "DASH-templated name to be used for baseURL. Implies storing all segments in one file, accessed using byte ranges", OFFSET(single_file_name), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, { "single_file_name", "DASH-templated name to be used for baseURL. Implies storing all segments in one file, accessed using byte ranges", OFFSET(single_file_name), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
{ "init_seg_name", "DASH-templated name to used for the initialization segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = "init-stream$RepresentationID$.m4s"}, 0, 0, E }, { "init_seg_name", "DASH-templated name to used for the initialization segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = "init-stream$RepresentationID$.m4s"}, 0, 0, E },
{ "media_seg_name", "DASH-templated name to used for the media segments", OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = "chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E }, { "media_seg_name", "DASH-templated name to used for the media segments", OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = "chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E },
{ "utc_timing_url", "URL of the page that will return the UTC timestamp in ISO format", OFFSET(utc_timing_url), AV_OPT_TYPE_STRING, { 0 }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }, { NULL },
}; };
......
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