[vlc-commits] demux: hls: handle xstart
Francois Cartegnie
git at videolan.org
Tue Mar 31 17:23:11 CEST 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 30 13:53:32 2020 +0200| [9d5715fd87a23296788a8b9d50ce7319ef399822] | committer: Francois Cartegnie
demux: hls: handle xstart
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d5715fd87a23296788a8b9d50ce7319ef399822
---
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 5dcb370c7f..404eed44d7 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -569,6 +569,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 fd6336c531..6dbf169ef2 100644
--- a/modules/demux/hls/playlist/Tags.cpp
+++ b/modules/demux/hls/playlist/Tags.cpp
@@ -318,6 +318,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},
@@ -355,6 +356,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