implement simple constant frame timings descriptor
This commit is contained in:
parent
157e3b6867
commit
6772e94994
3 changed files with 63 additions and 9 deletions
|
|
@ -32,6 +32,7 @@ namespace play {
|
|||
|
||||
|
||||
using lib::time::PQuant;
|
||||
using lib::time::Time;
|
||||
|
||||
namespace { // hidden local details of the service implementation....
|
||||
|
||||
|
|
@ -58,7 +59,47 @@ namespace play {
|
|||
Timings::Timings (FrameRate fps)
|
||||
: grid_(buildStandardGridForFramerate(fps))
|
||||
, playbackUrgency (ASAP)
|
||||
{ }
|
||||
{
|
||||
ENSURE (grid_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TimeValue
|
||||
Timings::getOrigin() const
|
||||
{
|
||||
return grid_->timeOf(0);
|
||||
}
|
||||
|
||||
|
||||
Offset
|
||||
Timings::getFrameOffsetAt (TimeValue refPoint) const
|
||||
{
|
||||
return 1 * getFrameDurationAt (refPoint); /////////////////TODO implement a speed factor here
|
||||
}
|
||||
|
||||
|
||||
Duration
|
||||
Timings::getFrameDurationAt (TimeValue refPoint) const
|
||||
{
|
||||
int64_t frameNr = grid_->gridPoint (refPoint);
|
||||
return Offset (grid_->timeOf(frameNr), grid_->timeOf(frameNr+1));
|
||||
}
|
||||
|
||||
|
||||
/** @remarks the purpose of this function is to support scheduling
|
||||
* and frame handling even in case the frame rate isn't constant.
|
||||
* To indicate the case the frame rate is changing right now,
|
||||
* this function might returns Duration::NIL
|
||||
* @todo implement real support for variable frame rates
|
||||
*/ ////////////////////////////////////////////////////////TICKET #236
|
||||
Duration
|
||||
Timings::constantFrameTimingsInterval (TimeValue startPoint) const
|
||||
{
|
||||
return Duration (Time::ANYTIME);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
namespace lib {
|
||||
namespace time{
|
||||
class Quantiser;
|
||||
typedef std::tr1::shared_ptr<const Quantiser> PQuant;
|
||||
}}
|
||||
|
||||
namespace proc {
|
||||
|
|
@ -66,6 +67,8 @@ namespace play {
|
|||
|
||||
using lib::time::FrameRate;
|
||||
using lib::time::TimeValue;
|
||||
using lib::time::Duration;
|
||||
using lib::time::Offset;
|
||||
//using std::string;
|
||||
|
||||
//using std::vector;
|
||||
|
|
@ -90,9 +93,7 @@ namespace play {
|
|||
*/
|
||||
class Timings
|
||||
{
|
||||
typedef std::tr1::shared_ptr<const lib::time::Quantiser> PQuant;
|
||||
|
||||
PQuant grid_;
|
||||
lib::time::PQuant grid_;
|
||||
|
||||
public:
|
||||
PlaybackUrgency playbackUrgency;
|
||||
|
|
@ -101,9 +102,16 @@ namespace play {
|
|||
|
||||
// default copy acceptable
|
||||
|
||||
TimeValue getOrigin();
|
||||
TimeValue getOrigin() const;
|
||||
|
||||
FrameRate getFrameRate();
|
||||
Offset getFrameOffsetAt (TimeValue refPoint) const;
|
||||
Duration getFrameDurationAt (TimeValue refPoint) const;
|
||||
|
||||
/** the frame spacing and duration remains constant for some time...
|
||||
* @param startPoint looking from that time point into future
|
||||
* @return duration after this starting point, where it's safe
|
||||
* to assume unaltered frame dimensions */
|
||||
Duration constantFrameTimingsInterval (TimeValue startPoint) const;
|
||||
|
||||
|
||||
//////////////TODO further accessor functions here
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ namespace play {
|
|||
namespace test {
|
||||
|
||||
using lib::time::Time;
|
||||
using lib::time::Duration;
|
||||
using lib::time::FrameRate;
|
||||
|
||||
//using proc::engine::BuffHandle;
|
||||
|
|
@ -67,10 +68,14 @@ namespace test {
|
|||
{
|
||||
Timings timings (FrameRate::PAL);
|
||||
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #831
|
||||
CHECK (Time::ZERO == timings.getOrigin());
|
||||
CHECK (FrameRate::PAL == timings.getFrameRate());
|
||||
Time t(0,10);
|
||||
Duration lengthPAL (1, FrameRate::PAL);
|
||||
|
||||
CHECK (timings.getOrigin() == Time::ZERO);
|
||||
CHECK (timings.getFrameDurationAt(t) == lengthPAL);
|
||||
CHECK (timings.getFrameOffsetAt(t) == lengthPAL);
|
||||
CHECK (ASAP == timings.playbackUrgency);
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #831
|
||||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #831
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue