Lumiera  0.pre.03
»edit your freedom«
timings.hpp
Go to the documentation of this file.
1 /*
2  TIMINGS.hpp - timing specifications for a frame quantised data stream
3 
4  Copyright (C)
5  2011, 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 
33 #ifndef STEAM_PLAY_TIMINGS_H
34 #define STEAM_PLAY_TIMINGS_H
35 
36 
37 #include "lib/error.hpp"
38 //#include "lib/handle.hpp"
39 #include "lib/time/timevalue.hpp"
40 //#include "steam/engine/buffer-provider.hpp"
41 //#include "lib/iter-source.hpp"
42 //#include "lib/sync.hpp"
43 
44 //#include <string>
45 //#include <vector>
46 #include <boost/rational.hpp>
47 #include <memory>
48 
49 namespace lib {
50 namespace time{
51  class Quantiser;
52  typedef std::shared_ptr<const Quantiser> PQuant;
53 }}
54 
55 namespace steam {
56 namespace play {
57 
58  using lib::time::FrameCnt;
61  using lib::time::Duration;
62  using lib::time::Offset;
63  using lib::time::Time;
64 //using std::string;
65 
66 //using std::vector;
67 //using std::shared_ptr;
68 
69  enum PlaybackUrgency {
70  ASAP,
71  NICE,
72  TIMEBOUND
73  };
74 
75 
76 
77  /*************************************************************************/
86  class Timings
87  {
88  lib::time::PQuant grid_;
89 
90  public:
91  PlaybackUrgency playbackUrgency;
92  boost::rational<FrameCnt> playbackSpeed;
94  Duration outputLatency;
96 
97  explicit
98  Timings (FrameRate fps);
99 
100  Timings (FrameRate fps, Time realTimeAnchor);
101 
102  // default copy acceptable
103 
104 
107 
108  Time getOrigin() const;
109 
110  Time getFrameStartAt (FrameCnt frameNr) const;
111  Duration getFrameDurationAt (TimeValue refPoint) const;
112  Duration getFrameDurationAt (FrameCnt refFrameNr) const;
113 
115  FrameCnt getBreakPointAfter (TimeValue refPoint) const;
116 
121  Duration constantFrameTimingsInterval (TimeValue startPoint) const;
122 
133  Offset getRealOffset (FrameCnt frameOffset) const;
134 
146  Time getTimeDue(FrameCnt frameOffset) const;
147 
156  Duration getPlanningChunkDuration() const;
157 
165  FrameCnt establishNextPlanningChunkStart(FrameCnt anchorFrame) const;
166 
167 
168  bool isOriginalSpeed() const;
169  bool isTimebound() const;
170 
171 
173  bool isValid() const;
174 
175 
177 
178  Timings constrainedBy (Timings additionalConditions);
179 
180  };
181 
182 
183 
184 
185 
186  inline bool
187  Timings::isOriginalSpeed() const
188  {
189  return 1 == playbackSpeed;
190  }
191 
192  inline bool
193  Timings::isTimebound() const
194  {
195  return play::TIMEBOUND == playbackUrgency;
196  }
197 
198 
199 
200 }} // namespace steam::play
201 #endif
Time scheduledDelivery
a wall clock time corresponding to the Grid&#39;s origin. Can be Time::Never (=not time bound) ...
Definition: timings.hpp:93
Framerate specified as frames per second.
Definition: timevalue.hpp:655
Generic frame timing specification.
Definition: timings.hpp:86
Steam-Layer implementation namespace root.
Implementation namespace for support and library code.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
static Timings DISABLED
marker for halted output
Definition: timings.hpp:106
Duration engineLatency
reasonable guess at the scheduling and dispatch-delay of the render engine
Definition: timings.hpp:95
Lumiera error handling (C++ interface).
Offset measures a distance in time.
Definition: timevalue.hpp:358
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:468
int64_t FrameCnt
relative framecount or frame number.
Definition: digxel.hpp:312
a family of time value like entities and their relationships.
basic constant internal time value.
Definition: timevalue.hpp:133