Lumiera  0.pre.03
»edit your freedom«
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 "steam/asset/clip.hpp"
31 
32 using std::static_pointer_cast;
33 
34 
35 namespace steam {
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 steam::asset
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Definition: trait.hpp:91
string name
element ID, comprehensible but sanitised.
Definition: asset.hpp:164
key abstraction: media-like assets
Definition: media.hpp:72
Tree like classification of Assets.
Definition: category.hpp:75
virtual PClipAsset getClipAsset()
return this wrapped into a shared ptr, because it&#39;s already the desired asset::Clip ...
Definition: asset/clip.cpp:96
const Ident ident
Asset identification tuple.
Definition: asset.hpp:208
const Asset::Ident createClipIdent(const Media &mediaref)
Definition: asset/clip.cpp:47
Steam-Layer implementation namespace root.
virtual PMedia checkCompound() const
specialisation delegating the decision to the media asset referred by this clip
Definition: asset/clip.cpp:107
a POD comprised of all the information sufficiently identifying any given Asset.
Definition: asset.hpp:158
const Media & source_
media source of this clip
Definition: asset/clip.hpp:47
virtual PClip createClip() const
Specialisation of the asset::Media interface method, just returning the already existing Clip-MO...
Definition: asset/clip.cpp:85
virtual Duration getLength() const
Definition: media.cpp:131
Definition of Asset representation for a media clip.
Core factory to generate media objects for use in the Session model.
const string org
origin or authorship id.
Definition: asset.hpp:176
bookkeeping (Asset) view of a media clip.
Definition: asset/clip.hpp:44
static lib::P< KIND > wrap(const KIND &asset)
retrieve the registered smart-ptr for any asset
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:80
static session::MObjectFactory create
Storage for the (single, static) MObject factory object.
Definition: mobject.hpp:98
const uint version
version number of the thing or concept represented by this asset.
Definition: asset.hpp:184
asset::Category category
primary tree like classification of the asset.
Definition: asset.hpp:169
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:44
PClip clipMO_
the corresponding (dependent) clip-MO
Definition: asset/clip.hpp:50
virtual PMedia checkCompound() const
predicate to decide if this asset::Media is part of a compound (multichannel) media.
Definition: media.cpp:109
ElementBoxWidget::Config::Qualifier name(string id)
define the name-ID displayed in the caption