diff --git a/livesupport/modules/core/etc/fadeInfo.xml b/livesupport/modules/core/etc/fadeInfo.xml index 595fa5a03..a10bad613 100644 --- a/livesupport/modules/core/etc/fadeInfo.xml +++ b/livesupport/modules/core/etc/fadeInfo.xml @@ -7,4 +7,4 @@ ]> + fadeOut="00:00:01.0005"/> diff --git a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h index 3dc9b2aea..086f39c87 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h +++ b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.28 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.29 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $ ------------------------------------------------------------------------------*/ @@ -130,8 +130,8 @@ using namespace boost::posix_time; * <!ATTLIST audioClip uri CDATA #IMPLIED > * * - * @author $Author: maroy $ - * @version $Revision: 1.28 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.29 $ */ class AudioClip : public Configurable, public Playable @@ -207,7 +207,7 @@ class AudioClip : public Configurable, * a valid ISO-8601 time */ void - setPlaylength(const std::string & timeString) + setPlaylength(Ptr::Ref timeString) throw (std::invalid_argument); diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index 2ae3fa4bf..c1863d712 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.40 $ + Version : $Revision: 1.41 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -128,7 +128,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.40 $ + * @version $Revision: 1.41 $ */ class Playlist : public Configurable, public Playable @@ -218,7 +218,7 @@ class Playlist : public Configurable, * a valid ISO-8601 time */ void - setPlaylength(const std::string & timeString) + setPlaylength(Ptr::Ref timeString) throw (std::invalid_argument); /** diff --git a/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h b/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h index 0d7d0996f..93fef7069 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h +++ b/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h,v $ ------------------------------------------------------------------------------*/ @@ -71,7 +71,7 @@ using namespace LiveSupport; * A helper object holding static time conversion functions. * * @author $Author: fgerlits $ - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ class TimeConversion { @@ -221,7 +221,7 @@ class TimeConversion * @return the duration as a time_duration */ static Ptr::Ref - parseTimeDuration(Ptr::Ref durationString) + parseTimeDuration(Ptr::Ref durationString) throw (); /** diff --git a/livesupport/modules/core/src/AudioClip.cxx b/livesupport/modules/core/src/AudioClip.cxx index 65612e206..91c685dcb 100644 --- a/livesupport/modules/core/src/AudioClip.cxx +++ b/livesupport/modules/core/src/AudioClip.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.30 $ + Version : $Revision: 1.31 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $ ------------------------------------------------------------------------------*/ @@ -40,6 +40,7 @@ #include // for TagLib #include // for TagLib +#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Core/AudioClip.h" using namespace boost::posix_time; @@ -285,22 +286,15 @@ AudioClip :: setTitle(Ptr::Ref title) * Set the value of the playlength from a string (private). *----------------------------------------------------------------------------*/ void -AudioClip :: setPlaylength(const std::string & timeString) +AudioClip :: setPlaylength(Ptr::Ref timeString) throw (std::invalid_argument) { try { - playlength.reset(new time_duration(duration_from_string(timeString))); - } catch (boost::bad_lexical_cast &e) { - std::string eMsg = "bad time format in playlength: "; - eMsg += e.what(); - throw std::invalid_argument(eMsg); + playlength = TimeConversion::parseTimeDuration(timeString); } catch (std::exception &e) { std::string eMsg = "bad time format in playlength: "; eMsg += e.what(); throw std::invalid_argument(eMsg); - } catch ( ... ) { - std::string eMsg = "bad time format in playlength"; - throw std::invalid_argument(eMsg); } } @@ -380,7 +374,10 @@ AudioClip :: configure(const xmlpp::Element & element) if (!playlength && prefix == extentElementPrefix && name == extentElementName) { if (dataElement->has_child_text()) { - setPlaylength(dataElement->get_child_text()->get_content()); + Ptr::Ref playlengthString(new std::string( + dataElement->get_child_text() + ->get_content() )); + setPlaylength(playlengthString); } else { // or just leave blank? bad either way playlength.reset(new time_duration(0,0,0,0)); } @@ -496,7 +493,9 @@ AudioClip :: setMetadata(Ptr::Ref value, throw (std::invalid_argument) { if (prefix == extentElementPrefix && name == extentElementName) { - setPlaylength(*value); // may throw invalid_argument + Ptr::Ref valueString(new const std::string( + *value)); + setPlaylength(valueString); // may throw invalid_argument } if (prefix == titleElementPrefix && name == titleElementName) { diff --git a/livesupport/modules/core/src/FadeInfo.cxx b/livesupport/modules/core/src/FadeInfo.cxx index ce2be9a98..b11532c13 100644 --- a/livesupport/modules/core/src/FadeInfo.cxx +++ b/livesupport/modules/core/src/FadeInfo.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfo.cxx,v $ ------------------------------------------------------------------------------*/ @@ -35,6 +35,7 @@ #include +#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Core/FadeInfo.h" using namespace boost::posix_time; @@ -99,16 +100,18 @@ FadeInfo :: configure(const xmlpp::Element & element) eMsg += idAttrName; throw std::invalid_argument(eMsg); } - fadeIn.reset(new time_duration( - duration_from_string(attribute->get_value()))); + Ptr::Ref fadeInString(new std::string( + attribute->get_value() )); + fadeIn = TimeConversion::parseTimeDuration(fadeInString); if (!(attribute = element.get_attribute(fadeOutAttrName))) { std::string eMsg = "missing attribute "; eMsg += idAttrName; throw std::invalid_argument(eMsg); } - fadeOut.reset(new time_duration( - duration_from_string(attribute->get_value()))); + Ptr::Ref fadeOutString(new std::string( + attribute->get_value() )); + fadeOut = TimeConversion::parseTimeDuration(fadeOutString); } diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index cd3b83b67..6e562a723 100644 --- a/livesupport/modules/core/src/Playlist.cxx +++ b/livesupport/modules/core/src/Playlist.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.39 $ + Version : $Revision: 1.40 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -35,6 +35,7 @@ #include +#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Core/Playlist.h" using namespace boost::posix_time; @@ -279,22 +280,15 @@ Playlist :: setPlaylength(Ptr::Ref playlength) * Set the value of the playlength from a string (private). *----------------------------------------------------------------------------*/ void -Playlist :: setPlaylength(const std::string & timeString) +Playlist :: setPlaylength(Ptr::Ref timeString) throw (std::invalid_argument) { try { - playlength.reset(new time_duration(duration_from_string(timeString))); - } catch (boost::bad_lexical_cast &e) { - std::string eMsg = "bad time format in playlength: "; - eMsg += e.what(); - throw std::invalid_argument(eMsg); + playlength = TimeConversion::parseTimeDuration(timeString); } catch (std::exception &e) { std::string eMsg = "bad time format in playlength: "; eMsg += e.what(); throw std::invalid_argument(eMsg); - } catch ( ... ) { - std::string eMsg = "bad time format in playlength"; - throw std::invalid_argument(eMsg); } } @@ -381,7 +375,10 @@ Playlist :: configure(const xmlpp::Element & element) if (!playlength && prefix == extentElementPrefix && name == extentElementName) { if (dataElement->has_child_text()) { - setPlaylength(dataElement->get_child_text()->get_content()); + Ptr::Ref playlengthString( + new std::string(dataElement->get_child_text() + ->get_content() )); + setPlaylength(playlengthString); } else { // or just leave blank? bad either way playlength.reset(new time_duration(0,0,0,0)); } @@ -708,7 +705,9 @@ Playlist :: setMetadata(Ptr::Ref value, throw (std::invalid_argument) { if (prefix == extentElementPrefix && name == extentElementName) { - setPlaylength(*value); + Ptr::Ref valueString(new const std::string( + *value)); + setPlaylength(valueString); } if (prefix == titleElementPrefix && name == titleElementName) { diff --git a/livesupport/modules/core/src/PlaylistElement.cxx b/livesupport/modules/core/src/PlaylistElement.cxx index 98fc3beaf..8d8ca3a02 100644 --- a/livesupport/modules/core/src/PlaylistElement.cxx +++ b/livesupport/modules/core/src/PlaylistElement.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.12 $ + Version : $Revision: 1.13 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $ ------------------------------------------------------------------------------*/ @@ -35,6 +35,7 @@ #include +#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Core/Playlist.h" #include "LiveSupport/Core/PlaylistElement.h" @@ -112,8 +113,9 @@ PlaylistElement :: configure(const xmlpp::Element & element) eMsg += relativeOffsetAttrName; throw std::invalid_argument(eMsg); } - relativeOffset.reset(new time_duration( - duration_from_string(attribute->get_value()))); + Ptr::Ref relativeOffsetString(new std::string( + attribute->get_value() )); + relativeOffset = TimeConversion::parseTimeDuration(relativeOffsetString); // set audio clip xmlpp::Node::NodeList childNodes diff --git a/livesupport/modules/core/src/TimeConversion.cxx b/livesupport/modules/core/src/TimeConversion.cxx index f367a6ad6..540841905 100644 --- a/livesupport/modules/core/src/TimeConversion.cxx +++ b/livesupport/modules/core/src/TimeConversion.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.10 $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TimeConversion.cxx,v $ ------------------------------------------------------------------------------*/ @@ -218,7 +218,7 @@ TimeConversion :: timeDurationToHhMmSsString( * Parse a string to a time_duration. *----------------------------------------------------------------------------*/ Ptr::Ref -TimeConversion :: parseTimeDuration(Ptr::Ref durationString) +TimeConversion :: parseTimeDuration(Ptr::Ref durationString) throw () { int micros = 0;