implement access to current session.
add lots of UNIMPLEMENTED stubs and finally get the sourcebase through the compiler....
This commit is contained in:
parent
83a972f846
commit
fadd31282f
30 changed files with 591 additions and 173 deletions
|
|
@ -29,11 +29,16 @@
|
|||
|
||||
#include "cinelerra.h"
|
||||
#include "proc/mobject/buildable.hpp"
|
||||
#include "proc/asset.hpp" // TODO finally not needed?
|
||||
|
||||
|
||||
using std::list;
|
||||
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::AssetManager;
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
|
|
@ -54,8 +59,13 @@ namespace mobject
|
|||
|
||||
// TODO: how to represent time intervals best?
|
||||
Time length;
|
||||
|
||||
list<Placement *> placement;
|
||||
|
||||
virtual ~MObject() {};
|
||||
|
||||
public:
|
||||
virtual shared_ptr<Placement>& getPlacement () =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??
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ namespace mobject
|
|||
{
|
||||
|
||||
|
||||
/** factory for creating the corretct Placement subclass */
|
||||
PlacementFactory Placement::create;
|
||||
|
||||
|
||||
/** create an actual (explicit) placement while trying to
|
||||
* satisfy the network of adjacent objects and placements.
|
||||
|
|
@ -37,6 +40,18 @@ namespace mobject
|
|||
Placement::resolve ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** implements the logic for selecting the correct
|
||||
* Placement subclass.
|
||||
* @return smart ptr owning the created placement object
|
||||
*/
|
||||
PlacementFactory::PType
|
||||
PlacementFactory::operator() (Placement::Style, Time, PMO subject)
|
||||
{
|
||||
UNIMPLEMENTED ("create correct Placement subclass");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ namespace mobject
|
|||
typedef cinelerra::Time Time;
|
||||
typedef session::Track Track;
|
||||
|
||||
MObject* subject;
|
||||
|
||||
|
||||
public:
|
||||
MObject* subject;
|
||||
|
||||
/**
|
||||
* styles of placement.
|
||||
*/
|
||||
|
|
|
|||
145
src/proc/mobject/session.hpp
Normal file
145
src/proc/mobject/session.hpp
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
SESSION.hpp - holds the complete session to be edited by the user
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/** @file session.hpp
|
||||
** Primary Interface to the current Session.
|
||||
** The Interface Session is abstract and only accessible via the
|
||||
** static field Session::current, which actually refers to a SessManager
|
||||
** singleton instance. The latter acts as smart ptr-to-Impl.
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MOBJECT_SESSION_H
|
||||
#define MOBJECT_SESSION_H
|
||||
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "common/singleton.hpp"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <tr1/memory>
|
||||
|
||||
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
namespace session
|
||||
{
|
||||
class SessManager;
|
||||
class EDL;
|
||||
class Fixture;
|
||||
typedef std::tr1::shared_ptr<Fixture> PFix;
|
||||
}
|
||||
|
||||
typedef session::SessManager& PSess; ///< acts as a "PImpl" smart ptr
|
||||
|
||||
|
||||
/**
|
||||
* The (current) Session holds all the user
|
||||
* visible content to be edited and manipulated
|
||||
* within the Cinelerra Application. From a users
|
||||
* perspective, it is a collection of Media Objects
|
||||
* (--> MObject) placed (--> Placement) onto virtual
|
||||
* Tracks.
|
||||
*
|
||||
* Opening a Session has effectively global consequences,
|
||||
* because the Session defines the available Assets, and some
|
||||
* kinds of Assets define default behaviour. Thus, access to
|
||||
* the Session is similar to a Singleton instance.
|
||||
*
|
||||
* @note Any client should be aware that the Session can be closed,
|
||||
* replaced and loaded. The only way to accees the Session is
|
||||
* via a "PImpl" smart pointer session::PSess (which indeed is
|
||||
* a reference to the SessManager and is accessible as the static
|
||||
* field Session::current). You will never be able to get a direct
|
||||
* pointer or reference to the Session object.
|
||||
*
|
||||
*/
|
||||
class Session : private boost::noncopyable
|
||||
{
|
||||
protected:
|
||||
Session () throw();
|
||||
virtual ~Session () = 0;
|
||||
|
||||
public:
|
||||
static session::SessManager& current;
|
||||
|
||||
virtual bool isValid () = 0;
|
||||
virtual void add (PPla& placement) = 0;
|
||||
virtual bool remove (PPla& placement) = 0;
|
||||
|
||||
/// @deprecated Ichthyo doubts it is good design to hand out the EDL??
|
||||
virtual session::EDL& currEDL () = 0;
|
||||
|
||||
virtual session::PFix& getFixture () = 0;
|
||||
virtual void rebuildFixture () = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
namespace session
|
||||
{
|
||||
|
||||
/**
|
||||
* creation, access and Session lifecycle Interface.
|
||||
* An instance is accessible via Session::current
|
||||
*/
|
||||
class SessManager : private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
/** clear current session contents
|
||||
* without resetting overall session config.
|
||||
* Afterwards, the session will contain only one
|
||||
* empty EDL, while all Assets are retained.
|
||||
*/
|
||||
virtual void clear () =0;
|
||||
|
||||
/** reset all session config and
|
||||
* start with a pristine default session.
|
||||
*/
|
||||
virtual void reset () =0;
|
||||
|
||||
/** replace the current session by a new
|
||||
* session loaded from serialized state.
|
||||
*/
|
||||
virtual void load () =0;
|
||||
|
||||
/** create a complete, serialized representation
|
||||
* of the current session config and contents.
|
||||
* @todo how to serialize, prameters, return value?
|
||||
*/
|
||||
virtual void save () =0;
|
||||
|
||||
/** access to the current session object instance.
|
||||
* This is the sole access path available for clients.
|
||||
* @note there is no operator*
|
||||
*/
|
||||
virtual Session* operator-> () throw() =0;
|
||||
|
||||
virtual ~SessManager() {};
|
||||
};
|
||||
|
||||
} // namespace mobject::session
|
||||
|
||||
} // namespace mobject
|
||||
#endif
|
||||
|
|
@ -37,7 +37,19 @@ namespace mobject
|
|||
class AbstractMO : public MObject
|
||||
{
|
||||
////////////// TODO: work out common services to provide!!!!
|
||||
};
|
||||
shared_ptr<Placement> placement_;
|
||||
|
||||
public:
|
||||
/* some dummy implementations used to make the code compile... */
|
||||
|
||||
virtual shared_ptr<Placement>& getPlacement () { return placement_; }
|
||||
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)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "proc/mobject/session/edl.hpp"
|
||||
#include "proc/mobject/session/track.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "proc/mobject/mobject.hpp"
|
||||
|
||||
namespace mobject
|
||||
|
|
@ -30,7 +31,22 @@ namespace mobject
|
|||
namespace session
|
||||
{
|
||||
|
||||
/** */
|
||||
/** @deprecated not sure if it is a good idea
|
||||
* to have this on the interface
|
||||
*/
|
||||
bool
|
||||
EDL::contains (const PPla& placement)
|
||||
{
|
||||
UNIMPLEMENTED ("test if a given placement is contained within this EDL");
|
||||
}
|
||||
|
||||
|
||||
PPla&
|
||||
EDL::find (const string& id)
|
||||
{
|
||||
UNIMPLEMENTED ("serch for a given 'thing' within the EDL");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,26 +24,39 @@
|
|||
#ifndef MOBJECT_SESSION_EDL_H
|
||||
#define MOBJECT_SESSION_EDL_H
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "proc/mobject/mobject.hpp"
|
||||
#include "proc/mobject/session/track.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "proc/asset/track.hpp"
|
||||
|
||||
using proc_interface::PAsset; // TODO better methot to refer to a track?
|
||||
|
||||
using std::list;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
namespace session
|
||||
{
|
||||
|
||||
|
||||
class EDL
|
||||
{
|
||||
protected:
|
||||
list<Track *> tracks;
|
||||
list<MObject *> clips;
|
||||
vector<PAsset> tracks;
|
||||
vector<MObject *> clips;
|
||||
|
||||
public:
|
||||
bool contains (const PPla& placement);
|
||||
PPla& find (const string& id); ///< @todo how to refer to clips? using asset IDs??
|
||||
|
||||
vector<PAsset>& getTracks () { return tracks; } ///< @todo use track assets correct, make const!
|
||||
size_t size ()
|
||||
{
|
||||
UNIMPLEMENTED ("what ist the 'size' of an EDL?");
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Fixture - the (low level) representation of the EDL with concrete placement data
|
||||
Fixture - the (low level) representation of the EDL with explicit placement data
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
|
||||
#include "proc/mobject/session/fixture.hpp"
|
||||
#include "nobugcfg.h"
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
|
|
@ -33,7 +34,7 @@ namespace mobject
|
|||
list<ExplicitPlacement*> &
|
||||
Fixture::getPlaylistForRender ()
|
||||
{
|
||||
abort();/////////////////////TODO
|
||||
UNIMPLEMENTED ("get Playlist For Render");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -43,7 +44,8 @@ namespace mobject
|
|||
Auto<double>*
|
||||
Fixture::getAutomation ()
|
||||
{
|
||||
return 0;/////////////////////TODO
|
||||
UNIMPLEMENTED ("getAutomation from Fixture");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
FIXTURE.hpp - the (low level) representation of the EDL with concrete placement data
|
||||
FIXTURE.hpp - the (low level) representation of the EDL with explicit placement data
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
#define MOBJECT_SESSION_FIXTURE_H
|
||||
|
||||
#include <list>
|
||||
#include <tr1/memory>
|
||||
|
||||
#include "proc/mobject/session/edl.hpp"
|
||||
#include "proc/mobject/session/track.hpp"
|
||||
|
|
@ -33,6 +34,7 @@
|
|||
|
||||
|
||||
using std::list;
|
||||
using std::tr1::shared_ptr;
|
||||
|
||||
|
||||
|
||||
|
|
@ -52,8 +54,12 @@ namespace mobject
|
|||
|
||||
public:
|
||||
list<ExplicitPlacement*> & getPlaylistForRender () ;
|
||||
Auto<double>* getAutomation () ; /////TODO: just a placeholder at the moment!!!
|
||||
Auto<double>* getAutomation () ; ///< @todo: just a placeholder at the moment!!!
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef shared_ptr<Fixture> PFix;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,36 +21,46 @@
|
|||
* *****************************************************/
|
||||
|
||||
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session/edl.hpp"
|
||||
#include "proc/mobject/session/fixture.hpp"
|
||||
/** @file session.cpp
|
||||
** Actual connection between the Session interface and its Implementation.
|
||||
** Holds the storage for the SessionManager implementation (singleton)
|
||||
**
|
||||
** @see session::SessionImpl
|
||||
** @see session::SessionManagerImpl
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/sessionimpl.hpp"
|
||||
|
||||
#include "common/singleton.hpp"
|
||||
|
||||
|
||||
using cinelerra::Singleton;
|
||||
using mobject::session::SessManager;
|
||||
using mobject::session::SessManagerImpl;
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
namespace session
|
||||
{
|
||||
|
||||
/** @return the system-wide current session.
|
||||
* Implemented as singleton.
|
||||
*/
|
||||
Singleton<Session> Session::getCurrent;
|
||||
/** the sole acces point for all client code to the system-wide
|
||||
* "current session". Implemented as smart pointer to singleton
|
||||
* implementation object, where the smart pointer is actually
|
||||
* the SessionManager (which is singleton as well...).
|
||||
*
|
||||
* Consequently, if you want to talk to the <i>session manager,</i>
|
||||
* you use dot-notation, while you access the <i>session object</i>
|
||||
* via arrow notaion (e.g. \code Session::current->getFixture() )
|
||||
*/
|
||||
SessManager& Session::current = Singleton<SessManagerImpl>()();
|
||||
|
||||
|
||||
|
||||
|
||||
/** create a new empty session with default values.
|
||||
*/
|
||||
Session::Session ()
|
||||
: edl(),
|
||||
fixture()
|
||||
{
|
||||
|
||||
}
|
||||
Session::Session () throw() { }
|
||||
Session::~Session () { }
|
||||
|
||||
|
||||
|
||||
} // namespace mobject::session
|
||||
|
||||
} // namespace mobject
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
SESSION.hpp - holds the complete session to be edited by the user
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MOBJECT_SESSION_SESSION_H
|
||||
#define MOBJECT_SESSION_SESSION_H
|
||||
|
||||
#include "common/singleton.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
namespace session
|
||||
{
|
||||
|
||||
class EDL;
|
||||
class Fixture;
|
||||
|
||||
/**
|
||||
* The (current) Session holds all the user
|
||||
* visible content to be edited and manipulated
|
||||
* within the Cinelerra Application. From a users
|
||||
* perspective, it is a collection of Media Objects
|
||||
* (--> MObject) placed (--> Placement) onto virtual
|
||||
* Tracks.
|
||||
*
|
||||
* Opening a Session has effectively global consequences,
|
||||
* because the Session defines the available Assets, and some
|
||||
* kinds of Assets define default behaviour. Thus, access to
|
||||
* the Session is similar to a Singleton instance.
|
||||
*
|
||||
*/
|
||||
class Session : private boost::noncopyable
|
||||
{
|
||||
protected:
|
||||
vector<EDL> edls;
|
||||
Fixture fixture;
|
||||
|
||||
Session ();
|
||||
friend class cinelerra::singleton::StaticCreate<SessionImpl>; //TODO use PImpl or just covariance??
|
||||
|
||||
public:
|
||||
static cinelerra::Singleton<Session> getCurrent;
|
||||
|
||||
void add (PPla placement);
|
||||
|
||||
|
||||
EDL& currEDL () { return edl; }
|
||||
Fixture& getFixture () { return fixture; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace mobject::session
|
||||
|
||||
} // namespace mobject
|
||||
#endif
|
||||
|
|
@ -22,16 +22,92 @@
|
|||
|
||||
|
||||
#include "proc/mobject/session/sessionimpl.hpp"
|
||||
#include "proc/mobject/session/edl.hpp"
|
||||
#include "proc/mobject/session/fixture.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "common/error.hpp"
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
|
||||
namespace session
|
||||
{
|
||||
|
||||
/** */
|
||||
/** create a new empty session with default values.
|
||||
* @note any exception arising while creating this
|
||||
* default session will inevitably halt the
|
||||
* system (and this is desirable)
|
||||
*/
|
||||
SessionImpl::SessionImpl () throw()
|
||||
: Session(),
|
||||
focusEDL_(0),
|
||||
edls(1),
|
||||
fixture(new Fixture)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** @internal used by SessionManager#clear
|
||||
* discard all EDL content, without
|
||||
* touching global configuration.
|
||||
*/
|
||||
void
|
||||
SessionImpl::clear ()
|
||||
{
|
||||
try
|
||||
{
|
||||
edls.clear();
|
||||
edls.resize(1);
|
||||
focusEDL_ = 0;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
focusEDL_ = 0;
|
||||
throw cinelerra::error::Fatal ("unexpected exception while clearing EDLs");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SessionImpl::isValid ()
|
||||
{
|
||||
UNIMPLEMENTED ("session self test");
|
||||
return false; // TODO
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SessionImpl::add (PPla& placement)
|
||||
{
|
||||
UNIMPLEMENTED ("add Placement to the current EDL");
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SessionImpl::remove (PPla& placement)
|
||||
{
|
||||
UNIMPLEMENTED ("search and remove a given Placement from current EDL");
|
||||
return false; // TODO
|
||||
}
|
||||
|
||||
/// @deprecated should not grant direct access to EDL objects
|
||||
EDL&
|
||||
SessionImpl::currEDL ()
|
||||
{
|
||||
ASSERT (focusEDL_ < edls.size());
|
||||
return edls[focusEDL_];
|
||||
}
|
||||
|
||||
|
||||
PFix&
|
||||
SessionImpl::getFixture ()
|
||||
{
|
||||
return fixture;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SessionImpl::rebuildFixture ()
|
||||
{
|
||||
UNIMPLEMENTED ("rebuild Fixture");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,13 +21,21 @@
|
|||
*/
|
||||
|
||||
|
||||
/** @file sessionimpl.hpp
|
||||
** Session and SessionManager Implemention classes.
|
||||
** These are primary Interfaces and we hide all implementaion complexities,
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MOBJECT_SESSION_SESSIONIMPL_H
|
||||
#define MOBJECT_SESSION_SESSIONIMPL_H
|
||||
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/edl.hpp"
|
||||
#include "proc/mobject/session/fixture.hpp"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
using std::vector;
|
||||
|
|
@ -46,18 +54,48 @@ namespace mobject
|
|||
class SessionImpl : public mobject::Session
|
||||
{
|
||||
protected:
|
||||
uint focusEDL_;
|
||||
vector<EDL> edls;
|
||||
Fixture fixture;
|
||||
PFix fixture;
|
||||
|
||||
SessionImpl ();
|
||||
friend class cinelerra::singleton::StaticCreate<SessionImpl>;
|
||||
SessionImpl () throw();
|
||||
friend class SessManagerImpl;
|
||||
|
||||
void add (PPla placement);
|
||||
void clear ();
|
||||
|
||||
EDL& currEDL () { return edl; }
|
||||
Fixture& getFixture () { return fixture; }
|
||||
public:
|
||||
virtual bool isValid ();
|
||||
virtual void add (PPla& placement);
|
||||
virtual bool remove (PPla& placement);
|
||||
|
||||
virtual EDL& currEDL ();
|
||||
|
||||
virtual PFix& getFixture ();
|
||||
virtual void rebuildFixture ();
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Session manager implementation class holding the
|
||||
* actual smart pointer to the current Session impl.
|
||||
*/
|
||||
class SessManagerImpl : public SessManager
|
||||
{
|
||||
boost::scoped_ptr<SessionImpl> pImpl_;
|
||||
|
||||
SessManagerImpl() throw();
|
||||
friend class cinelerra::singleton::StaticCreate<SessManagerImpl>;
|
||||
|
||||
public:
|
||||
virtual void clear () ;
|
||||
virtual void reset () ;
|
||||
virtual void load () ;
|
||||
virtual void save () ;
|
||||
virtual Session* operator-> () throw() { return pImpl_.get(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace mobject::session
|
||||
|
||||
|
|
|
|||
114
src/proc/mobject/session/sessmanagerimpl.cpp
Normal file
114
src/proc/mobject/session/sessmanagerimpl.cpp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
SessManagerImpl - global session access and lifecycle
|
||||
|
||||
Copyright (C) CinelerraCV
|
||||
2007, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
/** @file sessmanagerimpl.cpp
|
||||
** Implemention of the Session management functions.
|
||||
** The Class SessManager is declared alongside with mobject::Session,
|
||||
** because it serves as smart ptr-to-Impl at the same time. Effectively,
|
||||
** the session manager owns the current session object and only grants
|
||||
** access via his overloaded operator->() . Because there is no operator*(),
|
||||
** no one can get at the address of the current session object. (correct?)
|
||||
**
|
||||
** @see sessionimpl.hpp
|
||||
** @see mobject::Session#current
|
||||
** @see mobject::session::SessionManager_test
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/sessionimpl.hpp"
|
||||
|
||||
using boost::scoped_ptr;
|
||||
|
||||
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
namespace session
|
||||
{
|
||||
|
||||
/** Besides creating the single system-wide Session manger instance,
|
||||
* creates an empty default Session as well.
|
||||
* @note any exceptions arising in the course of this will halt
|
||||
* the system (and this behaviour is desirable).
|
||||
*/
|
||||
SessManagerImpl::SessManagerImpl () throw()
|
||||
: pImpl_ (new SessionImpl)
|
||||
{
|
||||
}
|
||||
|
||||
/** @note no transactional behaviour.
|
||||
* may succeed partial.
|
||||
*/
|
||||
void
|
||||
SessManagerImpl::clear ()
|
||||
{
|
||||
pImpl_->clear();
|
||||
}
|
||||
|
||||
|
||||
/** @note this operation is atomic and either succeeds or
|
||||
* failes completely, in which case the current session
|
||||
* remains unaltered.
|
||||
* @todo for this to work, we need to change the implementation of
|
||||
* AssetManager so support this kind of transactional switch!
|
||||
*/
|
||||
void
|
||||
SessManagerImpl::reset ()
|
||||
{
|
||||
scoped_ptr<SessionImpl> tmp (new SessionImpl);
|
||||
|
||||
TODO ("reset the assets registered with AssetManager");
|
||||
// Ichthyo-intern: ticket #95
|
||||
|
||||
pImpl_.swap (tmp);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SessManagerImpl::load ()
|
||||
{
|
||||
UNIMPLEMENTED ("load serialized session");
|
||||
}
|
||||
|
||||
|
||||
/** \par Implementation details
|
||||
* We intend to have several switchable object serialisers.
|
||||
* One of these serializers should genarate a comprehensible
|
||||
* text based representation suitable for checking into
|
||||
* SCM systems.
|
||||
* Sessions can be saved into one single file or be splitted
|
||||
* to several files (master file and edl files)
|
||||
*/
|
||||
void
|
||||
SessManagerImpl::save ()
|
||||
{
|
||||
UNIMPLEMENTED ("save session (serialized)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace mobject::session
|
||||
|
||||
} // namespace mobject
|
||||
|
|
@ -11,12 +11,12 @@ return: 0
|
|||
END
|
||||
|
||||
|
||||
TEST "CreateAsset_test" CreateAsset_test <<END
|
||||
return: 0
|
||||
PLANNED "CompoundMedia_test" CompoundMedia_test <<END
|
||||
END
|
||||
|
||||
|
||||
PLANNED "CompoundMedia_test" CompoundMedia_test <<END
|
||||
TEST "CreateAsset_test" CreateAsset_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
||||
|
||||
|
|
@ -33,10 +33,14 @@ return: 0
|
|||
END
|
||||
|
||||
|
||||
PLANNED "MakeClip_test" MakeClip_test <<END
|
||||
END
|
||||
|
||||
|
||||
PLANNED "MediaStructureQuery_test" MediaStructureQuery_test <<END
|
||||
END
|
||||
|
||||
|
||||
TEST "OrderingOfAssets_test" OrderingOfAssets_test <<END
|
||||
return: 0
|
||||
END
|
||||
END
|
||||
|
|
|
|||
|
|
@ -12,3 +12,11 @@ END
|
|||
|
||||
PLANNED "RebuildFixture_test" RebuildFixture_test <<END
|
||||
END
|
||||
|
||||
|
||||
PLANNED "SessionManager_test" SessionManager_test <<END
|
||||
END
|
||||
|
||||
|
||||
PLANNED "SessionStructure_test" SessionStructure_test <<END
|
||||
END
|
||||
|
|
|
|||
|
|
@ -67,13 +67,15 @@ namespace asset
|
|||
* factory, normally intended for loading existing sessions.
|
||||
*/
|
||||
void buildCompound()
|
||||
{
|
||||
{
|
||||
UNIMPLEMENTED ("create new compound media");
|
||||
}
|
||||
|
||||
/** @test adding and removing elementary media.
|
||||
*/
|
||||
void modifyCompound()
|
||||
{
|
||||
UNIMPLEMENTED ("add and remove elementary media to compound media asset");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -82,6 +84,7 @@ namespace asset
|
|||
*/
|
||||
void verifyClipStructure()
|
||||
{
|
||||
UNIMPLEMENTED ("create compound clip from compound media and verify structure");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ namespace asset
|
|||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
UNIMPLEMENTED ("delete asset and update all dependencies");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ namespace asset
|
|||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
UNIMPLEMENTED ("handling of Asset dependencies");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ using util::contains;
|
|||
using util::isnil;
|
||||
using std::string;
|
||||
|
||||
using std::tr1::static_pointer_cast; //TODO only temporarily;
|
||||
|
||||
namespace asset
|
||||
{
|
||||
|
|
@ -58,10 +59,10 @@ namespace asset
|
|||
|
||||
PM mm = asset::Media::create("test-1", VIDEO);
|
||||
PC cc = mm->createClip();
|
||||
PM cm = cc->getMedia();
|
||||
PM cm = static_pointer_cast<Media,Asset> (cc->getMedia()); //TODO: solve the reference/interface Problem on MObject, push down to Clip...
|
||||
|
||||
ASSERT (cm);
|
||||
ASSERT (0 < cc->length);
|
||||
ASSERT (0 < cc->getLength());
|
||||
ASSERT (cm->ident.category.hasKind (VIDEO));
|
||||
ASSERT (cm->getFilename() == mm->getFilename());
|
||||
ASSERT (cm->howtoProc() == mm->howtoProc());
|
||||
|
|
@ -79,7 +80,7 @@ namespace asset
|
|||
|
||||
return (0 < clip->getParents().size())
|
||||
&& (media == clip->getParents()[0])
|
||||
&& (contains (media->getDependant(), clip));
|
||||
// && (contains (media->getDependant(), clip)); //TODO implement Asset dependecies
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ namespace engine
|
|||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
UNIMPLEMENTED ("render node pulling source data from backend");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ namespace mobject
|
|||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
UNIMPLEMENTED ("complete render process for a given test segment of the EDL");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
|
||||
#include "common/test/run.hpp"
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/edl.hpp"
|
||||
#include "proc/mobject/session/testclip.hpp"
|
||||
#include "proc/mobject/placement.hpp"
|
||||
#include "common/util.hpp"
|
||||
|
|
@ -56,12 +57,12 @@ namespace mobject
|
|||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
Session& sess = Session::getCurrent();
|
||||
PSess sess = Session::current;
|
||||
PMO clip = TestClip::create();
|
||||
PPla pla = Placement::create(Placement::FIXED, Time(1), clip);
|
||||
sess.add (pla);
|
||||
sess->add (pla);
|
||||
|
||||
ASSERT (contains (sess.getEDL(), pla));
|
||||
ASSERT (sess->currEDL().contains (pla));
|
||||
// TODO: Clip-Asset and Placement magic??
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
#include "common/test/run.hpp"
|
||||
#include "proc/assetmanager.hpp"
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/edl.hpp" // TODO: really neded?
|
||||
#include "proc/mobject/session/testsession1.hpp"
|
||||
//#include "common/util.hpp"
|
||||
|
||||
|
|
@ -34,6 +35,9 @@
|
|||
using std::string;
|
||||
using std::cout;
|
||||
|
||||
using proc_interface::AssetManager;
|
||||
using proc_interface::PAsset;
|
||||
using proc_interface::IDA;
|
||||
|
||||
namespace mobject
|
||||
{
|
||||
|
|
@ -55,19 +59,19 @@ namespace mobject
|
|||
virtual void run(Arg arg)
|
||||
{
|
||||
buildTestseesion1();
|
||||
Session& sess = Session::getCurrent();
|
||||
PSess sess = Session::current;
|
||||
AssetManager& aMang = AssetManager::instance();
|
||||
|
||||
PPla clipPlacement = sess.getEDL().find(SESSION1_CLIP); // global Var asigned in buildTestsession1()
|
||||
PAsset clipAsset = aMang.getAsset(clipPlacement->subject->getMedia());
|
||||
PPla clipPlacement = sess->currEDL().find(SESSION1_CLIP); // global Var asigned in buildTestsession1()
|
||||
PAsset clipAsset = clipPlacement->subject->getMedia();
|
||||
IDA clipAID = clipAsset->getID();
|
||||
ASSERT (clipPlacement);
|
||||
|
||||
sess.remove (clipPlacement);
|
||||
sess->remove (clipPlacement);
|
||||
|
||||
ASSERT (!sess.getEDL().find(SESSION1_CLIP)); // EDL forgot the Clip/Placement
|
||||
ASSERT (!aMang.known (clipAID)); // corresponding Clip Asset has disappeared
|
||||
ASSERT (!aMang.getAsset(clipPlacement->subject->getMedia())); // internal cross-links removed
|
||||
ASSERT (!sess->currEDL().find(SESSION1_CLIP)); // EDL forgot the Clip/Placement
|
||||
ASSERT (!aMang.known (clipAID)); // corresponding Clip Asset has disappeared
|
||||
ASSERT (!clipPlacement->subject->getMedia()); // internal cross-links removed
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
|
||||
#include "common/test/run.hpp"
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/edl.hpp"
|
||||
#include "proc/mobject/session/testsession1.hpp"
|
||||
#include "common/util.hpp"
|
||||
|
||||
|
|
@ -58,16 +59,18 @@ namespace mobject
|
|||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
clearSession();
|
||||
PSess sess = Session::current;
|
||||
sess.clear();
|
||||
buildTestseesion1();
|
||||
Session& sess = Session::getCurrent();
|
||||
ASSERT (sess.isValid());
|
||||
sess.rebuildFixture();
|
||||
ASSERT (sess->isValid());
|
||||
sess->rebuildFixture();
|
||||
TODO ("check the fixture has been touched. e.g. by hash.");
|
||||
TODO ("query all Placements of all Clips (via AssetManager). Verify explicit plac contained in Fixture.");
|
||||
|
||||
for_each (sess.getFixture(),
|
||||
bind (&check_is_from_EDL, _1, sess.getEDL()));
|
||||
|
||||
UNIMPLEMENTED ("iterate over fixture");
|
||||
// TODO
|
||||
// for_each (sess->getFixture(),
|
||||
// bind (&check_is_from_EDL, _1, sess.getEDL()));
|
||||
|
||||
TODO ("can we check the other direction, from EDL to Fixture??");
|
||||
}
|
||||
|
|
@ -75,8 +78,8 @@ namespace mobject
|
|||
static void
|
||||
check_is_from_EDL (PPla explicitPlacement, EDL& edl)
|
||||
{
|
||||
PPla originalPlacement = explicitPlacement->subject->placement;
|
||||
ASSERT (contains(edl, originalPlacement));
|
||||
PPla originalPlacement = explicitPlacement->subject->getPlacement();
|
||||
ASSERT (edl.contains(originalPlacement));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
#include "common/test/run.hpp"
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/testsession1.hpp"
|
||||
//#include "common/util.hpp"
|
||||
//#include <boost/format.hpp>
|
||||
|
|
@ -68,8 +68,8 @@ namespace mobject
|
|||
*/
|
||||
void getCurrentSession ()
|
||||
{
|
||||
Session& sess = Session::getCurrent();
|
||||
ASSERT (sess.isValid());
|
||||
PSess sess = Session::current;
|
||||
ASSERT (sess->isValid());
|
||||
}
|
||||
|
||||
/** @test clear current session contents
|
||||
|
|
@ -80,6 +80,7 @@ namespace mobject
|
|||
void clearSession ()
|
||||
{
|
||||
UNIMPLEMENTED ("clear objects in current session");
|
||||
Session::current.clear();
|
||||
}
|
||||
|
||||
/** @test reset global session config and start with
|
||||
|
|
@ -89,6 +90,7 @@ namespace mobject
|
|||
void resetSession ()
|
||||
{
|
||||
UNIMPLEMENTED ("construct a pristine session");
|
||||
Session::current.reset();
|
||||
}
|
||||
|
||||
/** @test use a mock session serializer to load
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@
|
|||
|
||||
|
||||
#include "common/test/run.hpp"
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "proc/mobject/session/edl.hpp" // TODO only temporarily needed
|
||||
#include "proc/mobject/session/fixture.hpp" // TODO only temporarily needed
|
||||
#include "proc/assetmanager.hpp"
|
||||
//#include "common/util.hpp"
|
||||
//#include <boost/format.hpp>
|
||||
|
|
@ -55,12 +57,12 @@ namespace mobject
|
|||
{
|
||||
virtual void run(Arg arg)
|
||||
{
|
||||
Session& sess = Session::getCurrent();
|
||||
ASSERT (0 <= sess.getEDL().size()); // TODO implement
|
||||
ASSERT (0 <= sess.getFixture().size()); // TODO implement
|
||||
ASSERT (0 < sess.getTracks().size()); // TODO implement
|
||||
PSess sess = Session::current;
|
||||
ASSERT (0 <= sess->currEDL().size()); // TODO implement
|
||||
ASSERT (0 <= sess->getFixture()->size()); // TODO implement
|
||||
ASSERT (0 < sess->currEDL().getTracks().size()); // TODO implement
|
||||
|
||||
PAsset track = sess.getTracks()[0];
|
||||
PAsset track = sess->currEDL().getTracks()[0];
|
||||
AssetManager& aMang = AssetManager::instance();
|
||||
ASSERT (track == aMang.getAsset (track->getID()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
|
||||
#include "proc/mobject/session/testclip.hpp"
|
||||
#include "backend/mediaaccessfacade.hpp"
|
||||
#include "backend/mediaaccessmock.hpp"
|
||||
#include "proc/asset/media.hpp"
|
||||
#include "proc/asset/clip.hpp"
|
||||
|
||||
|
|
@ -33,7 +35,9 @@ namespace mobject
|
|||
{
|
||||
typedef shared_ptr<mobject::session::Clip> PC;
|
||||
typedef shared_ptr<asset::Media> PM;
|
||||
typedef MediaAccessFacade MAF;
|
||||
typedef backend_interface::MediaAccessFacade MAF;
|
||||
using backend_interface::test::MediaAccessMock;
|
||||
using asset::VIDEO;
|
||||
|
||||
|
||||
/** @todo find a way to link to an existing clip object.
|
||||
|
|
|
|||
|
|
@ -27,8 +27,11 @@
|
|||
|
||||
#include "common/test/run.hpp"
|
||||
#include "common/factory.hpp"
|
||||
|
||||
#include "proc/mobject/session/clip.hpp"
|
||||
//#include "common/util.hpp"
|
||||
|
||||
|
||||
//#include <boost/format.hpp>
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -51,7 +54,7 @@ namespace mobject
|
|||
* Can be used as Mock object to record invoked operations.
|
||||
*
|
||||
*/
|
||||
class TestClip ////TODO inherit from mobject::session::Clip
|
||||
class TestClip : public mobject::session::Clip /////////////TODO how this????
|
||||
{
|
||||
|
||||
/** smart ptr factory allowed to invoke TestClip's ctor */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#define MOBJECT_SESSION_TESTSESSION_H
|
||||
|
||||
|
||||
#include "proc/mobject/session/session.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "common/error.hpp"
|
||||
//#include "common/factory.hpp"
|
||||
//#include "common/util.hpp"
|
||||
|
|
@ -49,7 +49,8 @@ namespace mobject
|
|||
* in the UML design. All changes are done to the (global)
|
||||
* current session.
|
||||
*/
|
||||
void buildTestseesion1 ()
|
||||
inline void
|
||||
buildTestseesion1 ()
|
||||
{
|
||||
UNIMPLEMENTED ("Test-Session 1");
|
||||
};
|
||||
|
|
@ -59,13 +60,15 @@ namespace mobject
|
|||
* Analyze the current (gloal) Session to verify the
|
||||
* configuration of "Test-Session 1"
|
||||
*/
|
||||
bool checkTestseesion1 ()
|
||||
inline bool
|
||||
checkTestsession1 ()
|
||||
{
|
||||
UNIMPLEMENTED ("Test-Session 1");
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const string SESSION1_CLIP("TODO: some sensible way to refer to a clip");
|
||||
|
||||
|
||||
} // namespace session
|
||||
|
|
|
|||
Loading…
Reference in a new issue