added playlist to SMIL conversion to Playlist class
added releasePlaylist and and releaseAudioClip to TestStorageClient
This commit is contained in:
parent
ecd2c3d55c
commit
057da6a786
|
@ -22,10 +22,12 @@
|
||||||
|
|
||||||
<playlist id="1" playlength="01:30:00.000">
|
<playlist id="1" playlength="01:30:00.000">
|
||||||
<playlistElement id="101" relativeOffset="0" >
|
<playlistElement id="101" relativeOffset="0" >
|
||||||
<audioClip id="10001" playlength="01:00:00.000" uri="file:var/test1.mp3"/>
|
<audioClip id="10001" playlength="01:00:00.000"
|
||||||
|
uri="file:var/test1.mp3"/>
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
||||||
<audioClip id="10002" playlength="00:30:00.000" uri="file:var/test2.mp3"/>
|
<audioClip id="10002" playlength="00:30:00.000"
|
||||||
|
uri="file:var/test2.mp3"/>
|
||||||
<fadeInfo id="9901" fadeIn="00:00:02.000"
|
<fadeInfo id="9901" fadeIn="00:00:02.000"
|
||||||
fadeOut="00:00:01.500000" />
|
fadeOut="00:00:01.500000" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.9 $
|
Version : $Revision: 1.10 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
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.
|
* the playlist.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.9 $
|
* @version $Revision: 1.10 $
|
||||||
*/
|
*/
|
||||||
class Playlist : public Configurable
|
class Playlist : public Configurable
|
||||||
{
|
{
|
||||||
|
@ -368,6 +368,13 @@ class Playlist : public Configurable
|
||||||
void
|
void
|
||||||
revertToSavedCopy(void) throw (std::logic_error);
|
revertToSavedCopy(void) throw (std::logic_error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a SMIL XML document representation of the playlist.
|
||||||
|
* The playlist needs to be opened for playing first; otherwise
|
||||||
|
* an exception is thrown.
|
||||||
|
*/
|
||||||
|
Ptr<xmlpp::Document>::Ref
|
||||||
|
toSmil(void) const throw (std::logic_error);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.7 $
|
Version : $Revision: 1.8 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Attic/StorageClientInterface.h,v $
|
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.
|
* An interface for storage clients.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.7 $
|
* @version $Revision: 1.8 $
|
||||||
*/
|
*/
|
||||||
class StorageClientInterface
|
class StorageClientInterface
|
||||||
{
|
{
|
||||||
|
@ -90,6 +90,19 @@ class StorageClientInterface
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
= 0;
|
= 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the lock on a playlist with the specified id.
|
||||||
|
*
|
||||||
|
* @param id the id of the playlist to release.
|
||||||
|
* @exception std::invalid_argument if no playlist with the specified
|
||||||
|
* id exists.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
releasePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
std::logic_error)
|
||||||
|
= 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a playlist with the specified id.
|
* Delete a playlist with the specified id.
|
||||||
*
|
*
|
||||||
|
@ -132,7 +145,7 @@ class StorageClientInterface
|
||||||
/**
|
/**
|
||||||
* Return an audio clip with the specified id.
|
* Return an audio clip with the specified id.
|
||||||
*
|
*
|
||||||
* @param id the id of the playlist to return.
|
* @param id the id of the audio clip to return.
|
||||||
* @return the requested audio clip.
|
* @return the requested audio clip.
|
||||||
* @exception std::invalid_argument if no audio clip with the
|
* @exception std::invalid_argument if no audio clip with the
|
||||||
* specified id exists.
|
* specified id exists.
|
||||||
|
@ -142,6 +155,18 @@ class StorageClientInterface
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
= 0;
|
= 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the lock on an audio clip with the specified id.
|
||||||
|
*
|
||||||
|
* @param id the id of the audio clip to release.
|
||||||
|
* @exception std::invalid_argument if no audio clip with the
|
||||||
|
* specified id exists.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
releaseAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
= 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an audio clip with the specified id.
|
* Delete an audio clip with the specified id.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.8 $
|
Version : $Revision: 1.9 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -66,6 +66,58 @@ static const std::string playlengthAttrName = "playlength";
|
||||||
*/
|
*/
|
||||||
static const std::string elementListAttrName = "playlistElement";
|
static const std::string elementListAttrName = "playlistElement";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The XML version used to create the SMIL file.
|
||||||
|
*/
|
||||||
|
static const std::string xmlVersion = "1.0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the SMIL root node.
|
||||||
|
*/
|
||||||
|
static const std::string smilRootNodeName = "smil";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the SMIL language description attribute.
|
||||||
|
*/
|
||||||
|
static const std::string smilLanguageAttrName = "xmlns";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of the SMIL language description attribute.
|
||||||
|
*/
|
||||||
|
static const std::string smilLanguageAttrValue
|
||||||
|
= "http://www.w3.org/2001/SMIL20/Language";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the SMIL real networks extension attribute.
|
||||||
|
*/
|
||||||
|
static const std::string smilExtensionsAttrName = "xmlns:rn";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of the SMIL real networks extension attribute.
|
||||||
|
*/
|
||||||
|
static const std::string smilExtensionsAttrValue
|
||||||
|
= "http://features.real.com/2001/SMIL20/Extensions";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the body node in the SMIL file.
|
||||||
|
*/
|
||||||
|
static const std::string smilBodyNodeName = "body";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the sequential audio clip list node in the SMIL file.
|
||||||
|
*/
|
||||||
|
static const std::string smilSeqNodeName = "seq";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the audio clip element node in the SMIL file.
|
||||||
|
*/
|
||||||
|
static const std::string smilAudioClipNodeName = "audio";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute containing the URI of the audio clip element.
|
||||||
|
*/
|
||||||
|
static const std::string smilAudioClipUriAttrName = "src";
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -314,3 +366,42 @@ Playlist::revertToSavedCopy(void) throw (std::logic_error)
|
||||||
|
|
||||||
savedCopy.reset();
|
savedCopy.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Return a SMIL XML element representation of the playlist.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<xmlpp::Document>::Ref
|
||||||
|
Playlist::toSmil(void) const throw (std::logic_error)
|
||||||
|
{
|
||||||
|
if (!isLockedForPlaying) {
|
||||||
|
throw (std::logic_error("playlist not open for playing"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<xmlpp::Document>::Ref
|
||||||
|
smilDocument(new xmlpp::Document(xmlVersion));
|
||||||
|
xmlpp::Element * smilRootNode
|
||||||
|
= smilDocument->create_root_node(smilRootNodeName);
|
||||||
|
smilRootNode->set_attribute(smilLanguageAttrName,
|
||||||
|
smilLanguageAttrValue);
|
||||||
|
smilRootNode->set_attribute(smilExtensionsAttrName,
|
||||||
|
smilExtensionsAttrValue);
|
||||||
|
|
||||||
|
xmlpp::Element * smilBodyNode
|
||||||
|
= smilRootNode->add_child(smilBodyNodeName);
|
||||||
|
xmlpp::Element * smilSeqNode
|
||||||
|
= smilBodyNode->add_child(smilSeqNodeName);
|
||||||
|
|
||||||
|
PlaylistElementListType::const_iterator it = elementList->begin();
|
||||||
|
|
||||||
|
while (it != elementList->end()) {
|
||||||
|
xmlpp::Element * smilAudioClipNode
|
||||||
|
= smilSeqNode->add_child(smilAudioClipNodeName);
|
||||||
|
smilAudioClipNode->set_attribute(
|
||||||
|
smilAudioClipUriAttrName,
|
||||||
|
*(it->second->getAudioClip()->getUri()));
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
return smilDocument;
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.9 $
|
Version : $Revision: 1.10 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -63,6 +63,21 @@ CPPUNIT_TEST_SUITE_REGISTRATION(PlaylistTest);
|
||||||
*/
|
*/
|
||||||
static const std::string configFileName = "etc/playlist.xml";
|
static const std::string configFileName = "etc/playlist.xml";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The playlist in SMIL XML format.
|
||||||
|
*/
|
||||||
|
static const std::string smilPlaylist =
|
||||||
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
|
"<smil xmlns=\"http://www.w3.org/2001/SMIL20/Language\""
|
||||||
|
" xmlns:rn=\"http://features.real.com/2001/SMIL20/Extensions\">\n"
|
||||||
|
" <body>\n"
|
||||||
|
" <seq>\n"
|
||||||
|
" <audio src=\"file:var/test1.mp3\"/>\n"
|
||||||
|
" <audio src=\"file:var/test2.mp3\"/>\n"
|
||||||
|
" </seq>\n"
|
||||||
|
" </body>\n"
|
||||||
|
"</smil>\n";
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -354,3 +369,26 @@ PlaylistTest :: fadeInfoTest(void)
|
||||||
catch (std::invalid_argument &e) {
|
catch (std::invalid_argument &e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Check if the conversion to SMIL works
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistTest :: toSmilTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
playlist->setLockedForPlaying(true);
|
||||||
|
|
||||||
|
std::string newSmilPlaylist;
|
||||||
|
try {
|
||||||
|
newSmilPlaylist = playlist->toSmil()
|
||||||
|
->write_to_string_formatted("UTF-8");
|
||||||
|
}
|
||||||
|
catch (std::logic_error &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(newSmilPlaylist == smilPlaylist);
|
||||||
|
|
||||||
|
playlist->setLockedForPlaying(true);
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -58,7 +58,7 @@ namespace Core {
|
||||||
* Unit test for the UploadPlaylistMetohd class.
|
* Unit test for the UploadPlaylistMetohd class.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.7 $
|
||||||
* @see Playlist
|
* @see Playlist
|
||||||
*/
|
*/
|
||||||
class PlaylistTest : public CPPUNIT_NS::TestFixture
|
class PlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
|
@ -69,6 +69,7 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
CPPUNIT_TEST(audioClipTest);
|
CPPUNIT_TEST(audioClipTest);
|
||||||
CPPUNIT_TEST(savedCopyTest);
|
CPPUNIT_TEST(savedCopyTest);
|
||||||
CPPUNIT_TEST(fadeInfoTest);
|
CPPUNIT_TEST(fadeInfoTest);
|
||||||
|
CPPUNIT_TEST(toSmilTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -120,6 +121,14 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
void
|
void
|
||||||
fadeInfoTest(void) throw (CPPUNIT_NS::Exception);
|
fadeInfoTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the conversion to SMIL works.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
toSmilTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,18 @@
|
||||||
<!ELEMENT audioClip EMPTY >
|
<!ELEMENT audioClip EMPTY >
|
||||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST audioClip uri CDATA #REQUIRED >
|
||||||
]>
|
]>
|
||||||
<storageClientFactory>
|
<storageClientFactory>
|
||||||
<testStorage>
|
<testStorage>
|
||||||
<playlist id="1" playlength="01:30:00.000">
|
<playlist id="1" playlength="01:30:00.000">
|
||||||
<playlistElement id="101" relativeOffset="0" >
|
<playlistElement id="101" relativeOffset="0" >
|
||||||
<audioClip id="10001" playlength="01:00:00.000"/>
|
<audioClip id="10001" playlength="01:00:00.000"
|
||||||
|
uri="file:var/test1.mp3" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
||||||
<audioClip id="10002" playlength="00:30:00.000"/>
|
<audioClip id="10002" playlength="00:30:00.000"
|
||||||
|
uri="file:var/test2.mp3" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
</playlist>
|
</playlist>
|
||||||
</testStorage>
|
</testStorage>
|
||||||
|
|
|
@ -14,16 +14,21 @@
|
||||||
<!ELEMENT audioClip EMPTY >
|
<!ELEMENT audioClip EMPTY >
|
||||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST audioClip uri CDATA #REQUIRED >
|
||||||
]>
|
]>
|
||||||
<testStorage>
|
<testStorage>
|
||||||
<playlist id="1" playlength="01:30:00.000">
|
<playlist id="1" playlength="01:30:00.000">
|
||||||
<playlistElement id="101" relativeOffset="0" >
|
<playlistElement id="101" relativeOffset="0" >
|
||||||
<audioClip id="10001" playlength="01:00:00.000"/>
|
<audioClip id="10001" playlength="01:00:00.000"
|
||||||
|
uri="file:var/test1.mp3" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
||||||
<audioClip id="10002" playlength="00:30:00.000"/>
|
<audioClip id="10002" playlength="00:30:00.000"
|
||||||
|
uri="file:var/test2.mp3" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
</playlist>
|
</playlist>
|
||||||
<audioClip id="10001" playlength="01:00:00.000"/>
|
<audioClip id="10001" playlength="01:00:00.000"
|
||||||
<audioClip id="10002" playlength="00:30:00.000"/>
|
uri="file:var/test1.mp3" />
|
||||||
|
<audioClip id="10002" playlength="00:30:00.000"
|
||||||
|
uri="file:var/test2.mp3" />
|
||||||
</testStorage>
|
</testStorage>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -133,6 +133,42 @@ TestStorageClient :: getPlaylist(Ptr<const UniqueId>::Ref id) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Release a playlist.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
TestStorageClient :: releasePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
std::logic_error)
|
||||||
|
{
|
||||||
|
PlaylistMap::const_iterator it = playlistMap.find(id->getId());
|
||||||
|
|
||||||
|
if (it == playlistMap.end()) {
|
||||||
|
throw std::invalid_argument("no such playlist");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<Playlist>::Ref playlist = it->second;
|
||||||
|
if (playlist->isLocked()) {
|
||||||
|
throw std::logic_error("playlist is locked");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
Playlist::const_iterator playlistIt = playlist->begin();
|
||||||
|
while (playlistIt != playlist->end()) {
|
||||||
|
try {
|
||||||
|
releaseAudioClip(playlistIt->second->getAudioClip()->getId());
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
++playlistIt;
|
||||||
|
}
|
||||||
|
if (!success) {
|
||||||
|
throw std::logic_error("some audio clips in playlist do not exist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Delete a playlist.
|
* Delete a playlist.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -218,6 +254,21 @@ TestStorageClient :: getAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Release an audio clip.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
TestStorageClient :: releaseAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
AudioClipMap::const_iterator it = audioClipMap.find(id->getId());
|
||||||
|
|
||||||
|
if (it == audioClipMap.end()) {
|
||||||
|
throw std::invalid_argument("no such audio clip");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Delete an audio clip.
|
* Delete an audio clip.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.7 $
|
Version : $Revision: 1.8 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -67,7 +67,7 @@ using namespace LiveSupport::Core;
|
||||||
* A dummy storage client, only used for test purposes.
|
* A dummy storage client, only used for test purposes.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.7 $
|
* @version $Revision: 1.8 $
|
||||||
*/
|
*/
|
||||||
class TestStorageClient :
|
class TestStorageClient :
|
||||||
virtual public Configurable,
|
virtual public Configurable,
|
||||||
|
@ -160,6 +160,19 @@ class TestStorageClient :
|
||||||
getPlaylist(Ptr<const UniqueId>::Ref id) const
|
getPlaylist(Ptr<const UniqueId>::Ref id) const
|
||||||
throw (std::invalid_argument);
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the lock on a playlist with the specified id.
|
||||||
|
* At this point, this does not do anything.
|
||||||
|
*
|
||||||
|
* @param id the id of the playlist to release.
|
||||||
|
* @exception std::invalid_argument if no playlist with the specified
|
||||||
|
* specified id exists.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
releasePlaylist(Ptr<const UniqueId>::Ref id) const
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
std::logic_error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the playlist with the specified id.
|
* Delete the playlist with the specified id.
|
||||||
*
|
*
|
||||||
|
@ -210,6 +223,18 @@ class TestStorageClient :
|
||||||
getAudioClip(Ptr<const UniqueId>::Ref id) const
|
getAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||||
throw (std::invalid_argument);
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the lock on an audio clip with the specified id.
|
||||||
|
* At this point, this does not do anything.
|
||||||
|
*
|
||||||
|
* @param id the id of the audio clip to release.
|
||||||
|
* @exception std::invalid_argument if no audio clip with the
|
||||||
|
* specified id exists.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
releaseAudioClip(Ptr<const UniqueId>::Ref id) const
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the audio clip with the specified id.
|
* Delete the audio clip with the specified id.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -116,6 +116,32 @@ TestStorageClientTest :: firstTest(void)
|
||||||
|
|
||||||
Ptr<Playlist>::Ref playlist = tsc->getPlaylist(id1);
|
Ptr<Playlist>::Ref playlist = tsc->getPlaylist(id1);
|
||||||
CPPUNIT_ASSERT(playlist->getId()->getId() == id1->getId());
|
CPPUNIT_ASSERT(playlist->getId()->getId() == id1->getId());
|
||||||
|
|
||||||
|
try {
|
||||||
|
tsc->releasePlaylist(id1);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
std::string eMsg = "could not release playlist: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
CPPUNIT_FAIL(eMsg);
|
||||||
|
}
|
||||||
|
catch (std::logic_error &e) {
|
||||||
|
std::string eMsg = "could not release playlist: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
CPPUNIT_FAIL(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
tsc->releasePlaylist(id2);
|
||||||
|
CPPUNIT_FAIL("allowed to release non-existent playlist");
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
}
|
||||||
|
catch (std::logic_error &e) {
|
||||||
|
std::string eMsg = "release of non-existent playlist reports: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
CPPUNIT_FAIL(eMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -5,20 +5,30 @@
|
||||||
<!ATTLIST playlist id NMTOKEN #REQUIRED >
|
<!ATTLIST playlist id NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST playlist playlength NMTOKEN #REQUIRED >
|
<!ATTLIST playlist playlength NMTOKEN #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT playlistElement (audioClip) >
|
<!ELEMENT playlistElement (audioClip, fadeInfo?) >
|
||||||
<!ATTLIST playlistElement id NMTOKEN #REQUIRED >
|
<!ATTLIST playlistElement id NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST playlistElement relativeOffset NMTOKEN #REQUIRED >
|
<!ATTLIST playlistElement relativeOffset NMTOKEN #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT audioClip EMPTY >
|
<!ELEMENT audioClip EMPTY >
|
||||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST audioClip uri CDATA #REQUIRED >
|
||||||
|
|
||||||
|
<!ELEMENT fadeInfo EMPTY >
|
||||||
|
<!ATTLIST fadeInfo id NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeOut NMTOKEN #REQUIRED >
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<playlist id="1" playlength="01:30:00.000">
|
<playlist id="1" playlength="01:30:00.000">
|
||||||
<playlistElement id="101" relativeOffset="0" >
|
<playlistElement id="101" relativeOffset="0" >
|
||||||
<audioClip id="10001" playlength="01:00:00.000"/>
|
<audioClip id="10001" playlength="01:00:00.000"
|
||||||
|
uri="file:var/test1.mp3"/>
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
||||||
<audioClip id="10002" playlength="00:30:00.000"/>
|
<audioClip id="10002" playlength="00:30:00.000"
|
||||||
|
uri="file:var/test2.mp3"/>
|
||||||
|
<fadeInfo id="9901" fadeIn="00:00:02.000"
|
||||||
|
fadeOut="00:00:01.500000" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
</playlist>
|
</playlist>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<!ELEMENT audioClip EMPTY >
|
<!ELEMENT audioClip EMPTY >
|
||||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST audioClip uri CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT fadeInfo EMPTY >
|
<!ELEMENT fadeInfo EMPTY >
|
||||||
<!ATTLIST fadeInfo id NMTOKEN #REQUIRED >
|
<!ATTLIST fadeInfo id NMTOKEN #REQUIRED >
|
||||||
|
@ -26,15 +27,17 @@
|
||||||
<testStorage>
|
<testStorage>
|
||||||
<playlist id="1" playlength="01:30:00.000">
|
<playlist id="1" playlength="01:30:00.000">
|
||||||
<playlistElement id="101" relativeOffset="0" >
|
<playlistElement id="101" relativeOffset="0" >
|
||||||
<audioClip id="10001" playlength="01:00:00.000"/>
|
<audioClip id="10001" playlength="01:00:00.000"
|
||||||
|
uri="file:var/test1.mp3" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
<playlistElement id="102" relativeOffset="01:00:00.000" >
|
||||||
<audioClip id="10002" playlength="00:30:00.000"/>
|
<audioClip id="10002" playlength="00:30:00.000"
|
||||||
<fadeInfo id="9901" fadeIn="00:00:02.000"
|
uri="file:var/test2.mp3" />
|
||||||
fadeOut="00:00:01.500000" />
|
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
</playlist>
|
</playlist>
|
||||||
<audioClip id="10001" playlength="01:00:00.000"/>
|
<audioClip id="10001" playlength="01:00:00.000"
|
||||||
<audioClip id="10002" playlength="00:30:00.000"/>
|
uri="file:var/test1.mp3" />
|
||||||
|
<audioClip id="10002" playlength="00:30:00.000"
|
||||||
|
uri="file:var/test2.mp3" />
|
||||||
</testStorage>
|
</testStorage>
|
||||||
</storageClientFactory>
|
</storageClientFactory>
|
||||||
|
|
Loading…
Reference in New Issue