[vlc-commits] dash: BasicCMParser: Handle Representation @dependencyId

2012-01-24 Thread Hugo Beauzée-Luyssen
vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen beauz...@gmail.com | Wed 
Dec 21 23:46:15 2011 +0100| [9db9d6b9c8575a4836a8142b93ce089d83bdb541] | 
committer: Jean-Baptiste Kempf

dash: BasicCMParser: Handle Representation @dependencyId

Signed-off-by: Jean-Baptiste Kempf j...@videolan.org
(cherry picked from commit 8f9fd197f4df09c00bd7a5d06f8cadafd09cba7d)

Signed-off-by: Jean-Baptiste Kempf j...@videolan.org

 http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=9db9d6b9c8575a4836a8142b93ce089d83bdb541
---

 modules/stream_filter/dash/mpd/BasicCMParser.cpp  |   23 +++-
 modules/stream_filter/dash/mpd/BasicCMParser.h|3 ++
 modules/stream_filter/dash/mpd/Representation.cpp |   20 ++
 modules/stream_filter/dash/mpd/Representation.h   |4 ++-
 4 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp 
b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index 33bdd5f..6c37dc8 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -99,7 +99,6 @@ voidBasicCMParser::setRepresentations   (Node *root, 
Group *group)
 {
 const std::mapstd::string, std::stringattributes = 
representations.at(i)-getAttributes();
 
-//FIXME: handle @dependencyId afterward
 Representation *rep = new Representation( attributes );
 if ( this-parseCommonAttributesElements( representations.at( i ), rep 
) == false )
 {
@@ -130,11 +129,31 @@ voidBasicCMParser::setRepresentations   (Node *root, 
Group *group)
 if ( it != attributes.end() )
 rep-setQualityRanking( atoi( it-second.c_str() ) );
 
+it = attributes.find( dependencyId );
+if ( it != attributes.end() )
+this-handleDependencyId( rep, group, it-second );
+
 this-setSegmentInfo(representations.at(i), rep);
 if ( rep-getSegmentInfo()  
rep-getSegmentInfo()-getSegments().size()  0 )
-group-addRepresentation(rep);
+group-addRepresentation(rep);
+}
+}
+
+voidBasicCMParser::handleDependencyId( Representation *rep, const Group 
*group, const std::string dependencyId )
+{
+if ( dependencyId.empty() == true )
+return ;
+std::istringstream  s( dependencyId );
+while ( s )
+{
+std::string id;
+s  id;
+const Representation*dep = group-getRepresentationById( id );
+if ( dep )
+rep-addDependency( dep );
 }
 }
+
 voidBasicCMParser::setSegmentInfo   (Node *root, Representation *rep)
 {
 Node*segmentInfo = DOMHelper::getFirstChildElementByName( root, 
SegmentInfo);
diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.h 
b/modules/stream_filter/dash/mpd/BasicCMParser.h
index e8ad31e..2c867dc 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.h
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.h
@@ -51,6 +51,9 @@ namespace dash
 MPD*getMPD ();
 
 private:
+voidhandleDependencyId( Representation* rep, const Group* 
group, const std::string dependencyId );
+
+private:
 dash::xml::Node *root;
 MPD *mpd;
 
diff --git a/modules/stream_filter/dash/mpd/Representation.cpp 
b/modules/stream_filter/dash/mpd/Representation.cpp
index b4774de..debd9f5 100644
--- a/modules/stream_filter/dash/mpd/Representation.cpp
+++ b/modules/stream_filter/dash/mpd/Representation.cpp
@@ -46,15 +46,6 @@ Representation::~Representation ()
 delete(this-trickModeType);
 }
 
-std::string Representation::getDependencyId () const 
throw(AttributeNotPresentException)
-{
-std::mapstd::string, std::string::const_iterator  it = 
this-attributes.find(dependencyId);
-if ( it == this-attributes.end() )
-throw AttributeNotPresentException();
-
-return it-second;
-}
-
 const std::string  Representation::getId   () const
 {
 return this-id;
@@ -116,3 +107,14 @@ void Representation::setQualityRanking( int qualityRanking 
)
 if ( qualityRanking  0 )
 this-qualityRanking = qualityRanking;
 }
