Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
output-slot-connection.hpp
Go to the documentation of this file.
1/*
2 OUTPUT-SLOT-CONNECTION.hpp - implementation API for concrete output slots
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
29#ifndef STEAM_PLAY_OUTPUT_SLOT_CONNECTION_H
30#define STEAM_PLAY_OUTPUT_SLOT_CONNECTION_H
31
32
33#include "lib/error.hpp"
34#include "lib/nocopy.hpp"
38#include "lib/iter-source.hpp"
39#include "lib/handle.hpp"
40//#include "lib/time/timevalue.hpp"
41//#include "steam/engine/buffer-provider.hpp"
42//#include "steam/play/timings.hpp"
43//#include "lib/sync.hpp"
44
45//#include <string>
46#include <functional>
47#include <vector>
48//#include <memory>
49
50
51namespace steam {
52namespace play {
53
55//using steam::engine::BufferProvider;
56//using lib::time::Time;
57//using std::string;
59
60//using std::placeholders::_1;
61//using std::bind;
62 using std::vector;
63//using std::shared_ptr;
64
65
66
67
90 {
91 public:
92 virtual ~Connection();
93
95 virtual bool isTimely (FrameID, TimeValue) =0;
96 virtual void transfer (BuffHandle const&) =0;
97 virtual void pushout (BuffHandle const&) =0;
98 virtual void discard (BuffHandle const&) =0;
99 virtual void shutDown () =0;
100 };
101
102
103
114 {
115 public:
116 virtual ~ConnectionState() { }
117
118 virtual Connection& access (uint) const =0;
119 };
120
121
122
123
124 /* ===== Building blocks for OutputSlot implementation ===== */
125
128 : public OutputSlot
129 {
130 protected:
131 template<class CON>
132 class ConnectionManager;
133 };
134
135
153 template<class CON>
156 {
159
161
162
163 /* == Allocation Interface == */
164
167 {
169 REQUIRE (this->isActive());
171 }
172
173 Timings
175 {
176 UNIMPLEMENTED ("find out about timing constraints");
177 }
178
179 bool
180 isActive() const
181 {
182 return 0 < connections_.size();
183 }
184
185 CON&
186 access (uint chanNr) const
187 {
188 return connections_[chanNr];
189 }
190
191
192 protected: /* == API for OutputSlot-Impl == */
193 void
199
200 using ConnectionStorage = Connections::ElementHolder&;
201
205
206
208 : connections_(numChannels)
209 { }
210
211 public:
212 virtual
215
216
217
218 private: // Implementation details
219
220 static DataSink
221 connectOutputSink (CON& connection)
222 {
223 TRACE (test, "activating Con=%p", &connection );
224
225 DataSink newSink;
226 newSink.activate(&connection, shutdownConnection);
227 return newSink;
228 }
229
230 static void
232 {
233 REQUIRE (toClose);
234 toClose->shutDown();
235 }
236 };
237
238
239
240
241}} // namespace steam::play
242#endif
Handle & activate(IMP *impl, DEL whenDead)
Activation of the handle by the managing service.
Definition handle.hpp:112
A fixed collection of non-copyable polymorphic objects.
void populate_by(CTOR builder)
init all elements at once, invoking a builder functor for each.
basic constant internal time value.
Handle for a buffer for processing data, abstracting away the actual implementation.
denotes an opened connection ready to receive media data for output.
static void shutdownConnection(OutputSlot::Connection *toClose)
virtual void buildConnection(ConnectionStorage)=0
factory function to build the actual connection handling objects per channel
Base for OutputSlot standard implementation.
virtual Connection & access(uint) const =0
virtual void pushout(BuffHandle const &)=0
virtual bool isTimely(FrameID, TimeValue)=0
virtual void discard(BuffHandle const &)=0
virtual BuffHandle claimBufferFor(FrameID)=0
virtual void transfer(BuffHandle const &)=0
Interface: Generic output sink.
Generic frame timing specification.
Definition timings.hpp:87
Any copy and copy construction prohibited.
Definition nocopy.hpp:38
Lumiera error handling (C++ interface).
A generic opaque handle to an implementation entity, including lifecycle management.
unsigned int uint
Definition integral.hpp:29
Preconfigured adapters for some STL container standard usage situations.
Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.
_TransformIterT< IT, FUN >::Iter transform(IT &&source, FUN processingFunc)
pipes a given Lumiera Forward Iterator through a transformation function and wraps the resulting tran...
_SeqT< CON >::Range eachElm(CON &coll)
FrameCnt FrameID
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
An (abstract) capability to send media data to an external output.
Managing a collection of non-copyable polymorphic objects in compact storage.