Lumiera  0.pre.03
»edit your freedom«
output-slot.hpp
Go to the documentation of this file.
1 /*
2  OUTPUT-SLOT.hpp - capability to transfer data to a physical output
3 
4  Copyright (C) Lumiera.org
5  2011, 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 
65 #ifndef STEAM_PLAY_OUTPUT_SLOT_H
66 #define STEAM_PLAY_OUTPUT_SLOT_H
67 
68 
69 #include "lib/error.hpp"
70 #include "lib/handle.hpp"
71 #include "lib/time/timevalue.hpp"
73 #include "steam/play/timings.hpp"
74 #include "lib/iter-source.hpp"
75 #include "lib/nocopy.hpp"
76 
77 #include <memory>
78 
79 
80 namespace steam {
81 namespace play {
82 
85  using lib::time::FrameCnt;
87  using lib::time::Time;
88 
89  using std::unique_ptr;
90 
91 
92 
93  class DataSink;
94 
95  typedef FrameCnt FrameID;
96 
97 
98 
99  /****************************************************************************/
112  {
113 
114  protected:
115 
117  class ConnectionState;
118 
119  unique_ptr<ConnectionState> state_;
120 
124  virtual ConnectionState* buildState() =0;
125 
126 
127  public:
128  virtual ~OutputSlot();
129 
131 
133  {
134  public:
135  virtual OpenedSinks getOpenedSinks() =0;
136  virtual bool isActive() const =0;
137 
138  virtual Timings getTimingConstraints() =0;
139 
140  protected:
141  ~Allocation();
142  };
143 
145  class Connection;
146 
147 
149  bool isFree() const;
150 
152  Allocation& allocate();
153 
156  void disconnect();
157  };
158 
159 
160 
168  class DataSink
169  : public lib::Handle<OutputSlot::Connection>
170  {
171 
172  public:
173  BuffHandle lockBufferFor(FrameID);
174  void emit(FrameID, BuffHandle const&, TimeValue currentTime = Time::ANYTIME);
175 
176 
177  friend bool operator== (DataSink const& sink1, DataSink const& sink2)
178  {
179  return not (sink1 and sink2)
180  or (sink1 and sink2
181  and & sink1.impl() == & sink2.impl());
182  }
183  friend bool operator!= (DataSink const& sink1, DataSink const& sink2)
184  {
185  return not (sink1 == sink2);
186  }
187  };
188 
189 
190 
191 
192 
193 }} // namespace steam::play
194 #endif
static const Time ANYTIME
border condition marker value. ANYTIME <= any time value
Definition: timevalue.hpp:322
Generic opaque reference counting handle, for accessing a service and managing its lifecycle...
Definition: handle.hpp:72
virtual ConnectionState * buildState()=0
build the connected state, based on the existing configuration within this concrete OutputSlot ...
Generic frame timing specification.
Definition: timings.hpp:95
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
denotes an opened connection ready to receive media data for output.
Steam-Layer implementation namespace root.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
bool isFree() const
can this OutputSlot be allocated?
Definition: output-slot.cpp:61
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Extension point for Implementation.
void disconnect()
disconnect from this OutputSlot
Definition: output-slot.cpp:93
~Allocation()
never to be managed by clients directly
Definition: output-slot.cpp:48
Lumiera error handling (C++ interface).
Interface: Generic output sink.
Allocation & allocate()
claim this slot for exclusive use
Definition: output-slot.cpp:82
Handle for a buffer for processing data, abstracting away the actual implementation.
Definition: buffhandle.hpp:115
How to define a timing specification or constraint.
Interface: a facility providing and managing working buffers for media calculations.
A generic opaque handle to an implementation entity, including lifecycle management.
int64_t FrameCnt
relative framecount or frame number.
Definition: digxel.hpp:321
a family of time value like entities and their relationships.
Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.
basic constant internal time value.
Definition: timevalue.hpp:142
Abstraction to represent buffer management and lifecycle within the render engine.