[FFmpeg-cvslog] Merge commit '95f1004bdfdf2d26c330c1d4b7c4ac9352d60b18'

Clément Bœsch git at videolan.org
Sat May 20 17:40:33 EEST 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sat May 20 16:37:04 2017 +0200| [77a20cff3628b7353164b8433a6b4d4140c901bf] | committer: Clément Bœsch

Merge commit '95f1004bdfdf2d26c330c1d4b7c4ac9352d60b18'

* commit '95f1004bdfdf2d26c330c1d4b7c4ac9352d60b18':
  dashenc: add mandatory id to AdaptationSet and Period in manifest

Merged-by: Clément Bœsch <u at pkh.me>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77a20cff3628b7353164b8433a6b4d4140c901bf
---

 libavformat/dashenc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index fe1d6c2409..a14a6239d8 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -443,7 +443,7 @@ static int write_manifest(AVFormatContext *s, int final)
     DASHContext *c = s->priv_data;
     AVIOContext *out;
     char temp_filename[1024];
-    int ret, i;
+    int ret, i, as_id = 0;
     const char *proto = avio_find_protocol_name(s->filename);
     int use_rename = proto && !strcmp(proto, "file");
     static unsigned int warned_non_file = 0;
@@ -504,15 +504,15 @@ static int write_manifest(AVFormatContext *s, int final)
         OutputStream *os = &c->streams[0];
         int start_index = FFMAX(os->nb_segments - c->window_size, 0);
         int64_t start_time = av_rescale_q(os->segments[start_index]->time, s->streams[0]->time_base, AV_TIME_BASE_Q);
-        avio_printf(out, "\t<Period start=\"");
+        avio_printf(out, "\t<Period id=\"0\" start=\"");
         write_time(out, start_time);
         avio_printf(out, "\">\n");
     } else {
-        avio_printf(out, "\t<Period start=\"PT0.0S\">\n");
+        avio_printf(out, "\t<Period id=\"0\" start=\"PT0.0S\">\n");
     }
 
     if (c->has_video) {
-        avio_printf(out, "\t\t<AdaptationSet contentType=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\"");
+        avio_printf(out, "\t\t<AdaptationSet id=\"%d\" contentType=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\"", as_id++);
         if (c->max_frame_rate.num && !c->ambiguous_frame_rate)
             avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den);
         avio_printf(out, ">\n");
@@ -535,7 +535,7 @@ static int write_manifest(AVFormatContext *s, int final)
         avio_printf(out, "\t\t</AdaptationSet>\n");
     }
     if (c->has_audio) {
-        avio_printf(out, "\t\t<AdaptationSet contentType=\"audio\" segmentAlignment=\"true\" bitstreamSwitching=\"true\">\n");
+        avio_printf(out, "\t\t<AdaptationSet id=\"%d\" contentType=\"audio\" segmentAlignment=\"true\" bitstreamSwitching=\"true\">\n", as_id++);
         for (i = 0; i < s->nb_streams; i++) {
             AVStream *st = s->streams[i];
             OutputStream *os = &c->streams[i];


======================================================================

diff --cc libavformat/dashenc.c
index fe1d6c2409,865f50a1cf..a14a6239d8
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@@ -443,16 -439,10 +443,16 @@@ static int write_manifest(AVFormatConte
      DASHContext *c = s->priv_data;
      AVIOContext *out;
      char temp_filename[1024];
-     int ret, i;
+     int ret, i, as_id = 0;
 +    const char *proto = avio_find_protocol_name(s->filename);
 +    int use_rename = proto && !strcmp(proto, "file");
 +    static unsigned int warned_non_file = 0;
      AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
  
 -    snprintf(temp_filename, sizeof(temp_filename), "%s.tmp", s->filename);
 +    if (!use_rename && !warned_non_file++)
 +        av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n");
 +
 +    snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename);
      ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL);
      if (ret < 0) {
          av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename);
@@@ -512,11 -502,7 +512,11 @@@
      }
  
      if (c->has_video) {
-         avio_printf(out, "\t\t<AdaptationSet contentType=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\"");
 -        avio_printf(out, "\t\t<AdaptationSet id=\"%d\" contentType=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\">\n", as_id++);
++        avio_printf(out, "\t\t<AdaptationSet id=\"%d\" contentType=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\"", as_id++);
 +        if (c->max_frame_rate.num && !c->ambiguous_frame_rate)
 +            avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den);
 +        avio_printf(out, ">\n");
 +
          for (i = 0; i < s->nb_streams; i++) {
              AVStream *st = s->streams[i];
              OutputStream *os = &c->streams[i];



More information about the ffmpeg-cvslog mailing list