diff --git a/src/lib/time/time.cpp b/src/lib/time/time.cpp index 3fffe3307..48b0b31ec 100644 --- a/src/lib/time/time.cpp +++ b/src/lib/time/time.cpp @@ -151,6 +151,8 @@ namespace time { const FrameRate FrameRate::PAL (25); const FrameRate FrameRate::NTSC (30000,1001); + const FrameRate FrameRate::HALTED (1,std::numeric_limits::max()); + /** @return time span of one frame of this rate, * cast into internal Lumiera time scale */ diff --git a/src/lib/time/timevalue.hpp b/src/lib/time/timevalue.hpp index c41989c30..e0b06a86f 100644 --- a/src/lib/time/timevalue.hpp +++ b/src/lib/time/timevalue.hpp @@ -509,6 +509,8 @@ namespace time { static const FrameRate PAL; static const FrameRate NTSC; + static const FrameRate HALTED; + /** duration of one frame */ Duration duration() const; }; @@ -525,7 +527,7 @@ namespace time { __ensure_nonzero (NUM n) { if (n == 0) - throw error::Logic ("Zero spaced grid not allowed" + throw error::Logic ("Degenerated frame grid not allowed" , error::LUMIERA_ERROR_BOTTOM_VALUE); return n; } diff --git a/src/proc/engine/calc-plan-continuation.hpp b/src/proc/engine/calc-plan-continuation.hpp index b489f4129..39eee1093 100644 --- a/src/proc/engine/calc-plan-continuation.hpp +++ b/src/proc/engine/calc-plan-continuation.hpp @@ -128,6 +128,11 @@ namespace engine { performJobPlanningChunk() { UNIMPLEMENTED ("the actual meat: do the planning for a chunk of jobs"); + + + JobPlanningSequence jobs = dispatcher_->onCalcStream(modelPort_, channel_) + .establishNextJobs(refPoint_); + } }; diff --git a/src/proc/engine/calc-stream.hpp b/src/proc/engine/calc-stream.hpp index e7c134774..e3341502a 100644 --- a/src/proc/engine/calc-stream.hpp +++ b/src/proc/engine/calc-stream.hpp @@ -43,6 +43,8 @@ namespace proc { namespace engine{ + + namespace error = lumiera::error; // using std::string; // using lumiera::Subsys; @@ -62,7 +64,9 @@ namespace engine{ class RenderEnvironmentClosure { public: - virtual ~RenderEnvironmentClosure() { } ///< this is an interface + virtual ~RenderEnvironmentClosure() { } ///< this is an interface + + virtual play::Timings& effectiveTimings() =0; }; @@ -88,7 +92,6 @@ namespace engine{ class CalcStream { RenderEnvironmentClosure* eng_; - play::Timings timings_; engine::CalcPlanContinuation* plan_; protected: @@ -103,7 +106,6 @@ namespace engine{ CalcStream() : eng_(0) , plan_(0) - , timings_() { } ~CalcStream() { } @@ -116,6 +118,16 @@ namespace engine{ UNIMPLEMENTED ("set up dispatcher to start calculating and feeding to the given output sink"); return *this; } + + play::Timings const& + getTimings() + { + if (!eng_) + throw error::State ("attempt to get the playback timings " + "of an unconfigured, disabled or halted calculation stream" + ,error::LUMIERA_ERROR_LIFECYCLE); + return eng_->effectiveTimings(); + } }; diff --git a/src/proc/engine/engine-service.cpp b/src/proc/engine/engine-service.cpp index c3be5f8e8..bd27e0eb7 100644 --- a/src/proc/engine/engine-service.cpp +++ b/src/proc/engine/engine-service.cpp @@ -26,7 +26,7 @@ //#include //#include -//#include +#include //#include @@ -38,28 +38,15 @@ namespace engine{ // using lumiera::Subsys; // using std::auto_ptr; // using boost::scoped_ptr; - using std::function; + using std::tr1::function; using std::tr1::bind; + using std::tr1::ref; using lib::transform; using lib::append_all; namespace { // hidden local details of the service implementation.... - /** @internal build a representation of a single, ongoing calculation effort. - * This "CalcStream" is tied to the actual engine implementation, but only - * through an opaque link, representing this concrete engine as an - * RenderEnvironmentClosure. This enables the created CalcStream to be - * re-configured and adjusted while running. - */ - CalcStream - activateCalculation (play::DataSink sink, RenderEnvironmentClosure& engineCallback) - { - CalcStream calcStream(engineCallback); - calcStream.sendToOutput (sink); - return calcStream; - } - } // (End) hidden service impl details @@ -93,7 +80,7 @@ namespace engine{ Quality serviceQuality) { RenderEnvironmentClosure& renderConfig = configureCalculation (mPort,nominalTimings,serviceQuality); - function triggerRenderStart = bind (activateCalculation, renderConfig, _1); + function triggerRenderStart = bind (activateCalculation, _1, ref(renderConfig)); CalcStreams runningCalculations; append_all (transform (output.getOpenedSinks() @@ -119,7 +106,21 @@ namespace engine{ } - + /** @internal build a representation of a single, ongoing calculation effort. + * This "CalcStream" is tied to the actual engine implementation, but only + * through an opaque link, representing this concrete engine as an + * RenderEnvironmentClosure. This enables the created CalcStream to be + * re-configured and adjusted while running. + */ + CalcStream + EngineService::activateCalculation (play::DataSink sink, RenderEnvironmentClosure& engineCallback) + { + CalcStream calcStream(engineCallback); + calcStream.sendToOutput (sink); + return calcStream; + } + + /** @internal extension point * Install and activate a single, ongoing calculation effort. diff --git a/src/proc/engine/engine-service.hpp b/src/proc/engine/engine-service.hpp index 223404e3a..6cd290687 100644 --- a/src/proc/engine/engine-service.hpp +++ b/src/proc/engine/engine-service.hpp @@ -162,6 +162,9 @@ namespace engine{ void disableTracing(); ///< EX_FREE friend class EngineDiagnostics; + + private: + static CalcStream activateCalculation (play::DataSink, RenderEnvironmentClosure&); }; diff --git a/src/proc/engine/frame-coord.hpp b/src/proc/engine/frame-coord.hpp index 6846ee0fe..a1e95e679 100644 --- a/src/proc/engine/frame-coord.hpp +++ b/src/proc/engine/frame-coord.hpp @@ -70,9 +70,8 @@ namespace engine { /** build an \em undefined frame location */ FrameCoord() - : absoluteNominalTime(Time::ANYTIME) + : absoluteNominalTime(Time::NEVER) , absoluteFrameNumber(std::numeric_limits::max()) - , absoluteNominalTime(Time::NEVER) , modelPort() // unconnected , channelNr(0) { } diff --git a/src/proc/engine/job.hpp b/src/proc/engine/job.hpp index d100003ec..2070933ba 100644 --- a/src/proc/engine/job.hpp +++ b/src/proc/engine/job.hpp @@ -25,10 +25,11 @@ #define PROC_ENGINE_JOB_H +#include "lib/llist.h" + #include -typedef void* LList; ////////////////////////////////////TODO typedef uint64_t InvocationInstanceID; /////////////////TODO diff --git a/src/proc/play/output-slot.hpp b/src/proc/play/output-slot.hpp index 3b34a1fa1..f98c20426 100644 --- a/src/proc/play/output-slot.hpp +++ b/src/proc/play/output-slot.hpp @@ -160,6 +160,13 @@ namespace play { + /** + * denotes an opened connection ready to receive media data for output. + * Each DataSink (handle) corresponds to an OutputSlot::Connection entry. + * Data is handed over frame wise in a two-phase protocol: first, the client + * gets exclusive access to an output buffer, and then, when done, the buffer + * is handed over by an #emit call. + */ class DataSink : public lib::Handle { diff --git a/src/proc/play/timings.cpp b/src/proc/play/timings.cpp index b6fdaf7a1..045fd1143 100644 --- a/src/proc/play/timings.cpp +++ b/src/proc/play/timings.cpp @@ -72,6 +72,10 @@ namespace play { //////////////////////////////////////////////////////////////////TODO ctors for use in the real player/engine? + /** a special marker Timings record, + * indicating disabled or halted output */ + Timings Timings::DISABLED(FrameRate::HALTED); + TimeValue Timings::getOrigin() const diff --git a/src/proc/play/timings.hpp b/src/proc/play/timings.hpp index 3dc2ba9db..c2ec75ab2 100644 --- a/src/proc/play/timings.hpp +++ b/src/proc/play/timings.hpp @@ -104,10 +104,15 @@ namespace play { Time scheduledDelivery; Duration outputLatency; + explicit Timings (FrameRate fps); // default copy acceptable + + /** marker for halted output */ + static Timings DISABLED; + TimeValue getOrigin() const; TimeValue getFrameStartAt (int64_t frameNr) const;