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)
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 
31 #ifndef STEAM_DUMMYPLAYER_SERVICE_H
32 #define STEAM_DUMMYPLAYER_SERVICE_H
33 
34 
36 #include "include/display-facade.h"
38 #include "lib/nocopy.hpp"
39 
40 #include <memory>
41 #include <string>
42 
43 
44 namespace steam {
45  namespace node {
46  class DummyImageGenerator;
47  class TickService;
48  }
49 
50  namespace play {
51 
52  using std::string;
53  using lumiera::Subsys;
54  using lumiera::Display;
56 
59 
60 
61 
62  /****************************************************************/
73  {
74  uint fps_;
75  bool play_;
76 
77  Display::Sink display_;
78  std::unique_ptr<DummyImageGenerator> imageGen_;
79  std::unique_ptr<TickService> tick_;
80 
81 
82  public:
83  ProcessImpl(LumieraDisplaySlot) ;
84  ~ProcessImpl() ;
85 
86 
87  /* Implementation-level API */
88 
91  void setRate (uint fps);
92 
93  bool isActive () { return fps_ != 0; }
94  bool isPlaying() { return play_; }
95 
96  void doPlay(bool yes);
97 
98 
99  /* Lifecycle */
100 
101  DummyPlayer::Process createHandle();
102  static void terminate(DummyPlayer::ProcessImplementationLink*);
103 
104  private:
105  void doFrame ();
106  };
107 
108 
109 
110  /**************************************************/
120  {
121 
122  string error_;
123  Subsys::SigTerm notifyTermination_;
124 
125 
126  /* === Interface Lifecycle === */
127 
128  typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0)
129  , DummyPlayer
131  ServiceInstanceHandle serviceInstance_;
132 
133  public:
134  DummyPlayerService(Subsys::SigTerm terminationHandle);
135  ~DummyPlayerService() { notifyTermination_(&error_); }
136 
137 
138 
143  ProcessImpl* start (LumieraDisplaySlot viewerHandle);
144 
145  };
146 
147 
148 
149 
150  } // namespace play
151 
152 } // namespace steam
153 #endif
154 
Dependencies and lifecycle of a partially independent Subsystem of the Application.
Definition: subsys.hpp:61
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:37
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:93
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.