a better way to inject the Render-Engine Mock
instead of (ab)using the Timings spect for a runtime switch, better use the existing MockInjector facility and thus turn the mock engine mode into a global switch
This commit is contained in:
parent
a2bcedc31e
commit
ec659b7141
7 changed files with 25 additions and 44 deletions
|
|
@ -75,7 +75,13 @@ namespace backend {
|
||||||
class MediaAccessFacade;
|
class MediaAccessFacade;
|
||||||
using lib::Singleton;
|
using lib::Singleton;
|
||||||
|
|
||||||
} // namespace backend_interface
|
} // namespace backend
|
||||||
|
|
||||||
|
namespace proc {
|
||||||
|
namespace engine {
|
||||||
|
class EngineService;
|
||||||
|
using lib::Singleton;
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -101,6 +107,12 @@ namespace lib {
|
||||||
: public MockInjector<backend::MediaAccessFacade>
|
: public MockInjector<backend::MediaAccessFacade>
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
class Singleton<proc::engine::EngineService>
|
||||||
|
: public MockInjector<proc::engine::EngineService>
|
||||||
|
{ };
|
||||||
|
|
||||||
} // namespace lib
|
} // namespace lib
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
** This configuration header just pulls in some other implementation headers in
|
** This configuration header just pulls in some other implementation headers in
|
||||||
** the right order. The basic class template for creating singletons resides in
|
** the right order. The basic class template for creating singletons resides in
|
||||||
** singleton-factory.hpp, besides we need policy classes defining how to create
|
** singleton-factory.hpp, besides we need policy classes defining how to create
|
||||||
** the singleton objects and how to manage singleton lifecycle. Finally,
|
** the singleton objects and how to manage singleton lifecycle. Finally,
|
||||||
** we want to preconfigure singleton factories for some important facilities;
|
** we want to preconfigure singleton factories for some important facilities;
|
||||||
** e.g. sometimes we want to include a hook for injecting Test Mock instances.
|
** e.g. sometimes we want to include a hook for injecting Test Mock instances.
|
||||||
**
|
**
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,6 @@ namespace engine{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** storage for the EngineService interface object */
|
|
||||||
lib::Singleton<EngineServiceMock> EngineServiceMock::instance;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,14 +85,12 @@ namespace engine{
|
||||||
* order and to enqueue these into the scheduler.
|
* order and to enqueue these into the scheduler.
|
||||||
*/
|
*/
|
||||||
class EngineServiceMock
|
class EngineServiceMock
|
||||||
: boost::noncopyable
|
: public EngineService
|
||||||
{
|
{
|
||||||
|
lib::ScopedPtrVect<node::DummyTick> processors_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** access point to the Engine Interface Mock implementation. */
|
|
||||||
static lib::Singleton<EngineServiceMock> instance;
|
|
||||||
|
|
||||||
|
|
||||||
EngineServiceMock();
|
EngineServiceMock();
|
||||||
~EngineServiceMock() { }
|
~EngineServiceMock() { }
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,9 @@
|
||||||
** A timer service invoking a given callback periodically.
|
** A timer service invoking a given callback periodically.
|
||||||
** This is a rough preliminary implementation as of 1/2009. We use it to
|
** This is a rough preliminary implementation as of 1/2009. We use it to
|
||||||
** drive the frame "creation" of a player dummy (the render engine is not
|
** drive the frame "creation" of a player dummy (the render engine is not
|
||||||
** ready yet). The intention is to make this a real service later on, which
|
** ready yet). The intention is to use this service as part of a mock engine
|
||||||
** might consolidate and sync various ongoing output processes to a common
|
** setup, used to verify the construction of engine components. As an integration
|
||||||
** beat, which it implements by precision posix timers. Probably then this
|
** test, we build a "dummy player", delivering some test data frames to the Gui.
|
||||||
** service will become part of the backend, or rely on a timing service.
|
|
||||||
**
|
**
|
||||||
** @see proc::play::DummyPlayerService
|
** @see proc::play::DummyPlayerService
|
||||||
**
|
**
|
||||||
|
|
@ -39,6 +38,7 @@
|
||||||
#define PROC_PLAY_TICKSERVICE_H
|
#define PROC_PLAY_TICKSERVICE_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "lib/error.hpp"
|
||||||
#include "backend/thread-wrapper.hpp"
|
#include "backend/thread-wrapper.hpp"
|
||||||
|
|
||||||
#include <tr1/functional>
|
#include <tr1/functional>
|
||||||
|
|
@ -49,6 +49,7 @@ namespace proc {
|
||||||
namespace node {
|
namespace node {
|
||||||
|
|
||||||
using std::tr1::function;
|
using std::tr1::function;
|
||||||
|
using std::tr1::bind;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "proc/play/render-configurator.hpp"
|
#include "proc/play/render-configurator.hpp"
|
||||||
#include "proc/play/output-manager.hpp"
|
#include "proc/play/output-manager.hpp"
|
||||||
#include "proc/engine/engine-service.hpp"
|
#include "proc/engine/engine-service.hpp"
|
||||||
#include "proc/engine/engine-service-mock.hpp"
|
|
||||||
//#include "lib/itertools.hpp"
|
//#include "lib/itertools.hpp"
|
||||||
|
|
||||||
//#include <string>
|
//#include <string>
|
||||||
|
|
@ -48,7 +47,6 @@ namespace play {
|
||||||
using std::tr1::bind;
|
using std::tr1::bind;
|
||||||
using std::tr1::placeholders::_1;
|
using std::tr1::placeholders::_1;
|
||||||
using engine::EngineService;
|
using engine::EngineService;
|
||||||
using engine::EngineServiceMock;
|
|
||||||
|
|
||||||
typedef EngineService::QoS_Definition RenderQuality;
|
typedef EngineService::QoS_Definition RenderQuality;
|
||||||
|
|
||||||
|
|
@ -129,32 +127,14 @@ namespace play {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockRenderProcessBuilder
|
|
||||||
: public LumieraRenderProcessBuilder
|
|
||||||
{
|
|
||||||
engine::CalcStreams
|
|
||||||
activateEngine (ModelPort port, Timings timings, OutputSlot::Allocation& activeOutputConnection,RenderQuality quality)
|
|
||||||
{
|
|
||||||
return EngineServiceMock::instance().calculate (port, timings, activeOutputConnection, quality);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
MockRenderProcessBuilder (POutputManager outputManager, Timings playbackSpeed)
|
|
||||||
: LumieraRenderProcessBuilder(outputManager,playbackSpeed)
|
|
||||||
{ }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
/** @internal decision point about how to configure the rendering.
|
||||||
/** @internal decision point about how to configure the rendering */
|
* This would be the point to switch the render engine used. */
|
||||||
inline RenderConfigurator*
|
inline RenderConfigurator*
|
||||||
how_to_render (POutputManager outputPossibilities, Timings playTimings)
|
how_to_render (POutputManager outputPossibilities, Timings playTimings)
|
||||||
{
|
{
|
||||||
if (playTimings.isMockEngineRun())
|
return new LumieraRenderProcessBuilder (outputPossibilities, playTimings);
|
||||||
return new MockRenderProcessBuilder (outputPossibilities, playTimings);
|
|
||||||
|
|
||||||
else
|
|
||||||
return new LumieraRenderProcessBuilder (outputPossibilities, playTimings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,14 +81,6 @@ namespace play {
|
||||||
class Timings
|
class Timings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** push aside the real Lumiera engine and use a test mock.
|
|
||||||
* @todo 1/2012 hard wired -- until the engine becomes usable
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
isMockEngineRun ()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////TODO further accessor functions here
|
//////////////TODO further accessor functions here
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue