added FadeInfo methods
This commit is contained in:
parent
b2e359ac21
commit
8e121e1a47
|
@ -14,7 +14,7 @@ Development Loan Fund</a>, under the GNU <a
|
||||||
href="http://www.gnu.org/licenses/gpl.html">GPL</a>.<br>
|
href="http://www.gnu.org/licenses/gpl.html">GPL</a>.<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Author: $Author: fgerlits $</li>
|
<li>Author: $Author: fgerlits $</li>
|
||||||
<li>Version: $Revision: 1.6 $</li>
|
<li>Version: $Revision: 1.7 $</li>
|
||||||
<li>Location: $Source:
|
<li>Location: $Source:
|
||||||
/home/cvs/livesupport/doc/model/Scheduler/index.html,v $</li>
|
/home/cvs/livesupport/doc/model/Scheduler/index.html,v $</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -3229,8 +3229,9 @@ with the Playlist is removed, with the related FadeInfo instances<br>
|
||||||
<td valign="top"><b>Name</b><br>
|
<td valign="top"><b>Name</b><br>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" rowspan="1" valign="top">updateFadeInFadeOut<br>
|
<td colspan="2" rowspan="1" valign="top">updateFadeInFadeOut<br>
|
||||||
(audioClip : AudioClip,<br>
|
(playlist : Playlist,<br>
|
||||||
playlist : Playlist)<br>
|
relativeOffset: Time,<br>
|
||||||
|
fadeInfo: FadeInfo)<br>
|
||||||
: void<br>
|
: void<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -3238,7 +3239,8 @@ playlist : Playlist)<br>
|
||||||
<td valign="top"><b>Responsibilities</b><br>
|
<td valign="top"><b>Responsibilities</b><br>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" rowspan="1" valign="top">Update the fade-in and
|
<td colspan="2" rowspan="1" valign="top">Update the fade-in and
|
||||||
fade-out parameters for an audio clip playing in a playlist.<br>
|
fade-out parameters for an audio clip in a playlist, the start time of which
|
||||||
|
is at a given relative offset.<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -3262,8 +3264,9 @@ fade-out parameters for an audio clip playing in a playlist.<br>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top"><b>Exceptions</b><br>
|
<td valign="top"><b>Exceptions</b><br>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" rowspan="1" valign="top">If the Audio clip is not
|
<td colspan="2" rowspan="1" valign="top">If there is no Audio clip
|
||||||
in the playlist, indicate as an error.<br>
|
with a start time at the given relative offset in the playlist, indicate
|
||||||
|
as an error.<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -21,7 +21,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/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -86,10 +86,12 @@ LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} -L${LIB_DIR}
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \
|
CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \
|
||||||
${TMP_DIR}/AudioClip.o \
|
${TMP_DIR}/AudioClip.o \
|
||||||
|
${TMP_DIR}/FadeInfo.o \
|
||||||
${TMP_DIR}/PlaylistElement.o \
|
${TMP_DIR}/PlaylistElement.o \
|
||||||
${TMP_DIR}/Playlist.o
|
${TMP_DIR}/Playlist.o
|
||||||
|
|
||||||
TEST_RUNNER_OBJS = ${TMP_DIR}/AudioClipTest.o \
|
TEST_RUNNER_OBJS = ${TMP_DIR}/AudioClipTest.o \
|
||||||
|
${TMP_DIR}/FadeInfoTest.o \
|
||||||
${TMP_DIR}/PlaylistElementTest.o \
|
${TMP_DIR}/PlaylistElementTest.o \
|
||||||
${TMP_DIR}/PlaylistTest.o \
|
${TMP_DIR}/PlaylistTest.o \
|
||||||
${TMP_DIR}/TestRunner.o
|
${TMP_DIR}/TestRunner.o
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!DOCTYPE fadeInfo [
|
||||||
|
|
||||||
|
<!ELEMENT fadeInfo EMPTY >
|
||||||
|
<!ATTLIST fadeInfo id NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeOut NMTOKEN #REQUIRED >
|
||||||
|
]>
|
||||||
|
<fadeInfo id="9901" fadeIn="00:00:02.000" fadeOut="00:00:01.500"/>
|
|
@ -5,20 +5,27 @@
|
||||||
<!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 >
|
||||||
|
|
||||||
|
<!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"/>
|
||||||
</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"
|
||||||
|
fadeOut="00:00:01.500000" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
</playlist>
|
</playlist>
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!DOCTYPE playlistElement [
|
<!DOCTYPE playlistElement [
|
||||||
|
|
||||||
<!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 >
|
||||||
|
|
||||||
|
<!ELEMENT fadeInfo EMPTY >
|
||||||
|
<!ATTLIST fadeInfo id NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeOut NMTOKEN #REQUIRED >
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<playlistElement id="707" relativeOffset="00:12:34.000" >
|
<playlistElement id="707" relativeOffset="00:12:34.000" >
|
||||||
<audioClip id="10001" playlength="01:00:00.000"/>
|
<audioClip id="10001" playlength="01:00:00.000" />
|
||||||
</playlistElement>
|
<fadeInfo id="9901" fadeIn="00:00:02.000" fadeOut="00:00:01.500000" />
|
||||||
|
</playlistElement >
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
|
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.
|
* in a Playlist.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.2 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
class AudioClip : public Configurable
|
class AudioClip : public Configurable
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ class AudioClip : public Configurable
|
||||||
/**
|
/**
|
||||||
* Return the total playing length for this audio clip.
|
* Return the total playing length for this audio clip.
|
||||||
*
|
*
|
||||||
* @return the playing length of this audio clip, in milliseconds.
|
* @return the playing length of this audio clip, in microseconds.
|
||||||
*/
|
*/
|
||||||
Ptr<const time_duration>::Ref
|
Ptr<const time_duration>::Ref
|
||||||
getPlaylength(void) const throw ()
|
getPlaylength(void) const throw ()
|
||||||
|
|
|
@ -0,0 +1,216 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/FadeInfo.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_FadeInfo_h
|
||||||
|
#define LiveSupport_Core_FadeInfo_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <libxml++/libxml++.h>
|
||||||
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "LiveSupport/Core/UniqueId.h"
|
||||||
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing fade in / fade out information of a playlist element.
|
||||||
|
* These are contained in a PlaylistElement, a list of which, in turn, is
|
||||||
|
* contained in a Playlist.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class FadeInfo : public Configurable
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The name of the configuration XML elmenent used by FadeInfo.
|
||||||
|
*/
|
||||||
|
static const std::string configElementNameStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique id of the fade info.
|
||||||
|
*/
|
||||||
|
Ptr<UniqueId>::Ref id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The length of fade in period.
|
||||||
|
*/
|
||||||
|
Ptr<time_duration>::Ref fadeIn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The length of fade out period.
|
||||||
|
*/
|
||||||
|
Ptr<time_duration>::Ref fadeOut;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
FadeInfo(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a fade info instance by specifying all details.
|
||||||
|
* This is used for testing purposes.
|
||||||
|
*
|
||||||
|
* @param id the id of the fade info.
|
||||||
|
* @param fadeIn the length of the fade in period.
|
||||||
|
* @param fadeOut the length of the fade in period.
|
||||||
|
*/
|
||||||
|
FadeInfo(Ptr<UniqueId>::Ref id,
|
||||||
|
Ptr<time_duration>::Ref fadeIn,
|
||||||
|
Ptr<time_duration>::Ref fadeOut) throw()
|
||||||
|
{
|
||||||
|
this->id = id;
|
||||||
|
this->fadeIn = fadeIn;
|
||||||
|
this->fadeOut = fadeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a fade info instance by specifying the fade in and fade out.
|
||||||
|
*
|
||||||
|
* @param fadeIn the length of the fade in period.
|
||||||
|
* @param fadeOut the length of the fade in period.
|
||||||
|
*/
|
||||||
|
FadeInfo(Ptr<time_duration>::Ref fadeIn,
|
||||||
|
Ptr<time_duration>::Ref fadeOut) throw()
|
||||||
|
{
|
||||||
|
this->id = UniqueId::generateId();
|
||||||
|
this->fadeIn = fadeIn;
|
||||||
|
this->fadeOut = fadeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~FadeInfo(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the XML element this object expects
|
||||||
|
* to be sent to a call to configure().
|
||||||
|
*
|
||||||
|
* @return the name of the expected XML configuration element.
|
||||||
|
*/
|
||||||
|
static const std::string
|
||||||
|
getConfigElementName(void) throw ()
|
||||||
|
{
|
||||||
|
return configElementNameStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the object based on the XML element supplied.
|
||||||
|
* The supplied element is expected to be of the name
|
||||||
|
* returned by configElementName().
|
||||||
|
*
|
||||||
|
* @param element the XML element to configure the object from.
|
||||||
|
* @exception std::invalid_argument if the supplied XML element
|
||||||
|
* contains bad configuraiton information
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the id of the fade info instance.
|
||||||
|
*
|
||||||
|
* @return the unique id of the fade info instance.
|
||||||
|
*/
|
||||||
|
Ptr<const UniqueId>::Ref
|
||||||
|
getId(void) const throw ()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the length of the fade in period.
|
||||||
|
*
|
||||||
|
* @return the length of the fade in period, in microseconds.
|
||||||
|
*/
|
||||||
|
Ptr<const time_duration>::Ref
|
||||||
|
getFadeIn(void) const throw ()
|
||||||
|
{
|
||||||
|
return fadeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the length of the fade in period.
|
||||||
|
*
|
||||||
|
* @return the length of the fade in period, in microseconds.
|
||||||
|
*/
|
||||||
|
Ptr<const time_duration>::Ref
|
||||||
|
getFadeOut(void) const throw ()
|
||||||
|
{
|
||||||
|
return fadeOut;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_FadeInfo_h
|
||||||
|
|
|
@ -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/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.8 $
|
* @version $Revision: 1.9 $
|
||||||
*/
|
*/
|
||||||
class Playlist : public Configurable
|
class Playlist : public Configurable
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ class Playlist : public Configurable
|
||||||
/**
|
/**
|
||||||
* Return the total playing length for this playlist.
|
* Return the total playing length for this playlist.
|
||||||
*
|
*
|
||||||
* @return the playling length of this playlist, in milliseconds.
|
* @return the playling length of this playlist, in microseconds.
|
||||||
*/
|
*/
|
||||||
Ptr<const time_duration>::Ref
|
Ptr<const time_duration>::Ref
|
||||||
getPlaylength(void) const throw ()
|
getPlaylength(void) const throw ()
|
||||||
|
@ -278,18 +278,50 @@ class Playlist : public Configurable
|
||||||
return elementList->end();
|
return elementList->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an iterator pointing to a playlist element at a given
|
||||||
|
* relative offset.
|
||||||
|
* @param relativeOffset (a pointer to) the relative offset where
|
||||||
|
* the playlist element is.
|
||||||
|
* @return a constant iterator to the playlist element if it exists,
|
||||||
|
* or playlist->end() if it does not.
|
||||||
|
*/
|
||||||
|
const_iterator
|
||||||
|
find(Ptr<const time_duration>::Ref relativeOffset) const
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
return elementList->find(*relativeOffset);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new audio clip to the playlist.
|
* Add a new audio clip to the playlist.
|
||||||
*
|
*
|
||||||
|
* @param audioClip the new audio clip to be added
|
||||||
* @param relativeOffset the start of the audio clip, relative
|
* @param relativeOffset the start of the audio clip, relative
|
||||||
* to the start of the playlist
|
* to the start of the playlist
|
||||||
* @param audioClip the new audio clip to be added
|
* @param fadeInfo the fade in / fade out info (optional)
|
||||||
* @exception std::invalid_argument if the playlist already contains
|
* @exception std::invalid_argument if the playlist already contains
|
||||||
* an audio clip with the same relative offset
|
* an audio clip with the same relative offset
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
addAudioClip(Ptr<AudioClip>::Ref audioClip,
|
addAudioClip(Ptr<AudioClip>::Ref audioClip,
|
||||||
Ptr<time_duration>::Ref relativeOffset)
|
Ptr<time_duration>::Ref relativeOffset,
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo
|
||||||
|
= Ptr<FadeInfo>::Ref())
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the fade in / fade out info for a playlist element.
|
||||||
|
*
|
||||||
|
* @param relativeOffset the start of the playlist element, relative
|
||||||
|
* to the start of the playlist
|
||||||
|
* @param fadeInfo the new fade in / fade out info
|
||||||
|
* @exception std::invalid_argument if there is no playlist element
|
||||||
|
* at the given relative offset
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setFadeInfo(Ptr<time_duration>::Ref relativeOffset,
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo)
|
||||||
throw (std::invalid_argument);
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/PlaylistElement.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/PlaylistElement.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -50,6 +50,7 @@
|
||||||
#include "LiveSupport/Core/UniqueId.h"
|
#include "LiveSupport/Core/UniqueId.h"
|
||||||
#include "LiveSupport/Core/Configurable.h"
|
#include "LiveSupport/Core/Configurable.h"
|
||||||
#include "LiveSupport/Core/AudioClip.h"
|
#include "LiveSupport/Core/AudioClip.h"
|
||||||
|
#include "LiveSupport/Core/FadeInfo.h"
|
||||||
|
|
||||||
|
|
||||||
namespace LiveSupport {
|
namespace LiveSupport {
|
||||||
|
@ -73,7 +74,7 @@ using namespace LiveSupport::Core;
|
||||||
* An item in a playlist.
|
* An item in a playlist.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
class PlaylistElement : public Configurable
|
class PlaylistElement : public Configurable
|
||||||
{
|
{
|
||||||
|
@ -98,6 +99,11 @@ class PlaylistElement : public Configurable
|
||||||
*/
|
*/
|
||||||
Ptr<AudioClip>::Ref audioClip;
|
Ptr<AudioClip>::Ref audioClip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fade in / fade out info associated with the entry.
|
||||||
|
*/
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -112,38 +118,44 @@ class PlaylistElement : public Configurable
|
||||||
* Create a playlist element by specifying all details.
|
* Create a playlist element by specifying all details.
|
||||||
* This is used for testing purposes.
|
* This is used for testing purposes.
|
||||||
*
|
*
|
||||||
* @param id the id of the entry.
|
* @param id the id of the entry.
|
||||||
* @param audioClipId the ID of the audio clip associated
|
|
||||||
* with the playlist element.
|
|
||||||
* @param relativeOffset the start time of this element, relative to
|
* @param relativeOffset the start time of this element, relative to
|
||||||
* the start of the playlist.
|
* the start of the playlist.
|
||||||
|
* @param audioClip (a pointer to) the audio clip associated
|
||||||
|
* with the playlist element.
|
||||||
*/
|
*/
|
||||||
PlaylistElement(Ptr<UniqueId>::Ref id,
|
PlaylistElement(Ptr<UniqueId>::Ref id,
|
||||||
Ptr<time_duration>::Ref relativeOffset,
|
Ptr<time_duration>::Ref relativeOffset,
|
||||||
Ptr<AudioClip>::Ref audioClip)
|
Ptr<AudioClip>::Ref audioClip,
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo
|
||||||
|
= Ptr<FadeInfo>::Ref())
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
this->id = id;
|
this->id = id;
|
||||||
this->relativeOffset = relativeOffset;
|
this->relativeOffset = relativeOffset;
|
||||||
this->audioClip = audioClip;
|
this->audioClip = audioClip;
|
||||||
|
this->fadeInfo = fadeInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new playlist element, with a new UniqueId,
|
* Create a new playlist element, with a new UniqueId,
|
||||||
* to be added to a playlist.
|
* to be added to a playlist.
|
||||||
*
|
*
|
||||||
* @param audioClipId the ID of the audio clip associated
|
|
||||||
* with the playlist element.
|
|
||||||
* @param relativeOffset the start time of this element, relative to
|
* @param relativeOffset the start time of this element, relative to
|
||||||
* the start of the playlist.
|
* the start of the playlist.
|
||||||
|
* @param audioClip (a pointer to) the audio clip associated
|
||||||
|
* with the playlist element.
|
||||||
*/
|
*/
|
||||||
PlaylistElement(Ptr<time_duration>::Ref relativeOffset,
|
PlaylistElement(Ptr<time_duration>::Ref relativeOffset,
|
||||||
Ptr<AudioClip>::Ref audioClip)
|
Ptr<AudioClip>::Ref audioClip,
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo
|
||||||
|
= Ptr<FadeInfo>::Ref())
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
this->id = UniqueId::generateId();
|
this->id = UniqueId::generateId();
|
||||||
this->relativeOffset = relativeOffset;
|
this->relativeOffset = relativeOffset;
|
||||||
this->audioClip = audioClip;
|
this->audioClip = audioClip;
|
||||||
|
this->fadeInfo = fadeInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,6 +224,28 @@ class PlaylistElement : public Configurable
|
||||||
return audioClip;
|
return audioClip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the fade info associated with the playlist element.
|
||||||
|
*
|
||||||
|
* @param fadeInfo the fade info to be associated with the element.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setFadeInfo(Ptr<FadeInfo>::Ref fadeInfo) throw ()
|
||||||
|
{
|
||||||
|
this->fadeInfo = fadeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the fade info associated with the playlist element.
|
||||||
|
*
|
||||||
|
* @return the fade info associated with the element.
|
||||||
|
*/
|
||||||
|
Ptr<const FadeInfo>::Ref
|
||||||
|
getFadeInfo(void) const throw ()
|
||||||
|
{
|
||||||
|
return fadeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfo.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/FadeInfo.h"
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the config element for this class
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string FadeInfo::configElementNameStr = "fadeInfo";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the id of the audio clip.
|
||||||
|
*/
|
||||||
|
static const std::string idAttrName = "id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the fade in.
|
||||||
|
*/
|
||||||
|
static const std::string fadeInAttrName = "fadeIn";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute to get the fade out.
|
||||||
|
*/
|
||||||
|
static const std::string fadeOutAttrName = "fadeOut";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Create a fade info object based on an XML element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
FadeInfo :: configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (element.get_name() != configElementNameStr) {
|
||||||
|
std::string eMsg = "bad configuration element ";
|
||||||
|
eMsg += element.get_name();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Attribute * attribute;
|
||||||
|
std::stringstream strStr;
|
||||||
|
unsigned long int idValue;
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(idAttrName))) {
|
||||||
|
std::string eMsg = "missing attribute ";
|
||||||
|
eMsg += idAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
strStr.str(attribute->get_value());
|
||||||
|
strStr >> idValue;
|
||||||
|
id.reset(new UniqueId(idValue));
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(fadeInAttrName))) {
|
||||||
|
std::string eMsg = "missing attribute ";
|
||||||
|
eMsg += idAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
fadeIn.reset(new time_duration(
|
||||||
|
duration_from_string(attribute->get_value())));
|
||||||
|
|
||||||
|
if (!(attribute = element.get_attribute(fadeOutAttrName))) {
|
||||||
|
std::string eMsg = "missing attribute ";
|
||||||
|
eMsg += idAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
fadeOut.reset(new time_duration(
|
||||||
|
duration_from_string(attribute->get_value())));
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfoTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#error "Need unistd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/FadeInfo.h"
|
||||||
|
#include "FadeInfoTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(FadeInfoTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the audio clip.
|
||||||
|
*/
|
||||||
|
static const std::string configFileName = "etc/fadeInfo.xml";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
FadeInfoTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
FadeInfoTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test to see if the singleton Hello object is accessible
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
FadeInfoTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Ptr<xmlpp::DomParser>::Ref parser(
|
||||||
|
new xmlpp::DomParser(configFileName, true));
|
||||||
|
const xmlpp::Document * document = parser->get_document();
|
||||||
|
const xmlpp::Element * root = document->get_root_node();
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo(new FadeInfo());
|
||||||
|
|
||||||
|
fadeInfo->configure(*root);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(fadeInfo->getId()->getId() == 9901);
|
||||||
|
|
||||||
|
Ptr<const boost::posix_time::time_duration>::Ref
|
||||||
|
fadeIn = fadeInfo->getFadeIn();
|
||||||
|
CPPUNIT_ASSERT(fadeIn->hours() == 0);
|
||||||
|
CPPUNIT_ASSERT(fadeIn->minutes() == 0);
|
||||||
|
CPPUNIT_ASSERT(fadeIn->seconds() == 2);
|
||||||
|
|
||||||
|
Ptr<const boost::posix_time::time_duration>::Ref
|
||||||
|
fadeOut = fadeInfo->getFadeOut();
|
||||||
|
CPPUNIT_ASSERT(fadeOut->hours() == 0);
|
||||||
|
CPPUNIT_ASSERT(fadeOut->minutes() == 0);
|
||||||
|
CPPUNIT_ASSERT(fadeOut->seconds() == 1);
|
||||||
|
CPPUNIT_ASSERT(fadeOut->fractional_seconds() == 500);
|
||||||
|
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::string eMsg = "semantic error in configuration file:\n";
|
||||||
|
eMsg += e.what();
|
||||||
|
CPPUNIT_FAIL(eMsg);
|
||||||
|
} catch (xmlpp::exception &e) {
|
||||||
|
std::string eMsg = "error parsing configuration file:\n";
|
||||||
|
eMsg += e.what();
|
||||||
|
CPPUNIT_FAIL(eMsg);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfoTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef FadeInfoTest_h
|
||||||
|
#define FadeInfoTest_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the FadeInfo class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see FadeInfo
|
||||||
|
*/
|
||||||
|
class FadeInfoTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(FadeInfoTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple test.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the environment for the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setUp(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up the environment after the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
tearDown(void) throw ();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // FadeInfoTest_h
|
||||||
|
|
|
@ -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/src/Playlist.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -149,7 +149,8 @@ Playlist::addPlaylistElement(Ptr<PlaylistElement>::Ref playlistElement)
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip,
|
Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip,
|
||||||
Ptr<time_duration>::Ref relativeOffset)
|
Ptr<time_duration>::Ref relativeOffset,
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
if (elementList->find(*relativeOffset) != elementList->end()) {
|
if (elementList->find(*relativeOffset) != elementList->end()) {
|
||||||
|
@ -158,12 +159,31 @@ Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip,
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
|
Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
|
||||||
relativeOffset, audioClip));
|
relativeOffset, audioClip, fadeInfo));
|
||||||
|
|
||||||
(*elementList)[*relativeOffset] = playlistElement;
|
(*elementList)[*relativeOffset] = playlistElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Change the fade in / fade out info of a playlist element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
Playlist::setFadeInfo(Ptr<time_duration>::Ref relativeOffset,
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
PlaylistElementListType::iterator it = elementList->find(*relativeOffset);
|
||||||
|
|
||||||
|
if (it == elementList->end()) {
|
||||||
|
std::string eMsg = "no audio clip at this relative offset";
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
it->second->setFadeInfo(fadeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Remove an audio clip from the playlist.
|
* Remove an audio clip from the playlist.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
along with LiveSupport; if not, write to the Free Software
|
along with LiveSupport; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "LiveSupport/Core/UniqueId.h"
|
|
||||||
#include "LiveSupport/Core/PlaylistElement.h"
|
#include "LiveSupport/Core/PlaylistElement.h"
|
||||||
|
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
|
@ -63,10 +62,15 @@ static const std::string idAttrName = "id";
|
||||||
static const std::string relativeOffsetAttrName = "relativeOffset";
|
static const std::string relativeOffsetAttrName = "relativeOffset";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the (audio clip) child element of the playlist element.
|
* The name of the audio clip child element of the playlist element.
|
||||||
*/
|
*/
|
||||||
static const std::string audioClipElementName = "audioClip";
|
static const std::string audioClipElementName = "audioClip";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the fade info child element of the playlist element.
|
||||||
|
*/
|
||||||
|
static const std::string fadeInfoElementName = "fadeInfo";
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -86,6 +90,7 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
||||||
throw std::invalid_argument(eMsg);
|
throw std::invalid_argument(eMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set id
|
||||||
const xmlpp::Attribute * attribute;
|
const xmlpp::Attribute * attribute;
|
||||||
std::stringstream strStr;
|
std::stringstream strStr;
|
||||||
UniqueId::IdType idValue;
|
UniqueId::IdType idValue;
|
||||||
|
@ -99,6 +104,7 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
||||||
strStr >> idValue;
|
strStr >> idValue;
|
||||||
id.reset(new UniqueId(idValue));
|
id.reset(new UniqueId(idValue));
|
||||||
|
|
||||||
|
// set relative offset
|
||||||
if (!(attribute = element.get_attribute(relativeOffsetAttrName))) {
|
if (!(attribute = element.get_attribute(relativeOffsetAttrName))) {
|
||||||
std::string eMsg = "missing attribute ";
|
std::string eMsg = "missing attribute ";
|
||||||
eMsg += relativeOffsetAttrName;
|
eMsg += relativeOffsetAttrName;
|
||||||
|
@ -107,6 +113,7 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
||||||
relativeOffset.reset(new time_duration(
|
relativeOffset.reset(new time_duration(
|
||||||
duration_from_string(attribute->get_value())));
|
duration_from_string(attribute->get_value())));
|
||||||
|
|
||||||
|
// set audio clip
|
||||||
xmlpp::Node::NodeList childNodes
|
xmlpp::Node::NodeList childNodes
|
||||||
= element.get_children(audioClipElementName);
|
= element.get_children(audioClipElementName);
|
||||||
xmlpp::Node::NodeList::iterator it = childNodes.begin();
|
xmlpp::Node::NodeList::iterator it = childNodes.begin();
|
||||||
|
@ -121,7 +128,7 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
||||||
const xmlpp::Element * audioClipElement
|
const xmlpp::Element * audioClipElement
|
||||||
= dynamic_cast<const xmlpp::Element*> (*it);
|
= dynamic_cast<const xmlpp::Element*> (*it);
|
||||||
audioClip.reset(new AudioClip);
|
audioClip.reset(new AudioClip);
|
||||||
audioClip->configure(*audioClipElement); // may throw exception
|
audioClip->configure(*audioClipElement); // may throw exception
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
if (it != childNodes.end()) {
|
if (it != childNodes.end()) {
|
||||||
|
@ -130,4 +137,25 @@ PlaylistElement :: configure(const xmlpp::Element & element)
|
||||||
eMsg += " XML element";
|
eMsg += " XML element";
|
||||||
throw std::invalid_argument(eMsg);
|
throw std::invalid_argument(eMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set fade info
|
||||||
|
childNodes = element.get_children(fadeInfoElementName);
|
||||||
|
it = childNodes.begin();
|
||||||
|
|
||||||
|
if (it == childNodes.end()) { // no fade info is OK
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Element * fadeInfoElement
|
||||||
|
= dynamic_cast<const xmlpp::Element*> (*it);
|
||||||
|
fadeInfo.reset(new FadeInfo);
|
||||||
|
fadeInfo->configure(*fadeInfoElement); // may throw exception
|
||||||
|
|
||||||
|
++it;
|
||||||
|
if (it != childNodes.end()) {
|
||||||
|
std::string eMsg = "more than one ";
|
||||||
|
eMsg += fadeInfoElementName;
|
||||||
|
eMsg += " XML element";
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElementTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElementTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -111,6 +111,17 @@ PlaylistElementTest :: firstTest(void)
|
||||||
CPPUNIT_ASSERT(relativeOffset->total_seconds() == 12*60 + 34);
|
CPPUNIT_ASSERT(relativeOffset->total_seconds() == 12*60 + 34);
|
||||||
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
|
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
|
||||||
== 10001);
|
== 10001);
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getId()->getId()
|
||||||
|
== 9901);
|
||||||
|
Ptr<const time_duration>::Ref fadeIn
|
||||||
|
= playlistElement->getFadeInfo()
|
||||||
|
->getFadeIn();
|
||||||
|
CPPUNIT_ASSERT(fadeIn->total_milliseconds() == 2000);
|
||||||
|
|
||||||
|
Ptr<const time_duration>::Ref fadeOut
|
||||||
|
= playlistElement->getFadeInfo()
|
||||||
|
->getFadeOut();
|
||||||
|
CPPUNIT_ASSERT(fadeOut->total_milliseconds() == 1500);
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
std::string eMsg = "semantic error in configuration file:\n";
|
std::string eMsg = "semantic error in configuration file:\n";
|
||||||
|
|
|
@ -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/PlaylistTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -285,3 +285,72 @@ PlaylistTest :: savedCopyTest(void)
|
||||||
catch (std::logic_error &e) {
|
catch (std::logic_error &e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test to see if we can add a fade info
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistTest :: fadeInfoTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
Playlist::const_iterator it = playlist->begin();
|
||||||
|
CPPUNIT_ASSERT(it != playlist->end());
|
||||||
|
Ptr<PlaylistElement>::Ref playlistElement = it->second;
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo().get() == 0);
|
||||||
|
|
||||||
|
++it;
|
||||||
|
CPPUNIT_ASSERT(it != playlist->end());
|
||||||
|
playlistElement = it->second;
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn()
|
||||||
|
->total_milliseconds() == 2000);
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut()
|
||||||
|
->total_milliseconds() == 1500);
|
||||||
|
|
||||||
|
++it;
|
||||||
|
CPPUNIT_ASSERT(it == playlist->end());
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref relativeOffset (new time_duration(0,0,0,0));
|
||||||
|
Ptr<time_duration>::Ref fadeIn (new time_duration(0,0,3,200000));
|
||||||
|
Ptr<time_duration>::Ref fadeOut(new time_duration(0,0,4,0));
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut));
|
||||||
|
|
||||||
|
try {
|
||||||
|
playlist->setFadeInfo(relativeOffset, fadeInfo);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
CPPUNIT_FAIL("could not add new fade info");
|
||||||
|
}
|
||||||
|
|
||||||
|
it = playlist->begin();
|
||||||
|
playlistElement = it->second;
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn()
|
||||||
|
->total_milliseconds() == 3200);
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut()
|
||||||
|
->total_milliseconds() == 4000);
|
||||||
|
|
||||||
|
relativeOffset.reset(new time_duration(1,00,0,0));
|
||||||
|
|
||||||
|
try {
|
||||||
|
playlist->setFadeInfo(relativeOffset, fadeInfo);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
CPPUNIT_FAIL("could not update fade info");
|
||||||
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
|
playlistElement = it->second;
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeIn()
|
||||||
|
->total_milliseconds() == 3200);
|
||||||
|
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getFadeOut()
|
||||||
|
->total_milliseconds() == 4000);
|
||||||
|
|
||||||
|
relativeOffset.reset(new time_duration(0,18,0,0));
|
||||||
|
|
||||||
|
try {
|
||||||
|
playlist->setFadeInfo(relativeOffset, fadeInfo);
|
||||||
|
CPPUNIT_FAIL("allowed to set fade info for non-existent element");
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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/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.5 $
|
* @version $Revision: 1.6 $
|
||||||
* @see Playlist
|
* @see Playlist
|
||||||
*/
|
*/
|
||||||
class PlaylistTest : public CPPUNIT_NS::TestFixture
|
class PlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
|
@ -68,6 +68,7 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
CPPUNIT_TEST(lockTest);
|
CPPUNIT_TEST(lockTest);
|
||||||
CPPUNIT_TEST(audioClipTest);
|
CPPUNIT_TEST(audioClipTest);
|
||||||
CPPUNIT_TEST(savedCopyTest);
|
CPPUNIT_TEST(savedCopyTest);
|
||||||
|
CPPUNIT_TEST(fadeInfoTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -111,6 +112,14 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture
|
||||||
void
|
void
|
||||||
savedCopyTest(void) throw (CPPUNIT_NS::Exception);
|
savedCopyTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trying to add a new fade info.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
fadeInfoTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: fgerlits $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.19 $
|
# Version : $Revision: 1.20 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -132,7 +132,8 @@ SCHEDULER_OBJS = ${TMP_DIR}/SignalDispatcher.o \
|
||||||
${TMP_DIR}/SavePlaylistMethod.o \
|
${TMP_DIR}/SavePlaylistMethod.o \
|
||||||
${TMP_DIR}/PlayLogFactory.o \
|
${TMP_DIR}/PlayLogFactory.o \
|
||||||
${TMP_DIR}/PostgresqlPlayLog.o \
|
${TMP_DIR}/PostgresqlPlayLog.o \
|
||||||
${TMP_DIR}/GeneratePlayReportMethod.o
|
${TMP_DIR}/GeneratePlayReportMethod.o \
|
||||||
|
${TMP_DIR}/UpdateFadeInFadeOutMethod.o
|
||||||
|
|
||||||
|
|
||||||
SCHEDULER_EXE_OBJS = ${SCHEDULER_OBJS} \
|
SCHEDULER_EXE_OBJS = ${SCHEDULER_OBJS} \
|
||||||
|
@ -168,6 +169,7 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \
|
||||||
${TMP_DIR}/RevertEditedPlaylistMethodTest.o \
|
${TMP_DIR}/RevertEditedPlaylistMethodTest.o \
|
||||||
${TMP_DIR}/PostgresqlPlayLogTest.o \
|
${TMP_DIR}/PostgresqlPlayLogTest.o \
|
||||||
${TMP_DIR}/GeneratePlayReportMethodTest.o \
|
${TMP_DIR}/GeneratePlayReportMethodTest.o \
|
||||||
|
${TMP_DIR}/UpdateFadeInFadeOutMethodTest.o \
|
||||||
${TMP_DIR}/TestRunner.o
|
${TMP_DIR}/TestRunner.o
|
||||||
TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
|
TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,18 @@
|
||||||
<!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 >
|
||||||
|
|
||||||
|
<!ELEMENT fadeInfo EMPTY >
|
||||||
|
<!ATTLIST fadeInfo id NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeIn NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST fadeInfo fadeOut NMTOKEN #REQUIRED >
|
||||||
]>
|
]>
|
||||||
<storageClientFactory>
|
<storageClientFactory>
|
||||||
<testStorage>
|
<testStorage>
|
||||||
|
@ -25,6 +30,8 @@
|
||||||
</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"
|
||||||
|
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"/>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethod.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/GeneratePlayReportMethod.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -126,7 +126,7 @@ GeneratePlayReportMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
|
||||||
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
|
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
|
||||||
Ptr<PlayLogInterface>::Ref playLog = plf->getPlayLog();
|
Ptr<PlayLogInterface>::Ref playLog = plf->getPlayLog();
|
||||||
|
|
||||||
Ptr<std::vector<Ptr<const PlayLogEntry>::Ref> >::Ref playLogVector
|
Ptr<std::vector<Ptr<PlayLogEntry>::Ref> >::Ref playLogVector
|
||||||
= playLog->getPlayLogEntries(fromTime, toTime);
|
= playLog->getPlayLogEntries(fromTime, toTime);
|
||||||
|
|
||||||
XmlRpcTools::playLogVectorToXmlRpcValue(playLogVector, returnValue);
|
XmlRpcTools::playLogVectorToXmlRpcValue(playLogVector, returnValue);
|
||||||
|
|
|
@ -0,0 +1,190 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_TIME_H
|
||||||
|
#include <time.h>
|
||||||
|
#else
|
||||||
|
#error need time.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/StorageClientInterface.h"
|
||||||
|
#include "LiveSupport/Storage/StorageClientFactory.h"
|
||||||
|
#include "LiveSupport/Core/Playlist.h"
|
||||||
|
#include "LiveSupport/Core/FadeInfo.h"
|
||||||
|
#include "ScheduleInterface.h"
|
||||||
|
#include "ScheduleFactory.h"
|
||||||
|
#include "XmlRpcTools.h"
|
||||||
|
|
||||||
|
#include "UpdateFadeInFadeOutMethod.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace boost;
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::Storage;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of this XML-RPC method.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string UpdateFadeInFadeOutMethod::methodName
|
||||||
|
= "updateFadeInFadeOut";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The ID of this method for error reporting purposes.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const int UpdateFadeInFadeOutMethod::errorId = 1600;
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Construct the method and register it right away.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
UpdateFadeInFadeOutMethod :: UpdateFadeInFadeOutMethod (
|
||||||
|
Ptr<XmlRpc::XmlRpcServer>::Ref xmlRpcServer) throw()
|
||||||
|
: XmlRpc::XmlRpcServerMethod(methodName, xmlRpcServer.get())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Execute the stop XML-RPC function call.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
UpdateFadeInFadeOutMethod :: execute(
|
||||||
|
XmlRpc::XmlRpcValue & rootParameter,
|
||||||
|
XmlRpc::XmlRpcValue & returnValue)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
if (!rootParameter.valid() || rootParameter.size() != 1) {
|
||||||
|
XmlRpcTools::markError(errorId+1, "invalid argument format",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
XmlRpc::XmlRpcValue parameters = rootParameter[0];
|
||||||
|
|
||||||
|
Ptr<UniqueId>::Ref playlistId;
|
||||||
|
try{
|
||||||
|
playlistId = XmlRpcTools::extractPlaylistId(parameters);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
XmlRpcTools::markError(errorId+2,
|
||||||
|
"missing playlist ID argument",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref relativeOffset;
|
||||||
|
try{
|
||||||
|
relativeOffset = XmlRpcTools::extractRelativeOffset(parameters);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
XmlRpcTools::markError(errorId+3,
|
||||||
|
"missing relative offset argument",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref fadeIn;
|
||||||
|
try{
|
||||||
|
fadeIn = XmlRpcTools::extractFadeIn(parameters);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
XmlRpcTools::markError(errorId+4,
|
||||||
|
"missing fade in argument",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref fadeOut;
|
||||||
|
try{
|
||||||
|
fadeOut = XmlRpcTools::extractFadeOut(parameters);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
XmlRpcTools::markError(errorId+5,
|
||||||
|
"missing fade out argument",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<StorageClientFactory>::Ref scf;
|
||||||
|
Ptr<StorageClientInterface>::Ref storage;
|
||||||
|
scf = StorageClientFactory::getInstance();
|
||||||
|
storage = scf->getStorageClient();
|
||||||
|
|
||||||
|
Ptr<Playlist>::Ref playlist;
|
||||||
|
try {
|
||||||
|
playlist = storage->getPlaylist(playlistId);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument &e) {
|
||||||
|
XmlRpcTools::markError(errorId+6, "playlist does not exist",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playlist->canBeEdited()) {
|
||||||
|
XmlRpcTools::markError(errorId+7,
|
||||||
|
"playlist has not been opened for editing",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<FadeInfo>::Ref fadeInfo(new FadeInfo(fadeIn, fadeOut));
|
||||||
|
try { // and finally, the beef
|
||||||
|
playlist->setFadeInfo(relativeOffset, fadeInfo);
|
||||||
|
}
|
||||||
|
catch(std::invalid_argument &e) {
|
||||||
|
XmlRpcTools::markError(errorId+8,
|
||||||
|
"no audio clip at the specified "
|
||||||
|
"relative offset",
|
||||||
|
returnValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethod.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef UpdateFadeInFadeOutMethod_h
|
||||||
|
#define UpdateFadeInFadeOutMethod_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <XmlRpcServerMethod.h>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An XML-RPC method object to change the fade in / fade out info of an
|
||||||
|
* audio clip (specified by its relative offset) from a playlist (specified
|
||||||
|
* by its ID).
|
||||||
|
*
|
||||||
|
* The name of the method when called through XML-RPC is
|
||||||
|
* "updateFadeInFadeOut".
|
||||||
|
* The expected parameter is an XML-RPC structure, with the following
|
||||||
|
* members:
|
||||||
|
* <ul>
|
||||||
|
* <li>playlistId - int - the unique id of the playlist.</li>
|
||||||
|
* <li>relativeOffset - int - the number of seconds between the
|
||||||
|
* start of the playlist and the start of the audio clip
|
||||||
|
* to be removed.</li>
|
||||||
|
* <li>fadeIn - int - the length (in milliseconds) of the fade in. </li>
|
||||||
|
* <li>fadeOut - int - the length (in milliseconds) of the fade out. </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* In case of an error, an XML-RPC structure is returned, with the following
|
||||||
|
* fields:
|
||||||
|
* <ul>
|
||||||
|
* <li>errorCode - int - the id of the error condition</li>
|
||||||
|
* <li>errorMessage - string - a description of the error</li>
|
||||||
|
* </ul>
|
||||||
|
* The possible error codes are:
|
||||||
|
* <ul>
|
||||||
|
* <li>1601 - invalid argument format </li>
|
||||||
|
* <li>1602 - missing playlist ID argument </li>
|
||||||
|
* <li>1603 - missing relative offset argument </li>
|
||||||
|
* <li>1604 - missing fade in argument </li>
|
||||||
|
* <li>1605 - missing fade out argument </li>
|
||||||
|
* <li>1606 - playlist does not exist </li>
|
||||||
|
* <li>1607 - playlist has not been opened for editing </li>
|
||||||
|
* <li>1608 - no audio clip at the specified relative offset </li>
|
||||||
|
* </ul>
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class UpdateFadeInFadeOutMethod : public XmlRpc::XmlRpcServerMethod
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The name of this method, as it will be registered into the
|
||||||
|
* XML-RPC server.
|
||||||
|
*/
|
||||||
|
static const std::string methodName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of this method for error reporting purposes.
|
||||||
|
*/
|
||||||
|
static const int errorId;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* A default constructor, for testing purposes.
|
||||||
|
*/
|
||||||
|
UpdateFadeInFadeOutMethod(void) throw ()
|
||||||
|
: XmlRpc::XmlRpcServerMethod(methodName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constuctor that registers the method with the server right away.
|
||||||
|
*
|
||||||
|
* @param xmlRpcServer the XML-RPC server to register with.
|
||||||
|
*/
|
||||||
|
UpdateFadeInFadeOutMethod(
|
||||||
|
Ptr<XmlRpc::XmlRpcServer>::Ref xmlRpcServer)
|
||||||
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the display schedule command on the Scheduler daemon.
|
||||||
|
*
|
||||||
|
* @param parameters XML-RPC function call parameters
|
||||||
|
* @param returnValue the return value of the call (out parameter)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
execute(XmlRpc::XmlRpcValue & parameters,
|
||||||
|
XmlRpc::XmlRpcValue & returnValue) throw ();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Scheduler
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // UpdateFadeInFadeOutMethod_h
|
||||||
|
|
|
@ -0,0 +1,189 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#error "Need unistd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <XmlRpcValue.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Db/ConnectionManagerFactory.h"
|
||||||
|
#include "LiveSupport/Storage/StorageClientFactory.h"
|
||||||
|
#include "XmlRpcTools.h"
|
||||||
|
|
||||||
|
#include "OpenPlaylistForEditingMethod.h"
|
||||||
|
#include "AddAudioClipToPlaylistMethod.h"
|
||||||
|
#include "UpdateFadeInFadeOutMethod.h"
|
||||||
|
|
||||||
|
#include "UpdateFadeInFadeOutMethodTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace LiveSupport::Db;
|
||||||
|
using namespace LiveSupport::Storage;
|
||||||
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(UpdateFadeInFadeOutMethodTest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the storage client factory.
|
||||||
|
*/
|
||||||
|
const std::string UpdateFadeInFadeOutMethodTest::storageClientConfig =
|
||||||
|
"etc/storageClient.xml";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the connection manager factory.
|
||||||
|
*/
|
||||||
|
const std::string UpdateFadeInFadeOutMethodTest::connectionManagerConfig =
|
||||||
|
"etc/connectionManagerFactory.xml";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Configure a Configurable with an XML file.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
UpdateFadeInFadeOutMethodTest :: configure(
|
||||||
|
Ptr<Configurable>::Ref configurable,
|
||||||
|
const std::string fileName)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
xmlpp::exception)
|
||||||
|
{
|
||||||
|
Ptr<xmlpp::DomParser>::Ref parser(new xmlpp::DomParser(fileName, true));
|
||||||
|
const xmlpp::Document * document = parser->get_document();
|
||||||
|
const xmlpp::Element * root = document->get_root_node();
|
||||||
|
|
||||||
|
configurable->configure(*root);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
UpdateFadeInFadeOutMethodTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Ptr<StorageClientFactory>::Ref scf
|
||||||
|
= StorageClientFactory::getInstance();
|
||||||
|
configure(scf, storageClientConfig);
|
||||||
|
|
||||||
|
Ptr<ConnectionManagerFactory>::Ref cmf
|
||||||
|
= ConnectionManagerFactory::getInstance();
|
||||||
|
configure(cmf, connectionManagerConfig);
|
||||||
|
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
CPPUNIT_FAIL("semantic error in configuration file");
|
||||||
|
} catch (xmlpp::exception &e) {
|
||||||
|
CPPUNIT_FAIL("error parsing configuration file");
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
CPPUNIT_FAIL(e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
UpdateFadeInFadeOutMethodTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Just a very simple smoke test
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
UpdateFadeInFadeOutMethodTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
Ptr<OpenPlaylistForEditingMethod>::Ref
|
||||||
|
openPlaylistMethod(new OpenPlaylistForEditingMethod());
|
||||||
|
Ptr<UpdateFadeInFadeOutMethod>::Ref
|
||||||
|
updateFadeMethod(new UpdateFadeInFadeOutMethod());
|
||||||
|
XmlRpc::XmlRpcValue parameters;
|
||||||
|
XmlRpc::XmlRpcValue rootParameter;
|
||||||
|
rootParameter.setSize(1);
|
||||||
|
XmlRpc::XmlRpcValue result;
|
||||||
|
|
||||||
|
parameters["playlistId"] = 1;
|
||||||
|
parameters["relativeOffset"] = 90*60;
|
||||||
|
parameters["fadeIn"] = 0;
|
||||||
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
updateFadeMethod->execute(rootParameter, result);
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("errorCode"));
|
||||||
|
CPPUNIT_ASSERT((int)(result["errorCode"]) == 1605); // missing fade out
|
||||||
|
|
||||||
|
parameters["fadeOut"] = 2100;
|
||||||
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
updateFadeMethod->execute(rootParameter, result);
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("errorCode"));
|
||||||
|
CPPUNIT_ASSERT((int)(result["errorCode"]) == 1607); // not open for editing
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
openPlaylistMethod->execute(rootParameter, result);
|
||||||
|
CPPUNIT_ASSERT(!result.hasMember("errorCode"));
|
||||||
|
result.clear();
|
||||||
|
updateFadeMethod->execute(rootParameter, result);
|
||||||
|
CPPUNIT_ASSERT(result.hasMember("errorCode"));
|
||||||
|
CPPUNIT_ASSERT((int)(result["errorCode"]) == 1608); // no audio clip at
|
||||||
|
// this rel offset
|
||||||
|
parameters["relativeOffset"] = 0;
|
||||||
|
rootParameter[0] = parameters;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
updateFadeMethod->execute(rootParameter, result);
|
||||||
|
CPPUNIT_ASSERT(!result.hasMember("errorCode"));
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/UpdateFadeInFadeOutMethodTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef UpdateFadeInFadeOutMethodTest_h
|
||||||
|
#define UpdateFadeInFadeOutMethodTest_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Scheduler {
|
||||||
|
|
||||||
|
using namespace LiveSupport;
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for the UpdateFadeInFadeOutMethod class.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
* @see UpdateFadeInFadeOutMethod
|
||||||
|
*/
|
||||||
|
class UpdateFadeInFadeOutMethodTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(UpdateFadeInFadeOutMethodTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the storage client factory.
|
||||||
|
*/
|
||||||
|
static const std::string storageClientConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration file for the connection manager
|
||||||
|
* factory.
|
||||||
|
*/
|
||||||
|
static const std::string connectionManagerConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure a configurable with an XML file.
|
||||||
|
*
|
||||||
|
* @param configurable configure this
|
||||||
|
* @param fileName the name of the XML file to configure with.
|
||||||
|
* @exception std::invalid_argument on configuration errors.
|
||||||
|
* @exception xmlpp::exception on XML parsing errors.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
configure(Ptr<Configurable>::Ref configurable,
|
||||||
|
std::string fileName)
|
||||||
|
throw (std::invalid_argument,
|
||||||
|
xmlpp::exception);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple test.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the environment for the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setUp(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up the environment after the test case.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
tearDown(void) throw ();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Scheduler
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // UpdateFadeInFadeOutMethodTest_h
|
||||||
|
|
|
@ -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/products/scheduler/src/Attic/XmlRpcTools.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -95,6 +95,18 @@ const std::string XmlRpcTools::scheduleEntryIdName =
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
const std::string XmlRpcTools::playtimeName = "playtime";
|
const std::string XmlRpcTools::playtimeName = "playtime";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the fade in member in the XML-RPC parameter
|
||||||
|
* structure.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string XmlRpcTools::fadeInName = "fadeIn";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the fade out member in the XML-RPC parameter
|
||||||
|
* structure.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string XmlRpcTools::fadeOutName = "fadeOut";
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
@ -402,6 +414,40 @@ XmlRpcTools :: extractPlayschedule(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Extract the fade in time from an XML-RPC function call parameter
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<time_duration>::Ref
|
||||||
|
XmlRpcTools :: extractFadeIn(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (!xmlRpcValue.hasMember(fadeInName)) {
|
||||||
|
throw std::invalid_argument("missing fade in argument");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref fadeIn(new time_duration(0,0,
|
||||||
|
(int) xmlRpcValue[fadeInName], 0));
|
||||||
|
return fadeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Extract the fade out time from an XML-RPC function call parameter
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Ptr<time_duration>::Ref
|
||||||
|
XmlRpcTools :: extractFadeOut(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (!xmlRpcValue.hasMember(fadeOutName)) {
|
||||||
|
throw std::invalid_argument("missing fade out argument");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref fadeOut(new time_duration(0,0,
|
||||||
|
(int) xmlRpcValue[fadeOutName], 0));
|
||||||
|
return fadeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Convert a schedule entry ID (a UniqueId) to an XmlRpcValue
|
* Convert a schedule entry ID (a UniqueId) to an XmlRpcValue
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -438,7 +484,7 @@ XmlRpcTools :: playLogEntryToXmlRpcValue(
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
XmlRpcTools :: playLogVectorToXmlRpcValue(
|
XmlRpcTools :: playLogVectorToXmlRpcValue(
|
||||||
Ptr<const std::vector<Ptr<const PlayLogEntry>::Ref> >::Ref
|
Ptr<const std::vector<Ptr<PlayLogEntry>::Ref> >::Ref
|
||||||
playLogVector,
|
playLogVector,
|
||||||
XmlRpc::XmlRpcValue & returnValue)
|
XmlRpc::XmlRpcValue & returnValue)
|
||||||
throw ()
|
throw ()
|
||||||
|
@ -447,11 +493,11 @@ XmlRpcTools :: playLogVectorToXmlRpcValue(
|
||||||
// a call to setSize() makes sure it's an XML-RPC
|
// a call to setSize() makes sure it's an XML-RPC
|
||||||
// array
|
// array
|
||||||
|
|
||||||
std::vector<Ptr<const PlayLogEntry>::Ref>::const_iterator it =
|
std::vector<Ptr<PlayLogEntry>::Ref>::const_iterator it =
|
||||||
playLogVector->begin();
|
playLogVector->begin();
|
||||||
int arraySize = 0;
|
int arraySize = 0;
|
||||||
while (it != playLogVector->end()) {
|
while (it != playLogVector->end()) {
|
||||||
Ptr<const PlayLogEntry>::Ref playLog = *it;
|
Ptr<PlayLogEntry>::Ref playLog = *it;
|
||||||
XmlRpc::XmlRpcValue returnStruct;
|
XmlRpc::XmlRpcValue returnStruct;
|
||||||
playLogEntryToXmlRpcValue(playLog, returnStruct);
|
playLogEntryToXmlRpcValue(playLog, returnStruct);
|
||||||
returnValue[arraySize++] = returnStruct;
|
returnValue[arraySize++] = returnStruct;
|
||||||
|
|
|
@ -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/products/scheduler/src/Attic/XmlRpcTools.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -72,7 +72,7 @@ using namespace LiveSupport::Core;
|
||||||
* in the Scheduler.
|
* in the Scheduler.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.8 $
|
* @version $Revision: 1.9 $
|
||||||
*/
|
*/
|
||||||
class XmlRpcTools
|
class XmlRpcTools
|
||||||
{
|
{
|
||||||
|
@ -119,6 +119,18 @@ class XmlRpcTools
|
||||||
*/
|
*/
|
||||||
static const std::string playtimeName;
|
static const std::string playtimeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the fade in member in the XML-RPC parameter
|
||||||
|
* structure.
|
||||||
|
*/
|
||||||
|
static const std::string fadeInName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the fade out member in the XML-RPC parameter
|
||||||
|
* structure.
|
||||||
|
*/
|
||||||
|
static const std::string fadeOutName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a boost::posix_time::ptime to an XmlRpcValue
|
* Convert a boost::posix_time::ptime to an XmlRpcValue
|
||||||
*
|
*
|
||||||
|
@ -303,6 +315,30 @@ class XmlRpcTools
|
||||||
extractPlayschedule(XmlRpc::XmlRpcValue & xmlRpcValue)
|
extractPlayschedule(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||||
throw (std::invalid_argument);
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the fade in time from the XML-RPC parameters.
|
||||||
|
*
|
||||||
|
* @param xmlRpcValue the XML-RPC parameter to extract from.
|
||||||
|
* @return a time_duration that was found in the XML-RPC parameter.
|
||||||
|
* @exception std::invalid_argument if there was no fadeIn
|
||||||
|
* member in xmlRpcValue
|
||||||
|
*/
|
||||||
|
static Ptr<time_duration>::Ref
|
||||||
|
extractFadeIn(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the fade out time from the XML-RPC parameters.
|
||||||
|
*
|
||||||
|
* @param xmlRpcValue the XML-RPC parameter to extract from.
|
||||||
|
* @return a time_duration that was found in the XML-RPC parameter.
|
||||||
|
* @exception std::invalid_argument if there was no fadeOut
|
||||||
|
* member in xmlRpcValue
|
||||||
|
*/
|
||||||
|
static Ptr<time_duration>::Ref
|
||||||
|
extractFadeOut(XmlRpc::XmlRpcValue & xmlRpcValue)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a vector of ScheduleEntries to an XML-RPC return value.
|
* Convert a vector of ScheduleEntries to an XML-RPC return value.
|
||||||
*
|
*
|
||||||
|
@ -337,7 +373,7 @@ class XmlRpcTools
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
playLogVectorToXmlRpcValue(
|
playLogVectorToXmlRpcValue(
|
||||||
Ptr<const std::vector<Ptr<const PlayLogEntry>::Ref> >::Ref
|
Ptr<const std::vector<Ptr<PlayLogEntry>::Ref> >::Ref
|
||||||
playLogVector,
|
playLogVector,
|
||||||
XmlRpc::XmlRpcValue & returnValue)
|
XmlRpc::XmlRpcValue & returnValue)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
Loading…
Reference in New Issue