rectify frame dispatch invocation

This commit is contained in:
Fischlurch 2012-02-24 00:29:59 +01:00
parent 393a447861
commit ee1450a81a
3 changed files with 21 additions and 8 deletions

View file

@ -26,6 +26,7 @@
#include "proc/common.hpp"
//#include "proc/state.hpp"
#include "proc/mobject/model-port.hpp"
#include "proc/engine/time-anchor.hpp"
#include "proc/engine/frame-coord.hpp"
#include "proc/engine/job-ticket.hpp"
@ -38,6 +39,7 @@
namespace proc {
namespace engine {
using mobject::ModelPort;
using lib::time::TimeSpan;
using lib::time::FSecs;
using lib::time::Time;
@ -50,12 +52,21 @@ namespace engine {
class Dispatcher
: boost::noncopyable
{
struct CoordBuilder
{
Dispatcher& dispatcher_;
ModelPort modelPort_;
uint channel_;
FrameCoord relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset);
};
public:
virtual ~Dispatcher(); ///< this is an interface
CoordBuilder onCalcStream (ModelPort modelPort, uint channel);
virtual FrameCoord locateFrameNext (uint frameCountOffset) =0;
virtual FrameCoord locateFrameNext (uint frameCountOffset, TimeAnchor refPoint) =0;
JobTicket& accessJobTicket (FrameCoord const&);

View file

@ -26,7 +26,6 @@
#include "proc/common.hpp"
//#include "proc/state.hpp"
#include "proc/mobject/model-port.hpp"
#include "lib/time/timevalue.hpp"
#include "proc/play/timings.hpp"
@ -35,10 +34,9 @@
namespace proc {
namespace engine {
using mobject::ModelPort;
// using lib::time::TimeSpan;
// using lib::time::FSecs;
// using lib::time::Time;
using lib::time::Time;
//
// class ExitNode;
@ -59,6 +57,9 @@ namespace engine {
*/
class TimeAnchor
{
///////////////////////////TODO need some kind of scale or grid here
uint64_t anchorPoint_;
Time relatedRealTime_;
TimeAnchor()
{
@ -69,7 +70,7 @@ namespace engine {
// using default copy operations
static TimeAnchor
build (play::Timings timings, uint64_t startFrame, ModelPort modelPort, uint channel)
build (play::Timings timings, uint64_t startFrame)
{
UNIMPLEMENTED ("representation of the Time Anchor closure");
}

View file

@ -71,7 +71,7 @@ namespace test {
/* == mock Dispatcher implementation == */
FrameCoord
locateFrameNext (uint frameCountOffset)
locateFrameNext (uint frameCountOffset, TimeAnchor refPoint)
{
UNIMPLEMENTED ("dummy implementation of the core dispatch operation");
}
@ -132,10 +132,11 @@ namespace test {
uint startFrame(10);
uint channel(0);
TimeAnchor refPoint = TimeAnchor::build (timings, startFrame, modelPort, channel);
TimeAnchor refPoint = TimeAnchor::build (timings, startFrame);
CHECK (refPoint == Time::ZERO + Duration(10, FrameRate::PAL));
FrameCoord coordinates = dispatcher.locateFrameNext (15);
FrameCoord coordinates = dispatcher.onCalcStream (modelPort,channel)
.relativeFrameLocation (refPoint, 15);
CHECK (coordinates.absoluteNominalTime == Time(0,1));
CHECK (coordinates.absoluteFrameNumber == 25);
CHECK (coordinates.remainingRealTime() >= Time(FSecs(24,25)));