[vlc-commits] demux: adaptative: parse hls codecs

Francois Cartegnie git at videolan.org
Thu Aug 6 17:30:19 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Aug  2 16:42:06 2015 +0200| [40fce919a94e37401001f31c953bc5ad5cd58f79] | committer: Francois Cartegnie

demux: adaptative: parse hls codecs

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

 modules/demux/hls/playlist/Parser.cpp |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index fe6caf0..828bb0e 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -28,6 +28,7 @@
 #include "../adaptative/playlist/BaseAdaptationSet.h"
 #include "../adaptative/playlist/SegmentList.h"
 #include "../adaptative/tools/Retrieve.hpp"
+#include "../adaptative/tools/Helper.h"
 #include "M3U8.hpp"
 #include "Tags.hpp"
 
@@ -144,8 +145,22 @@ void Parser::parseRepresentation(BaseAdaptationSet *adaptSet, const AttributesTa
         if(bwAttr)
             rep->setBandwidth(bwAttr->decimal());
 
+        if(codecsAttr)
+        {
+            std::list<std::string> list = Helper::tokenize(codecsAttr->quotedString(), ',');
+            std::list<std::string>::const_iterator it;
+            for(it=list.begin(); it!=list.end(); ++it)
+            {
+                std::size_t pos = (*it).find_first_of('.', 0);
+                if(pos != std::string::npos)
+                    rep->addCodec((*it).substr(0, pos));
+                else
+                    rep->addCodec(*it);
+            }
+        }
+
         /* if more than 1 codec, don't probe, can't be packed audio */
-        if(codecsAttr && codecsAttr->quotedString().find(',') != std::string::npos)
+        if(rep->getCodecs().size() > 1)
             rep->setMimeType("video/mp2t");
 
         if(resAttr)



More information about the vlc-commits mailing list