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) 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 
23 
29 #include "lib/error.hpp"
32 
33 #include <vector>
34 
35 
36 namespace steam {
37 namespace play {
38 
39  using std::vector;
40 
41  namespace error = lumiera::error;
42 
43 
44 
45 
46  OutputSlot::~OutputSlot() { } // emit VTables here....
47 
49 
50  OutputSlot::Connection::~Connection() { }
51 
52 
53 
54 
55 
60  bool
62  {
63  return not this->state_;
64  }
65 
66 
83  {
84  if (not isFree())
85  throw error::Logic ("Attempt to open/allocate an OutputSlot already in use.");
86 
87  state_.reset (this->buildState());
88  return *state_;
89  }
90 
91 
92  void
94  {
95  if (not isFree())
96  state_.reset(0);
97  }
98 
99 
100 
101  /* === DataSink frontend === */
102 
103  BuffHandle
104  DataSink::lockBufferFor(FrameID frameNr)
105  {
106  return impl().claimBufferFor(frameNr);
107  }
108 
109 
110  void
111  DataSink::emit (FrameID frameNr, BuffHandle const& data2emit, TimeValue currentTime)
112  {
113  OutputSlot::Connection& connection = impl();
114  if (connection.isTimely(frameNr,currentTime))
115  connection.transfer(data2emit);
116  else
117  connection.discard(data2emit);
118  }
119 
120 
121 
122 
123 }} // 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:199
bool isFree() const
can this OutputSlot be allocated?
Definition: output-slot.cpp:61
void disconnect()
disconnect from this OutputSlot
Definition: output-slot.cpp:93
Interface for concrete output implementations to talk to the OutputSlot frontend. ...
~Allocation()
never to be managed by clients directly
Definition: output-slot.cpp:48
Lumiera error handling (C++ interface).
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
basic constant internal time value.
Definition: timevalue.hpp:142