Added support for passing a stop_time value of the playlist, when the scheduler wants the playlist to stop. It has to be passed as second parameter to start method of audioplayer. For now the STOP_TIME macro is used to pass value. Files Changed: GLiveSupport.cxx, PlaylistEvent.cxx, AudioPlayerInterface.h, GstreamerPlayer.cxx, streamerPlayer.h

This commit is contained in:
kapil 2009-10-02 12:49:43 +00:00
parent 2ed80ef62f
commit 60518f7074
5 changed files with 24 additions and 14 deletions

View File

@ -204,7 +204,7 @@ class AudioPlayerInterface
* @see #stop
*/
virtual void
start(int) throw (std::logic_error)
start(int,int) throw (std::logic_error)
= 0;
/**

View File

@ -386,8 +386,14 @@ GstreamerPlayer :: getPosition(void) throw (std::logic_error)
throw std::logic_error("player not open");
}
gint64 ns = m_playContext->getPosition();
gint64 ns = m_playContext->getPosition();
#if 0
if (((ns/GST_SECOND) + (m_smilOffset/GST_SECOND)) >= m_stop_time){
m_playContext->stopContext();
m_playContext->closeContext();
g_idle_add(GstreamerPlayer::fireOnStopEvent, this);
}
#endif
length.reset(new time_duration(microseconds((m_smilOffset + ns) / 1000LL)));
return length;
@ -398,9 +404,10 @@ GstreamerPlayer :: getPosition(void) throw (std::logic_error)
* Start playing
*----------------------------------------------------------------------------*/
void
GstreamerPlayer :: start(int start_time) throw (std::logic_error)
GstreamerPlayer :: start(int start_time, int stop_time) throw (std::logic_error)
{
DEBUG_BLOCK
m_stop_time = stop_time;
m_start_time = start_time;
if (!isOpen()) {
throw std::logic_error("GstreamerPlayer not opened yet");

View File

@ -124,6 +124,7 @@ class GstreamerPlayer : virtual public Configurable,
std::string m_audioDevice;
gint64 m_smilOffset;
gint m_stop_time;
gint64 m_currentPlayLength;
gint64 m_Id;
@ -329,7 +330,7 @@ public:
* @see #stop
*/
virtual void
start(int) throw (std::logic_error);
start(int,int) throw (std::logic_error);
/**
* Pause the player.

View File

@ -76,7 +76,7 @@ using namespace LiveSupport::SchedulerClient;
using namespace LiveSupport::Widgets;
using namespace LiveSupport::GLiveSupport;
#define STOP_TIME 300
/* =================================================== local data structures */
@ -1302,7 +1302,7 @@ GLiveSupport :: playOutputAudio(Ptr<Playable>::Ref playable)
{
return false;
}
outputPlayer->start(0);
outputPlayer->start(0, STOP_TIME);
std::cerr << "gLiveSupport: Live Mode playing audio clip '"
<< *playable->getTitle()
<< "'" << std::endl;
@ -1311,7 +1311,7 @@ GLiveSupport :: playOutputAudio(Ptr<Playable>::Ref playable)
case Playable::PlaylistType:
outputItemPlayingNow = acquirePlaylist(playable->getId());
outputPlayer->open(*outputItemPlayingNow->getUri(), (gint64)outputItemPlayingNow->getId()->getId());
outputPlayer->start(0);
outputPlayer->start(0, STOP_TIME);
std::cerr << "gLiveSupport: Live Mode playing playlist '"
<< *playable->getTitle()
<< "'" << std::endl;
@ -1361,7 +1361,7 @@ GLiveSupport :: pauseOutputAudio(void)
outputPlayerIsPaused = true;
} else if (outputPlayerIsPaused) {
outputPlayer->start(0);
outputPlayer->start(0, STOP_TIME);
outputPlayerIsPaused = false;
}
}
@ -1444,7 +1444,7 @@ GLiveSupport :: playCueAudio(Ptr<Playable>::Ref playable)
case Playable::AudioClipType:
cueItemPlayingNow = acquireAudioClip(playable->getId());
cuePlayer->open(*cueItemPlayingNow->getUri(), (gint64)cueItemPlayingNow->getId()->getId());
cuePlayer->start(0);
cuePlayer->start(0, STOP_TIME);
std::cerr << "gLiveSupport: Cue playing audio clip '"
<< *playable->getTitle()
<< "'" << std::endl;
@ -1453,7 +1453,7 @@ GLiveSupport :: playCueAudio(Ptr<Playable>::Ref playable)
case Playable::PlaylistType:
cueItemPlayingNow = acquirePlaylist(playable->getId());
cuePlayer->open(*cueItemPlayingNow->getUri(), (gint64)cueItemPlayingNow->getId()->getId());
cuePlayer->start(0);
cuePlayer->start(0, STOP_TIME);
std::cerr << "gLiveSupport: Cue playing playlist '"
<< *playable->getTitle()
<< "'" << std::endl;
@ -1502,7 +1502,7 @@ GLiveSupport :: pauseCueAudio(void)
cuePlayerIsPaused = true;
} else if (cuePlayerIsPaused) {
cuePlayer->start(0);
cuePlayer->start(0, STOP_TIME);
cuePlayerIsPaused = false;
}
}
@ -1770,7 +1770,7 @@ GLiveSupport :: playTestSoundOnCue(Ptr<const Glib::ustring>::Ref oldDevice,
}
cuePlayer->setAudioDevice(*newDevice);
cuePlayer->open(*testAudioUrl, (gint64)0);
cuePlayer->start(0);
cuePlayer->start(0, STOP_TIME);
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
while (cuePlayer->isPlaying()) {
runMainLoop();

View File

@ -54,6 +54,8 @@ using namespace boost;
using namespace LiveSupport::Core;
using namespace LiveSupport::Scheduler;
#define START_TIME 0
#define STOP_TIME 30
/* =================================================== local data structures */
@ -159,7 +161,7 @@ PlaylistEvent :: start(void) throw ()
try {
audioPlayer->open(*playlist->getUri(), (gint64)playlist->getId()->getId());
audioPlayer->start(0);
audioPlayer->start(START_TIME, STOP_TIME);
playLog->addPlayLogEntry(playlist->getId(), TimeConversion::now());
} catch (std::invalid_argument &e) {