Commit 07fb2c88 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: parse language

parent 50390eee
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "playlist/AbstractPlaylist.hpp" #include "playlist/AbstractPlaylist.hpp"
#include "playlist/BasePeriod.h" #include "playlist/BasePeriod.h"
#include "playlist/BaseAdaptationSet.h" #include "playlist/BaseAdaptationSet.h"
#include "playlist/BaseRepresentation.h"
#include "http/HTTPConnectionManager.h" #include "http/HTTPConnectionManager.h"
#include "logic/AlwaysBestAdaptationLogic.h" #include "logic/AlwaysBestAdaptationLogic.h"
#include "logic/RateBasedAdaptationLogic.h" #include "logic/RateBasedAdaptationLogic.h"
...@@ -102,6 +103,20 @@ bool PlaylistManager::setupPeriod() ...@@ -102,6 +103,20 @@ bool PlaylistManager::setupPeriod()
delete logic; delete logic;
throw VLC_ENOMEM; throw VLC_ENOMEM;
} }
std::list<std::string> languages;
if(!set->getLang().empty())
{
languages = set->getLang();
}
else if(!set->getRepresentations().empty())
{
languages = set->getRepresentations().front()->getLang();
}
if(!languages.empty())
st->setLanguage(languages.front());
st->create(logic, tracker, streamOutputFactory); st->create(logic, tracker, streamOutputFactory);
streams.push_back(st); streams.push_back(st);
} catch (int) { } catch (int) {
......
...@@ -225,6 +225,16 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period) ...@@ -225,6 +225,16 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period)
if((*it)->hasAttribute("mimeType")) if((*it)->hasAttribute("mimeType"))
adaptationSet->setMimeType((*it)->getAttributeValue("mimeType")); adaptationSet->setMimeType((*it)->getAttributeValue("mimeType"));
if((*it)->hasAttribute("lang"))
{
std::string lang = (*it)->getAttributeValue("lang");
std::size_t pos = lang.find_first_of('-');
if(pos != std::string::npos && pos > 0)
adaptationSet->addLang(lang.substr(0, pos));
else if (lang.size() < 4)
adaptationSet->addLang(lang);
}
Node *baseUrl = DOMHelper::getFirstChildElementByName((*it), "BaseURL"); Node *baseUrl = DOMHelper::getFirstChildElementByName((*it), "BaseURL");
if(baseUrl) if(baseUrl)
adaptationSet->baseUrl.Set(new Url(baseUrl->getText())); adaptationSet->baseUrl.Set(new Url(baseUrl->getText()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment