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)
5  2011, 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 
56 #ifndef STEAM_PLAY_OUTPUT_SLOT_H
57 #define STEAM_PLAY_OUTPUT_SLOT_H
58 
59 
60 #include "lib/error.hpp"
61 #include "lib/handle.hpp"
62 #include "lib/time/timevalue.hpp"
64 #include "steam/play/timings.hpp"
65 #include "lib/iter-source.hpp"
66 #include "lib/nocopy.hpp"
67 
68 #include <memory>
69 
70 
71 namespace steam {
72 namespace play {
73 
76  using lib::time::FrameCnt;
78  using lib::time::Time;
79 
80  using std::unique_ptr;
81 
82 
83 
84  class DataSink;
85 
86  typedef FrameCnt FrameID;
87 
88 
89 
90  /****************************************************************************/
103  {
104 
105  protected:
106 
108  class ConnectionState;
109 
110  unique_ptr<ConnectionState> state_;
111 
115  virtual ConnectionState* buildState() =0;
116 
117 
118  public:
119  virtual ~OutputSlot();
120 
122 
124  {
125  public:
126  virtual OpenedSinks getOpenedSinks() =0;
127  virtual bool isActive() const =0;
128 
129  virtual Timings getTimingConstraints() =0;
130 
131  protected:
132  ~Allocation();
133  };
134 
136  class Connection;
137 
138 
140  bool isFree() const;
141 
143  Allocation& allocate();
144 
147  void disconnect();
148  };
149 
150 
151 
159  class DataSink
160  : public lib::Handle<OutputSlot::Connection>
161  {
162 
163  public:
164  BuffHandle lockBufferFor(FrameID);
165  void emit(FrameID, BuffHandle const&, TimeValue currentTime = Time::ANYTIME);
166 
167 
168  friend bool operator== (DataSink const& sink1, DataSink const& sink2)
169  {
170  return not (sink1 and sink2)
171  or (sink1 and sink2
172  and & sink1.impl() == & sink2.impl());
173  }
174  friend bool operator!= (DataSink const& sink1, DataSink const& sink2)
175  {
176  return not (sink1 == sink2);
177  }
178  };
179 
180 
181 
182 
183 
184 }} // namespace steam::play
185 #endif
static const Time ANYTIME
border condition marker value. ANYTIME <= any time value
Definition: timevalue.hpp:313
Generic opaque reference counting handle, for accessing a service and managing its lifecycle...
Definition: handle.hpp:63
virtual ConnectionState * buildState()=0
build the connected state, based on the existing configuration within this concrete OutputSlot ...
Generic frame timing specification.
Definition: timings.hpp:86
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
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:299
bool isFree() const
can this OutputSlot be allocated?
Definition: output-slot.cpp:52
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:84
~Allocation()
never to be managed by clients directly
Definition: output-slot.cpp:39
Lumiera error handling (C++ interface).
Interface: Generic output sink.
Allocation & allocate()
claim this slot for exclusive use
Definition: output-slot.cpp:73
Handle for a buffer for processing data, abstracting away the actual implementation.
Definition: buffhandle.hpp:111
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:312
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:133
Abstraction to represent buffer management and lifecycle within the render engine.