diff --git a/src/proc/mobject/mobject.hpp b/src/proc/mobject/mobject.hpp index be7d10014..1e18e09e8 100644 --- a/src/proc/mobject/mobject.hpp +++ b/src/proc/mobject/mobject.hpp @@ -38,7 +38,7 @@ using std::tr1::shared_ptr; #include "proc/assetmanager.hpp" using proc_interface::IDA; // TODO finally not needed? -using proc_interface::PAsset; //TODO: only temporarily +//using proc_interface::PAsset; //TODO: only temporarily using proc_interface::AssetManager; namespace mobject @@ -70,9 +70,8 @@ namespace mobject static session::MObjectFactory create; /** MObject self-test (usable for asserting) */ - virtual bool isValid() =0; + virtual bool isValid() const =0; - virtual PAsset getMedia () =0; ///< @todo solve the reference/Interface problem concerning Placements, then push down virtual Time& getLength() =0; ///< @todo how to deal with the time/length field?? }; diff --git a/src/proc/mobject/session/abstractmo.hpp b/src/proc/mobject/session/abstractmo.hpp index 302bf2914..f73661d8a 100644 --- a/src/proc/mobject/session/abstractmo.hpp +++ b/src/proc/mobject/session/abstractmo.hpp @@ -43,12 +43,8 @@ namespace mobject /* some dummy implementations used to make the code compile... */ - virtual Time& getLength() { return length; } - virtual PAsset getMedia () - { - UNIMPLEMENTED ("how to relate MObjects and media assets..."); - return AssetManager::instance().getAsset(IDA(0)); // KABOOM! (just to make it compile) - } + virtual Time& getLength() { return length; } + protected: /** custom deleter func allowing class Placement * to take ownership of MObjct instances diff --git a/src/proc/mobject/session/clip.cpp b/src/proc/mobject/session/clip.cpp index 2502fc176..8314b13f6 100644 --- a/src/proc/mobject/session/clip.cpp +++ b/src/proc/mobject/session/clip.cpp @@ -40,6 +40,16 @@ namespace mobject + /** implementing the common MObject self test. + * Length definition is consitent, underlying + * media def is accessible etc. */ + bool + Clip::isValid () const + { + UNIMPLEMENTED ("check consistency of clip length def, implies accessing the underlying media def"); + } + + void Clip::setupLength() { diff --git a/src/proc/mobject/session/clip.hpp b/src/proc/mobject/session/clip.hpp index fb0d00b9a..1a39cb14f 100644 --- a/src/proc/mobject/session/clip.hpp +++ b/src/proc/mobject/session/clip.hpp @@ -33,6 +33,7 @@ namespace mobject { namespace session { + using asset::Media; /** @@ -63,6 +64,16 @@ namespace mobject virtual void setupLength(); + public: + virtual bool isValid() const; + + /** access the underlying media asset */ + virtual Media::PMedia getMedia () + { + UNIMPLEMENTED ("how to relate MObjects and media assets..."); + return AssetManager::instance().getAsset(IDA(0)); // KABOOM! (just to make it compile) + } + }; diff --git a/src/proc/mobject/session/locatingpin.cpp b/src/proc/mobject/session/locatingpin.cpp index a054b1736..1404853ee 100644 --- a/src/proc/mobject/session/locatingpin.cpp +++ b/src/proc/mobject/session/locatingpin.cpp @@ -101,6 +101,14 @@ namespace mobject return FixedLocation (solution.getTime(), solution.getTrack()); } + bool + LocatingPin::isOverdetermined () const + { + LocatingSolution solution; + resolve (solution); + return solution.is_impossible(); + } + inline bool still_to_solve (LocatingPin::LocatingSolution& solution) diff --git a/src/proc/mobject/session/locatingpin.hpp b/src/proc/mobject/session/locatingpin.hpp index 8f030fff3..431ef5ef3 100644 --- a/src/proc/mobject/session/locatingpin.hpp +++ b/src/proc/mobject/session/locatingpin.hpp @@ -51,7 +51,7 @@ using boost::scoped_ptr; namespace mobject { - class Placement; + template class Placement; namespace session { @@ -89,10 +89,11 @@ namespace mobject public: const FixedLocation resolve () const; + bool isOverdetermined () const; /* Factory functions for adding LocatingPins */ - FixedLocation& operator() (Time, Track); + FixedLocation& operator() (Time, Track=0); RelativeLocation& operator() (PMO refObj, Time offset=0); LocatingPin (const LocatingPin&); diff --git a/src/proc/mobject/session/mobjectfactory.cpp b/src/proc/mobject/session/mobjectfactory.cpp index b407f908e..740852558 100644 --- a/src/proc/mobject/session/mobjectfactory.cpp +++ b/src/proc/mobject/session/mobjectfactory.cpp @@ -40,12 +40,14 @@ namespace mobject * into a Placement, which takes ownership. So, when the * render engine gets across this Clip-MO, it is able to * obtain the media information contained in the corresponding - * asset. + * media asset. Depending on the mediaDef passed in, the + * created Clip could be a compound (multichannel) clip + * comprised of several SimpleClip subobjects. + * @todo implement creation of multichannel CompoundClip */ Placement MObjectFactory::operator() (PClipAsset& mediaDef) { - //TODO sholdin't we rather store a ref to the underlying media assset?? return Placement (new Clip (mediaDef)); } diff --git a/tests/components/proc/asset/makecliptest.cpp b/tests/components/proc/asset/makecliptest.cpp index 8f8c82192..64497e521 100644 --- a/tests/components/proc/asset/makecliptest.cpp +++ b/tests/components/proc/asset/makecliptest.cpp @@ -52,14 +52,14 @@ namespace asset class MakeClip_test : public Test { typedef shared_ptr PM; - typedef shared_ptr PC; + typedef asset::Media::PClipMO PC; virtual void run (Arg arg) { PM mm = asset::Media::create("test-1", VIDEO); PC cc = mm->createClip(); - PM cm = static_pointer_cast (cc->getMedia()); //TODO: solve the reference/interface Problem on MObject, push down to Clip... + PM cm = cc->getMedia(); ASSERT (cm); ASSERT (0 < cc->getLength()); diff --git a/tests/components/proc/mobject/placementbasictest.cpp b/tests/components/proc/mobject/placementbasictest.cpp index 75b87f269..e720535f5 100644 --- a/tests/components/proc/mobject/placementbasictest.cpp +++ b/tests/components/proc/mobject/placementbasictest.cpp @@ -66,24 +66,23 @@ namespace mobject PM media = asset::Media::create("test-1", VIDEO); Placement pc = MObject::create(media); - // can use the Clip-MObject interface by dereferencing the placement + // use of the Clip-MObject interface by dereferencing the placement PM clip_media = pc->getMedia(); ASSERT (clip_media->ident.category.hasKind (VIDEO)); // using the Placement interface // TODO: how to handle unterdetermined Placement? Throw? - FixedPlacement & fixpla = pc.chain(Placement::FIXED, Time(1)); // TODO: the track?? + FixedLocation & fixloc = pc.chain(Placement::FIXED, Time(1)); // TODO: the track?? ExplicitPlacement expla = pc.resolve(); ASSERT (expla.time == 1); - ASSERT (!expla.isOverdetermined()); + ASSERT (!expla.chain.isOverdetermined()); ASSERT (*expla == *pc); - ASSERT (*fixpla == *pc); // now overconstraining with another Placement pc.chain(Placement::FIXED, Time(2)); expla = pc.resolve(); ASSERT (expla.time == 2); // the latest addition wins - ASSERT (expla.isOverdetermined()); + ASSERT (expla.chain.isOverdetermined()); } };