2007-08-08 04:50:02 +02:00
|
|
|
/*
|
|
|
|
|
PLACEMENT.hpp - Key Abstraction: a way to place and locate a Media Object
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2007-10-18 17:29:01 +02:00
|
|
|
/** @file placement.hpp
|
|
|
|
|
** Placements are at the very core of all editing operations,
|
|
|
|
|
** because they act as handles (smart pointers) to access the media objects
|
|
|
|
|
** to be manipulated. Moreover, Placements are the actual content of the EDL(s)
|
|
|
|
|
** and Fixture and thus are small objects with value semantics. Many editing tasks
|
|
|
|
|
** include finding some Placement in the EDL or directly take a ref to some Placement.
|
|
|
|
|
**
|
|
|
|
|
** Placements are <b>smart pointers</b>: By acting on the Placement object, we can change
|
|
|
|
|
** parameters of the way the media object is placed (e.g. adjust an offset), while by
|
|
|
|
|
** dereferencing the Placement object, we access the "real" media object (e.g. for trimming).
|
|
|
|
|
**
|
|
|
|
|
** Placements are templated on the type of the actual MObject they refer to, so, sometimes
|
|
|
|
|
** we rather use a Placement<Clip> to be able to use the more specific methods of the
|
|
|
|
|
** session::Clip interface. But <i>please note the following detail:</i> this type
|
|
|
|
|
** labeling is the <i>only</i> difference between this subclasses, besides that,
|
|
|
|
|
** they can be replaced by one another (no slicing).
|
|
|
|
|
**
|
|
|
|
|
** @see ExplicitPlacement
|
|
|
|
|
**
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
#ifndef MOBJECT_PLACEMENT_H
|
|
|
|
|
#define MOBJECT_PLACEMENT_H
|
2007-08-08 04:50:02 +02:00
|
|
|
|
2007-09-27 04:45:06 +02:00
|
|
|
#include "common/time.hpp"
|
|
|
|
|
#include "common/factory.hpp"
|
2007-08-08 04:50:02 +02:00
|
|
|
#include "proc/mobject/mobject.hpp"
|
2007-10-18 17:29:01 +02:00
|
|
|
#include "proc/mobject/session/locatingpin.hpp"
|
2007-08-08 04:50:02 +02:00
|
|
|
#include "proc/mobject/session/track.hpp"
|
|
|
|
|
|
|
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
namespace mobject
|
2007-08-08 04:50:02 +02:00
|
|
|
{
|
2007-08-09 18:51:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class ExplicitPlacement;
|
|
|
|
|
|
|
|
|
|
|
2007-10-18 17:29:01 +02:00
|
|
|
template<class MO>
|
|
|
|
|
class Placement : public shared_ptr<MO>
|
2007-08-08 04:50:02 +02:00
|
|
|
{
|
2007-08-09 18:51:47 +02:00
|
|
|
protected:
|
|
|
|
|
typedef cinelerra::Time Time;
|
|
|
|
|
typedef session::Track Track;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
2007-10-18 17:29:01 +02:00
|
|
|
LocatingPin chain;
|
2007-09-27 04:45:06 +02:00
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
/** resolve the network of placement and
|
|
|
|
|
* provide the resulting (explicit) placement.
|
|
|
|
|
*/
|
2007-10-18 17:29:01 +02:00
|
|
|
virtual ExplicitPlacement resolve () ;
|
2007-09-27 04:45:06 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
Placement ();
|
2007-10-18 17:29:01 +02:00
|
|
|
virtual ~Placement() {};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* === defining specialisations to be subclasses === */
|
|
|
|
|
|
|
|
|
|
namespace session
|
|
|
|
|
{
|
|
|
|
|
class Clip;
|
|
|
|
|
class Effect;
|
|
|
|
|
class Meta;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
class Placement<session::Clip> : public Placement<MObject>
|
|
|
|
|
{
|
|
|
|
|
//TODO: overwirte shared_ptr's operator-> to return the correct subtype of MObject...
|
2007-09-27 04:45:06 +02:00
|
|
|
};
|
|
|
|
|
|
2007-10-18 17:29:01 +02:00
|
|
|
template<>
|
|
|
|
|
class Placement<session::Effect> : public Placement<MObject>
|
|
|
|
|
{ };
|
2007-09-27 04:45:06 +02:00
|
|
|
|
2007-10-18 17:29:01 +02:00
|
|
|
template<>
|
|
|
|
|
class Placement<session::Meta> : public Placement<MObject>
|
|
|
|
|
{ };
|
2007-09-27 04:45:06 +02:00
|
|
|
|
|
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace mobject
|
2007-08-08 04:50:02 +02:00
|
|
|
#endif
|