[vlc-commits] demux: hls: load session key

Francois Cartegnie git at videolan.org
Fri May 10 11:13:27 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Apr 19 11:34:48 2019 +0200| [e8dab66b213034ccb28414b3bba7b3f2b4145f42] | committer: Francois Cartegnie

demux: hls: load session key

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

 modules/demux/hls/playlist/Parser.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index 941f8f30ba..18e372b1d4 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -68,6 +68,17 @@ static std::list<Tag *> getTagsFromList(std::list<Tag *> &list, int tag)
     return ret;
 }
 
+static Tag * getTagFromList(std::list<Tag *> &list, int tag)
+{
+    std::list<Tag *>::const_iterator it;
+    for(it = list.begin(); it != list.end(); ++it)
+    {
+        if( (*it)->getType() == tag )
+            return *it;
+    }
+    return NULL;
+}
+
 static void releaseTagsList(std::list<Tag *> &list)
 {
     std::list<Tag *>::const_iterator it;
@@ -421,6 +432,14 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std::
         std::list<Tag *>::const_iterator it;
         std::map<std::string, AttributesTag *> groupsmap;
 
+        Tag *sessionKey = getTagFromList(tagslist, AttributesTag::EXTXSESSIONKEY);
+        if(sessionKey)
+        {
+            CommonEncryption sessionEncryption;
+            parseEncryption(static_cast<const AttributesTag *>(sessionKey),
+                            playlist->getUrlSegment(), sessionEncryption);
+        }
+
         /* We'll need to create an adaptation set for each media group / alternative rendering
          * we create a list of playlist being and alternative/group */
         std::list<Tag *> mediainfotags = getTagsFromList(tagslist, AttributesTag::EXTXMEDIA);



More information about the vlc-commits mailing list