[vlc-commits] dash: Avoid multiple lookups.
Hugo Beauzée-Luyssen
git at videolan.org
Thu Nov 24 18:00:54 CET 2011
vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Nov 24 11:52:44 2011 +0100| [df9757124d8e12c0fbf39803f3d3e8057262f353] | committer: Rémi Denis-Courmont
dash: Avoid multiple lookups.
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=df9757124d8e12c0fbf39803f3d3e8057262f353
---
modules/stream_filter/dash/mpd/MPD.cpp | 16 ++++++++++------
modules/stream_filter/dash/mpd/MPD.h | 4 +++-
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/modules/stream_filter/dash/mpd/MPD.cpp b/modules/stream_filter/dash/mpd/MPD.cpp
index 69b4c05..cb8c7e0 100644
--- a/modules/stream_filter/dash/mpd/MPD.cpp
+++ b/modules/stream_filter/dash/mpd/MPD.cpp
@@ -60,24 +60,28 @@ std::vector<BaseUrl*> MPD::getBaseUrls ()
}
std::string MPD::getMinBufferTime () throw(AttributeNotPresentException)
{
- if(this->attributes.find("minBufferTime") == this->attributes.end())
+ AttributesMap::iterator it = this->attributes.find("minBufferTime");
+ if( it == this->attributes.end())
throw AttributeNotPresentException();
- return this->attributes["minBufferTime"];
+ return it->second;
}
std::string MPD::getType () throw(AttributeNotPresentException)
{
- if(this->attributes.find("type") == this->attributes.end())
+ AttributesMap::iterator it = this->attributes.find( "type" );
+ if( it == this->attributes.end() )
throw AttributeNotPresentException();
- return this->attributes["type"];
+ return it->second;
}
std::string MPD::getDuration () throw(AttributeNotPresentException)
{
- if(this->attributes.find("mediaPresentationDuration") == this->attributes.end())
+ AttributesMap::iterator it = this->attributes.find("mediaPresentationDuration");
+
+ if( it == this->attributes.end())
throw AttributeNotPresentException();
- return this->attributes["mediaPresentationDuration"];
+ return it->second;
}
ProgramInformation* MPD::getProgramInformation () throw(ElementNotPresentException)
{
diff --git a/modules/stream_filter/dash/mpd/MPD.h b/modules/stream_filter/dash/mpd/MPD.h
index 732d38b..2942b18 100644
--- a/modules/stream_filter/dash/mpd/MPD.h
+++ b/modules/stream_filter/dash/mpd/MPD.h
@@ -41,6 +41,8 @@ namespace dash
{
class MPD
{
+ typedef std::map<std::string, std::string> AttributesMap;
+
public:
MPD (std::map<std::string, std::string> attributes);
MPD ();
@@ -58,7 +60,7 @@ namespace dash
void setProgramInformation (ProgramInformation *progInfo);
private:
- std::map<std::string, std::string> attributes;
+ AttributesMap attributes;
std::vector<Period *> periods;
std::vector<BaseUrl *> baseUrls;
ProgramInformation *programInfo;
More information about the vlc-commits
mailing list