changed modules/core to make all time_duration values consistently of the

form HH:MM:SS.ssssss (before, some were HH:MM:SS, or even just "0") --
this was necessary, because the storage server now checks this
This commit is contained in:
fgerlits 2005-03-07 11:16:12 +00:00
parent f32ab1daa3
commit f35e6d9b1a
16 changed files with 115 additions and 59 deletions

View File

@ -6,4 +6,5 @@
<!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED >
<!ATTLIST fadeInfo fadeOut NMTOKEN #REQUIRED >
]>
<fadeInfo id="0000000000009901" fadeIn="00:00:02.000" fadeOut="00:00:01.500"/>
<fadeInfo id="0000000000009901" fadeIn="00:00:02.000000"
fadeOut="00:00:01.500"/>

View File

@ -24,11 +24,11 @@
<playlist id="0000000000000001"
title="My First Playlist"
playlength="00:00:34.000" >
playlength="00:00:34.000000" >
<playlistElement id="0000000000000101"
relativeOffset="0" >
relativeOffset="00:00:00.000000" >
<audioClip id="0000000000010001"
playlength="00:00:11.000"
playlength="00:00:11.000000"
title = "one"
uri="file:var/test1.mp3" />
</playlistElement>
@ -47,9 +47,9 @@
<playlist id="0000000000000002"
playlength="00:00:11.000000" >
<playlistElement id="0000000000000111"
relativeOffset="0" >
relativeOffset="00:00:00.000000" >
<audioClip id="0000000000010003"
playlength="00:00:11.000"
playlength="00:00:11.000000"
title = "three"
uri="file:var/test3.mp3" />
</playlistElement>

View File

@ -26,14 +26,14 @@
<playlist id="0000000000000002"
playlength="00:00:11.000000" >
<playlistElement id="0000000000000111"
relativeOffset="0" >
relativeOffset="00:00:00.000000" >
<audioClip id="0000000000010003"
playlength="00:00:11.000"
playlength="00:00:11.000000"
title = "three"
uri="file:var/test3.mp3" />
</playlistElement>
</playlist>
<fadeInfo id="0000000000009901"
fadeIn="00:00:02.000"
fadeIn="00:00:02.000000"
fadeOut="00:00:01.500000" />
</playlistElement>

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.22 $
Version : $Revision: 1.23 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
------------------------------------------------------------------------------*/
@ -130,7 +130,7 @@ using namespace boost::posix_time;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.22 $
* @version $Revision: 1.23 $
*/
class AudioClip : public Configurable,
public Playable
@ -183,6 +183,19 @@ class AudioClip : public Configurable,
const std::string &name, const std::string &prefix)
throw ();
/**
* Convert a time_duration to string, in format HH:MM:SS.ssssss.
*/
std::string
toFixedString(Ptr<time_duration>::Ref time) const throw ()
{
if (time->fractional_seconds()) {
return to_simple_string(*time);
} else {
return to_simple_string(*time) + ".000000";
}
}
public:
/**

View File

@ -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/include/LiveSupport/Core/FadeInfo.h,v $
------------------------------------------------------------------------------*/
@ -89,7 +89,7 @@ using namespace boost::posix_time;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.6 $
* @version $Revision: 1.7 $
*/
class FadeInfo : public Configurable
{
@ -114,6 +114,19 @@ class FadeInfo : public Configurable
*/
Ptr<time_duration>::Ref fadeOut;
/**
* Convert a time_duration to string, in format HH:MM:SS.ssssss.
*/
std::string
toFixedString(Ptr<time_duration>::Ref time) const throw ()
{
if (time->fractional_seconds()) {
return to_simple_string(*time);
} else {
return to_simple_string(*time) + ".000000";
}
}
public:
/**

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.32 $
Version : $Revision: 1.33 $
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;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.32 $
* @version $Revision: 1.33 $
*/
class Playlist : public Configurable,
public Playable
@ -237,6 +237,20 @@ class Playlist : public Configurable,
find(Ptr<UniqueId>::Ref playlistElementId)
throw ();
/**
* Convert a time_duration to string, in format HH:MM:SS.ssssss.
*/
std::string
toFixedString(Ptr<time_duration>::Ref time) const
throw ()
{
if (time->fractional_seconds()) {
return to_simple_string(*time);
} else {
return to_simple_string(*time) + ".000000";
}
}
public:
/**

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.11 $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/PlaylistElement.h,v $
------------------------------------------------------------------------------*/
@ -104,7 +104,7 @@ class Playlist;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.11 $
* @version $Revision: 1.12 $
*/
class PlaylistElement : public Configurable
{
@ -157,6 +157,19 @@ class PlaylistElement : public Configurable
*/
Ptr<FadeInfo>::Ref fadeInfo;
/**
* Convert a time_duration to string, in format HH:MM:SS.ssssss.
*/
std::string
toFixedString(Ptr<time_duration>::Ref time) const throw ()
{
if (time->fractional_seconds()) {
return to_simple_string(*time);
} else {
return to_simple_string(*time) + ".000000";
}
}
public:

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.21 $
Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
------------------------------------------------------------------------------*/
@ -161,7 +161,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
setMetadata(title, titleElementName, titleElementPrefix);
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
toFixedString(playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -184,7 +184,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
setMetadata(title, titleElementName, titleElementPrefix);
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
toFixedString(playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -204,7 +204,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
setMetadata(title, titleElementName, titleElementPrefix);
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
toFixedString(playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -522,7 +522,7 @@ AudioClip :: getXmlElementString(void) const throw ()
+ std::string(*id)
+ "\" ");
xmlString->append(playlengthAttrName + "=\""
+ to_simple_string(*playlength)
+ toFixedString(playlength)
+ "\" ");
xmlString->append(Glib::ustring(titleAttrName) + "=\""
+ *title

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.11 $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $
------------------------------------------------------------------------------*/
@ -133,7 +133,7 @@ AudioClipTest :: firstTest(void)
CPPUNIT_ASSERT(*audioClip->getXmlElementString() ==
"<audioClip id=\"0000000000000001\" "
"playlength=\"00:18:30\" "
"playlength=\"00:18:30.000000\" "
"title=\"File Title txt\"/>");
} catch (std::invalid_argument &e) {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfo.cxx,v $
------------------------------------------------------------------------------*/
@ -126,11 +126,11 @@ FadeInfo :: getXmlElementString(void) throw ()
+ std::string(*id)
+ "\" ");
xmlString->append(fadeInAttrName + "=\""
+ to_simple_string(*fadeIn)
+ "\" ");
+ toFixedString(fadeIn)
+ "\" ");
xmlString->append(fadeOutAttrName + "=\""
+ to_simple_string(*fadeOut)
+ "\"/>");
+ toFixedString(fadeOut)
+ "\"/>");
return xmlString;
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfoTest.cxx,v $
------------------------------------------------------------------------------*/
@ -119,7 +119,7 @@ FadeInfoTest :: firstTest(void)
CPPUNIT_ASSERT(*fadeInfo->getXmlElementString() ==
"<fadeInfo id=\"0000000000009901\" "
"fadeIn=\"00:00:02\" "
"fadeIn=\"00:00:02.000000\" "
"fadeOut=\"00:00:01.000500\"/>");
} catch (std::invalid_argument &e) {

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.31 $
Version : $Revision: 1.32 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
------------------------------------------------------------------------------*/
@ -244,7 +244,7 @@ Playlist :: setPlaylength(Ptr<time_duration>::Ref playlength)
throw ()
{
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
toFixedString(playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -705,8 +705,9 @@ Playlist :: getXmlElementString(void) const throw ()
+ std::string(*getId())
+ "\" ");
xmlString->append(playlengthAttrName + "=\""
+ to_simple_string(*getPlaylength())
+ toFixedString(getPlaylength())
+ "\" ");
xmlString->append(Glib::ustring(titleAttrName) + "=\""
+ *getTitle()
+ "\">\n");

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.11 $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $
------------------------------------------------------------------------------*/
@ -199,8 +199,9 @@ PlaylistElement :: getXmlElementString(void) throw ()
+ std::string(*id)
+ "\" ");
xmlString->append(relativeOffsetAttrName + "=\""
+ to_simple_string(*relativeOffset)
+ "\">\n");
+ toFixedString(relativeOffset)
+ "\">\n");
xmlString->append(*getPlayable()->getXmlElementString() + "\n");
if (fadeInfo) {
xmlString->append(*fadeInfo->getXmlElementString() + "\n");

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElementTest.cxx,v $
------------------------------------------------------------------------------*/
@ -150,9 +150,9 @@ PlaylistElementTest :: firstTest(void)
CPPUNIT_ASSERT(*playlistElement->getXmlElementString() ==
"<playlistElement id=\"0000000000000111\" "
"relativeOffset=\"00:00:00\">\n"
"relativeOffset=\"00:00:00.000000\">\n"
"<audioClip id=\"0000000000010003\" "
"playlength=\"00:00:11\" "
"playlength=\"00:00:11.000000\" "
"title=\"three\"/>\n"
"</playlistElement>");

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.22 $
Version : $Revision: 1.23 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -115,20 +115,20 @@ PlaylistTest :: firstTest(void)
CPPUNIT_ASSERT(playlist->valid());
CPPUNIT_ASSERT(*playlist->getXmlElementString() ==
"<playlist id=\"0000000000000001\" playlength=\"00:00:34\" "
"<playlist id=\"0000000000000001\" playlength=\"00:00:34.000000\" "
"title=\"My First Playlist\">\n"
"<playlistElement id=\"0000000000000101\" relativeOffset=\"00:00:00\">\n"
"<audioClip id=\"0000000000010001\" playlength=\"00:00:11\" title=\"one\"/>\n"
"<playlistElement id=\"0000000000000101\" relativeOffset=\"00:00:00.000000\">\n"
"<audioClip id=\"0000000000010001\" playlength=\"00:00:11.000000\" title=\"one\"/>\n"
"</playlistElement>\n"
"<playlistElement id=\"0000000000000102\" relativeOffset=\"00:00:11\">\n"
"<audioClip id=\"0000000000010002\" playlength=\"00:00:12\" title=\"two\"/>\n"
"<fadeInfo id=\"0000000000009901\" fadeIn=\"00:00:02\" "
"<playlistElement id=\"0000000000000102\" relativeOffset=\"00:00:11.000000\">\n"
"<audioClip id=\"0000000000010002\" playlength=\"00:00:12.000000\" title=\"two\"/>\n"
"<fadeInfo id=\"0000000000009901\" fadeIn=\"00:00:02.000000\" "
"fadeOut=\"00:00:01.500000\"/>\n"
"</playlistElement>\n"
"<playlistElement id=\"0000000000000103\" relativeOffset=\"00:00:23\">\n"
"<playlist id=\"0000000000000002\" playlength=\"00:00:11\" title=\"\">\n"
"<playlistElement id=\"0000000000000111\" relativeOffset=\"00:00:00\">\n"
"<audioClip id=\"0000000000010003\" playlength=\"00:00:11\" title=\"three\"/>\n"
"<playlistElement id=\"0000000000000103\" relativeOffset=\"00:00:23.000000\">\n"
"<playlist id=\"0000000000000002\" playlength=\"00:00:11.000000\" title=\"\">\n"
"<playlistElement id=\"0000000000000111\" relativeOffset=\"00:00:00.000000\">\n"
"<audioClip id=\"0000000000010003\" playlength=\"00:00:11.000000\" title=\"three\"/>\n"
"</playlistElement>\n"
"</playlist>\n"
"</playlistElement>\n"

View File

@ -36,9 +36,9 @@
]>
<storageClientFactory>
<testStorage tempFiles="file:///tmp/tempPlaylist">
<playlist id="1" playlength="00:00:34.000" >
<playlist id="1" playlength="00:00:34.000000" >
<playlistElement id="101" relativeOffset="0" >
<audioClip id="10001" playlength="00:00:11.000"
<audioClip id="10001" playlength="00:00:11.000000"
title="one"
uri="file:var/test1.mp3" />
</playlistElement>
@ -51,8 +51,8 @@
</playlistElement>
<playlistElement id="103" relativeOffset="00:00:23.000000" >
<playlist id="2" playlength="00:00:11.000000" >
<playlistElement id="111" relativeOffset="0" >
<audioClip id="10003" playlength="00:00:11.000"
<playlistElement id="111" relativeOffset="00:00:00.000000" >
<audioClip id="10003" playlength="00:00:11.000000"
title="three"
uri="file:var/test3.mp3" />
</playlistElement>
@ -60,16 +60,16 @@
</playlistElement>
</playlist>
<playlist id="2" playlength="00:00:11.000000" >
<playlistElement id="111" relativeOffset="0" >
<audioClip id="10003" playlength="00:00:11.000"
<playlistElement id="111" relativeOffset="00:00:00.000000" >
<audioClip id="10003" playlength="00:00:11.000000"
title="three"
uri="file:var/test3.mp3" />
</playlistElement>
</playlist>
<audioClip id="10001" playlength="01:00:00.000"
<audioClip id="10001" playlength="01:00:00.000000"
title="one"
uri="file:var/test1.mp3" />
<audioClip id="10002" playlength="00:30:00.000"
<audioClip id="10002" playlength="00:30:00.000000"
title="two"
uri="file:var/test2.mp3" />
</testStorage>