[vlc-commits] dash: CommonAttributesElements: When applicable, convert attributes to integers
Hugo Beauzée-Luyssen
git at videolan.org
Tue Jan 24 23:21:50 CET 2012
vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Dec 1 15:57:59 2011 +0100| [8aa98f8c743227b0d5f1fb113324a3d667734762] | committer: Jean-Baptiste Kempf
dash: CommonAttributesElements: When applicable, convert attributes to integers
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit d314c4f4cac6d055e23a387f6aa2b741aec237da)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=8aa98f8c743227b0d5f1fb113324a3d667734762
---
.../dash/mpd/CommonAttributesElements.cpp | 35 ++++++++++---------
.../dash/mpd/CommonAttributesElements.h | 10 +++---
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/modules/stream_filter/dash/mpd/CommonAttributesElements.cpp b/modules/stream_filter/dash/mpd/CommonAttributesElements.cpp
index 37aa2a3..7c56376 100644
--- a/modules/stream_filter/dash/mpd/CommonAttributesElements.cpp
+++ b/modules/stream_filter/dash/mpd/CommonAttributesElements.cpp
@@ -23,6 +23,8 @@
#include "CommonAttributesElements.h"
+#include <cstdlib>
+
using namespace dash::mpd;
using namespace dash::exception;
@@ -37,43 +39,43 @@ CommonAttributesElements::~CommonAttributesElements()
delete this->contentProtection;
}
-std::string CommonAttributesElements::getWidth () const throw(AttributeNotPresentException)
+int CommonAttributesElements::getWidth () const
{
std::map<std::string, std::string>::const_iterator it = this->attributes.find("width");
if ( it == this->attributes.end())
- throw AttributeNotPresentException();
+ return -1;
- return it->second;
+ return atoi( it->second.c_str() );
}
-std::string CommonAttributesElements::getHeight () const throw(AttributeNotPresentException)
+int CommonAttributesElements::getHeight () const
{
std::map<std::string, std::string>::const_iterator it = this->attributes.find("height");
if ( it == this->attributes.end() )
- throw AttributeNotPresentException();
+ return -1;
- return it->second;
+ return atoi( it->second.c_str() );
}
-std::string CommonAttributesElements::getParX () const throw(AttributeNotPresentException)
+int CommonAttributesElements::getParX () const
{
std::map<std::string, std::string>::const_iterator it = this->attributes.find("parx");
- if ( it == this->attributes.end())
- throw AttributeNotPresentException();
+ if ( it == this->attributes.end() )
+ return 1; //Default value is defined in standard's §5.4.3.2.2
- return it->second;
+ return atoi( it->second.c_str() );
}
-std::string CommonAttributesElements::getParY () const throw(AttributeNotPresentException)
+int CommonAttributesElements::getParY () const
{
std::map<std::string, std::string>::const_iterator it = this->attributes.find("pary");
if ( it == this->attributes.end() )
- throw AttributeNotPresentException();
+ return 1; //Default value is defined in standard's §5.4.3.2.2
- return it->second;
+ return atoi( it->second.c_str() );
}
@@ -84,16 +86,15 @@ std::string CommonAttributesElements::getLang () const t
throw AttributeNotPresentException();
return it->second;
-
}
-std::string CommonAttributesElements::getFrameRate () const throw(AttributeNotPresentException)
+int CommonAttributesElements::getFrameRate () const
{
std::map<std::string, std::string>::const_iterator it = this->attributes.find("frameRate");
if ( it == this->attributes.end())
- throw AttributeNotPresentException();
+ return -1;
- return it->second;
+ return atoi( it->second.c_str() );
}
diff --git a/modules/stream_filter/dash/mpd/CommonAttributesElements.h b/modules/stream_filter/dash/mpd/CommonAttributesElements.h
index 9248e20..7f69adc 100644
--- a/modules/stream_filter/dash/mpd/CommonAttributesElements.h
+++ b/modules/stream_filter/dash/mpd/CommonAttributesElements.h
@@ -41,12 +41,12 @@ namespace dash
public:
CommonAttributesElements( const std::map<std::string, std::string>& attributes );
virtual ~CommonAttributesElements();
- std::string getWidth () const throw(dash::exception::AttributeNotPresentException);
- std::string getHeight () const throw(dash::exception::AttributeNotPresentException);
- std::string getParX () const throw(dash::exception::AttributeNotPresentException);
- std::string getParY () const throw(dash::exception::AttributeNotPresentException);
+ int getWidth () const;
+ int getHeight () const;
+ int getParX () const;
+ int getParY () const;
std::string getLang () const throw(dash::exception::AttributeNotPresentException);
- std::string getFrameRate () const throw(dash::exception::AttributeNotPresentException);
+ int getFrameRate () const;
std::string getNumberOfChannels () const throw(dash::exception::AttributeNotPresentException);
std::string getSamplingRate () const throw(dash::exception::AttributeNotPresentException);
ContentProtection* getContentProtection () const throw(dash::exception::ElementNotPresentException);
More information about the vlc-commits
mailing list