Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 GUI_DISPLAY_SERVICE_H
50 #define GUI_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 gui {
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 
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)
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 
166 
167  };
168 
169 
170 
171 
172  void
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 gui
189 #endif
ServiceInstanceHandle serviceInstance_
void allocate(LumieraDisplaySlot, bool doAllocate)
prepare and the given slot for output
LumieraDisplayFrame currBuffer_
Interface for outputting frames to an (already allocated) viewer or display.
Actual implementation of a single displayer slot.
Handle tracking the registration of an interface, deregistering it on deletion.
lumiera_displaySlot * LumieraDisplaySlot
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:47
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_Display, 0), lumiera::Display > ServiceInstanceHandle
Actual implementation of the DisplayService.
unsigned char * LumieraDisplayFrame
void displayCurrentFrame()
internal: activated via Dispatcher and running in GTK main thread
static LumieraDisplaySlot setUp(FrameDestination const &)
open a new display, sending frames to the given output destination
This header is for including and configuring NoBug.
Managing lifecycle for a collection of objects.
DisplayerSlot & resolve(LumieraDisplaySlot)
resolve the given display slot handle to yield a ref to an actual implementation object.
void put(LumieraDisplayFrame)
receive a frame to be displayed
sigc::slot< void, void * > FrameDestination
Experimental Interface, allowing the Dummy-Player to access the video display widget in the GUI...
TRACE(test,"inserted %d", data)
Mix-Ins to allow or prohibit various degrees of copying and cloning.
DisplayerSlot(FrameDestination const &)
#define LUMIERA_INTERFACE_INAME(name, version)
Construct a type identifier for an interface.
Definition: interface.h:102
sigc::signal< void, void * > FrameSignal
A handle template for automatically dealing with interface and plugin registration and deregistration...
lib::ScopedPtrVect< DisplayerSlot > DisplayerTab