Lumiera  0.pre.03
»edit your freedom«
mobject/session/clip.cpp
Go to the documentation of this file.
1 /*
2  Clip - 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 
32 #include "steam/assetmanager.hpp"
33 #include "steam/asset/media.hpp"
34 #include "steam/asset/clip.hpp"
35 #include "lib/time/mutation.hpp"
36 #include "lib/util.hpp"
37 
39 using util::isnil;
40 
41 namespace steam {
42 namespace mobject {
43 namespace session {
44 
48  Clip::Clip (asset::Clip const& clipDef, Media const& mediaDef)
49  : mediaDef_(mediaDef)
50  , clipDef_(clipDef)
51  {
52  setupLength();
53  throwIfInvalid();
54  }
55 
56 
57 
61  bool
62  Clip::isValid () const
63  {
64  TODO ("check consistency of clip length def, implies accessing the underlying media def");
65  return not isnil(length_);
66  }
67 
68 
69  void
70  Clip::setupLength()
71  {
72  TODO ("really calculate the length of a clip and set length field");
73  this->length_.accept (Mutation::changeDuration(mediaDef_.getLength()));
74  }
75 
76 
77  PMedia
78  Clip::getMedia () const
79  {
81  }
82 
83 
86  {
87  return asset::AssetManager::wrap (clipDef_);
88  }
89 
90 
91 
92 
93 }}} // namespace steam::mobject::session
94 
Steam-Layer Interface: Asset Lookup and Organisation.
Modifying time and timecode values.
key abstraction: media-like assets
Definition: media.hpp:72
Media data represented a specific kind of Asset.
PClipAsset findClipAsset() const
locate the corresponding asset representing this clip or the whole compound in case of a multichannel...
bool isValid() const
implementing the common MObject self test.
PMedia getMedia() const
access the underlying media asset
MObject in the Session to represent a clip on the timeline.
Interface: an opaque change imposed onto some time value.
Definition: mutation.hpp:100
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
virtual Duration getLength() const
Definition: media.cpp:131
Definition of Asset representation for a media clip.
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
Clip(const asset::Clip &, const Media &)
new clip-MO linked with the given asset::Clip.