vlc | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Thu Nov 20 23:01:09 2014 +0100| [c1481178bd3dd312ac57c1a6d43c14640f559cbd] | committer: Francois Cartegnie
stream_filter: dash: get mimeType() from representations > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1481178bd3dd312ac57c1a6d43c14640f559cbd --- modules/stream_filter/dash/mpd/AdaptationSet.cpp | 8 ++++++++ modules/stream_filter/dash/mpd/AdaptationSet.h | 1 + modules/stream_filter/dash/mpd/CommonAttributesElements.h | 2 +- modules/stream_filter/dash/mpd/IsoffMainParser.cpp | 12 ++++++++++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/modules/stream_filter/dash/mpd/AdaptationSet.cpp b/modules/stream_filter/dash/mpd/AdaptationSet.cpp index d48fcc5..39123f1 100644 --- a/modules/stream_filter/dash/mpd/AdaptationSet.cpp +++ b/modules/stream_filter/dash/mpd/AdaptationSet.cpp @@ -48,6 +48,14 @@ AdaptationSet::~AdaptationSet () vlc_delete_all( this->representations ); } +const std::string& AdaptationSet::getMimeType() const +{ + if (mimeType.empty() && !representations.empty()) + return representations.front()->getMimeType(); + else + return mimeType; +} + bool AdaptationSet::getSubsegmentAlignmentFlag() const { return this->subsegmentAlignmentFlag; diff --git a/modules/stream_filter/dash/mpd/AdaptationSet.h b/modules/stream_filter/dash/mpd/AdaptationSet.h index 8b48a4b..5e52a8f 100644 --- a/modules/stream_filter/dash/mpd/AdaptationSet.h +++ b/modules/stream_filter/dash/mpd/AdaptationSet.h @@ -44,6 +44,7 @@ namespace dash AdaptationSet(); virtual ~AdaptationSet(); + virtual const std::string& getMimeType() const; /*reimpl*/ bool getSubsegmentAlignmentFlag() const; void setSubsegmentAlignmentFlag( bool alignment ); std::vector<Representation *>& getRepresentations (); diff --git a/modules/stream_filter/dash/mpd/CommonAttributesElements.h b/modules/stream_filter/dash/mpd/CommonAttributesElements.h index f39249d..eb42a27 100644 --- a/modules/stream_filter/dash/mpd/CommonAttributesElements.h +++ b/modules/stream_filter/dash/mpd/CommonAttributesElements.h @@ -38,7 +38,7 @@ namespace dash public: CommonAttributesElements(); virtual ~CommonAttributesElements(); - const std::string& getMimeType() const; + virtual const std::string& getMimeType() const; void setMimeType( const std::string &mimeType ); int getWidth() const; void setWidth( int width ); diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp index c82a795..14a6455 100644 --- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp +++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp @@ -72,11 +72,16 @@ void IsoffMainParser::setMPDAttributes () void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period) { std::vector<Node *> adaptationSets = DOMHelper::getElementByTagName(periodNode, "AdaptationSet", false); + std::vector<Node *>::const_iterator it; - for(size_t i = 0; i < adaptationSets.size(); i++) + for(it = adaptationSets.begin(); it != adaptationSets.end(); it++) { AdaptationSet *adaptationSet = new AdaptationSet(); - this->setRepresentations(adaptationSets.at(i), adaptationSet); + if(!adaptationSet) + continue; + if((*it)->hasAttribute("mimeType")) + adaptationSet->setMimeType((*it)->getAttributeValue("mimeType")); + setRepresentations((*it), adaptationSet); period->addAdaptationSet(adaptationSet); } } @@ -102,6 +107,9 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation if(repNode->hasAttribute("bandwidth")) this->currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str())); + if(repNode->hasAttribute("mimeType")) + currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType")); + this->setSegmentBase(repNode, this->currentRepresentation); this->setSegmentList(repNode, this->currentRepresentation); adaptationSet->addRepresentation(this->currentRepresentation); _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits