Lumiera  0.pre.03
»edit your freedom«
output-slot.cpp
Go to the documentation of this file.
1 /*
2  OutputSlot - 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 
14 
20 #include "lib/error.hpp"
23 
24 #include <vector>
25 
26 
27 namespace steam {
28 namespace play {
29 
30  using std::vector;
31 
32  namespace error = lumiera::error;
33 
34 
35 
36 
37  OutputSlot::~OutputSlot() { } // emit VTables here....
38 
40 
41  OutputSlot::Connection::~Connection() { }
42 
43 
44 
45 
46 
51  bool
53  {
54  return not this->state_;
55  }
56 
57 
74  {
75  if (not isFree())
76  throw error::Logic ("Attempt to open/allocate an OutputSlot already in use.");
77 
78  state_.reset (this->buildState());
79  return *state_;
80  }
81 
82 
83  void
85  {
86  if (not isFree())
87  state_.reset(0);
88  }
89 
90 
91 
92  /* === DataSink frontend === */
93 
95  DataSink::lockBufferFor(FrameID frameNr)
96  {
97  return impl().claimBufferFor(frameNr);
98  }
99 
100 
101  void
102  DataSink::emit (FrameID frameNr, BuffHandle const& data2emit, TimeValue currentTime)
103  {
104  OutputSlot::Connection& connection = impl();
105  if (connection.isTimely(frameNr,currentTime))
106  connection.transfer(data2emit);
107  else
108  connection.discard(data2emit);
109  }
110 
111 
112 
113 
114 }} // namespace steam::play
An (abstract) capability to send media data to an external output.
virtual ConnectionState * buildState()=0
build the connected state, based on the existing configuration within this concrete OutputSlot ...
Steam-Layer implementation namespace root.
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:190
bool isFree() const
can this OutputSlot be allocated?
Definition: output-slot.cpp:52
void disconnect()
disconnect from this OutputSlot
Definition: output-slot.cpp:84
Interface for concrete output implementations to talk to the OutputSlot frontend. ...
~Allocation()
never to be managed by clients directly
Definition: output-slot.cpp:39
Lumiera error handling (C++ interface).
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
basic constant internal time value.
Definition: timevalue.hpp:133