[vlc-commits] demux: hls: handle xstart

Francois Cartegnie git at videolan.org
Tue Mar 31 17:26:22 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 30 13:53:32 2020 +0200| [09c03f1c868f9a7fd657ac33bdc50f330ae84542] | committer: Francois Cartegnie

demux: hls: handle xstart

(cherry picked from commit 9d5715fd87a23296788a8b9d50ce7319ef399822)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=09c03f1c868f9a7fd657ac33bdc50f330ae84542
---

 modules/demux/hls/playlist/Parser.cpp | 13 +++++++++++++
 modules/demux/hls/playlist/Tags.cpp   |  2 ++
 modules/demux/hls/playlist/Tags.hpp   |  1 +
 3 files changed, 16 insertions(+)

diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index 374952cfc9..0d26405b1e 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -551,6 +551,19 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std::
 
     playlist->addPeriod(period);
 
+    auto xstart = std::find_if(tagslist.cbegin(), tagslist.cend(),
+                               [](auto t) {return t->getType() == AttributesTag::EXTXSTART;});
+    if(xstart != tagslist.end())
+    {
+        auto xstartTag = static_cast<const AttributesTag *>(*xstart);
+        if(xstartTag->getAttributeByName("TIME-OFFSET"))
+        {
+            float offset = xstartTag->getAttributeByName("TIME-OFFSET")->floatingPoint();
+            if(offset > 0)
+                playlist->suggestedPresentationDelay.Set(CLOCK_FREQ * offset);
+        }
+    }
+
     releaseTagsList(tagslist);
 
     playlist->debug();
diff --git a/modules/demux/hls/playlist/Tags.cpp b/modules/demux/hls/playlist/Tags.cpp
index f608e1177b..e8aa51650d 100644
--- a/modules/demux/hls/playlist/Tags.cpp
+++ b/modules/demux/hls/playlist/Tags.cpp
@@ -301,6 +301,7 @@ Tag * TagFactory::createTagByName(const std::string &name, const std::string &va
         {"EXT-X-PLAYLIST-TYPE",             SingleValueTag::EXTXPLAYLISTTYPE},
         {"EXT-X-I-FRAMES-ONLY",             Tag::EXTXIFRAMESONLY},
         {"EXT-X-MEDIA",                     AttributesTag::EXTXMEDIA},
+        {"EXT-X-START",                     AttributesTag::EXTXSTART},
         {"EXT-X-STREAM-INF",                AttributesTag::EXTXSTREAMINF},
         {"EXT-X-SESSION-KEY",               AttributesTag::EXTXSESSIONKEY},
         {"EXTINF",                          ValuesListTag::EXTINF},
@@ -338,6 +339,7 @@ Tag * TagFactory::createTagByName(const std::string &name, const std::string &va
         case AttributesTag::EXTXSESSIONKEY:
         case AttributesTag::EXTXMAP:
         case AttributesTag::EXTXMEDIA:
+        case AttributesTag::EXTXSTART:
         case AttributesTag::EXTXSTREAMINF:
             return new (std::nothrow) AttributesTag(exttagmapping[i].i, value);
         }
diff --git a/modules/demux/hls/playlist/Tags.hpp b/modules/demux/hls/playlist/Tags.hpp
index 9f2cd8af9e..7cdbcb20b6 100644
--- a/modules/demux/hls/playlist/Tags.hpp
+++ b/modules/demux/hls/playlist/Tags.hpp
@@ -96,6 +96,7 @@ namespace hls
                     EXTXKEY = 20,
                     EXTXMAP,
                     EXTXMEDIA,
+                    EXTXSTART,
                     EXTXSTREAMINF,
                     EXTXSESSIONKEY,
                 };



More information about the vlc-commits mailing list