Lumiera  0.pre.03
»edit your freedom«
streamtype.hpp
Go to the documentation of this file.
1 /*
2  STREAMTYPE.hpp - classification of media stream types
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 
34 #ifndef STEAM_STREAMTYPE_H
35 #define STEAM_STREAMTYPE_H
36 
37 #include "lib/symbol.hpp"
38 //#include "common/query.hpp"
39 #include "lib/idi/entry-id.hpp"
40 
41 
42 
43 namespace steam {
44 
45  using lib::Symbol;
46 
47 // "yes mummy, we all know this code is not finished yet..."
48 #pragma GCC diagnostic push
49 #pragma GCC diagnostic ignored "-Wuninitialized"
50 
54  struct StreamType
56  {
57  enum MediaKind
58  {
59  VIDEO,
60  IMMAGE,
61  AUDIO,
62  MIDI
63  };
64 
65  enum Usage
66  {
67  RAW,
68  SOURCE,
69  TARGET,
70  INTERMEDIARY
71  };
72 
73  struct Prototype;
74 
75  class ImplFacade;
76  class ImplConstraint;
77 
79 
80 
81  Prototype const& prototype;
82  ImplFacade * implType;
83  Usage intentionTag;
84 
85  };
86 #pragma GCC diagnostic pop
87 
88 
93  {
94  Symbol id;
95  MediaKind kind;
96 
97  bool subsumes (Prototype const& other) const;
98  bool canRender (Prototype const& other) const;
99  };
100 
101 
102 
103 
109  {
110  public:
111  Symbol libraryID;
112 
113  class TypeTag ;
114 
121  struct DataBuffer { };
122 
123 
124  virtual bool operator== (ImplFacade const& other) const =0;
125  virtual bool operator== (StreamType const& other) const =0;
126 
127  virtual bool canConvert (ImplFacade const& other) const =0;
128  virtual bool canConvert (StreamType const& other) const =0;
129 
130  virtual DataBuffer* createFrame () const =0;
131  virtual MediaKind getKind() const =0;
132 
133  virtual ~ImplFacade() {};
134 
135  protected:
136  ImplFacade (Symbol libID) ;
137  };
138 
139 
147  : public StreamType::ImplFacade
148  {
149  public:
150  virtual bool canConvert (ImplFacade const& other) const =0;
151  virtual bool canConvert (StreamType const& other) const =0;
152 
153  virtual bool subsumes (ImplFacade const& other) const =0;
154 
156  virtual void makeCompliant (ImplFacade & other) const =0;
157 
160  virtual DataBuffer* createFrame () const =0;
161 
165  virtual DataBuffer* createFrame (ImplConstraint const& furtherConstraints) const =0;
166 
167  //TODO: do we need functions to represent and describe this constraint?
168 
169  };
170 
171 
179  {
180  void* rawTypeStruct_;
181 
182  public:
183  Symbol libraryID;
184 
185  template<class TY>
186  TypeTag (Symbol lID, TY& rawType)
187  : rawTypeStruct_(&rawType),
188  libraryID(lID)
189  { }
190  };
191 
192 
193 
194 
195 } // namespace steam
196 
197 
198 namespace lumiera {
199  using steam::StreamType;
200 }
201 
202 #endif /*STEAM_STREAMTYPE_H*/
opaque placeholder (type erasure) for implementation specific type info.
Definition: streamtype.hpp:178
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Steam-Layer implementation namespace root.
A (more or less) concrete implementation type, wired up as a facade providing the basic set of operat...
Definition: streamtype.hpp:108
Token or Atom with distinct identity.
Definition: symbol.hpp:126
Marker types to indicate a literal string and a Symbol.
ElementBoxWidget::Config::Qualifier kind(Kind kind)
qualify the basic use case for the new ElementBoxWidget
Lumiera public interface.
Definition: advice.cpp:113
Special case of an implementation type being only partially specified Besides requiring some aspect o...
Definition: streamtype.hpp:146
Bare symbolic and hash ID used for accounting of asset like entries.
placeholder type for the contents of a data buffer.
Definition: streamtype.hpp:121