From 7150ab9ee93941a99ec14079809a078427e3acbb Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 22 Jan 2009 23:16:46 +0100 Subject: [PATCH] add implementation of PlayProcess logic --- src/common/interfaceproxy.cpp | 5 +++++ src/proc/dummy-player-service.cpp | 27 +++++++++++++++++++++++---- src/proc/dummy-player-service.hpp | 14 +++++++++++++- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/common/interfaceproxy.cpp b/src/common/interfaceproxy.cpp index 984555f28..bf7607f17 100644 --- a/src/common/interfaceproxy.cpp +++ b/src/common/interfaceproxy.cpp @@ -163,6 +163,11 @@ namespace lumiera { //----Proxy-Implementation-of-DummyPlayer-------- typedef proc::DummyPlayer::Process Process; + /** @note as an optimisation we hand out a direct reference + * to the implementing process object. While this ref could + * still be passed as handle to the C Language interface, using + * it directly within the client (=GUI) retains only on level + * of indirection, irrespective which interface is used. */ Process& start() { Process* pP = static_cast (_i_.startPlay()); diff --git a/src/proc/dummy-player-service.cpp b/src/proc/dummy-player-service.cpp index f1f80409a..4984f9b45 100644 --- a/src/proc/dummy-player-service.cpp +++ b/src/proc/dummy-player-service.cpp @@ -247,7 +247,7 @@ namespace proc { , implInstance_(this,_instance) , serviceInstance_( LUMIERA_INTERFACE_REF (lumieraorg_DummyPlayer, 0, lumieraorg_DummyPlayerFacade)) { - INFO (operate, "GuiNotification Facade opened."); + INFO (operate, "DummyPlayer Facade opened."); } @@ -260,7 +260,8 @@ namespace proc { return theDescriptor(); } - DummyPlayer::~DummyPlayer() { } ///< emit the vtable here into this translation unit within liblumieraproc.so ... + // emit the vtable here into this translation unit within liblumieraproc.so ... + DummyPlayer::~DummyPlayer() { } DummyPlayer::Process::~Process() { } @@ -268,7 +269,22 @@ namespace proc { DummyPlayer::Process& DummyPlayerService::start() { - UNIMPLEMENTED ("initiate a new playback process"); + REQUIRE (!theProcess_.isActive()); + theProcess_.setRate(25); + + return theProcess_; + } + + + + void + ProcessImpl::setRate (uint fps) + { + REQUIRE (fps==0 || fps_==0 ); + REQUIRE (fps==0 || !play_ ); + + fps_ = fps; + play_ = (fps != 0); } @@ -276,7 +292,8 @@ namespace proc { void ProcessImpl::pause(bool doPlay) { - UNIMPLEMENTED ("pause playback"); + REQUIRE (isActive()); + play_ = doPlay; } @@ -284,6 +301,8 @@ namespace proc { void* const ProcessImpl::getFrame() { + REQUIRE (isActive()); + UNIMPLEMENTED ("actually deliver a frame"); } diff --git a/src/proc/dummy-player-service.hpp b/src/proc/dummy-player-service.hpp index 7610b91c3..f007e5cf4 100644 --- a/src/proc/dummy-player-service.hpp +++ b/src/proc/dummy-player-service.hpp @@ -59,8 +59,20 @@ namespace proc { void pause(bool doPlay); void* const getFrame(); + uint fps_; + bool play_; + public: - ProcessImpl() {} + ProcessImpl() : fps_(0), play_(false) {} + + /* Implementation-level API to be used By DummyPlayerService */ + + /** activate a playback process + * with given specification */ + void setRate (uint fps); + + bool isActive () { return fps_ != 0; } + bool isPlaying() { return play_; } };