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) Lumiera.org
5  2011, 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 
42 #ifndef STEAM_PLAY_TIMINGS_H
43 #define STEAM_PLAY_TIMINGS_H
44 
45 
46 #include "lib/error.hpp"
47 //#include "lib/handle.hpp"
48 #include "lib/time/timevalue.hpp"
49 //#include "steam/engine/buffer-provider.hpp"
50 //#include "lib/iter-source.hpp"
51 //#include "lib/sync.hpp"
52 
53 //#include <string>
54 //#include <vector>
55 #include <boost/rational.hpp>
56 #include <memory>
57 
58 namespace lib {
59 namespace time{
60  class Quantiser;
61  typedef std::shared_ptr<const Quantiser> PQuant;
62 }}
63 
64 namespace steam {
65 namespace play {
66 
67  using lib::time::FrameCnt;
70  using lib::time::Duration;
71  using lib::time::Offset;
72  using lib::time::Time;
73 //using std::string;
74 
75 //using std::vector;
76 //using std::shared_ptr;
77 
78  enum PlaybackUrgency {
79  ASAP,
80  NICE,
81  TIMEBOUND
82  };
83 
84 
85 
86  /*************************************************************************/
95  class Timings
96  {
97  lib::time::PQuant grid_;
98 
99  public:
100  PlaybackUrgency playbackUrgency;
101  boost::rational<FrameCnt> playbackSpeed;
103  Duration outputLatency;
105 
106  explicit
107  Timings (FrameRate fps);
108 
109  Timings (FrameRate fps, Time realTimeAnchor);
110 
111  // default copy acceptable
112 
113 
116 
117  Time getOrigin() const;
118 
119  Time getFrameStartAt (FrameCnt frameNr) const;
120  Duration getFrameDurationAt (TimeValue refPoint) const;
121  Duration getFrameDurationAt (FrameCnt refFrameNr) const;
122 
124  FrameCnt getBreakPointAfter (TimeValue refPoint) const;
125 
130  Duration constantFrameTimingsInterval (TimeValue startPoint) const;
131 
142  Offset getRealOffset (FrameCnt frameOffset) const;
143 
155  Time getTimeDue(FrameCnt frameOffset) const;
156 
165  Duration getPlanningChunkDuration() const;
166 
174  FrameCnt establishNextPlanningChunkStart(FrameCnt anchorFrame) const;
175 
176 
177  bool isOriginalSpeed() const;
178  bool isTimebound() const;
179 
180 
182  bool isValid() const;
183 
184 
186 
187  Timings constrainedBy (Timings additionalConditions);
188 
189  };
190 
191 
192 
193 
194 
195  inline bool
196  Timings::isOriginalSpeed() const
197  {
198  return 1 == playbackSpeed;
199  }
200 
201  inline bool
202  Timings::isTimebound() const
203  {
204  return play::TIMEBOUND == playbackUrgency;
205  }
206 
207 
208 
209 }} // namespace steam::play
210 #endif
Time scheduledDelivery
a wall clock time corresponding to the Grid&#39;s origin. Can be Time::Never (=not time bound) ...
Definition: timings.hpp:102
Framerate specified as frames per second.
Definition: timevalue.hpp:661
Generic frame timing specification.
Definition: timings.hpp:95
Steam-Layer implementation namespace root.
Implementation namespace for support and library code.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:305
static Timings DISABLED
marker for halted output
Definition: timings.hpp:115
Duration engineLatency
reasonable guess at the scheduling and dispatch-delay of the render engine
Definition: timings.hpp:104
Lumiera error handling (C++ interface).
Offset measures a distance in time.
Definition: timevalue.hpp:364
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:474
int64_t FrameCnt
relative framecount or frame number.
Definition: digxel.hpp:322
a family of time value like entities and their relationships.
basic constant internal time value.
Definition: timevalue.hpp:142