vlc | branch: master | Francois Cartegnie <[email protected]> | Tue May 14 10:33:39 2019 +0200| [823c06d10e125a798ba2f7da84cee505c27af204] | committer: Francois Cartegnie
demux: adaptive: set lang as adaptset property only > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=823c06d10e125a798ba2f7da84cee505c27af204 --- modules/demux/adaptive/PlaylistManager.cpp | 12 +----------- modules/demux/adaptive/playlist/BaseAdaptationSet.cpp | 14 ++++++++++++++ modules/demux/adaptive/playlist/BaseAdaptationSet.h | 3 +++ .../demux/adaptive/playlist/CommonAttributesElements.cpp | 11 ----------- modules/demux/adaptive/playlist/CommonAttributesElements.h | 4 ---- modules/demux/dash/mpd/IsoffMainParser.cpp | 9 +-------- modules/demux/hls/playlist/Parser.cpp | 9 +-------- modules/demux/smooth/playlist/Parser.cpp | 4 ++-- 8 files changed, 22 insertions(+), 44 deletions(-) diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp index e1def52518..50629cfe48 100644 --- a/modules/demux/adaptive/PlaylistManager.cpp +++ b/modules/demux/adaptive/PlaylistManager.cpp @@ -132,18 +132,8 @@ bool PlaylistManager::setupPeriod() streams.push_back(st); /* Generate stream description */ - 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->setLanguage(set->getLang()); if(!set->description.Get().empty()) st->setDescription(set->description.Get()); diff --git a/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp b/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp index 89d87f6834..64e9cfbdab 100644 --- a/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp +++ b/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp @@ -89,6 +89,20 @@ void BaseAdaptationSet::addRepresentation(BaseRepresentation *rep) childs.push_back(rep); } +const std::string & BaseAdaptationSet::getLang() const +{ + return lang; +} + +void BaseAdaptationSet::setLang( const std::string &lang_ ) +{ + std::size_t pos = lang.find_first_of('-'); + if(pos != std::string::npos && pos > 0) + lang = lang_.substr(0, pos); + else if(lang_.size() < 4) + lang = lang_; +} + void BaseAdaptationSet::setSegmentAligned(bool b) { segmentAligned = b ? TRIBOOL_TRUE : TRIBOOL_FALSE; diff --git a/modules/demux/adaptive/playlist/BaseAdaptationSet.h b/modules/demux/adaptive/playlist/BaseAdaptationSet.h index c1688280f3..da795bac37 100644 --- a/modules/demux/adaptive/playlist/BaseAdaptationSet.h +++ b/modules/demux/adaptive/playlist/BaseAdaptationSet.h @@ -56,11 +56,14 @@ namespace adaptive void setBitswitchAble(bool); bool isBitSwitchable() const; void addRepresentation( BaseRepresentation *rep ); + const std::string& getLang() const; + void setLang( const std::string &lang ); void debug(vlc_object_t *,int = 0) const; Property<std::string> description; protected: std::vector<BaseRepresentation *> representations; + std::string lang; Tribool segmentAligned; Tribool bitswitchAble; }; diff --git a/modules/demux/adaptive/playlist/CommonAttributesElements.cpp b/modules/demux/adaptive/playlist/CommonAttributesElements.cpp index 4fbfa6e1c7..1448de8152 100644 --- a/modules/demux/adaptive/playlist/CommonAttributesElements.cpp +++ b/modules/demux/adaptive/playlist/CommonAttributesElements.cpp @@ -73,14 +73,3 @@ void CommonAttributesElements::setHeight( int height ) if ( height > 0 ) this->height = height; } - -const std::list<std::string>& CommonAttributesElements::getLang() const -{ - return lang; -} - -void CommonAttributesElements::addLang( const std::string &lang ) -{ - if ( lang.empty() == false ) - this->lang.push_back( lang ); -} diff --git a/modules/demux/adaptive/playlist/CommonAttributesElements.h b/modules/demux/adaptive/playlist/CommonAttributesElements.h index 8ff1576b75..3ba41d06c4 100644 --- a/modules/demux/adaptive/playlist/CommonAttributesElements.h +++ b/modules/demux/adaptive/playlist/CommonAttributesElements.h @@ -24,7 +24,6 @@ #ifndef COMMONATTRIBUTESELEMENTS_H #define COMMONATTRIBUTESELEMENTS_H -#include <list> #include <string> namespace adaptive @@ -42,14 +41,11 @@ namespace adaptive void setWidth( int width ); int getHeight() const; void setHeight( int height ); - const std::list<std::string>& getLang() const; - void addLang( const std::string &lang ); protected: std::string mimeType; int width; int height; - std::list<std::string> lang; }; } } diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp index 0ae75780eb..a8ba02ba25 100644 --- a/modules/demux/dash/mpd/IsoffMainParser.cpp +++ b/modules/demux/dash/mpd/IsoffMainParser.cpp @@ -231,14 +231,7 @@ void IsoffMainParser::parseAdaptationSets (Node *periodNode, Period *period) 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); - } + adaptationSet->setLang((*it)->getAttributeValue("lang")); if((*it)->hasAttribute("bitstreamSwitching")) adaptationSet->setBitswitchAble((*it)->getAttributeValue("bitstreamSwitching") == "true"); diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp index 9b8b94758b..ba782f28c9 100644 --- a/modules/demux/hls/playlist/Parser.cpp +++ b/modules/demux/hls/playlist/Parser.cpp @@ -537,14 +537,7 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std:: } 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); - } + altAdaptSet->setLang(pair.second->getAttributeByName("LANGUAGE")->quotedString()); if(!altAdaptSet->getRepresentations().empty()) period->addAdaptationSet(altAdaptSet); diff --git a/modules/demux/smooth/playlist/Parser.cpp b/modules/demux/smooth/playlist/Parser.cpp index 9575f3ba5f..b53513c862 100644 --- a/modules/demux/smooth/playlist/Parser.cpp +++ b/modules/demux/smooth/playlist/Parser.cpp @@ -177,7 +177,7 @@ static void ParseQualityLevel(BaseAdaptationSet *adaptSet, Node *qualNode, const initSegment->setTrackID(trackid); if(!adaptSet->getLang().empty()) - initSegment->setLanguage(adaptSet->getLang().front()); + initSegment->setLanguage(adaptSet->getLang()); if(rep->getWidth() > 0 && rep->getHeight() > 0) initSegment->setVideoSize(rep->getWidth(), rep->getHeight()); @@ -223,7 +223,7 @@ static void ParseStreamIndex(BasePeriod *period, Node *streamIndexNode, unsigned { adaptSet->setID(ID(id)); if(streamIndexNode->hasAttribute("Language")) - adaptSet->addLang(streamIndexNode->getAttributeValue("Language")); + adaptSet->setLang(streamIndexNode->getAttributeValue("Language")); if(streamIndexNode->hasAttribute("Name")) adaptSet->description.Set(streamIndexNode->getAttributeValue("Name")); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
