[FFmpeg-devel,5/8] libavformat/dashenc: add option to provide UTC timing source

Submitted by Peter Große on Jan. 21, 2017, 2:39 p.m.

Details

Message ID 20170121143909.29028-6-pegro@friiks.de
State New
Headers show

Commit Message

Peter Große Jan. 21, 2017, 2:39 p.m.
If set, adds a UTCTime tag in the manifest.
See http://vm2.dashif.org/dash.js/docs/jsdocs/MediaPlayer.html#addUTCTimingSource for more information.
Usable default: "https://time.akamai.com/?iso"

Signed-off-by: Peter Große <pegro@friiks.de>
---
 libavformat/dashenc.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 054d0c0..fd1a304 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -95,6 +95,7 @@  typedef struct DASHContext {
     const char *single_file_name;
     const char *init_seg_name;
     const char *media_seg_name;
+    const char *utc_timing_url;
     AVRational min_frame_rate, max_frame_rate;
     int ambiguous_frame_rate;
 } DASHContext;
@@ -508,6 +509,8 @@  static int write_manifest(AVFormatContext *s, int final)
         av_free(escaped);
     }
     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) {
         OutputStream *os = &c->streams[0];
         int start_index = FFMAX(os->nb_segments - c->window_size, 0);
@@ -1048,6 +1051,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 },
     { "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 },
+    { "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 },
 };