+
+const std::listconst Representation* Representation::getDependencies() 
const
+{
+return this-dependencies;
+}
+
+void Representation::addDependency(const Representation *dep)
+{
+if ( dep != NULL )
+this-dependencies.push_back( dep );
+}
diff --git a/modules/stream_filter/dash/mpd/Representation.h 
b/modules/stream_filter/dash/mpd/Representation.h
index 992f693..162384e 100644
--- a/modules/stream_filter/dash/mpd/Representation.h
+++ b/modules/stream_filter/dash/mpd/Representation.h
@@ -55,7 +55,8 @@ namespace dash
 voidsetBandwidth( int bandwidth );
 int getQualityRanking   () const;
 voidsetQualityRanking   ( 

[vlc-commits] dash: BasicCMParser: Handle Representation @dependencyId

2011-12-30 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen beauz...@gmail.com | Wed Dec 21 
23:46:15 2011 +0100| [8f9fd197f4df09c00bd7a5d06f8cadafd09cba7d] | committer: 
Jean-Baptiste Kempf

dash: BasicCMParser: Handle Representation @dependencyId

Signed-off-by: Jean-Baptiste Kempf j...@videolan.org

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

 modules/stream_filter/dash/mpd/BasicCMParser.cpp  |   23 +++-
 modules/stream_filter/dash/mpd/BasicCMParser.h|3 ++
 modules/stream_filter/dash/mpd/Representation.cpp |   20 ++
 modules/stream_filter/dash/mpd/Representation.h   |4 ++-
 4 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp 
b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index 33bdd5f..6c37dc8 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -99,7 +99,6 @@ voidBasicCMParser::setRepresentations   (Node *root, 
Group *group)
 {
 const std::mapstd::string, std::stringattributes = 
representations.at(i)-getAttributes();
 
-//FIXME: handle @dependencyId afterward
 Representation *rep = new Representation( attributes );
 if ( this-parseCommonAttributesElements( representations.at( i ), rep 
) == false )
 {
@@ -130,11 +129,31 @@ voidBasicCMParser::setRepresentations   (Node *root, 
Group *group)
 if ( it != attributes.end() )
 rep-setQualityRanking( atoi( it-second.c_str() ) );
 
+it = attributes.find( dependencyId );
+if ( it != attributes.end() )
+this-handleDependencyId( rep, group, it-second );
+
 this-setSegmentInfo(representations.at(i), rep);
 if ( rep-getSegmentInfo()  
rep-getSegmentInfo()-getSegments().size()  0 )
-group-addRepresentation(rep);
+group-addRepresentation(rep);
+}
+}
+
+voidBasicCMParser::handleDependencyId( Representation *rep, const Group 
*group, const std::string dependencyId )
+{
+if ( dependencyId.empty() == true )
+return ;
+std::istringstream  s( dependencyId );
+while ( s )
+{
+std::string id;
+s  id;
+const Representation*dep = group-getRepresentationById( id );
+if ( dep )
+rep-addDependency( dep );
 }
 }
+
 voidBasicCMParser::setSegmentInfo   (Node *root, Representation *rep)
 {
 Node*segmentInfo = DOMHelper::getFirstChildElementByName( root, 
SegmentInfo);
diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.h 
b/modules/stream_filter/dash/mpd/BasicCMParser.h
index e8ad31e..2c867dc 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.h
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.h
@@ -51,6 +51,9 @@ namespace dash
 MPD*getMPD ();
 
 private:
+voidhandleDependencyId( Representation* rep, const Group* 
group, const std::string dependencyId );
+
+private:
 dash::xml::Node *root;
 MPD *mpd;
 
diff --git a/modules/stream_filter/dash/mpd/Representation.cpp 
b/modules/stream_filter/dash/mpd/Representation.cpp
index b4774de..debd9f5 100644
--- a/modules/stream_filter/dash/mpd/Representation.cpp
+++ b/modules/stream_filter/dash/mpd/Representation.cpp
@@ -46,15 +46,6 @@ Representation::~Representation ()
 delete(this-trickModeType);
 }
 
-std::string Representation::getDependencyId () const 
throw(AttributeNotPresentException)
-{
-std::mapstd::string, std::string::const_iterator  it = 
this-attributes.find(dependencyId);
-if ( it == this-attributes.end() )
-throw AttributeNotPresentException();
-
-return it-second;
-}
-
 const std::string  Representation::getId   () const
 {
 return this-id;
@@ -116,3 +107,14 @@ void Representation::setQualityRanking( int qualityRanking 
)
 if ( qualityRanking  0 )
 this-qualityRanking = qualityRanking;
 }
+
+const std::listconst Representation* Representation::getDependencies() 
const
+{
+return this-dependencies;
+}
+
+void Representation::addDependency(const Representation *dep)
+{
+if ( dep != NULL )
+this-dependencies.push_back( dep );
+}
diff --git a/modules/stream_filter/dash/mpd/Representation.h 
b/modules/stream_filter/dash/mpd/Representation.h
index 992f693..162384e 100644
--- a/modules/stream_filter/dash/mpd/Representation.h
+++ b/modules/stream_filter/dash/mpd/Representation.h
@@ -55,7 +55,8 @@ namespace dash
 voidsetBandwidth( int bandwidth );
 int getQualityRanking   () const;
 voidsetQualityRanking   ( int 
qualityRanking );
-std::string getDependencyId () const