added get/set methods for title and for general metadata in AudioClip
and in Playlist
This commit is contained in:
parent
54df237819
commit
3b01df226c
12 changed files with 460 additions and 89 deletions
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
#
|
||||
# Author : $Author: fgerlits $
|
||||
# Version : $Revision: 1.18 $
|
||||
# Version : $Revision: 1.19 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $
|
||||
#
|
||||
# @configure_input@
|
||||
|
@ -71,7 +71,7 @@ LIBXMLPP_LIBS=@LIBXMLPP_LIBS@
|
|||
|
||||
# TODO: move ICU flag determination to configure script
|
||||
ICU_CFLAGS=
|
||||
ICU_LIBS=`${USR_DIR}/bin/icu-config --ldflags-toolutil --ldflags-icuio`
|
||||
ICU_LIBS=`${USR_DIR}/bin/icu-config --ldflags --ldflags-toolutil --ldflags-icuio`
|
||||
|
||||
TEST_RESULTS = ${DOC_DIR}/testResults.xml
|
||||
# the text result XSLT has to be relative to the test result file, e.g. TMP_DIR
|
||||
|
|
|
@ -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/AudioClip.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -77,6 +77,7 @@ using namespace boost::posix_time;
|
|||
*
|
||||
* <pre><code>
|
||||
* <audioClip id="1"
|
||||
* title="Name of the Song"
|
||||
* playlength="00:18:30.000000"
|
||||
* uri="file:var/test1.mp3" >
|
||||
* <metadata
|
||||
|
@ -108,13 +109,14 @@ using namespace boost::posix_time;
|
|||
*
|
||||
* <pre><code>
|
||||
* <!ELEMENT audioClip (metadata?) >
|
||||
* <!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||
* <!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||
* <!ATTLIST audioClip id NMTOKEN #IMPLIED >
|
||||
* <!ATTLIST audioClip title CDATA #IMPLIED >
|
||||
* <!ATTLIST audioClip playlength NMTOKEN #IMPLIED >
|
||||
* <!ATTLIST audioClip uri CDATA #IMPLIED >
|
||||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.11 $
|
||||
* @version $Revision: 1.12 $
|
||||
*/
|
||||
class AudioClip : public Configurable,
|
||||
public Playable
|
||||
|
@ -130,6 +132,11 @@ class AudioClip : public Configurable,
|
|||
*/
|
||||
Ptr<UniqueId>::Ref id;
|
||||
|
||||
/**
|
||||
* The title of the audio clip.
|
||||
*/
|
||||
Ptr<UnicodeString>::Ref title;
|
||||
|
||||
/**
|
||||
* The playling length of the audio clip.
|
||||
*/
|
||||
|
@ -145,6 +152,17 @@ class AudioClip : public Configurable,
|
|||
*/
|
||||
Ptr<const string>::Ref token;
|
||||
|
||||
/**
|
||||
* The type for storing the metadata.
|
||||
*/
|
||||
typedef std::map<const std::string, Ptr<UnicodeString>::Ref>
|
||||
metadataType;
|
||||
|
||||
/**
|
||||
* The metadata for this audio clip.
|
||||
*/
|
||||
metadataType metadata;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -167,7 +185,8 @@ class AudioClip : public Configurable,
|
|||
}
|
||||
|
||||
/**
|
||||
* Create an audio clip by specifying all details.
|
||||
* Create an audio clip by specifying all details, except
|
||||
* for the title.
|
||||
* This is used for testing purposes.
|
||||
*
|
||||
* @param id the id of the audio clip.
|
||||
|
@ -181,6 +200,28 @@ class AudioClip : public Configurable,
|
|||
throw ()
|
||||
{
|
||||
this->id = id;
|
||||
this->title.reset(new UnicodeString(""));
|
||||
this->playlength = playlength;
|
||||
this->uri = uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an audio clip by specifying all details.
|
||||
* This is used for testing purposes.
|
||||
*
|
||||
* @param id the id of the audio clip.
|
||||
* @param playlength the playing length of the audio clip.
|
||||
* @param uri the location of the sound file corresponding to
|
||||
* this audio clip object (optional)
|
||||
*/
|
||||
AudioClip(Ptr<UniqueId>::Ref id,
|
||||
Ptr<UnicodeString>::Ref title,
|
||||
Ptr<time_duration>::Ref playlength,
|
||||
Ptr<string>::Ref uri = Ptr<string>::Ref())
|
||||
throw ()
|
||||
{
|
||||
this->id = id;
|
||||
this->title = title;
|
||||
this->playlength = playlength;
|
||||
this->uri = uri;
|
||||
}
|
||||
|
@ -288,6 +329,52 @@ class AudioClip : public Configurable,
|
|||
this->token = token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the title of this audio clip.
|
||||
*
|
||||
* @return the title.
|
||||
*/
|
||||
virtual Ptr<UnicodeString>::Ref
|
||||
getTitle(void) const throw ()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the title of this audio clip.
|
||||
*
|
||||
* @param title a new title.
|
||||
*/
|
||||
virtual void
|
||||
setTitle(Ptr<UnicodeString>::Ref title)
|
||||
throw ()
|
||||
{
|
||||
this->title = title;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of a metadata field in this audio clip.
|
||||
*
|
||||
* @return the value of the metadata field; 0 if there is
|
||||
* no such field;
|
||||
*/
|
||||
virtual Ptr<UnicodeString>::Ref
|
||||
getMetadata(const string &key) const
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Set the value of a metadata field in this audio clip.
|
||||
*
|
||||
* @param key the name of the metadata field.
|
||||
* @param value the new value of the metadata field.
|
||||
*/
|
||||
virtual void
|
||||
setMetadata(const string &key, Ptr<UnicodeString>::Ref value)
|
||||
throw ();
|
||||
|
||||
|
||||
/**
|
||||
* Return an XML representation of this audio clip. This contains
|
||||
* the metadata fields of the audio clip, and it's roughly the
|
||||
|
@ -296,7 +383,7 @@ class AudioClip : public Configurable,
|
|||
* @return an xmlpp::Document containing the metadata.
|
||||
*/
|
||||
Ptr<xmlpp::Document>::Ref
|
||||
getMetadata() throw ();
|
||||
toXml() throw ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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/include/LiveSupport/Core/Playable.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -44,6 +44,7 @@
|
|||
#include <string>
|
||||
#include <libxml++/libxml++.h>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <unicode/unistr.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Core/UniqueId.h"
|
||||
|
@ -69,7 +70,7 @@ using namespace boost::posix_time;
|
|||
* It contains the methods which are common to these classes.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
class Playable
|
||||
{
|
||||
|
@ -91,6 +92,7 @@ class Playable
|
|||
virtual Ptr<time_duration>::Ref
|
||||
getPlaylength(void) const throw () = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Return the URI of the sound file of this audio clip or
|
||||
* playlist, which can be played by the helix client. This
|
||||
|
@ -111,6 +113,7 @@ class Playable
|
|||
virtual void
|
||||
setUri(Ptr<const string>::Ref uri) throw () = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Return the token which is used to identify this audio clip
|
||||
* or playlist to the storage server.
|
||||
|
@ -128,6 +131,45 @@ class Playable
|
|||
*/
|
||||
virtual void
|
||||
setToken(Ptr<const string>::Ref token) throw () = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Return the title of this audio clip or playlist.
|
||||
*
|
||||
* @return the title.
|
||||
*/
|
||||
virtual Ptr<UnicodeString>::Ref
|
||||
getTitle(void) const throw () = 0;
|
||||
|
||||
/**
|
||||
* Set the title of this audio clip or playlist.
|
||||
*
|
||||
* @param title a new title.
|
||||
*/
|
||||
virtual void
|
||||
setTitle(Ptr<UnicodeString>::Ref title)
|
||||
throw () = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of a metadata field in this audio clip or playlist.
|
||||
*
|
||||
* @return the value of the metadata field; 0 if there is
|
||||
* no such field;
|
||||
*/
|
||||
virtual Ptr<UnicodeString>::Ref
|
||||
getMetadata(const string &key) const
|
||||
throw () = 0;
|
||||
|
||||
/**
|
||||
* Set the value of a metadata field in this audio clip or playlist.
|
||||
*
|
||||
* @param key the name of the metadata field.
|
||||
* @param value the new value of the metadata field.
|
||||
*/
|
||||
virtual void
|
||||
setMetadata(const string &key, Ptr<UnicodeString>::Ref value)
|
||||
throw () = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.19 $
|
||||
Version : $Revision: 1.20 $
|
||||
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.19 $
|
||||
* @version $Revision: 1.20 $
|
||||
*/
|
||||
class Playlist : public Configurable,
|
||||
public Playable
|
||||
|
@ -109,6 +109,11 @@ class Playlist : public Configurable,
|
|||
*/
|
||||
Ptr<UniqueId>::Ref id;
|
||||
|
||||
/**
|
||||
* The title of the playlist.
|
||||
*/
|
||||
Ptr<UnicodeString>::Ref title;
|
||||
|
||||
/**
|
||||
* The playling length of the playlist.
|
||||
*/
|
||||
|
@ -163,6 +168,18 @@ class Playlist : public Configurable,
|
|||
Ptr<Playlist>::Ref savedCopy;
|
||||
|
||||
|
||||
/**
|
||||
* The type for storing the metadata.
|
||||
*/
|
||||
typedef std::map<const std::string, Ptr<UnicodeString>::Ref>
|
||||
metadataType;
|
||||
|
||||
/**
|
||||
* The metadata for this playlist.
|
||||
*/
|
||||
metadataType metadata;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -174,6 +191,29 @@ class Playlist : public Configurable,
|
|||
this->isLockedForEditing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a playlist by specifying all details, except the title.
|
||||
* This is used for testing purposes.
|
||||
*
|
||||
* @param id the id of the playlist.
|
||||
* @param playlength the playing length of the playlist.
|
||||
* @param uri the location of the SMIL file representing this
|
||||
* playlist (optional)
|
||||
*/
|
||||
Playlist(Ptr<UniqueId>::Ref id,
|
||||
Ptr<time_duration>::Ref playlength,
|
||||
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
|
||||
throw ()
|
||||
{
|
||||
this->id = id;
|
||||
this->title.reset(new UnicodeString(""));
|
||||
this->playlength = playlength;
|
||||
this->uri = uri;
|
||||
elementList.reset(new PlaylistElementListType);
|
||||
this->isLockedForPlaying = false;
|
||||
this->isLockedForEditing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a playlist by specifying all details.
|
||||
* This is used for testing purposes.
|
||||
|
@ -183,12 +223,14 @@ class Playlist : public Configurable,
|
|||
* @param uri the location of the SMIL file representing this
|
||||
* playlist (optional)
|
||||
*/
|
||||
Playlist(Ptr<UniqueId>::Ref id,
|
||||
Ptr<time_duration>::Ref playlength,
|
||||
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
|
||||
Playlist(Ptr<UniqueId>::Ref id,
|
||||
Ptr<UnicodeString>::Ref title,
|
||||
Ptr<time_duration>::Ref playlength,
|
||||
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
|
||||
throw ()
|
||||
{
|
||||
this->id = id;
|
||||
this->title = title;
|
||||
this->playlength = playlength;
|
||||
this->uri = uri;
|
||||
elementList.reset(new PlaylistElementListType);
|
||||
|
@ -491,7 +533,56 @@ class Playlist : public Configurable,
|
|||
* saved copy, do nothing and throw an exception.
|
||||
*/
|
||||
void
|
||||
revertToSavedCopy(void) throw (std::logic_error);
|
||||
revertToSavedCopy(void) throw (std::invalid_argument);
|
||||
|
||||
|
||||
/**
|
||||
* Return the title of this playlist.
|
||||
*
|
||||
* @return the title.
|
||||
*/
|
||||
virtual Ptr<UnicodeString>::Ref
|
||||
getTitle(void) const throw ()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the title of this playlist.
|
||||
*
|
||||
* @param title a new title.
|
||||
*/
|
||||
virtual void
|
||||
setTitle(Ptr<UnicodeString>::Ref title)
|
||||
throw ()
|
||||
{
|
||||
this->title = title;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of a metadata field in this playlist.
|
||||
*
|
||||
* Currently, this always returns a null pointer.
|
||||
*
|
||||
* @return the value of the metadata field; 0 if there is
|
||||
* no such field;
|
||||
*/
|
||||
virtual Ptr<UnicodeString>::Ref
|
||||
getMetadata(const string &key) const
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Set the value of a metadata field in this playlist.
|
||||
*
|
||||
* Currently, this does not do anything.
|
||||
*
|
||||
* @param key the name of the metadata field.
|
||||
* @param value the new value of the metadata field.
|
||||
*/
|
||||
virtual void
|
||||
setMetadata(const string &key, Ptr<UnicodeString>::Ref value)
|
||||
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/src/AudioClip.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -174,10 +174,40 @@ AudioClip :: configure(const xmlpp::Element & element)
|
|||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create an XML element from this audio clip.
|
||||
* Return the value of a metadata field.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<UnicodeString>::Ref
|
||||
AudioClip :: getMetadata(const string &key) const
|
||||
throw ()
|
||||
{
|
||||
metadataType::const_iterator it = metadata.find(key);
|
||||
|
||||
if (it != metadata.end()) {
|
||||
return it->second;
|
||||
}
|
||||
else {
|
||||
Ptr<UnicodeString>::Ref nullPointer;
|
||||
return nullPointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set the value of a metadata field.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
AudioClip :: setMetadata(const string &key, Ptr<UnicodeString>::Ref value)
|
||||
throw ()
|
||||
{
|
||||
metadata[key] = value;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create an XML document from this audio clip.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<xmlpp::Document>::Ref
|
||||
AudioClip :: getMetadata()
|
||||
AudioClip :: toXml()
|
||||
throw ()
|
||||
{
|
||||
Ptr<xmlpp::Document>::Ref metadata(new xmlpp::Document);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.15 $
|
||||
Version : $Revision: 1.16 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -350,10 +350,10 @@ Playlist::createSavedCopy(void) throw ()
|
|||
* Revert to a saved copy of the playlist.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Playlist::revertToSavedCopy(void) throw (std::logic_error)
|
||||
Playlist::revertToSavedCopy(void) throw (std::invalid_argument)
|
||||
{
|
||||
if (savedCopy == 0) {
|
||||
throw (std::logic_error("playlist has no saved copy"));
|
||||
throw (std::invalid_argument("playlist has no saved copy"));
|
||||
}
|
||||
|
||||
this->id = savedCopy->id;
|
||||
|
@ -364,3 +364,34 @@ Playlist::revertToSavedCopy(void) throw (std::logic_error)
|
|||
|
||||
savedCopy.reset();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return the value of a metadata field.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<UnicodeString>::Ref
|
||||
Playlist :: getMetadata(const string &key) const
|
||||
throw ()
|
||||
{
|
||||
metadataType::const_iterator it = metadata.find(key);
|
||||
|
||||
if (it != metadata.end()) {
|
||||
return it->second;
|
||||
}
|
||||
else {
|
||||
Ptr<UnicodeString>::Ref nullPointer;
|
||||
return nullPointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set the value of a metadata field.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
Playlist :: setMetadata(const string &key, Ptr<UnicodeString>::Ref value)
|
||||
throw ()
|
||||
{
|
||||
metadata[key] = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.13 $
|
||||
Version : $Revision: 1.14 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -260,7 +260,7 @@ PlaylistTest :: savedCopyTest(void)
|
|||
playlist->revertToSavedCopy();
|
||||
CPPUNIT_FAIL("allowed to revert to non-existent state");
|
||||
}
|
||||
catch (std::logic_error &e) {
|
||||
catch (std::invalid_argument &e) {
|
||||
}
|
||||
|
||||
playlist->createSavedCopy();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue