added title attribute to AudioClip (in config(), too)
updated config files with title attribute created getXmlString() method in AudioClip, Playlist, PlaylistElement and FadeInfo replaced old (and bad) toXml() method with getMetadataString() in AudioClip
This commit is contained in:
parent
05d760368a
commit
4d777103f7
23 changed files with 725 additions and 84 deletions
|
@ -12,6 +12,7 @@
|
|||
<!ELEMENT audioClip EMPTY >
|
||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||
<!ATTLIST audioClip title CDATA #REQUIRED >
|
||||
<!ATTLIST audioClip uri CDATA #IMPLIED >
|
||||
|
||||
<!ELEMENT fadeInfo EMPTY >
|
||||
|
@ -24,12 +25,14 @@
|
|||
playlength="00:00:34.000" >
|
||||
<playlistElement id="101" relativeOffset="0" >
|
||||
<audioClip id="10001" playlength="00:00:11.000"
|
||||
title = "one"
|
||||
uri="file:var/test1.mp3" />
|
||||
</playlistElement>
|
||||
<playlistElement id="0000000000000102"
|
||||
relativeOffset="00:00:11.000000" >
|
||||
<audioClip id="0000000000010002"
|
||||
playlength="00:00:12.000000"
|
||||
title = "two"
|
||||
uri="file:var/test2.mp3" />
|
||||
<fadeInfo id="0000000000009901"
|
||||
fadeIn="00:00:02.000000"
|
||||
|
@ -43,6 +46,7 @@
|
|||
relativeOffset="0" >
|
||||
<audioClip id="0000000000010003"
|
||||
playlength="00:00:11.000"
|
||||
title = "three"
|
||||
uri="file:var/test3.mp3" />
|
||||
</playlistElement>
|
||||
</playlist>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<!ELEMENT audioClip EMPTY >
|
||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||
<!ATTLIST audioClip title CDATA #REQUIRED >
|
||||
<!ATTLIST audioClip uri CDATA #IMPLIED >
|
||||
|
||||
<!ELEMENT fadeInfo EMPTY >
|
||||
|
@ -28,6 +29,7 @@
|
|||
relativeOffset="0" >
|
||||
<audioClip id="0000000000010003"
|
||||
playlength="00:00:11.000"
|
||||
title = "three"
|
||||
uri="file:var/test3.mp3" />
|
||||
</playlistElement>
|
||||
</playlist>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.14 $
|
||||
Version : $Revision: 1.15 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -124,7 +124,7 @@ using namespace boost::posix_time;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.14 $
|
||||
* @version $Revision: 1.15 $
|
||||
*/
|
||||
class AudioClip : public Configurable,
|
||||
public Playable
|
||||
|
@ -188,7 +188,7 @@ class AudioClip : public Configurable,
|
|||
|
||||
/**
|
||||
* Create an audio clip by specifying all details, except
|
||||
* for the title.
|
||||
* for the title. The title is set to the empty string.
|
||||
* This is used for testing purposes.
|
||||
*
|
||||
* @param id the id of the audio clip.
|
||||
|
@ -367,24 +367,37 @@ class AudioClip : public Configurable,
|
|||
|
||||
|
||||
/**
|
||||
* Return an XML representation of this audio clip. This contains
|
||||
* the metadata fields of the audio clip, and it's roughly the
|
||||
* inverse of the configure() method.
|
||||
* Return an XML representation of this audio clip
|
||||
* (in UTF-8 encoding).
|
||||
* This consists of minimal information (ID, playlength, title)
|
||||
* only, without any metadata.
|
||||
*
|
||||
* (NOTE: This returns a non-constant pointer to a member of the
|
||||
* AudioClip object, so handle with care, and do not ever, ever
|
||||
* modify the Document object returned. It cannot be made const
|
||||
* because <code>xmlpp::Document::write_to_file()</code> and
|
||||
* <code>xmlpp::Document::write_to_string()</code> are only defined on
|
||||
* non-constant instances.)
|
||||
*
|
||||
* @return an xmlpp::Document containing the metadata.
|
||||
* @return a string representation of the audio clip in XML
|
||||
*/
|
||||
Ptr<xmlpp::Document>::Ref
|
||||
toXml() throw ()
|
||||
{
|
||||
return xmlAudioClip;
|
||||
}
|
||||
virtual Ptr<Glib::ustring>::Ref
|
||||
getXmlString(void) throw ();
|
||||
|
||||
|
||||
/**
|
||||
* Return an XML representation of the metadata of the audio clip
|
||||
* (in UTF-8 encoding). This has the (pseudo-) DTD
|
||||
* <pre><code>
|
||||
* <!ELEMENT audioClip (metadata) >
|
||||
* <!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||
*
|
||||
* <!ELEMENT metadata (dcterms:extent, dc:title, (ANY)*) >
|
||||
* <!ELEMENT dcterms:extent (NMTOKEN) >
|
||||
* <!ELEMENT dc:title (CDATA) >
|
||||
* </code></pre>
|
||||
*
|
||||
* If the audio clip has no metadata at all (this is possible if
|
||||
* it was created by the default constructor or the constructor
|
||||
* which takes a unique ID only), a null pointer is returned.
|
||||
*
|
||||
* @return a string representation of the metadata in XML
|
||||
*/
|
||||
Ptr<Glib::ustring>::Ref
|
||||
getMetadataString() throw ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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/include/LiveSupport/Core/FadeInfo.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -89,7 +89,7 @@ using namespace boost::posix_time;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.4 $
|
||||
* @version $Revision: 1.5 $
|
||||
*/
|
||||
class FadeInfo : public Configurable
|
||||
{
|
||||
|
@ -219,6 +219,14 @@ class FadeInfo : public Configurable
|
|||
{
|
||||
return fadeOut;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an XML representation of this FadeInfo object.
|
||||
*
|
||||
* @return a string representation of the audio clip in XML
|
||||
*/
|
||||
virtual Ptr<Glib::ustring>::Ref
|
||||
getXmlString(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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/include/LiveSupport/Core/Playable.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -69,7 +69,7 @@ using namespace boost::posix_time;
|
|||
* It contains the methods which are common to these classes.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.4 $
|
||||
* @version $Revision: 1.5 $
|
||||
*/
|
||||
class Playable
|
||||
{
|
||||
|
@ -176,6 +176,14 @@ class Playable
|
|||
const std::string &ns = "")
|
||||
throw () = 0;
|
||||
|
||||
/**
|
||||
* Return an XML representation of this audio clip or playlist.
|
||||
* This consists of minimal information only, without any metadata.
|
||||
*
|
||||
* @return a string representation of the audio clip in XML
|
||||
*/
|
||||
virtual Ptr<Glib::ustring>::Ref
|
||||
getXmlString(void) throw () = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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/Playlist.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -93,7 +93,7 @@ using namespace boost::posix_time;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.22 $
|
||||
* @version $Revision: 1.23 $
|
||||
*/
|
||||
class Playlist : public Configurable,
|
||||
public Playable
|
||||
|
@ -191,6 +191,18 @@ class Playlist : public Configurable,
|
|||
this->isLockedForEditing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a playlist by specifying its ID only.
|
||||
*/
|
||||
Playlist(Ptr<UniqueId>::Ref id) throw ()
|
||||
{
|
||||
this->id = id;
|
||||
|
||||
elementList.reset(new PlaylistElementListType);
|
||||
this->isLockedForPlaying = false;
|
||||
this->isLockedForEditing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a playlist by specifying all details, except the title.
|
||||
* This is used for testing purposes.
|
||||
|
@ -209,6 +221,7 @@ class Playlist : public Configurable,
|
|||
this->title.reset(new Glib::ustring(""));
|
||||
this->playlength = playlength;
|
||||
this->uri = uri;
|
||||
|
||||
elementList.reset(new PlaylistElementListType);
|
||||
this->isLockedForPlaying = false;
|
||||
this->isLockedForEditing = false;
|
||||
|
@ -233,6 +246,7 @@ class Playlist : public Configurable,
|
|||
this->title = title;
|
||||
this->playlength = playlength;
|
||||
this->uri = uri;
|
||||
|
||||
elementList.reset(new PlaylistElementListType);
|
||||
this->isLockedForPlaying = false;
|
||||
this->isLockedForEditing = false;
|
||||
|
@ -586,7 +600,17 @@ class Playlist : public Configurable,
|
|||
throw ();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return an XML representation of this audio clip.
|
||||
* This consists of minimal information (ID and playlength for
|
||||
* playlists; ID, playlength and title
|
||||
* for the audio clips, plus fade in / fade out info)
|
||||
* only, without any metadata.
|
||||
*
|
||||
* @return a string representation of the audio clip in XML
|
||||
*/
|
||||
virtual Ptr<Glib::ustring>::Ref
|
||||
getXmlString(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.9 $
|
||||
Version : $Revision: 1.10 $
|
||||
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.9 $
|
||||
* @version $Revision: 1.10 $
|
||||
*/
|
||||
class PlaylistElement : public Configurable
|
||||
{
|
||||
|
@ -369,6 +369,14 @@ class PlaylistElement : public Configurable
|
|||
return fadeInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an XML representation of this playlist element.
|
||||
* This consists of minimal information only, without any metadata.
|
||||
*
|
||||
* @return a string representation of the audio clip in XML
|
||||
*/
|
||||
virtual Ptr<Glib::ustring>::Ref
|
||||
getXmlString(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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/AudioClip.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -66,6 +66,11 @@ static const std::string uriAttrName = "uri";
|
|||
*/
|
||||
static const std::string playlengthAttrName = "playlength";
|
||||
|
||||
/**
|
||||
* The name of the attribute to get the title of the audio clip.
|
||||
*/
|
||||
static const std::string titleAttrName = "title";
|
||||
|
||||
/**
|
||||
* The name of the metadata child element.
|
||||
*/
|
||||
|
@ -76,31 +81,31 @@ static const std::string metadataElementName = "metadata";
|
|||
*/
|
||||
static const std::string extentElementPrefix = "dcterms";
|
||||
|
||||
/**
|
||||
* The URI identifier for the "dcterms" prefix
|
||||
*/
|
||||
static const std::string extentElementUri = "http://purl.org/dc/terms/";
|
||||
|
||||
/**
|
||||
* The name of the extent (length) metadata element.
|
||||
*/
|
||||
static const std::string extentElementName = "extent";
|
||||
|
||||
/**
|
||||
* The URI identifier for the "dcterms" prefix
|
||||
*/
|
||||
static const std::string extentElementUri = "http://purl.org/dc/terms/";
|
||||
|
||||
/**
|
||||
* The prefix of the title metadata element.
|
||||
*/
|
||||
static const std::string titleElementPrefix = "dc";
|
||||
|
||||
/**
|
||||
* The URI identifier for the "dc" prefix
|
||||
*/
|
||||
static const std::string titleElementUri ="http://purl.org/dc/elements/1.1/";
|
||||
|
||||
/**
|
||||
* The name of the title metadata element.
|
||||
*/
|
||||
static const std::string titleElementName = "title";
|
||||
|
||||
/**
|
||||
* The URI identifier for the "dc" prefix
|
||||
*/
|
||||
static const std::string titleElementUri ="http://purl.org/dc/elements/1.1/";
|
||||
|
||||
/**
|
||||
* The URI identifier for the default XML namespace
|
||||
*/
|
||||
|
@ -128,6 +133,8 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
|
|||
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
|
||||
to_simple_string(*playlength) ));
|
||||
setMetadata(playlengthString, extentElementName, extentElementPrefix);
|
||||
|
||||
setMetadata(title, titleElementName, titleElementPrefix);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
@ -197,9 +204,14 @@ AudioClip :: configure(const xmlpp::Element & element)
|
|||
duration_from_string(attribute->get_value())));
|
||||
}
|
||||
|
||||
if (!title
|
||||
&& (attribute = element.get_attribute(titleAttrName))) {
|
||||
title.reset(new const Glib::ustring(attribute->get_value()));
|
||||
}
|
||||
|
||||
if (!uri
|
||||
&& (attribute = element.get_attribute(uriAttrName))) {
|
||||
uri.reset(new std::string(attribute->get_value()));
|
||||
uri.reset(new const std::string(attribute->get_value()));
|
||||
}
|
||||
|
||||
xmlpp::Node::NodeList childNodes
|
||||
|
@ -232,17 +244,25 @@ AudioClip :: configure(const xmlpp::Element & element)
|
|||
}
|
||||
|
||||
if (!playlength && prefix == extentElementPrefix
|
||||
&& name == extentElementName
|
||||
&& dataElement->has_child_text()) {
|
||||
playlength.reset(new time_duration(duration_from_string(
|
||||
&& name == extentElementName) {
|
||||
if (dataElement->has_child_text()) {
|
||||
playlength.reset(new time_duration(duration_from_string(
|
||||
dataElement->get_child_text()->get_content() )));
|
||||
}
|
||||
else { // or just leave blank? bad either way
|
||||
playlength.reset(new time_duration(0,0,0,0));
|
||||
}
|
||||
}
|
||||
|
||||
if (!title && prefix == titleElementPrefix
|
||||
&& name == titleElementName
|
||||
&& dataElement->has_child_text()) {
|
||||
Glib::ustring value = dataElement->get_child_text()
|
||||
->get_content();
|
||||
&& name == titleElementName) {
|
||||
Glib::ustring value;
|
||||
if (dataElement->has_child_text()) {
|
||||
value = dataElement->get_child_text()->get_content();
|
||||
}
|
||||
else {
|
||||
value = "";
|
||||
}
|
||||
Ptr<const Glib::ustring>::Ref ptrToValue(
|
||||
new const Glib::ustring(value));
|
||||
title = ptrToValue;
|
||||
|
@ -271,6 +291,16 @@ AudioClip :: configure(const xmlpp::Element & element)
|
|||
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
|
||||
to_simple_string(*playlength) ));
|
||||
setMetadata(playlengthString, extentElementName, extentElementPrefix);
|
||||
|
||||
if (!title) {
|
||||
std::string eMsg = "missing attribute ";
|
||||
eMsg += titleAttrName;
|
||||
eMsg += " or metadata element ";
|
||||
eMsg += titleElementPrefix + ":" + titleElementName;
|
||||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
|
||||
setMetadata(title, titleElementName, titleElementPrefix);
|
||||
}
|
||||
|
||||
|
||||
|
@ -353,9 +383,9 @@ AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
|||
extentElementPrefix);
|
||||
}
|
||||
|
||||
xmlpp::Node::NodeList nodeList = metadata->get_children(key);
|
||||
xmlpp::Node::NodeList::iterator it = nodeList.begin();
|
||||
xmlpp::Element* element;
|
||||
xmlpp::Node::NodeList nodeList = metadata->get_children(key);
|
||||
xmlpp::Node::NodeList::iterator it = nodeList.begin();
|
||||
xmlpp::Element* element = 0;
|
||||
|
||||
while (it != nodeList.end()) {
|
||||
xmlpp::Node* node = *it;
|
||||
|
@ -379,3 +409,44 @@ AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
|||
element->set_child_text(*value);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return a string containing the essential fields of this object, in XML.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Glib::ustring>::Ref
|
||||
AudioClip :: getXmlString(void) throw ()
|
||||
{
|
||||
Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring);
|
||||
|
||||
xmlString->append("<");
|
||||
xmlString->append(configElementNameStr + " ");
|
||||
xmlString->append(idAttrName + "=\""
|
||||
+ std::string(*id)
|
||||
+ "\" ");
|
||||
xmlString->append(playlengthAttrName + "=\""
|
||||
+ to_simple_string(*playlength)
|
||||
+ "\" ");
|
||||
xmlString->append(Glib::ustring(titleAttrName) + "=\""
|
||||
+ *title
|
||||
+ "\"/>");
|
||||
return xmlString;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return a string containing the metadata of the audio clip, in XML.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Glib::ustring>::Ref
|
||||
AudioClip :: getMetadataString() throw ()
|
||||
{
|
||||
Ptr<Glib::ustring>::Ref metadataString;
|
||||
|
||||
if (!xmlAudioClip) {
|
||||
return metadataString;
|
||||
}
|
||||
|
||||
metadataString.reset(new Glib::ustring(xmlAudioClip->write_to_string() ));
|
||||
|
||||
return metadataString;
|
||||
}
|
||||
|
||||
|
|
|
@ -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/AudioClipTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -124,6 +124,14 @@ AudioClipTest :: firstTest(void)
|
|||
CPPUNIT_ASSERT(*alternativeTitle ==
|
||||
"Alternative File Title ín sőmé %$#@* LÁNGŰAGÉ");
|
||||
|
||||
CPPUNIT_ASSERT(*audioClip->getXmlString() ==
|
||||
"<audioClip id=\"0000000000000001\" "
|
||||
"playlength=\"00:18:30\" "
|
||||
"title=\"File Title txt\"/>");
|
||||
|
||||
//std::cerr << "\nxml: '" << *audioClip->getXmlString() << "'" << std::endl;
|
||||
//std::cerr << "\nmetadata: " << *audioClip->getMetadataString() << std::endl;
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
CPPUNIT_FAIL("semantic error in configuration file");
|
||||
} catch (xmlpp::exception &e) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.2 $
|
||||
Version : $Revision: 1.3 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfo.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -113,3 +113,27 @@ FadeInfo :: configure(const xmlpp::Element & element)
|
|||
fadeOut.reset(new time_duration(
|
||||
duration_from_string(attribute->get_value())));
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return a string containing the essential fields of this object, in XML.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Glib::ustring>::Ref
|
||||
FadeInfo :: getXmlString(void) throw ()
|
||||
{
|
||||
Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring);
|
||||
|
||||
xmlString->append("<");
|
||||
xmlString->append(configElementNameStr + " ");
|
||||
xmlString->append(idAttrName + "=\""
|
||||
+ std::string(*id)
|
||||
+ "\" ");
|
||||
xmlString->append(fadeInAttrName + "=\""
|
||||
+ to_simple_string(*fadeIn)
|
||||
+ "\" ");
|
||||
xmlString->append(fadeOutAttrName + "=\""
|
||||
+ to_simple_string(*fadeOut)
|
||||
+ "\"/>");
|
||||
return xmlString;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.1 $
|
||||
Version : $Revision: 1.2 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfoTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -117,6 +117,11 @@ FadeInfoTest :: firstTest(void)
|
|||
CPPUNIT_ASSERT(fadeOut->seconds() == 1);
|
||||
CPPUNIT_ASSERT(fadeOut->fractional_seconds() == 500);
|
||||
|
||||
CPPUNIT_ASSERT(*fadeInfo->getXmlString() ==
|
||||
"<fadeInfo id=\"00000000000026ad\" "
|
||||
"fadeIn=\"00:00:02\" "
|
||||
"fadeOut=\"00:00:01.000500\"/>");
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::string eMsg = "semantic error in configuration file:\n";
|
||||
eMsg += e.what();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.18 $
|
||||
Version : $Revision: 1.19 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -398,3 +398,32 @@ Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
|||
metadata[completeKey] = value;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return a string containing the essential fields of this object, in XML.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Glib::ustring>::Ref
|
||||
Playlist :: getXmlString(void) throw ()
|
||||
{
|
||||
Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring);
|
||||
|
||||
xmlString->append("<");
|
||||
xmlString->append(configElementNameStr + " ");
|
||||
xmlString->append(idAttrName + "=\""
|
||||
+ std::string(*id)
|
||||
+ "\" ");
|
||||
xmlString->append(playlengthAttrName + "=\""
|
||||
+ to_simple_string(*playlength)
|
||||
+ "\">\n");
|
||||
|
||||
PlaylistElementListType::const_iterator it = elementList->begin();
|
||||
while (it != elementList->end()) {
|
||||
xmlString->append(*it->second->getXmlString() + "\n");
|
||||
++it;
|
||||
}
|
||||
|
||||
xmlString->append("</");
|
||||
xmlString->append(configElementNameStr + ">");
|
||||
|
||||
return xmlString;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -188,3 +188,31 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
|||
throw std::invalid_argument(eMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return a string containing the essential fields of this object, in XML.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<Glib::ustring>::Ref
|
||||
PlaylistElement :: getXmlString(void) throw ()
|
||||
{
|
||||
Ptr<Glib::ustring>::Ref xmlString(new Glib::ustring);
|
||||
|
||||
xmlString->append("<");
|
||||
xmlString->append(configElementNameStr + " ");
|
||||
xmlString->append(idAttrName + "=\""
|
||||
+ std::string(*id)
|
||||
+ "\" ");
|
||||
xmlString->append(relativeOffsetAttrName + "=\""
|
||||
+ to_simple_string(*relativeOffset)
|
||||
+ "\">\n");
|
||||
xmlString->append(*getPlayable()->getXmlString() + "\n");
|
||||
if (fadeInfo) {
|
||||
xmlString->append(*fadeInfo->getXmlString() + "\n");
|
||||
}
|
||||
xmlString->append("</");
|
||||
xmlString->append(configElementNameStr + ">");
|
||||
|
||||
return xmlString;
|
||||
}
|
||||
|
||||
|
|
|
@ -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/PlaylistElementTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -124,7 +124,7 @@ PlaylistElementTest :: firstTest(void)
|
|||
|
||||
CPPUNIT_ASSERT(playlistElement->getType()
|
||||
== PlaylistElement::PlaylistType);
|
||||
|
||||
|
||||
// check that we can access the playlist inside the playlist element
|
||||
// as a Playable instance
|
||||
CPPUNIT_ASSERT(playlistElement->getPlaylist()
|
||||
|
@ -148,6 +148,14 @@ PlaylistElementTest :: firstTest(void)
|
|||
CPPUNIT_ASSERT(playlistElement->getType()
|
||||
== PlaylistElement::AudioClipType);
|
||||
|
||||
CPPUNIT_ASSERT(*playlistElement->getXmlString() ==
|
||||
"<playlistElement id=\"000000000000006f\" "
|
||||
"relativeOffset=\"00:00:00\">\n"
|
||||
"<audioClip id=\"0000000000002713\" "
|
||||
"playlength=\"00:00:11\" "
|
||||
"title=\"three\"/>\n"
|
||||
"</playlistElement>");
|
||||
|
||||
// and the audio clip inside the playlist element
|
||||
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
|
||||
== 10003);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.14 $
|
||||
Version : $Revision: 1.15 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -115,6 +115,25 @@ PlaylistTest :: firstTest(void)
|
|||
|
||||
CPPUNIT_ASSERT(playlist->valid());
|
||||
|
||||
CPPUNIT_ASSERT(*playlist->getXmlString() ==
|
||||
"<playlist id=\"0000000000000001\" playlength=\"00:00:34\">\n"
|
||||
"<playlistElement id=\"0000000000000065\" relativeOffset=\"00:00:00\">\n"
|
||||
"<audioClip id=\"0000000000002711\" playlength=\"00:00:11\" title=\"one\"/>\n"
|
||||
"</playlistElement>\n"
|
||||
"<playlistElement id=\"0000000000000066\" relativeOffset=\"00:00:11\">\n"
|
||||
"<audioClip id=\"0000000000002712\" playlength=\"00:00:12\" title=\"two\"/>\n"
|
||||
"<fadeInfo id=\"00000000000026ad\" fadeIn=\"00:00:02\" "
|
||||
"fadeOut=\"00:00:01.500000\"/>\n"
|
||||
"</playlistElement>\n"
|
||||
"<playlistElement id=\"0000000000000067\" relativeOffset=\"00:00:23\">\n"
|
||||
"<playlist id=\"0000000000000002\" playlength=\"00:00:11\">\n"
|
||||
"<playlistElement id=\"000000000000006f\" relativeOffset=\"00:00:00\">\n"
|
||||
"<audioClip id=\"0000000000002713\" playlength=\"00:00:11\" title=\"three\"/>\n"
|
||||
"</playlistElement>\n"
|
||||
"</playlist>\n"
|
||||
"</playlistElement>\n"
|
||||
"</playlist>");
|
||||
|
||||
Playlist::const_iterator it = playlist->begin();
|
||||
CPPUNIT_ASSERT(it != playlist->end());
|
||||
Ptr<PlaylistElement>::Ref playlistElement = it->second;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue