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)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
27 #ifndef ASSET_MEDIA_H
28 #define ASSET_MEDIA_H
29 
30 #include "steam/asset.hpp"
31 #include "lib/time/timevalue.hpp"
34 #include "lib/nocopy.hpp"
35 
36 
37 
38 
39 namespace steam {
40 namespace asset {
41 
42  class Clip;
43  class Media;
44  class MediaFactory;
45  class ProcPatt;
46 
47  using lib::time::Duration;
48 
49 
50  template<>
51  class ID<Media> : public ID<Asset>
52  {
53  public:
54  ID (HashVal id);
55  ID (const Media&);
56  };
57 
58 
59 
63  class Media : public Asset
64  {
65  string filename_;
66  const Duration len_;
67 
68  public:
69  using PMedia = lib::P<Media>;
73 
74 
76  const string& getFilename () const { return filename_; }
77 
78  virtual const ID<Media>& getID() const
79  {
80  return static_cast<const ID<Media>& > (Asset::getID());
81  }
82 
88  PProcPatt howtoProc () const;
89 
97  PClip createClip ();
98 
100  virtual Duration getLength () const;
101 
102 
103  protected:
104  Media (const Asset::Ident& idi, const string& file, Duration length)
105  : Asset(idi), filename_(file), len_(length) {}
106  friend class MediaFactory;
107 
110  virtual PClipAsset getClipAsset ();
111 
116  virtual PMedia checkCompound () const;
117  friend class steam::asset::Clip;
118 
119  };
120 
121 
122  // definition of ID<Media> ctors is possible now,
123  // after providing full definition of class Media
124 
125  inline ID<Media>::ID(HashVal id) : ID<Asset> (id) {};
126  inline ID<Media>::ID(const Media& media) : ID<Asset> (media.getID()) {};
127 
128 
129 
130 
136  {
137  public:
138  typedef lib::P<Media> PType;
139 
140  PType operator() (Asset::Ident& key, const string& file="");
141  PType operator() (const string& file, const Category& cat);
142  PType operator() (const string& file, asset::Kind);
143 
144  PType operator() (Asset::Ident& key, const char* file);
145  PType operator() (const char* file, const Category& cat);
146  PType operator() (const char* file, asset::Kind);
147 
149  operator() (Media& mediaref);
150 
151  };
152 
153  LUMIERA_ERROR_DECLARE (PART_OF_COMPOUND);
154 
155 
156 
157 
158 }} // namespace steam::asset
159 #endif
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
Definition: trait.hpp:82
key abstraction: media-like assets
Definition: media.hpp:63
Tree like classification of Assets.
Definition: category.hpp:66
virtual const ID< Media > & getID() const
<
Definition: media.hpp:78
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
MObject in the Session to represent a clip on the timeline.
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition: error.h:62
Core abstraction of the Session model: a media object.
static MediaFactory create
storage for the static MediaFactory instance
Definition: media.hpp:75
Steam-Layer implementation namespace root.
Factory specialised for creating Media Asset objects.
Definition: media.hpp:134
const ID< Asset > id
Asset primary key.
Definition: asset.hpp:212
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:149
Superinterface describing especially bookkeeping properties.
Definition: asset.hpp:139
Steam-Layer Interface: Assets.
Kind
top-level distinction of different Kinds of Assets.
Definition: category.hpp:46
bookkeeping (Asset) view of a media clip.
Definition: asset/clip.hpp:35
size_t HashVal
a STL compatible hash value
Definition: hash-value.h:52
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:468
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition: trait.hpp:71
a family of time value like entities and their relationships.
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:35
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition: asset.hpp:99