From 0e0d7335a1ed36b612f06856e62612f4294f938b Mon Sep 17 00:00:00 2001 From: fgerlits Date: Tue, 9 Nov 2004 16:05:44 +0000 Subject: [PATCH] rewrote acquire/release methods in TestStorageClient --- .../core/include/LiveSupport/Core/AudioClip.h | 17 +++++++-- .../core/include/LiveSupport/Core/Playlist.h | 37 +++++++++++++++++-- .../LiveSupport/Core/StorageClientInterface.h | 32 ++++++++-------- livesupport/modules/core/src/Playlist.cxx | 4 +- 4 files changed, 66 insertions(+), 24 deletions(-) diff --git a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h index 2813676ef..0d1dcc58b 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h +++ b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h @@ -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/AudioClip.h,v $ ------------------------------------------------------------------------------*/ @@ -72,7 +72,7 @@ using namespace boost::posix_time; * in a Playlist. * * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class AudioClip : public Configurable { @@ -115,7 +115,8 @@ class AudioClip : public Configurable */ AudioClip(Ptr::Ref id, Ptr::Ref playlength, - Ptr::Ref uri = Ptr::Ref()) throw () + Ptr::Ref uri = Ptr::Ref()) + throw () { this->id = id; this->playlength = playlength; @@ -188,6 +189,16 @@ class AudioClip : public Configurable return uri; } + /** + * Change the URI of this audio clip. This is only used in testing. + * + * @return the URI of this audio clip. + */ + void + setUri(Ptr::Ref uri) throw () + { + this->uri = uri; + } }; diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index ebc3bae90..229f9fdd1 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.12 $ + Version : $Revision: 1.13 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -71,7 +71,7 @@ using namespace boost::posix_time; * the playlist. * * @author $Author: fgerlits $ - * @version $Revision: 1.12 $ + * @version $Revision: 1.13 $ */ class Playlist : public Configurable { @@ -91,6 +91,11 @@ class Playlist : public Configurable */ Ptr::Ref playlength; + /** + * The uri of the SMIL file generated from this playlist (if any). + */ + Ptr::Ref uri; + /** * Flag set if playlist is currently playing. */ @@ -136,6 +141,7 @@ class Playlist : public Configurable */ Playlist(void) throw () { + elementList.reset(new PlaylistElementListType); this->isLockedForPlaying = false; this->isLockedForEditing = false; } @@ -148,10 +154,14 @@ class Playlist : public Configurable * @param playlength the playing length of the playlist. */ Playlist(Ptr::Ref id, - Ptr::Ref playlength) throw () + Ptr::Ref playlength, + Ptr::Ref uri = Ptr::Ref()) + throw () { this->id = id; this->playlength = playlength; + this->uri = uri; + elementList.reset(new PlaylistElementListType); this->isLockedForPlaying = false; this->isLockedForEditing = false; } @@ -211,6 +221,27 @@ class Playlist : public Configurable return playlength; } + /** + * Return the uri of the playlist. + * + * @return the uri of the playlist. + */ + Ptr::Ref + getUri(void) const throw () + { + return uri; + } + + /** + * Set the uri of the playlist. + * + */ + void + setUri(Ptr::Ref uri) throw () + { + this->uri = uri; + } + /** * Test whether the playlist is locked for editing or playing. * diff --git a/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.h b/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.h index 221c14855..95668c7da 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.h +++ b/livesupport/modules/core/include/LiveSupport/Core/StorageClientInterface.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/Attic/StorageClientInterface.h,v $ ------------------------------------------------------------------------------*/ @@ -61,7 +61,7 @@ namespace Core { * An interface for storage clients. * * @author $Author: fgerlits $ - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ class StorageClientInterface { @@ -94,12 +94,13 @@ class StorageClientInterface * Acquire the resources for the playlist. * * @param id the id of the playlist to acquire. - * @return a path (in the local storage) to the Playlist SMIL - * temp file. + * @return a new Playlist instance containing a uri field which + * points to an executable (playable) SMIL representation of + * the playlist (in the local storage). * @exception std::invalid_argument if no playlist with the specified * specified id exists. */ - virtual Ptr::Ref + virtual Ptr::Ref acquirePlaylist(Ptr::Ref id) const throw (std::logic_error) = 0; @@ -108,12 +109,12 @@ class StorageClientInterface * Release the resources (audio clips, other playlists) used * in a playlist. * - * @param id the id of the playlist to release. - * @exception std::invalid_argument if no playlist with the specified - * specified id exists. + * @param playlist the playlist to release. + * @exception std::logic_error if the playlist has no uri field, + * or the file does not exist, etc. */ virtual void - releasePlaylist(Ptr::Ref id) const + releasePlaylist(Ptr::Ref playlist) const throw (std::logic_error) = 0; /** @@ -172,24 +173,25 @@ class StorageClientInterface * Acquire the resources for the audio clip with the specified id. * * @param id the id of the audio clip to acquire. - * @return a URI to the audio clip. + * @return a new AudioClip instance, containing a uri field which + * points to (a way of getting) the sound file. * @exception std::invalid_argument if no audio clip with the * specified id exists. */ - virtual Ptr::Ref + virtual Ptr::Ref acquireAudioClip(Ptr::Ref id) const throw (std::logic_error) = 0; /** - * Release the lock on an audio clip with the specified id. + * Release the resource (sound file) used by an audio clip. * * @param id the id of the audio clip to release. - * @exception std::invalid_argument if no audio clip with the - * specified id exists. + * @exception std::logic_error if the audio clip has no uri field, + * or the file does not exist, etc. */ virtual void - releaseAudioClip(Ptr::Ref id) const + releaseAudioClip(Ptr::Ref audioClip) const throw (std::logic_error) = 0; diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index fdd928aae..3289e2dc5 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.11 $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -158,7 +158,6 @@ Playlist :: configure(const xmlpp::Element & element) playlength.reset(new time_duration( duration_from_string(attribute->get_value()))); - elementList.reset(new PlaylistElementListType); xmlpp::Node::NodeList childNodes = element.get_children(elementListAttrName); xmlpp::Node::NodeList::iterator it = childNodes.begin(); @@ -212,7 +211,6 @@ Playlist::addAudioClip(Ptr::Ref audioClip, Ptr::Ref playlistElement(new PlaylistElement( relativeOffset, audioClip, fadeInfo)); - (*elementList)[*relativeOffset] = playlistElement; }