Lumiera  0.pre.03
»edityourfreedom«
proc/asset/clip.cpp
Go to the documentation of this file.
1 /*
2  Clip(Asset) - bookkeeping (asset) view of a media clip.
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
29 #include "proc/asset/clip.hpp"
31 
32 using std::static_pointer_cast;
33 
34 
35 namespace proc {
36 namespace asset {
37 
38  namespace {
39 
46  const Asset::Ident
47  createClipIdent (const Media& mediaref)
48  {
49  string name (mediaref.ident.name + "-clip"); // TODO something sensible here; append number, sanitise etc.
50  Category category (mediaref.ident.category);
51  category.setPath(CLIP_SUBFOLDER);
52  return Asset::Ident (name, category,
53  mediaref.ident.org,
54  mediaref.ident.version );
55  }
56 
58  createClipMO (const Clip& thisClipAsset, const Media& mediaChannel)
59  {
60  return mobject::MObject::create (thisClipAsset,mediaChannel);
61  }
62  }
63 
64 
65 
66  Clip::Clip (Media& mediaref)
67  : Media (createClipIdent (mediaref),
68  mediaref.getFilename(),
69  mediaref.getLength())
70  , source_ (mediaref)
71  , clipMO_ (createClipMO (*this, source_))
72  {
73  this->defineDependency (mediaref);
74  }
75 
76 
86  {
87  return clipMO_;
88  }
89 
90 
91 
97  {
98  return AssetManager::wrap (*this);
99  }
100 
101 
102 
108  {
109  return source_.checkCompound();
110  }
111 
112 
113 
114 }} // namespace proc::asset
PClip clipMO_
the corresponding (dependent) clip-MO
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Definition: trait.hpp:87
The asset subsystem of the Proc-Layer.
Definition: id-scheme.hpp:64
static session::MObjectFactory create
Storage for the (single, static) MObject factory object.
Definition: mobject.hpp:98
const Media & source_
media source of this clip
const string CLIP_SUBFOLDER
virtual PMedia checkCompound() const
specialisation delegating the decision to the media asset referred by this clip
mobject::Placement< mobject::session::Clip > PClip
Definition: media.hpp:81
virtual PClipAsset getClipAsset()
return this wrapped into a shared ptr, because it&#39;s already the desired asset::Clip ...
static lib::P< KIND > wrap(const KIND &asset)
retrieve the registered smart-ptr for any asset
Definition of Asset representation for a media clip.
Core factory to generate media objects for use in the Session model.
void defineDependency(PAsset parent)
establish a connection between this and the given parent asset, denoting we are in some way dependent...
Definition: asset.cpp:193
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:76
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63
virtual PClip createClip() const
Specialisation of the asset::Media interface method, just returning the already existing Clip-MO...
key abstraction: media-like assets
Definition: media.hpp:72
Clip(Media &mediaref)
virtual PMedia checkCompound() const
predicate to decide if this asset::Media is part of a compound (multichannel) media.
Definition: media.cpp:109