From a640283e4cc751373f40848714b7d0dfcd36ecb3 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 18 Nov 2013 00:01:43 +0100 Subject: [PATCH] introduce typedef for Frame numbers (see #882) --- src/backend/engine/job.h | 4 +- src/lib/time.h | 17 +- src/lib/time/digxel.hpp | 4 +- src/lib/time/grid.hpp | 4 +- src/lib/time/mutation.hpp | 4 +- src/lib/time/quantiser.cpp | 4 +- src/lib/time/quantiser.hpp | 12 +- src/lib/time/time.cpp | 4 +- src/lib/time/timecode.cpp | 8 +- src/lib/time/timevalue.hpp | 164 ++++++++++-------- src/proc/engine/calc-plan-continuation.cpp | 4 +- src/proc/engine/calc-plan-continuation.hpp | 5 +- src/proc/engine/dispatcher.hpp | 3 +- src/proc/engine/frame-coord.hpp | 7 +- src/proc/engine/job-planning.hpp | 2 +- src/proc/engine/time-anchor.hpp | 13 +- src/proc/play/output-slot.hpp | 3 +- src/proc/play/timings.cpp | 17 +- src/proc/play/timings.hpp | 13 +- tests/core/backend/engine/dummy-job.cpp | 2 +- .../proc/engine/dispatcher-interface-test.cpp | 2 +- .../proc/play/output-slot-protocol-test.cpp | 2 +- tests/library/time/time-control-test.cpp | 4 +- tests/library/time/time-formats-test.cpp | 4 +- tests/library/time/time-value-test.cpp | 2 +- 25 files changed, 170 insertions(+), 138 deletions(-) diff --git a/src/backend/engine/job.h b/src/backend/engine/job.h index cf107e9e9..fb27e63d3 100644 --- a/src/backend/engine/job.h +++ b/src/backend/engine/job.h @@ -91,6 +91,8 @@ enum JobFailureReason PREREQUISITE_NOT_AVAILABLE ///////////////TODO }; +typedef int64_t FrameCnt; + /** @@ -110,7 +112,7 @@ typedef struct lumiera_jobClosure* LumieraJobClosure; */ union InvocationInstanceID { - int64_t frameNumber; + FrameCnt frameNumber; lumiera_uid luid; struct {int a,b;} diff --git a/src/lib/time.h b/src/lib/time.h index f321e176a..1ec4a9d78 100644 --- a/src/lib/time.h +++ b/src/lib/time.h @@ -95,13 +95,6 @@ extern "C" { /* ===================== C interface ======================== */ #endif -/** - * Formats a time value in H:MM:SS.mmm format into a temporary buffer. - * @return safeclib temporary buffer containing formatted time string - */ -char* -lumiera_tmpbuf_print_time (gavl_time_t time); - /** * Quantise the given time into a fixed grid, relative to the origin. * The time grid used for quantisation is comprised of equally spaced intervals, @@ -219,6 +212,16 @@ int lumiera_time_ntsc_drop_hours (gavl_time_t time); +/** + * @internal Diagnostics helper: render time value in H:MM:SS.mmm format. + * @return `safeclib` temporary buffer containing formatted time string + * @note any time output for real should go through quantisation followed + * by rendering into a suitable timecode format. + */ +char* +lumiera_tmpbuf_print_time (gavl_time_t time); + + #ifdef __cplusplus }//extern "C" diff --git a/src/lib/time/digxel.hpp b/src/lib/time/digxel.hpp index 8237d95dc..66aa9431a 100644 --- a/src/lib/time/digxel.hpp +++ b/src/lib/time/digxel.hpp @@ -317,7 +317,9 @@ namespace time { typedef Digxel< int, digxel::SexaFormatter> SexaDigit; ///< for displaying time components (sexagesimal) typedef Digxel HexaDigit; ///< for displaying a hex byte typedef Digxel< int, digxel::HourFormatter> HourDigit; ///< for displaying hours in H:M.S - typedef Digxel CountVal; ///< for displaying a counter ///////////TICKET #882 : should better use a typedef for frame counts + + typedef int64_t FrameCnt; + typedef Digxel CountVal; ///< for displaying a counter /** special Digxel to show a sign. diff --git a/src/lib/time/grid.hpp b/src/lib/time/grid.hpp index f509cedd4..df7a21f29 100644 --- a/src/lib/time/grid.hpp +++ b/src/lib/time/grid.hpp @@ -62,9 +62,9 @@ namespace time { virtual ~Grid(); ///< this is an Interface - virtual int64_t gridPoint (TimeValue const& raw) const =0; + virtual FrameCnt gridPoint (TimeValue const& raw) const =0; virtual TimeValue gridAlign (TimeValue const& raw) const =0; - virtual TimeValue timeOf (int64_t gridPoint) const =0; + virtual TimeValue timeOf (FrameCnt gridPoint) const =0; virtual TimeValue timeOf (FSecs gridTime, int=0) const =0; }; diff --git a/src/lib/time/mutation.hpp b/src/lib/time/mutation.hpp index 297bdda9d..dc57ff25f 100644 --- a/src/lib/time/mutation.hpp +++ b/src/lib/time/mutation.hpp @@ -177,8 +177,8 @@ namespace time { Mutation::imposeChange (QuTime& target, int steps) { PQuant const& grid (target); - int64_t originalGridPoint = grid->gridPoint(target); - int64_t adjustedGridPoint = originalGridPoint + steps; + FrameCnt originalGridPoint = grid->gridPoint(target); + FrameCnt adjustedGridPoint = originalGridPoint + steps; return imposeChange (target, grid->timeOf (adjustedGridPoint)); } #endif diff --git a/src/lib/time/quantiser.cpp b/src/lib/time/quantiser.cpp index 041aa7210..f698e5b32 100644 --- a/src/lib/time/quantiser.cpp +++ b/src/lib/time/quantiser.cpp @@ -136,7 +136,7 @@ namespace time { * range when converting back into a TimeValue. * @see #lumiera_quantise_frames */ - int64_t + FrameCnt FixedFrameQuantiser::gridPoint (TimeValue const& rawTime) const { return lumiera_quantise_frames (_raw(rawTime), _raw(origin_), _raw(raster_)); @@ -149,7 +149,7 @@ namespace time { * valid range of lumiera::Time */ TimeValue - FixedFrameQuantiser::timeOf (int64_t gridPoint) const + FixedFrameQuantiser::timeOf (FrameCnt gridPoint) const { return TimeValue (lumiera_time_of_gridpoint (gridPoint, _raw(origin_), _raw(raster_))); } diff --git a/src/lib/time/quantiser.hpp b/src/lib/time/quantiser.hpp index 38cf9cf8e..989a2e875 100644 --- a/src/lib/time/quantiser.hpp +++ b/src/lib/time/quantiser.hpp @@ -108,9 +108,9 @@ namespace time { //------Grid-API---------------------------------------------- - virtual int64_t gridPoint (TimeValue const& raw) const =0; + virtual FrameCnt gridPoint (TimeValue const& raw) const =0; virtual TimeValue gridAlign (TimeValue const& raw) const =0; - virtual TimeValue timeOf (int64_t gridPoint) const =0; + virtual TimeValue timeOf (FrameCnt gridPoint) const =0; virtual TimeValue timeOf (FSecs, int =0) const =0; }; @@ -137,10 +137,10 @@ namespace time { FixedFrameQuantiser (FrameRate const& frames_per_second, TimeValue referencePoint =TimeValue(0)); FixedFrameQuantiser (Duration const& frame_duration, TimeValue referencePoint =TimeValue(0)); - int64_t gridPoint (TimeValue const&) const; - TimeValue gridAlign (TimeValue const&) const; - TimeValue timeOf (int64_t gridPoint) const; - TimeValue timeOf (FSecs, int =0) const; + FrameCnt gridPoint (TimeValue const&) const; + TimeValue gridAlign (TimeValue const&) const; + TimeValue timeOf (FrameCnt gridPoint) const; + TimeValue timeOf (FSecs, int =0) const; }; diff --git a/src/lib/time/time.cpp b/src/lib/time/time.cpp index 73ca17180..c39772fdf 100644 --- a/src/lib/time/time.cpp +++ b/src/lib/time/time.cpp @@ -192,14 +192,14 @@ namespace time { /** offset by the given number of frames. */ - Offset::Offset (int64_t count, FrameRate const& fps) + Offset::Offset (FrameCnt count, FrameRate const& fps) : TimeValue (count? (count<0? -1:+1) * lumiera_framecount_to_time (::abs(count), fps) : _raw(Duration::NIL)) { } /** duration of the given number of frames. * @note always positive; count used absolute */ - Duration::Duration (int64_t count, FrameRate const& fps) + Duration::Duration (FrameCnt count, FrameRate const& fps) : TimeValue (count? lumiera_framecount_to_time (abs(count), fps) : _raw(Duration::NIL)) { } diff --git a/src/lib/time/timecode.cpp b/src/lib/time/timecode.cpp index 53faef575..3eb1efbf4 100644 --- a/src/lib/time/timecode.cpp +++ b/src/lib/time/timecode.cpp @@ -70,7 +70,7 @@ namespace time { static regex frameNr_parser ("(? (match[1])); + return frameGrid.timeOf (lexical_cast (match[1])); else throw error::Invalid ("unable to parse framecount \""+frameNumber+"\"" , LUMIERA_ERROR_INVALID_TIMECODE); @@ -205,9 +205,9 @@ namespace time { uint Smpte::getFramerate (QuantR quantiser_, TimeValue const& rawTime) { - int64_t refCnt = quantiser_.gridPoint(rawTime); - int64_t newCnt = quantiser_.gridPoint(Time(0,1) + rawTime); - int64_t effectiveFrames = newCnt - refCnt; + FrameCnt refCnt = quantiser_.gridPoint(rawTime); + FrameCnt newCnt = quantiser_.gridPoint(Time(0,1) + rawTime); + FrameCnt effectiveFrames = newCnt - refCnt; ENSURE (1000 > effectiveFrames); ENSURE (0 < effectiveFrames); return uint(effectiveFrames); diff --git a/src/lib/time/timevalue.hpp b/src/lib/time/timevalue.hpp index 8dd36ad47..04dec4370 100644 --- a/src/lib/time/timevalue.hpp +++ b/src/lib/time/timevalue.hpp @@ -181,6 +181,95 @@ namespace time { + + + + + + + /* ======= specific Time entities ==================== */ + + /** relative framecount or frame number. + * Used within the engine at places where the underlying + * grid and origin is obvious from the call context. + * @warning do not mix up gavl_time_t and FrameCnt. + * @warning use 64bit consistently. + * beware: \c long is 32bit on i386 + * @note any conversion to frame numbers should go through + * time quantisation followed by conversion to FrameNr + */ + typedef int64_t FrameCnt; + + /** rational representation of fractional seconds + * @warning do not mix up gavl_time_t and FSecs */ + typedef boost::rational FSecs; + + + /** + * Lumiera's internal time value datatype. + * This is a TimeValue, but now more specifically denoting + * a point in time, measured in reference to an internal + * (opaque) time scale. + * + * Lumiera Time provides some limited capabilities for + * direct manipulation; Time values can be created directly + * from \c (ms,sec,min,hour) specification and there is an + * string representation intended for internal use (reporting + * and debugging). Any real output, formatting and persistent + * storage should be based on the (quantised) timecode + * formats though, which can be generated from time values. + * + * Similar to TimeValue, also Time objects are considered + * immutable values. As convenience shortcut, some operators + * are provided, creating a TimVar for further calculations. + */ + class Time + : public TimeValue + { + /// direct assignment prohibited + Time& operator= (Time const); + + /// suppress possible direct conversions + Time(int); + + public: + static const Time MAX ; + static const Time MIN ; + static const Time ZERO; + + static const Time ANYTIME; ///< border condition marker value. #ANYTIME <= any time value + static const Time NEVER; ///< border condition marker value. #NEVER >= any time value + + explicit + Time (TimeValue const& val =TimeValue(0)) + : TimeValue(val) + { } + + Time (TimeVar const& calcResult) + : TimeValue(calcResult) + { } + + explicit + Time (FSecs const& fractionalSeconds); + + Time ( long millis + , uint secs + , uint mins =0 + , uint hours=0 + ); + + /** @internal diagnostics */ + operator std::string () const; + + /** convenience start for time calculations */ + TimeVar operator+ (TimeValue const& tval) const { return TimeVar(*this) + tval; } + TimeVar operator- (TimeValue const& tval) const { return TimeVar(*this) - tval; } + TimeVar operator- () const { return -TimeVar(*this); } + }; + + + + /** * Offset measures a distance in time. * It may be used to relate two points in time, @@ -215,7 +304,7 @@ namespace time { : TimeValue(TimeVar(target) -= origin) { } - Offset (int64_t count, FrameRate const& fps); + Offset (FrameCnt count, FrameRate const& fps); static const Offset ZERO; @@ -277,77 +366,6 @@ namespace time { - /* ======= specific Time entities ==================== */ - - /** rational representation of fractional seconds - * @warning do not mix up gavl_time_t and FSecs */ - typedef boost::rational FSecs; - - - /** - * Lumiera's internal time value datatype. - * This is a TimeValue, but now more specifically denoting - * a point in time, measured in reference to an internal - * (opaque) time scale. - * - * Lumiera Time provides some limited capabilities for - * direct manipulation; Time values can be created directly - * from \c (ms,sec,min,hour) specification and there is an - * string representation intended for internal use (reporting - * and debugging). Any real output, formatting and persistent - * storage should be based on the (quantised) timecode - * formats though, which can be generated from time values. - * - * Similar to TimeValue, also Time objects are considered - * immutable values. As convenience shortcut, some operators - * are provided, creating a TimVar for further calculations. - */ - class Time - : public TimeValue - { - /// direct assignment prohibited - Time& operator= (Time const); - - /// suppress possible direct conversions - Time(int); - - public: - static const Time MAX ; - static const Time MIN ; - static const Time ZERO; - - static const Time ANYTIME; ///< border condition marker value. #ANYTIME <= any time value - static const Time NEVER; ///< border condition marker value. #NEVER >= any time value - - explicit - Time (TimeValue const& val =TimeValue(0)) - : TimeValue(val) - { } - - Time (TimeVar const& calcResult) - : TimeValue(calcResult) - { } - - explicit - Time (FSecs const& fractionalSeconds); - - Time ( long millis - , uint secs - , uint mins =0 - , uint hours=0 - ); - - /** @internal diagnostics */ - operator std::string () const; - - /** convenience start for time calculations */ - TimeVar operator+ (TimeValue const& tval) const { return TimeVar(*this) + tval; } - TimeVar operator- (TimeValue const& tval) const { return TimeVar(*this) - tval; } - TimeVar operator- () const { return -TimeVar(*this); } - }; - - - /** * Duration is the internal Lumiera time metric. @@ -378,7 +396,7 @@ namespace time { { } Duration (TimeSpan const& interval); - Duration (int64_t count, FrameRate const& fps); + Duration (FrameCnt count, FrameRate const& fps); static const Duration NIL; diff --git a/src/proc/engine/calc-plan-continuation.cpp b/src/proc/engine/calc-plan-continuation.cpp index 49c5c5971..549feaa56 100644 --- a/src/proc/engine/calc-plan-continuation.cpp +++ b/src/proc/engine/calc-plan-continuation.cpp @@ -73,7 +73,7 @@ namespace engine { Job - CalcPlanContinuation::prepareRenderPlanningFrom (int64_t startFrame) + CalcPlanContinuation::prepareRenderPlanningFrom (FrameCnt startFrame) { InvocationInstanceID invoKey; invoKey.frameNumber = startFrame; @@ -84,7 +84,7 @@ namespace engine { void - CalcPlanContinuation::performJobPlanningChunk(int64_t nextStartFrame) + CalcPlanContinuation::performJobPlanningChunk(FrameCnt nextStartFrame) { TimeAnchor refPoint(timings_, nextStartFrame); JobPlanningSequence jobs = dispatcher_.onCalcStream(modelPort_, channel_) diff --git a/src/proc/engine/calc-plan-continuation.hpp b/src/proc/engine/calc-plan-continuation.hpp index fa40a0927..c75fd3adf 100644 --- a/src/proc/engine/calc-plan-continuation.hpp +++ b/src/proc/engine/calc-plan-continuation.hpp @@ -44,6 +44,7 @@ namespace engine { // using lib::time::TimeSpan; // using lib::time::FSecs; // using lib::time::Time; + using lib::time::FrameCnt; /** @@ -107,11 +108,11 @@ namespace engine { * @param startFrame where to begin rendering, relative to the nominal * time grid implicitly related to the ModelPort to be pulled */ - Job prepareRenderPlanningFrom (int64_t startFrame); + Job prepareRenderPlanningFrom (FrameCnt startFrame); private: - void performJobPlanningChunk(int64_t nextStartFrame); + void performJobPlanningChunk(FrameCnt nextStartFrame); Job buildFollowUpJobFrom (TimeAnchor const& refPoint); }; diff --git a/src/proc/engine/dispatcher.hpp b/src/proc/engine/dispatcher.hpp index 36f9989da..902cbfd2e 100644 --- a/src/proc/engine/dispatcher.hpp +++ b/src/proc/engine/dispatcher.hpp @@ -41,6 +41,7 @@ namespace engine { using std::tr1::function; using mobject::ModelPort; + using lib::time::FrameCnt; using lib::time::TimeSpan; using lib::time::FSecs; using lib::time::Time; @@ -100,7 +101,7 @@ namespace engine { virtual FrameCoord locateRelative (FrameCoord, uint frameCountOffset) =0; virtual FrameCoord locateRelative (TimeAnchor, uint frameCountOffset) =0; //////////TODO is this really an interface operation, or just a convenience shortcut? - virtual bool isEndOfChunk (int64_t, ModelPort port) =0; + virtual bool isEndOfChunk (FrameCnt, ModelPort port) =0; ////////TODO: API-1 = just get next frame, without limitations .... CHECK ////////TODO: API-2 = query limitation of planning chunk .... CHECK diff --git a/src/proc/engine/frame-coord.hpp b/src/proc/engine/frame-coord.hpp index a1e95e679..8aabee8a4 100644 --- a/src/proc/engine/frame-coord.hpp +++ b/src/proc/engine/frame-coord.hpp @@ -36,6 +36,7 @@ namespace proc { namespace engine { using mobject::ModelPort; + using lib::time::FrameCnt; using lib::time::TimeVar; using lib::time::Time; @@ -59,8 +60,8 @@ namespace engine { struct FrameCoord { - TimeVar absoluteNominalTime; - int64_t absoluteFrameNumber; + TimeVar absoluteNominalTime; + FrameCnt absoluteFrameNumber; TimeVar absoluteRealDeadline; @@ -71,7 +72,7 @@ namespace engine { /** build an \em undefined frame location */ FrameCoord() : absoluteNominalTime(Time::NEVER) - , absoluteFrameNumber(std::numeric_limits::max()) + , absoluteFrameNumber(std::numeric_limits::max()) , modelPort() // unconnected , channelNr(0) { } diff --git a/src/proc/engine/job-planning.hpp b/src/proc/engine/job-planning.hpp index 2ab2053cd..ebf815ca2 100644 --- a/src/proc/engine/job-planning.hpp +++ b/src/proc/engine/job-planning.hpp @@ -308,7 +308,7 @@ namespace engine { protected: virtual JobTicket& accessJobTicket (ModelPort, TimeValue nominalTime) =0; - virtual bool isEndOfChunk (int64_t, ModelPort port) =0; + virtual bool isEndOfChunk (FrameCnt, ModelPort port) =0; }; diff --git a/src/proc/engine/time-anchor.hpp b/src/proc/engine/time-anchor.hpp index 8474bbb5e..994bec648 100644 --- a/src/proc/engine/time-anchor.hpp +++ b/src/proc/engine/time-anchor.hpp @@ -38,6 +38,7 @@ namespace engine { using backend::RealClock; using lib::time::Offset; using lib::time::Duration; + using lib::time::FrameCnt; using lib::time::TimeVar; using lib::time::Time; @@ -84,11 +85,11 @@ namespace engine { class TimeAnchor { play::Timings timings_; - int64_t anchorPoint_; + FrameCnt anchorPoint_; Time relatedRealTime_; static Time - expectedTimeofArival (play::Timings const& timings, int64_t startFrame, Offset startDelay) + expectedTimeofArival (play::Timings const& timings, FrameCnt startFrame, Offset startDelay) { Duration totalLatency = startDelay + timings.currentEngineLatency() @@ -110,7 +111,7 @@ namespace engine { public: - TimeAnchor (play::Timings timings, int64_t startFrame, Offset startDelay =Offset::ZERO) + TimeAnchor (play::Timings timings, FrameCnt startFrame, Offset startDelay =Offset::ZERO) : timings_(timings) , anchorPoint_(startFrame) , relatedRealTime_(expectedTimeofArival(timings,startFrame,startDelay)) @@ -131,7 +132,7 @@ namespace engine { * the previous planning chunk, resulting in a seamless * coverage of the timeline */ - int64_t + FrameCnt getNextAnchorPoint() const { return timings_.establishNextPlanningChunkStart (this->anchorPoint_); @@ -150,7 +151,7 @@ namespace engine { /** @return the frame at which any job planning * for this planning chunk will start */ - int64_t getStartFrame() const + FrameCnt getStartFrame() const { return anchorPoint_; } @@ -160,7 +161,7 @@ namespace engine { remainingRealTimeFor (FrameCoord plannedFrame) //////////////////////////////////////////////////TODO break this into two sensible operations, using the deadline from the FrameCoord { - int64_t frameOffset = plannedFrame.absoluteFrameNumber - anchorPoint_; + FrameCnt frameOffset = plannedFrame.absoluteFrameNumber - anchorPoint_; return Offset(this->relatedRealTime_ + timings_.getRealOffset(frameOffset) - RealClock::now()); diff --git a/src/proc/play/output-slot.hpp b/src/proc/play/output-slot.hpp index 98a514f1d..cc93f08ef 100644 --- a/src/proc/play/output-slot.hpp +++ b/src/proc/play/output-slot.hpp @@ -82,6 +82,7 @@ namespace play { using proc::engine::BuffHandle; using proc::engine::BufferProvider; + using lib::time::FrameCnt; using lib::time::TimeValue; using lib::time::Time; @@ -91,7 +92,7 @@ namespace play { class DataSink; - typedef int64_t FrameID; + typedef FrameCnt FrameID; diff --git a/src/proc/play/timings.cpp b/src/proc/play/timings.cpp index 0947dd243..8293ee020 100644 --- a/src/proc/play/timings.cpp +++ b/src/proc/play/timings.cpp @@ -35,6 +35,7 @@ namespace play { using lib::time::PQuant; using lib::time::Time; using lib::time::TimeVar; + using lib::time::FrameCnt; namespace { // hidden local details of the service implementation.... @@ -85,7 +86,7 @@ namespace play { Time - Timings::getFrameStartAt (int64_t frameNr) const + Timings::getFrameStartAt (FrameCnt frameNr) const { return Time(grid_->timeOf(frameNr)); } @@ -101,13 +102,13 @@ namespace play { Duration Timings::getFrameDurationAt (TimeValue refPoint) const { - int64_t frameNr = grid_->gridPoint (refPoint); + FrameCnt frameNr = grid_->gridPoint (refPoint); return getFrameDurationAt(frameNr); } Duration - Timings::getFrameDurationAt (int64_t refFrameNr) const + Timings::getFrameDurationAt (FrameCnt refFrameNr) const { return Offset (grid_->timeOf(refFrameNr), grid_->timeOf(refFrameNr + 1)); } @@ -128,7 +129,7 @@ namespace play { Time - Timings::getTimeDue(int64_t frameOffset) const + Timings::getTimeDue(FrameCnt frameOffset) const { if (TIMEBOUND == playbackUrgency) { @@ -142,7 +143,7 @@ namespace play { Offset - Timings::getRealOffset (int64_t frameOffset) const + Timings::getRealOffset (FrameCnt frameOffset) const { Offset nominalOffset (grid_->timeOf(0), grid_->timeOf(frameOffset)); return isOriginalSpeed()? nominalOffset @@ -158,12 +159,12 @@ namespace play { } - int64_t - Timings::establishNextPlanningChunkStart(int64_t currentAnchorFrame) const + FrameCnt + Timings::establishNextPlanningChunkStart(FrameCnt currentAnchorFrame) const { TimeVar breakingPoint = grid_->timeOf(currentAnchorFrame); breakingPoint += getPlanningChunkDuration(); - int64_t nextFrame = grid_->gridPoint (breakingPoint); + FrameCnt nextFrame = grid_->gridPoint (breakingPoint); ASSERT (breakingPoint <= grid_->timeOf(nextFrame)); ASSERT (breakingPoint > grid_->timeOf(nextFrame-1)); diff --git a/src/proc/play/timings.hpp b/src/proc/play/timings.hpp index 0a406e53b..efd6e1c2a 100644 --- a/src/proc/play/timings.hpp +++ b/src/proc/play/timings.hpp @@ -66,6 +66,7 @@ namespace time{ namespace proc { namespace play { + using lib::time::FrameCnt; using lib::time::FrameRate; using lib::time::TimeValue; using lib::time::Duration; @@ -100,7 +101,7 @@ namespace play { public: PlaybackUrgency playbackUrgency; - boost::rational playbackSpeed; /////////////TICKET #902 we need a more generic representation for variable speed playback + boost::rational playbackSpeed; /////////////TICKET #902 we need a more generic representation for variable speed playback Time scheduledDelivery; Duration outputLatency; @@ -115,10 +116,10 @@ namespace play { Time getOrigin() const; - Time getFrameStartAt (int64_t frameNr) const; + Time getFrameStartAt (FrameCnt frameNr) const; Offset getFrameOffsetAt (TimeValue refPoint) const; Duration getFrameDurationAt (TimeValue refPoint) const; - Duration getFrameDurationAt (int64_t refFrameNr) const; + Duration getFrameDurationAt (FrameCnt refFrameNr) const; /** the frame spacing and duration remains constant for some time... * @param startPoint looking from that time point into future @@ -136,7 +137,7 @@ namespace play { * a relative offset, but expressed in real time scale values * @see proc::engine::TimeAnchor for an absolutely anchored conversion */ - Offset getRealOffset (int64_t frameOffset) const; + Offset getRealOffset (FrameCnt frameOffset) const; /** real time deadline for the given frame, without any latency. * This value is provided in case of scheduled time of delivery, @@ -149,7 +150,7 @@ namespace play { * @warning not clear as of 1/13 if it is even possible to have such a function * on the Timings record. */ - Time getTimeDue(int64_t frameOffset) const; + Time getTimeDue(FrameCnt frameOffset) const; /** the minimum time span to be covered by frame calculation jobs * planned in one sway. The ongoing planning of additional jobs @@ -168,7 +169,7 @@ namespace play { * the planning chunk duration into the future * @remarks this value is used by the frame dispatcher to create a * follow-up planning job */ - int64_t establishNextPlanningChunkStart(int64_t currentAnchorFrame) const; + FrameCnt establishNextPlanningChunkStart(FrameCnt currentAnchorFrame) const; /** reasonable guess of the current engine working delay. * Frame calculation deadlines will be readjusted by that value, diff --git a/tests/core/backend/engine/dummy-job.cpp b/tests/core/backend/engine/dummy-job.cpp index 2eadbd876..bb2997a28 100644 --- a/tests/core/backend/engine/dummy-job.cpp +++ b/tests/core/backend/engine/dummy-job.cpp @@ -85,7 +85,7 @@ namespace engine { return Time::NEVER < nominalJobTime && 0 <= invoKey.metaInfo.a && invoKey.metaInfo.a < MAX_PARAM_A - && -MAX_PARAM_B < invoKey.metaInfo.b + && -MAX_PARAM_B <= invoKey.metaInfo.b && invoKey.metaInfo.b < MAX_PARAM_B; } diff --git a/tests/core/proc/engine/dispatcher-interface-test.cpp b/tests/core/proc/engine/dispatcher-interface-test.cpp index 24507d41c..c78551cea 100644 --- a/tests/core/proc/engine/dispatcher-interface-test.cpp +++ b/tests/core/proc/engine/dispatcher-interface-test.cpp @@ -96,7 +96,7 @@ namespace test { } bool - isEndOfChunk (int64_t, ModelPort port) + isEndOfChunk (FrameCnt, ModelPort port) { UNIMPLEMENTED ("determine when to finish a planning chunk"); } diff --git a/tests/core/proc/play/output-slot-protocol-test.cpp b/tests/core/proc/play/output-slot-protocol-test.cpp index ca921f448..739a920d4 100644 --- a/tests/core/proc/play/output-slot-protocol-test.cpp +++ b/tests/core/proc/play/output-slot-protocol-test.cpp @@ -78,7 +78,7 @@ namespace test { // within the frame-calculation "loop" // we perform a data exchange cycle - int64_t frameNr = 123; + FrameCnt frameNr = 123; BuffHandle buff00 = sink1.lockBufferFor (frameNr); BuffHandle buff10 = sink2.lockBufferFor (frameNr); diff --git a/tests/library/time/time-control-test.cpp b/tests/library/time/time-control-test.cpp index 182cb8018..6d07b8cf9 100644 --- a/tests/library/time/time-control-test.cpp +++ b/tests/library/time/time-control-test.cpp @@ -354,14 +354,14 @@ namespace test{ template void - ____verify_nudged (TAR const& target, TAR const& refState, int64_t offsetSteps) + ____verify_nudged (TAR const& target, TAR const& refState, FrameCnt offsetSteps) { CHECK (target != refState || !offsetSteps); CHECK (target == Time(refState)+Time(FSecs(offsetSteps))); } template<> void - ____verify_nudged (QuTime const& target, QuTime const& refState, int64_t offsetSteps) + ____verify_nudged (QuTime const& target, QuTime const& refState, FrameCnt offsetSteps) { CHECK (target != refState || !offsetSteps); CHECK (target == Time (materialise(refState)) diff --git a/tests/library/time/time-formats-test.cpp b/tests/library/time/time-formats-test.cpp index 1b9d23116..a4498cfee 100644 --- a/tests/library/time/time-formats-test.cpp +++ b/tests/library/time/time-formats-test.cpp @@ -52,12 +52,12 @@ namespace test{ using format::Smpte; namespace{ - const int64_t MAX_FRAME = 265*24*60*60*25; + const FrameCnt MAX_FRAME = 265*24*60*60*25; string generateRandomFrameNr() { - int64_t frameNr(0); /////////TICKET #882 : better use a typedef for frame counts + FrameCnt frameNr(0); while (!frameNr) frameNr = rand() % (2*MAX_FRAME) - MAX_FRAME; diff --git a/tests/library/time/time-value-test.cpp b/tests/library/time/time-value-test.cpp index 552202fd9..057eb79ec 100644 --- a/tests/library/time/time-value-test.cpp +++ b/tests/library/time/time-value-test.cpp @@ -290,7 +290,7 @@ namespace test{ void verify_fractionalOffset () { - typedef boost::rational Frac; + typedef boost::rational Frac; Duration three (TimeValue(3)); // three micro seconds