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)
5  2009, 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 
40 #ifndef STAGE_DISPLAY_SERVICE_H
41 #define STAGE_DISPLAY_SERVICE_H
42 
43 
44 #include "include/display-facade.h"
46 #include "lib/scoped-ptrvect.hpp"
47 #include "include/logging.h"
48 #include "lib/nocopy.hpp"
49 
50 #include <glibmm.h>
51 #include <sigc++/sigc++.h>
52 #include <string>
53 #include <vector>
54 
55 
56 namespace stage {
57 
58  using std::string;
59  using std::vector;
60  using lumiera::Display;
61  using Glib::Dispatcher;
62 
63 
64  typedef sigc::slot<void, void*> FrameDestination;
65  typedef sigc::signal<void, void*> FrameSignal;
66 
67 
68 
69  /****************************************************************/
76  : public lumiera_displaySlot,
78  {
79  Dispatcher dispatcher_;
80  FrameSignal hasFrame_;
81 
82  LumieraDisplayFrame currBuffer_;
83 
84 
85  public:
86  DisplayerSlot (FrameDestination const&) ;
87  ~DisplayerSlot () ;
88 
89  /* Implementation-level API to be used by DisplayService */
90 
92  inline void put (LumieraDisplayFrame);
93 
94 
95  private:
98  void displayCurrentFrame();
99 
100  };
101 
103 
104 
105 
106  /**************************************************/
122  {
123 
124  string error_;
125  DisplayerTab slots_;
126 
127 
128  /* === Interface Lifecycle === */
129 
130  typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_Display, 0)
133  ServiceInstanceHandle serviceInstance_;
134 
135 
136  public:
137  DisplayService();
138  ~DisplayService() { INFO (proc_dbg, "Display service dying..."); }
139 
140 
144  static LumieraDisplaySlot setUp (FrameDestination const&);
145 
146 
150  void allocate (LumieraDisplaySlot, bool doAllocate);
151 
152 
156  DisplayerSlot& resolve (LumieraDisplaySlot);
157 
158  };
159 
160 
161 
162 
163  void
164  DisplayerSlot::put(LumieraDisplayFrame newFrame)
165  {
166  if (newFrame != currBuffer_)
167  {
168  currBuffer_ = newFrame;
169  dispatcher_.emit();
170  }
171  else
172  {
173  TRACE (render, "frame dropped?");
174  }
175  }
176 
177 
178 
179 } // namespace stage
180 #endif
Interface for outputting frames to an (already allocated) viewer or display.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
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:37
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:93
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:56