From 76b24ce50d3ec160336851875bd5b7085b5e91f2 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 10 Dec 2011 03:18:48 +0100 Subject: [PATCH] WIP draft the building of a render CalculationStream --- src/proc/play/play-process.cpp | 13 ++-- src/proc/play/play-process.hpp | 13 +++- src/proc/play/play-service.cpp | 8 ++- src/proc/play/render-configurator.cpp | 79 ++++++++++++++++++++++++ src/proc/play/render-configurator.hpp | 87 +++++++++++++++++++++++++++ 5 files changed, 192 insertions(+), 8 deletions(-) create mode 100644 src/proc/play/render-configurator.cpp create mode 100644 src/proc/play/render-configurator.hpp diff --git a/src/proc/play/play-process.cpp b/src/proc/play/play-process.cpp index ca1417659..6a3f2e465 100644 --- a/src/proc/play/play-process.cpp +++ b/src/proc/play/play-process.cpp @@ -1,5 +1,5 @@ /* - PlayProcess.hpp - state frame for an ongoing play/render process + PlayProcess - state frame for an ongoing play/render process Copyright (C) Lumiera.org 2011, Hermann Vosseler @@ -22,6 +22,7 @@ #include "proc/play/play-process.hpp" +#include "proc/play/render-configurator.hpp" #include "lib/itertools.hpp" //#include @@ -57,7 +58,8 @@ namespace play { if (!slot.isFree()) throw error::State("unable to acquire a suitable output slot" /////////////////////TICKET #197 #816 , LUMIERA_ERROR_CANT_PLAY); - return Feed (port,slot); + + return Feed (port,slot); //////////////////////////////////TODO: how to get the RenderConfigurator (strategy) here??? } @@ -110,10 +112,9 @@ namespace play { /** */ - Feed::Feed (ModelPort port, OutputSlot& output) - { - UNIMPLEMENTED("build an active playback/render feed"); - } + Feed::Feed (ModelPort port, OutputSlot& output, RenderConfigurator& renderStrategy) + : renderStreams_(renderStrategy.buildCalculationStreams(port,output)) + { } diff --git a/src/proc/play/play-process.hpp b/src/proc/play/play-process.hpp index 193dc252e..818f0725f 100644 --- a/src/proc/play/play-process.hpp +++ b/src/proc/play/play-process.hpp @@ -83,6 +83,10 @@ namespace play { namespace error = lumiera::error; + /** Strategy for configuring the render process */ + class RenderConfigurator; + + /** * Rendering data feed, corresponding to a single * global pipe and to be delivered into a single OutputSlot. @@ -95,7 +99,14 @@ namespace play { public: typedef lib::IterSource::iterator Connections; - Feed (ModelPort, OutputSlot&); + typedef std::vector RenderStreams; + + RenderStreams renderStreams_; + + /** building a Feed effectively involves the EngineService + * to establish an actual rendering plan. Which is abstracted + * here through the RenderConfigurator instance */ + Feed (ModelPort, OutputSlot&, RenderConfigurator&); }; diff --git a/src/proc/play/play-service.cpp b/src/proc/play/play-service.cpp index aab3306b7..a3932d1c9 100644 --- a/src/proc/play/play-service.cpp +++ b/src/proc/play/play-service.cpp @@ -21,6 +21,8 @@ * *****************************************************/ +#include "lib/error.hpp" +#include "include/play-facade.h" #include "proc/play/play-service.hpp" #include "proc/play/play-process.hpp" #include "lib/util.hpp" @@ -97,6 +99,7 @@ namespace play { void endProcess (PlayProcess* dyingProcess) { + /////////////////////////////////////////////TICKET #867 : somehow ensure sane abort of all attached calculation efforts delete dyingProcess; Lock sync(this); @@ -114,7 +117,10 @@ namespace play { using lumiera::Play; - PlayService::~PlayService() { } + PlayService::~PlayService() + { + UNIMPLEMENTED ("block waiting for any ongoing play processes. Ensure the process table is empty -- OR -- hand it over to some kind of cleanup service"); + } /** bring up the global render- and playback service. diff --git a/src/proc/play/render-configurator.cpp b/src/proc/play/render-configurator.cpp new file mode 100644 index 000000000..ffd091feb --- /dev/null +++ b/src/proc/play/render-configurator.cpp @@ -0,0 +1,79 @@ +/* + RenderConfigurator - strategy to help building an actual render calculation stream + + Copyright (C) Lumiera.org + 2011, Hermann Vosseler + + This program 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. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "proc/play/render-configurator.hpp" +#include "proc/engine/engine-service.hpp" +//#include "lib/itertools.hpp" + +//#include +//#include +//#include +//#include + + + +namespace proc { +namespace play { + +// using std::string; +// using lumiera::Subsys; +// using std::auto_ptr; +// using boost::scoped_ptr; +// using std::tr1::bind; + + + namespace { // Implementation details... + +// using std::tr1::bind; +// using std::tr1::function; +// using std::tr1::placeholders::_1; +// using lib::transform; + + class DefaultRenderProcessBuilder + : public RenderConfigurator + { + + RenderStreams + buildCalculationStreams (ModelPort port, OutputSlot& output) + { + UNIMPLEMENTED("build an active playback/render feed"); + + ///TODO allocate the output slot + ///TODO extract the individual channels + ///TODO get the timings + + engine::EngineService::instance().calculate(port, nominalTimings, activeOutputConnection, serviceQuality); + } + }; + + + } // (End) hidden service impl details + + + + + + /** */ + + +}} // namespace proc::play diff --git a/src/proc/play/render-configurator.hpp b/src/proc/play/render-configurator.hpp new file mode 100644 index 000000000..8811d803f --- /dev/null +++ b/src/proc/play/render-configurator.hpp @@ -0,0 +1,87 @@ +/* + RENDER-CONFIGURATOR.hpp - strategy to help building an actual render calculation stream + + Copyright (C) Lumiera.org + 2011, Hermann Vosseler + + This program 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. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/** @file render-configurator.hpp + ** Strategy holding all the detail knowledge necessary to establish + ** a running render CalculationStream. + ** + ** @see engine::EngineService + ** @see engine::Feed + ** @see engine::PlayService + */ + + +#ifndef PROC_PLAY_RENDER_CONFIGURATOR_H +#define PROC_PLAY_RENDER_CONFIGURATOR_H + + +#include "lib/error.hpp" +//#include "include/dummy-player-facade.h" +//#include "include/display-facade.h" +//#include "common/instancehandle.hpp" +//#include "lib/singleton-ref.hpp" +#include "proc/mobject/model-port.hpp" +//#include "proc/play/output-manager.hpp" +//#include "lib/iter-source.hpp" +//#include "lib/util.hpp" +// +//#include +//#include +//#include +#include + + +namespace proc { +namespace play { + +// using std::string; +// using lumiera::Subsys; +// using lumiera::Display; +// using lumiera::DummyPlayer; +// using util::isnil; + using proc::mobject::ModelPort; + +// typedef proc::play::POutputManager POutputManager; +// typedef lib::IterSource::iterator ModelPorts; + + namespace error = lumiera::error; + + + /** Strategy for configuring the render process */ + class RenderConfigurator + { + + public: + virtual ~RenderConfigurator(); ///< this is an interface + + + typedef std::vector RenderStreams; ////TODO this belongs rather into class Feed + + virtual RenderStreams buildCalculationStreams (ModelPort, OutputSlot&) =0; + + }; + + + + +}} // namespace proc::play +#endif