WIP: CalcStream initialisation

especially: where to establish the effective Timings.

also fixed several compilation errors
This commit is contained in:
Fischlurch 2013-06-15 04:02:48 +02:00
parent 77066ee3ce
commit 84281d5b60
11 changed files with 66 additions and 25 deletions

View file

@ -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<int>::max());
/** @return time span of one frame of this rate,
* cast into internal Lumiera time scale */

View file

@ -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;
}

View file

@ -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_);
}
};

View file

@ -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();
}
};

View file

@ -26,7 +26,7 @@
//#include <string>
//#include <memory>
//#include <tr1/functional>
#include <tr1/functional>
//#include <boost/scoped_ptr.hpp>
@ -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<CalcStream(play::DataSink)> triggerRenderStart = bind (activateCalculation, renderConfig, _1);
function<CalcStream(play::DataSink)> 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.

View file

@ -162,6 +162,9 @@ namespace engine{
void disableTracing(); ///< EX_FREE
friend class EngineDiagnostics;
private:
static CalcStream activateCalculation (play::DataSink, RenderEnvironmentClosure&);
};

View file

@ -70,9 +70,8 @@ namespace engine {
/** build an \em undefined frame location */
FrameCoord()
: absoluteNominalTime(Time::ANYTIME)
: absoluteNominalTime(Time::NEVER)
, absoluteFrameNumber(std::numeric_limits<int64_t>::max())
, absoluteNominalTime(Time::NEVER)
, modelPort() // unconnected
, channelNr(0)
{ }

View file

@ -25,10 +25,11 @@
#define PROC_ENGINE_JOB_H
#include "lib/llist.h"
#include <gavl/gavl.h>
typedef void* LList; ////////////////////////////////////TODO
typedef uint64_t InvocationInstanceID; /////////////////TODO

View file

@ -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<OutputSlot::Connection>
{

View file

@ -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

View file

@ -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;