[vlc-commits] demux: hls: pass language to output

Francois Cartegnie git at videolan.org
Sat Jul 25 22:30:46 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jul 25 22:26:33 2015 +0200| [b45c28ecb69c7e80087b6d7a0e6e4b9e0bd5ecf2] | committer: Francois Cartegnie

demux: hls: pass language to output

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

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

diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index 8c2ac3b..8c16b86 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -358,6 +358,16 @@ M3U8 * Parser::parse(const std::string &playlisturl)
                 if(pair.second->getAttributeByName("NAME"))
                    altAdaptSet->description.Set(pair.second->getAttributeByName("NAME")->quotedString());
 
+                if(pair.second->getAttributeByName("LANGUAGE"))
+                {
+                    std::string lang = pair.second->getAttributeByName("LANGUAGE")->quotedString();
+                    std::size_t pos = lang.find_first_of('-');
+                    if(pos != std::string::npos && pos > 0)
+                        altAdaptSet->addLang(lang.substr(0, pos));
+                    else if (lang.size() < 4)
+                        altAdaptSet->addLang(lang);
+                }
+
                 if(!altAdaptSet->getRepresentations().empty())
                     period->addAdaptationSet(altAdaptSet);
                 else



More information about the vlc-commits mailing list