adapt Core + Proc to use the new Time framework

This commit is contained in:
Fischlurch 2011-05-16 08:37:36 +02:00
parent ef126283eb
commit 042598f04c
19 changed files with 81 additions and 46 deletions

View file

@ -26,6 +26,7 @@
#include "lib/symbol.hpp" #include "lib/symbol.hpp"
#include "lib/time/timevalue.hpp"
#include <typeinfo> #include <typeinfo>
#include <string> #include <string>
@ -102,10 +103,10 @@ namespace test{
/** create a random but not insane Time value */ /** create a random but not insane Time value */
inline Time inline lib::time::Time
randTime () randTime ()
{ {
return Time (500 * (rand() % 2), (rand() % 600)); return lib::time::Time (500 * (rand() % 2), (rand() % 600));
} }
/** create garbage string of given length /** create garbage string of given length

View file

@ -28,6 +28,7 @@
#include "proc/asset/unknown.hpp" #include "proc/asset/unknown.hpp"
#include "proc/mobject/session/clip.hpp" #include "proc/mobject/session/clip.hpp"
#include "proc/mobject/session/mobjectfactory.hpp" #include "proc/mobject/session/mobjectfactory.hpp"
#include "lib/time/timevalue.hpp"
#include "lib/util.hpp" #include "lib/util.hpp"
#include "include/logging.h" #include "include/logging.h"
@ -36,6 +37,8 @@
using util::isnil; using util::isnil;
using lib::time::FSecs;
using lib::time::Duration;
using boost::format; using boost::format;
using boost::regex; using boost::regex;
@ -44,11 +47,10 @@ using boost::regex_search;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
namespace asset namespace asset {
{
namespace { // Implementation details
namespace // Implementation details
{
/** helper: extract a name token out of a given path/filename /** helper: extract a name token out of a given path/filename
* @return sanitised token based on the name (minus extension), * @return sanitised token based on the name (minus extension),
* empty string if not the common filename pattern. * empty string if not the common filename pattern.
@ -116,7 +118,7 @@ namespace asset
} }
lumiera::Time Duration
Media::getLength() const Media::getLength() const
{ {
return len_; return len_;
@ -157,7 +159,7 @@ namespace asset
if (isnil (key.name)) key.name=extractName(file); if (isnil (key.name)) key.name=extractName(file);
TODO ("file exists?"); TODO ("file exists?");
TODO ("extract media file properties"); TODO ("extract media file properties");
Time length(25); Duration length(FSecs(5));
TODO ("detecting and wiring multichannel compound media!"); TODO ("detecting and wiring multichannel compound media!");
pM = new Media (key,file,length); pM = new Media (key,file,length);
} }

View file

@ -39,6 +39,7 @@
#include "proc/asset.hpp" #include "proc/asset.hpp"
#include "lib/factory.hpp" #include "lib/factory.hpp"
#include "lib/time/timevalue.hpp"
#include "proc/mobject/mobject.hpp" #include "proc/mobject/mobject.hpp"
#include "proc/mobject/session/clip.hpp" #include "proc/mobject/session/clip.hpp"
@ -52,7 +53,7 @@ namespace asset {
class ProcPatt; class ProcPatt;
using lumiera::P; using lumiera::P;
using lumiera::Time; using lib::time::Duration;
template<> template<>
@ -71,7 +72,7 @@ namespace asset {
class Media : public Asset class Media : public Asset
{ {
string filename_; string filename_;
const Time len_; const Duration len_;
public: public:
typedef P<Media> PMedia; typedef P<Media> PMedia;
@ -105,11 +106,11 @@ namespace asset {
PClipMO createClip (); PClipMO createClip ();
/** @return the overall length of the media represented by this asset */ /** @return the overall length of the media represented by this asset */
virtual Time getLength () const; virtual Duration getLength () const;
protected: protected:
Media (const Asset::Ident& idi, const string& file, Time length) Media (const Asset::Ident& idi, const string& file, Duration length)
: Asset(idi), filename_(file), len_(length) {} : Asset(idi), filename_(file), len_(length) {}
friend class MediaFactory; friend class MediaFactory;

View file

@ -38,7 +38,7 @@ namespace asset {
* on using the Unknown::getOrg() function. * on using the Unknown::getOrg() function.
* @note we don't depend on the refered media... * @note we don't depend on the refered media...
*/ */
Unknown::Unknown (const Asset::Ident& idi, string name, Time length) Unknown::Unknown (const Asset::Ident& idi, string name, Duration length)
: Media (idi, name, length) : Media (idi, name, length)
{ {
TODO ("implement some sensible behaviour for the »unknown media« placeholder..."); TODO ("implement some sensible behaviour for the »unknown media« placeholder...");

View file

@ -25,13 +25,16 @@
#define ASSET_UNKNOWN_H #define ASSET_UNKNOWN_H
#include "proc/asset/media.hpp" #include "proc/asset/media.hpp"
#include "lib/time/timevalue.hpp"
namespace asset { namespace asset {
using lib::time::FSecs;
using lib::time::Duration;
const lumiera::Time DUMMY_TIME (25); ///< @todo solve config management const Duration DUMMY_TIME (FSecs(5)); ///< @todo solve config management
/** /**
* Placeholder Asset for unknown or unavailable media source. * Placeholder Asset for unknown or unavailable media source.
@ -42,7 +45,7 @@ namespace asset {
class Unknown : public Media class Unknown : public Media
{ {
protected: protected:
Unknown (const Asset::Ident& idi, string name="", Time length=DUMMY_TIME); Unknown (const Asset::Ident& idi, string name="", Duration length=DUMMY_TIME);
friend class MediaFactory; friend class MediaFactory;
public: public:

View file

@ -26,11 +26,16 @@
#include "proc/common.hpp" #include "proc/common.hpp"
#include "proc/state.hpp" #include "proc/state.hpp"
#include "lib/time/timevalue.hpp"
namespace engine { namespace engine {
using lib::time::TimeSpan;
using lib::time::FSecs;
using lib::time::Time;
class ExitNode; class ExitNode;
/** /**
@ -41,11 +46,15 @@ namespace engine {
protected: protected:
ExitNode * output; ExitNode * output;
/** begin of the timerange covered by this RenderGraph */ /** timerange covered by this RenderGraph */
lumiera::Time start; TimeSpan segment_;
/**end (exclusive) of the timerange */ public:
lumiera::Time end; RenderGraph()
: segment_(Time::ZERO, FSecs(5))
{
UNIMPLEMENTED ("anything regarding the Fixture datastructure");
}
}; };

View file

@ -147,7 +147,7 @@ namespace mobject {
/** resolves the referred placement to an /** resolves the referred placement to an
* ExplicitPlacement and returns the found start time * ExplicitPlacement and returns the found start time
*/ */
lumiera::Time const& lib::time::Time const&
getStartTime() getStartTime()
{ {
return pRef_.resolve().time; return pRef_.resolve().time;

View file

@ -23,8 +23,10 @@
#include "proc/mobject/mobject.hpp" #include "proc/mobject/mobject.hpp"
#include "proc/mobject/session/mobjectfactory.hpp" #include "proc/mobject/session/mobjectfactory.hpp"
#include "lib/time/timevalue.hpp"
#include "lib/util.hpp" #include "lib/util.hpp"
using lib::time::Time;
using util::isnil; using util::isnil;
namespace mobject { namespace mobject {
@ -39,7 +41,7 @@ namespace mobject {
MObject::MObject() MObject::MObject()
: length_() : length_(Time::ZERO)
, shortID_() , shortID_()
{ } { }

View file

@ -31,6 +31,7 @@
#include "proc/mobject/builder/buildertool.hpp" #include "proc/mobject/builder/buildertool.hpp"
#include "proc/mobject/placement.hpp" #include "proc/mobject/placement.hpp"
#include "proc/asset.hpp" //TODO finally not needed? #include "proc/asset.hpp" //TODO finally not needed?
#include "lib/time/timevalue.hpp"
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/operators.hpp> #include <boost/operators.hpp>
@ -68,10 +69,9 @@ namespace mobject {
boost::equality_comparable< MObject > boost::equality_comparable< MObject >
{ {
protected: protected:
typedef lumiera::Time Time; typedef lib::time::Duration Duration;
// TODO: how to represent time intervals best? Duration length_;
Time length_;
mutable string shortID_; mutable string shortID_;
@ -93,7 +93,7 @@ namespace mobject {
/** MObject self-test (usable for asserting) */ /** MObject self-test (usable for asserting) */
virtual bool isValid() const =0; virtual bool isValid() const =0;
virtual Time& getLength() =0; ///< @todo how to deal with the time/length field?? ////TICKET #448 virtual Duration& getLength() =0; ////////////////////TICKET #448
virtual bool operator== (const MObject& oo) const =0; ///< needed for handling by lumiera::P virtual bool operator== (const MObject& oo) const =0; ///< needed for handling by lumiera::P

View file

@ -69,6 +69,7 @@
#include "pre.hpp" #include "pre.hpp"
#include "lib/hash-indexed.hpp" #include "lib/hash-indexed.hpp"
#include "lib/time/timevalue.hpp"
#include "proc/mobject/session/locatingpin.hpp" #include "proc/mobject/session/locatingpin.hpp"
#include "proc/asset/pipe.hpp" //////////////TICKET #109 : get rid of this #include "proc/asset/pipe.hpp" //////////////TICKET #109 : get rid of this
@ -123,7 +124,7 @@ namespace mobject {
typedef HashIndexed<Placement<MObject>, lib::hash::LuidH> HashInd; typedef HashIndexed<Placement<MObject>, lib::hash::LuidH> HashInd;
typedef shared_ptr<MObject> _SmartPtr; typedef shared_ptr<MObject> _SmartPtr;
typedef void (*Deleter)(MObject*); typedef void (*Deleter)(MObject*);
typedef lumiera::Time Time; typedef lib::time::Time Time;
typedef asset::shared_ptr<asset::Pipe> Pipe; ////TICKET #109 : get rid of this typedef asset::shared_ptr<asset::Pipe> Pipe; ////TICKET #109 : get rid of this

View file

@ -54,7 +54,7 @@ namespace session {
public: public:
Time& Duration&
getLength() getLength()
{ {
return length_; return length_;

View file

@ -25,6 +25,11 @@
#include "proc/assetmanager.hpp" #include "proc/assetmanager.hpp"
#include "proc/asset/media.hpp" #include "proc/asset/media.hpp"
#include "proc/asset/clip.hpp" #include "proc/asset/clip.hpp"
#include "lib/time/mutation.hpp"
#include "lib/util.hpp"
using lib::time::Mutation;
using util::isnil;
namespace mobject { namespace mobject {
namespace session { namespace session {
@ -33,9 +38,8 @@ namespace session {
* Initially, this clip will cover the whole source media length. * Initially, this clip will cover the whole source media length.
*/ */
Clip::Clip (const asset::Clip& clipDef, const Media& mediaDef) Clip::Clip (const asset::Clip& clipDef, const Media& mediaDef)
: start_(0), : mediaDef_(mediaDef)
mediaDef_(mediaDef), , clipDef_(clipDef)
clipDef_(clipDef)
{ {
setupLength(); setupLength();
throwIfInvalid(); throwIfInvalid();
@ -50,7 +54,7 @@ namespace session {
Clip::isValid () const Clip::isValid () const
{ {
TODO ("check consistency of clip length def, implies accessing the underlying media def"); TODO ("check consistency of clip length def, implies accessing the underlying media def");
return length_ > Time(0); return !isnil(length_);
} }
@ -58,7 +62,7 @@ namespace session {
Clip::setupLength() Clip::setupLength()
{ {
TODO ("really calculate the length of a clip and set length field"); TODO ("really calculate the length of a clip and set length field");
this->length_ = mediaDef_.getLength(); this->length_.accept (Mutation::changeDuration(mediaDef_.getLength()));
} }

View file

@ -25,6 +25,7 @@
#define MOBJECT_SESSION_CLIP_H #define MOBJECT_SESSION_CLIP_H
#include "proc/mobject/session/abstractmo.hpp" #include "proc/mobject/session/abstractmo.hpp"
#include "lib/time/timevalue.hpp"
namespace asset { namespace asset {
@ -36,6 +37,8 @@ namespace mobject {
namespace session { namespace session {
using asset::Media; using asset::Media;
using lib::time::TimeVar;
typedef P<Media> PMedia; typedef P<Media> PMedia;
typedef P<asset::Clip> PClipAsset; typedef P<asset::Clip> PClipAsset;
@ -67,7 +70,7 @@ namespace session {
protected: protected:
/** start position in source */ /** start position in source */
Time start_; TimeVar start_;
/** @todo using a mere ref here is against the scheme and only /** @todo using a mere ref here is against the scheme and only
done as temporal solution, until we work out how to handle done as temporal solution, until we work out how to handle

View file

@ -189,7 +189,7 @@ namespace session {
RelativeLocation& RelativeLocation&
LocatingPin::operator() (PlaRef& refObj, Time offset) LocatingPin::operator() (PlaRef& refObj, Offset const& offset)
{ {
return static_cast<RelativeLocation&> return static_cast<RelativeLocation&>
(addChain (new RelativeLocation (refObj, offset))); (addChain (new RelativeLocation (refObj, offset)));

View file

@ -48,6 +48,7 @@
#include "proc/common.hpp" #include "proc/common.hpp"
#include "lib/time/timevalue.hpp"
#include <utility> #include <utility>
#include <tr1/memory> #include <tr1/memory>
@ -96,7 +97,9 @@ namespace mobject {
class LocatingPin class LocatingPin
{ {
protected: protected:
typedef lumiera::Time Time; typedef lib::time::Time Time;
typedef lib::time::TimeVar TimeVar;
typedef lib::time::Offset Offset;
typedef Time* Track; //TODO dummy declaration; we don't use Tracks as first-class entity any longer typedef Time* Track; //TODO dummy declaration; we don't use Tracks as first-class entity any longer
typedef std::tr1::shared_ptr<asset::Pipe> Pipe; typedef std::tr1::shared_ptr<asset::Pipe> Pipe;
typedef std::pair<Time,Pipe> SolutionData; //TICKET #100 (ichthyo considers better passing of solution by subclass) typedef std::pair<Time,Pipe> SolutionData; //TICKET #100 (ichthyo considers better passing of solution by subclass)
@ -119,7 +122,7 @@ namespace mobject {
/* Factory functions for adding LocatingPins */ /* Factory functions for adding LocatingPins */
FixedLocation& operator() (Time start, Track track=0); FixedLocation& operator() (Time start, Track track=0);
RelativeLocation& operator() (PlacementRef<MObject>& refObj, Time offset=Time(0)); //////////TODO: warning, just a dummy placeholder for now!! RelativeLocation& operator() (PlacementRef<MObject>& refObj, Offset const& offset=Offset(Time::ZERO)); //////////TODO: warning, just a dummy placeholder for now!!
LocatingPin (const LocatingPin&); LocatingPin (const LocatingPin&);
LocatingPin& operator= (const LocatingPin&); LocatingPin& operator= (const LocatingPin&);
@ -145,8 +148,8 @@ protected:
*/ */
struct LocatingSolution struct LocatingSolution
{ {
Time minTime; TimeVar minTime;
Time maxTime; TimeVar maxTime;
Track minTrack; // TODO don't use Tracks Track minTrack; // TODO don't use Tracks
Track maxTrack; Track maxTrack;
bool impo; bool impo;

View file

@ -33,6 +33,8 @@
namespace mobject { namespace mobject {
namespace session { namespace session {
using lib::time::Offset;
/** /**
* @todo just a design sketch, nothing finished yet. * @todo just a design sketch, nothing finished yet.
@ -56,14 +58,14 @@ namespace session {
}; };
protected: protected:
RelativeLocation (PlaRef const& a, Time ofs) : anchor_(a), offset_(ofs) { } RelativeLocation (PlaRef const& a, Offset const& ofs) : anchor_(a), offset_(ofs) { }
friend class LocatingPin; friend class LocatingPin;
/** the kind of relation denoted by this Placement */ /** the kind of relation denoted by this Placement */
RelType relType; RelType relType;
/** Offset the actual position by this (time) value relative to the anchor point. */ /** Offset the actual position by this (time) value relative to the anchor point. */
Time offset_; Offset offset_;
//TODO: suitable representation? //TODO: suitable representation?

View file

@ -28,6 +28,7 @@
#include "proc/common.hpp" #include "proc/common.hpp"
#include "proc/mobject/explicitplacement.hpp" #include "proc/mobject/explicitplacement.hpp"
#include "lib/time/timevalue.hpp"
using std::list; using std::list;
@ -46,12 +47,10 @@ namespace mobject {
class Segment class Segment
{ {
protected: protected:
typedef lumiera::Time Time; typedef lib::time::TimeSpan Span;
/** begin of this timeline segment. */ /** begin of this timeline segment. */
Time start; Span span_;
/** duration (span) of this timeline segment. */
Time length;
/** relevant MObjects comprising this segment. */ /** relevant MObjects comprising this segment. */
list<ExplicitPlacement> elements; list<ExplicitPlacement> elements;

View file

@ -32,7 +32,7 @@ namespace session {
* will be set to 0 * will be set to 0
*/ */
Track::Track (TrackID const& trackID) Track::Track (TrackID const& trackID)
: start_(0) : start_(Time::ZERO) //////////////////////////////////TODO something more inspired please
, id_(trackID) , id_(trackID)
{ {
throwIfInvalid(); throwIfInvalid();

View file

@ -26,6 +26,7 @@
#include "proc/mobject/session/meta.hpp" #include "proc/mobject/session/meta.hpp"
#include "proc/asset/entry-id.hpp" #include "proc/asset/entry-id.hpp"
#include "lib/time/timevalue.hpp"
@ -33,6 +34,7 @@ namespace mobject {
namespace session { //////////////////////////////////////////////////////TICKET #637 namespace session { //////////////////////////////////////////////////////TICKET #637
using lumiera::P; using lumiera::P;
using lib::time::Time;
class Track; class Track;
@ -52,6 +54,9 @@ namespace session {
using asset::TrackID; using asset::TrackID;
//////////////////////////////////////////////////////TICKET #646
//////////////////////////////////////////////////////TICKET #715
/** /**
* A Track is grouping device within the Session. * A Track is grouping device within the Session.
* The corresponding Placement by which this Track object is referred * The corresponding Placement by which this Track object is referred
@ -73,7 +78,7 @@ namespace session {
*/ */
class Track : public Meta class Track : public Meta
{ {
Time start_; Time start_; /////////////////////////////////TODO: this doesn't belong here. The start position is governed by the Placement!!!
TrackID id_; TrackID id_;