Lumiera  0.pre.03
»edit your freedom«
media.hpp
Go to the documentation of this file.
1 /*
2  MEDIA.hpp - key abstraction: media-like assets
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 
36 #ifndef ASSET_MEDIA_H
37 #define ASSET_MEDIA_H
38 
39 #include "steam/asset.hpp"
40 #include "lib/time/timevalue.hpp"
43 #include "lib/nocopy.hpp"
44 
45 
46 
47 
48 namespace steam {
49 namespace asset {
50 
51  class Clip;
52  class Media;
53  class MediaFactory;
54  class ProcPatt;
55 
56  using lib::time::Duration;
57 
58 
59  template<>
60  class ID<Media> : public ID<Asset>
61  {
62  public:
63  ID (HashVal id);
64  ID (const Media&);
65  };
66 
67 
68 
72  class Media : public Asset
73  {
74  string filename_;
75  const Duration len_;
76 
77  public:
78  using PMedia = lib::P<Media>;
82 
83 
85  const string& getFilename () const { return filename_; }
86 
87  virtual const ID<Media>& getID() const
88  {
89  return static_cast<const ID<Media>& > (Asset::getID());
90  }
91 
97  PProcPatt howtoProc () const;
98 
106  PClip createClip ();
107 
109  virtual Duration getLength () const;
110 
111 
112  protected:
113  Media (const Asset::Ident& idi, const string& file, Duration length)
114  : Asset(idi), filename_(file), len_(length) {}
115  friend class MediaFactory;
116 
119  virtual PClipAsset getClipAsset ();
120 
125  virtual PMedia checkCompound () const;
126  friend class steam::asset::Clip;
127 
128  };
129 
130 
131  // definition of ID<Media> ctors is possible now,
132  // after providing full definition of class Media
133 
134  inline ID<Media>::ID(HashVal id) : ID<Asset> (id) {};
135  inline ID<Media>::ID(const Media& media) : ID<Asset> (media.getID()) {};
136 
137 
138 
139 
145  {
146  public:
147  typedef lib::P<Media> PType;
148 
149  PType operator() (Asset::Ident& key, const string& file="");
150  PType operator() (const string& file, const Category& cat);
151  PType operator() (const string& file, asset::Kind);
152 
153  PType operator() (Asset::Ident& key, const char* file);
154  PType operator() (const char* file, const Category& cat);
155  PType operator() (const char* file, asset::Kind);
156 
158  operator() (Media& mediaref);
159 
160  };
161 
162  LUMIERA_ERROR_DECLARE (PART_OF_COMPOUND);
163 
164 
165 
166 
167 }} // namespace steam::asset
168 #endif
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Definition: trait.hpp:91
key abstraction: media-like assets
Definition: media.hpp:72
Tree like classification of Assets.
Definition: category.hpp:75
virtual const ID< Media > & getID() const
<
Definition: media.hpp:87
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
MObject in the Session to represent a clip on the timeline.
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition: error.h:71
Core abstraction of the Session model: a media object.
static MediaFactory create
storage for the static MediaFactory instance
Definition: media.hpp:84
Steam-Layer implementation namespace root.
Factory specialised for creating Media Asset objects.
Definition: media.hpp:143
const ID< Asset > id
Asset primary key.
Definition: asset.hpp:221
Mix-Ins to allow or prohibit various degrees of copying and cloning.
a POD comprised of all the information sufficiently identifying any given Asset.
Definition: asset.hpp:158
Superinterface describing especially bookkeeping properties.
Definition: asset.hpp:148
Steam-Layer Interface: Assets.
Kind
top-level distinction of different Kinds of Assets.
Definition: category.hpp:55
bookkeeping (Asset) view of a media clip.
Definition: asset/clip.hpp:44
size_t HashVal
a STL compatible hash value
Definition: hash-value.h:56
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:477
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:80
a family of time value like entities and their relationships.
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:44
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition: asset.hpp:108