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:
parent
2ed80ef62f
commit
60518f7074
5 changed files with 24 additions and 14 deletions
|
@ -204,7 +204,7 @@ class AudioPlayerInterface
|
||||||
* @see #stop
|
* @see #stop
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
start(int) throw (std::logic_error)
|
start(int,int) throw (std::logic_error)
|
||||||
= 0;
|
= 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -386,8 +386,14 @@ GstreamerPlayer :: getPosition(void) throw (std::logic_error)
|
||||||
throw std::logic_error("player not open");
|
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)));
|
length.reset(new time_duration(microseconds((m_smilOffset + ns) / 1000LL)));
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
|
@ -398,9 +404,10 @@ GstreamerPlayer :: getPosition(void) throw (std::logic_error)
|
||||||
* Start playing
|
* Start playing
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
GstreamerPlayer :: start(int start_time) throw (std::logic_error)
|
GstreamerPlayer :: start(int start_time, int stop_time) throw (std::logic_error)
|
||||||
{
|
{
|
||||||
DEBUG_BLOCK
|
DEBUG_BLOCK
|
||||||
|
m_stop_time = stop_time;
|
||||||
m_start_time = start_time;
|
m_start_time = start_time;
|
||||||
if (!isOpen()) {
|
if (!isOpen()) {
|
||||||
throw std::logic_error("GstreamerPlayer not opened yet");
|
throw std::logic_error("GstreamerPlayer not opened yet");
|
||||||
|
|
|
@ -124,6 +124,7 @@ class GstreamerPlayer : virtual public Configurable,
|
||||||
std::string m_audioDevice;
|
std::string m_audioDevice;
|
||||||
|
|
||||||
gint64 m_smilOffset;
|
gint64 m_smilOffset;
|
||||||
|
gint m_stop_time;
|
||||||
gint64 m_currentPlayLength;
|
gint64 m_currentPlayLength;
|
||||||
gint64 m_Id;
|
gint64 m_Id;
|
||||||
|
|
||||||
|
@ -329,7 +330,7 @@ public:
|
||||||
* @see #stop
|
* @see #stop
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
start(int) throw (std::logic_error);
|
start(int,int) throw (std::logic_error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pause the player.
|
* Pause the player.
|
||||||
|
|
|
@ -76,7 +76,7 @@ using namespace LiveSupport::SchedulerClient;
|
||||||
using namespace LiveSupport::Widgets;
|
using namespace LiveSupport::Widgets;
|
||||||
using namespace LiveSupport::GLiveSupport;
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
|
#define STOP_TIME 300
|
||||||
/* =================================================== local data structures */
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1302,7 +1302,7 @@ GLiveSupport :: playOutputAudio(Ptr<Playable>::Ref playable)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
outputPlayer->start(0);
|
outputPlayer->start(0, STOP_TIME);
|
||||||
std::cerr << "gLiveSupport: Live Mode playing audio clip '"
|
std::cerr << "gLiveSupport: Live Mode playing audio clip '"
|
||||||
<< *playable->getTitle()
|
<< *playable->getTitle()
|
||||||
<< "'" << std::endl;
|
<< "'" << std::endl;
|
||||||
|
@ -1311,7 +1311,7 @@ GLiveSupport :: playOutputAudio(Ptr<Playable>::Ref playable)
|
||||||
case Playable::PlaylistType:
|
case Playable::PlaylistType:
|
||||||
outputItemPlayingNow = acquirePlaylist(playable->getId());
|
outputItemPlayingNow = acquirePlaylist(playable->getId());
|
||||||
outputPlayer->open(*outputItemPlayingNow->getUri(), (gint64)outputItemPlayingNow->getId()->getId());
|
outputPlayer->open(*outputItemPlayingNow->getUri(), (gint64)outputItemPlayingNow->getId()->getId());
|
||||||
outputPlayer->start(0);
|
outputPlayer->start(0, STOP_TIME);
|
||||||
std::cerr << "gLiveSupport: Live Mode playing playlist '"
|
std::cerr << "gLiveSupport: Live Mode playing playlist '"
|
||||||
<< *playable->getTitle()
|
<< *playable->getTitle()
|
||||||
<< "'" << std::endl;
|
<< "'" << std::endl;
|
||||||
|
@ -1361,7 +1361,7 @@ GLiveSupport :: pauseOutputAudio(void)
|
||||||
outputPlayerIsPaused = true;
|
outputPlayerIsPaused = true;
|
||||||
|
|
||||||
} else if (outputPlayerIsPaused) {
|
} else if (outputPlayerIsPaused) {
|
||||||
outputPlayer->start(0);
|
outputPlayer->start(0, STOP_TIME);
|
||||||
outputPlayerIsPaused = false;
|
outputPlayerIsPaused = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1444,7 +1444,7 @@ GLiveSupport :: playCueAudio(Ptr<Playable>::Ref playable)
|
||||||
case Playable::AudioClipType:
|
case Playable::AudioClipType:
|
||||||
cueItemPlayingNow = acquireAudioClip(playable->getId());
|
cueItemPlayingNow = acquireAudioClip(playable->getId());
|
||||||
cuePlayer->open(*cueItemPlayingNow->getUri(), (gint64)cueItemPlayingNow->getId()->getId());
|
cuePlayer->open(*cueItemPlayingNow->getUri(), (gint64)cueItemPlayingNow->getId()->getId());
|
||||||
cuePlayer->start(0);
|
cuePlayer->start(0, STOP_TIME);
|
||||||
std::cerr << "gLiveSupport: Cue playing audio clip '"
|
std::cerr << "gLiveSupport: Cue playing audio clip '"
|
||||||
<< *playable->getTitle()
|
<< *playable->getTitle()
|
||||||
<< "'" << std::endl;
|
<< "'" << std::endl;
|
||||||
|
@ -1453,7 +1453,7 @@ GLiveSupport :: playCueAudio(Ptr<Playable>::Ref playable)
|
||||||
case Playable::PlaylistType:
|
case Playable::PlaylistType:
|
||||||
cueItemPlayingNow = acquirePlaylist(playable->getId());
|
cueItemPlayingNow = acquirePlaylist(playable->getId());
|
||||||
cuePlayer->open(*cueItemPlayingNow->getUri(), (gint64)cueItemPlayingNow->getId()->getId());
|
cuePlayer->open(*cueItemPlayingNow->getUri(), (gint64)cueItemPlayingNow->getId()->getId());
|
||||||
cuePlayer->start(0);
|
cuePlayer->start(0, STOP_TIME);
|
||||||
std::cerr << "gLiveSupport: Cue playing playlist '"
|
std::cerr << "gLiveSupport: Cue playing playlist '"
|
||||||
<< *playable->getTitle()
|
<< *playable->getTitle()
|
||||||
<< "'" << std::endl;
|
<< "'" << std::endl;
|
||||||
|
@ -1502,7 +1502,7 @@ GLiveSupport :: pauseCueAudio(void)
|
||||||
cuePlayerIsPaused = true;
|
cuePlayerIsPaused = true;
|
||||||
|
|
||||||
} else if (cuePlayerIsPaused) {
|
} else if (cuePlayerIsPaused) {
|
||||||
cuePlayer->start(0);
|
cuePlayer->start(0, STOP_TIME);
|
||||||
cuePlayerIsPaused = false;
|
cuePlayerIsPaused = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1770,7 +1770,7 @@ GLiveSupport :: playTestSoundOnCue(Ptr<const Glib::ustring>::Ref oldDevice,
|
||||||
}
|
}
|
||||||
cuePlayer->setAudioDevice(*newDevice);
|
cuePlayer->setAudioDevice(*newDevice);
|
||||||
cuePlayer->open(*testAudioUrl, (gint64)0);
|
cuePlayer->open(*testAudioUrl, (gint64)0);
|
||||||
cuePlayer->start(0);
|
cuePlayer->start(0, STOP_TIME);
|
||||||
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
|
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
|
||||||
while (cuePlayer->isPlaying()) {
|
while (cuePlayer->isPlaying()) {
|
||||||
runMainLoop();
|
runMainLoop();
|
||||||
|
|
|
@ -54,6 +54,8 @@ using namespace boost;
|
||||||
using namespace LiveSupport::Core;
|
using namespace LiveSupport::Core;
|
||||||
using namespace LiveSupport::Scheduler;
|
using namespace LiveSupport::Scheduler;
|
||||||
|
|
||||||
|
#define START_TIME 0
|
||||||
|
#define STOP_TIME 30
|
||||||
/* =================================================== local data structures */
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,7 +161,7 @@ PlaylistEvent :: start(void) throw ()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
audioPlayer->open(*playlist->getUri(), (gint64)playlist->getId()->getId());
|
audioPlayer->open(*playlist->getUri(), (gint64)playlist->getId()->getId());
|
||||||
audioPlayer->start(0);
|
audioPlayer->start(START_TIME, STOP_TIME);
|
||||||
|
|
||||||
playLog->addPlayLogEntry(playlist->getId(), TimeConversion::now());
|
playLog->addPlayLogEntry(playlist->getId(), TimeConversion::now());
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue