Lumiera  0.pre.03
»edit your freedom«
display-service.hpp
Go to the documentation of this file.
1 /*
2  DISPLAY-SERVICE.hpp - service providing access to a display for outputting frames
3 
4  Copyright (C) Lumiera.org
5  2009, 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 
49 #ifndef STAGE_DISPLAY_SERVICE_H
50 #define STAGE_DISPLAY_SERVICE_H
51 
52 
53 #include "include/display-facade.h"
55 #include "lib/scoped-ptrvect.hpp"
56 #include "include/logging.h"
57 #include "lib/nocopy.hpp"
58 
59 #include <glibmm.h>
60 #include <sigc++/sigc++.h>
61 #include <string>
62 #include <vector>
63 
64 
65 namespace stage {
66 
67  using std::string;
68  using std::vector;
69  using lumiera::Display;
70  using Glib::Dispatcher;
71 
72 
73  typedef sigc::slot<void, void*> FrameDestination;
74  typedef sigc::signal<void, void*> FrameSignal;
75 
76 
77 
78  /****************************************************************/
85  : public lumiera_displaySlot,
87  {
88  Dispatcher dispatcher_;
89  FrameSignal hasFrame_;
90 
91  LumieraDisplayFrame currBuffer_;
92 
93 
94  public:
95  DisplayerSlot (FrameDestination const&) ;
96  ~DisplayerSlot () ;
97 
98  /* Implementation-level API to be used by DisplayService */
99 
101  inline void put (LumieraDisplayFrame);
102 
103 
104  private:
107  void displayCurrentFrame();
108 
109  };
110 
112 
113 
114 
115  /**************************************************/
131  {
132 
133  string error_;
134  DisplayerTab slots_;
135 
136 
137  /* === Interface Lifecycle === */
138 
139  typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_Display, 0)
142  ServiceInstanceHandle serviceInstance_;
143 
144 
145  public:
146  DisplayService();
147  ~DisplayService() { INFO (proc_dbg, "Display service dying..."); }
148 
149 
153  static LumieraDisplaySlot setUp (FrameDestination const&);
154 
155 
159  void allocate (LumieraDisplaySlot, bool doAllocate);
160 
161 
165  DisplayerSlot& resolve (LumieraDisplaySlot);
166 
167  };
168 
169 
170 
171 
172  void
173  DisplayerSlot::put(LumieraDisplayFrame newFrame)
174  {
175  if (newFrame != currBuffer_)
176  {
177  currBuffer_ = newFrame;
178  dispatcher_.emit();
179  }
180  else
181  {
182  TRACE (render, "frame dropped?");
183  }
184  }
185 
186 
187 
188 } // namespace stage
189 #endif
Interface for outputting frames to an (already allocated) viewer or display.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Actual implementation of a single displayer slot.
This header is for including and configuring NoBug.
Managing lifecycle for a collection of objects.
void put(LumieraDisplayFrame)
receive a frame to be displayed
Experimental Interface, allowing the Dummy-Player to access the video display widget in the GUI...
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
void displayCurrentFrame()
internal: activated via Dispatcher and running in GTK main thread
Actual implementation of the DisplayService.
Handle tracking the registration of an interface, deregistering it on deletion.
#define LUMIERA_INTERFACE_INAME(name, version)
Construct a type identifier for an interface.
Definition: interface.h:102
A handle template for automatically dealing with interface and plugin registration and deregistration...
string resolve(fsys::path iniSpec)
use the general mechanism for resolving a search path to get the absolute path of the setup...
Definition: basic-setup.cpp:65