Lumiera  0.pre.03
»edit your freedom«
dummy-player-service.hpp
Go to the documentation of this file.
1 /*
2  DUMMY-PLAYER-SERVICE.hpp - service implementing a dummy test player
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 
40 #ifndef STEAM_DUMMYPLAYER_SERVICE_H
41 #define STEAM_DUMMYPLAYER_SERVICE_H
42 
43 
45 #include "include/display-facade.h"
47 #include "lib/nocopy.hpp"
48 
49 #include <memory>
50 #include <string>
51 
52 
53 namespace steam {
54  namespace node {
55  class DummyImageGenerator;
56  class TickService;
57  }
58 
59  namespace play {
60 
61  using std::string;
62  using lumiera::Subsys;
63  using lumiera::Display;
65 
68 
69 
70 
71  /****************************************************************/
82  {
83  uint fps_;
84  bool play_;
85 
86  Display::Sink display_;
87  std::unique_ptr<DummyImageGenerator> imageGen_;
88  std::unique_ptr<TickService> tick_;
89 
90 
91  public:
92  ProcessImpl(LumieraDisplaySlot) ;
93  ~ProcessImpl() ;
94 
95 
96  /* Implementation-level API */
97 
100  void setRate (uint fps);
101 
102  bool isActive () { return fps_ != 0; }
103  bool isPlaying() { return play_; }
104 
105  void doPlay(bool yes);
106 
107 
108  /* Lifecycle */
109 
110  DummyPlayer::Process createHandle();
111  static void terminate(DummyPlayer::ProcessImplementationLink*);
112 
113  private:
114  void doFrame ();
115  };
116 
117 
118 
119  /**************************************************/
129  {
130 
131  string error_;
132  Subsys::SigTerm notifyTermination_;
133 
134 
135  /* === Interface Lifecycle === */
136 
137  typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0)
138  , DummyPlayer
140  ServiceInstanceHandle serviceInstance_;
141 
142  public:
143  DummyPlayerService(Subsys::SigTerm terminationHandle);
144  ~DummyPlayerService() { notifyTermination_(&error_); }
145 
146 
147 
152  ProcessImpl* start (LumieraDisplaySlot viewerHandle);
153 
154  };
155 
156 
157 
158 
159  } // namespace play
160 
161 } // namespace steam
162 #endif
163 
Dependencies and lifecycle of a partially independent Subsystem of the Application.
Definition: subsys.hpp:70
Interface for outputting frames to an (already allocated) viewer or display.
Playback process, front-end to be used by client code.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Steam-Layer implementation namespace root.
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.
Tick generating service for a periodic callback, with adjustable frequency.
Actual implementation of a single (dummy) playback process.
Handle tracking the registration of an interface, deregistering it on deletion.
Actual implementation of the DummyPlayer service.
#define LUMIERA_INTERFACE_INAME(name, version)
Construct a type identifier for an interface.
Definition: interface.h:102
Experimental Interface Steam-Layer (or maybe the vault?): Global access point for starting a dummy pl...
A handle template for automatically dealing with interface and plugin registration and deregistration...
Functor for pushing frames to the display.