Commit graph

59 commits

Author SHA1 Message Date
90aba4df09 Timeline: demonstrate safeguards against reversed and toxic input 2022-11-18 02:55:28 +01:00
f1b3f4e666 Timeline: reconsider time handling and Stage/Steam integration
This ZoomWindow_test highlights again the question about the intended usage
of the Lumiera time entities. In which way do we want to perform time calculations,
and under which circumstances is it adequate to perform arithmetic on
raw time values?

These questions made me think about rather far reaching concerns regarding
subsidiarity and implicit or explicit usage context. Basically I could
reconfirm the design choices taken some years ago -- while I must admit
that the project is headed towards a way larger scale and more loose
coupling of the parts, than I could imagine several years ago, at the
time when the design started...

As a side note: we can not avoid that some knowledge about the time implementation
leaks out from the support lib; time codes themselves are tightly coupled
to the usage scenario within the session and can not be used as means
for implementing UI concerns. And the more generic time frameworks,
like std::chrono (as much as it is desirable to have some integration here)
will not be of any help for most of our specific usage patterns.
The reason is, for film editing we do not have a global time scale,
rather the truth is when the film starts....
2022-10-30 23:12:34 +01:00
7145d0d9ce Timeline: ZoomWindow implementation draft
implement the first test case: nudge the zoom factor
⟹ scale factor doubled
⟹ visible window reduced to half size
⟹ visible window placed in the middle of the overall range
2022-10-30 01:31:25 +02:00
fd31f47498 ElementBox: integrate as base for Clip widget (see #1038)
According to plan, this was more or less a drop-in replacement.
However, this first integration prototype highlights some design problems

 * `ElementBoxWidget` is designed ''constructor-centric''
 * but the population by diff messages will supply crucial information later
 * and seemingly the size-constraint code is now invoked prior to widget realisation \\
   ⟹ Assertion Failure
2022-10-17 04:19:26 +02:00
38837da65e Timehandling: choose safer representation for fractional seconds (closes #939)
When drafting the time handling framework some years ago,
I foresaw the possible danger of mixing up numbers relating
to fractional seconds, with other plain numbers intended as
frame counts or as micro ticks. Thus I deliberately picked
an incompatible integer type for FSecs = boost::rational<long>

However, using long is problematic in itself, since its actual
bit length is not fixed, and especially on 32bit platforms long
is quite surprisingly defined to be the same as int.

However, meanwhile, using the new C++ features, I have blocked
pretty much any possible implicit conversion path, requiring
explicit conversions in the relevant ctor invocations. So,
after weighting in the alternatives, FSecs is now defined
as boost::rational<int64_t>.
2020-02-17 03:13:36 +01:00
aad71a496a Boost-1.65: fix another integer ambiguity problem with boost::rational
<rant>
the "improved" boost::rational can no longer compute 1/x
quite brilliant
</rant>

well... the reason is again signed vs unsigned int.
FrameRate is based on unsigned int (since a negative frame rate makes no sense).
2019-06-22 21:43:33 +02:00
dc301231cf Boost-1.65: resolve ambiguity in timevalue comparison
seemingly, the newer boost libraries added an internal type rational<I>::bool_type
together with an overload for the equality comparison operator.

Unfortunately this now renders a comparison ambiguous with the constant zero (i.e. int{0})
because in our use case we employ rational<uint>.

Workaround is to compare explicitly to a zero of the underlying integer type.
2019-06-22 19:15:19 +02:00
48a829d544 Library: clarify usage of the basic time scale
effectively we rely in the micro tick timescale promoted by libGAVL,
but it seems indicated to introduce our own constant definition.
And also clarify some comments and tests.

(this changeset does not change any values or functionality)
2018-12-10 00:12:52 +01:00
f99637285a GCC-7: fix segfault in static init
seemingly this code was brittle: GCC-7 treats int64_t as long,
which leads to preferring the template specialisation over the
explicit version of the operator* -- which means the template
instantiation invokes itself.
2018-04-28 03:02:02 +02:00
89d93a13e4 Modernise Unknown Exception handler and Exception messages 2018-04-02 01:48:51 +02:00
104b71e8aa Timehandling: allow default initialisation for Offset values
From a purely logical viewpoint, it looked sensible to require an actual
value for an offset, especially since our time values are immutable.
But this has the unfortunate consequence that we'd be unable to use
an offset value as parameter for any command, since we store the arguments
as tuple and the tuple type has a default constructor. We might be able
to get around that problem, but such looks brittle to me; it is just
plain surprising for anyone not familiar with the internals of the
command system.

For that reason, I've now added a default ctor to the Offset type
2017-01-11 04:09:32 +01:00
1a4b6545a0 maximum munch
...feels like X-mas
2016-12-23 04:23:03 +01:00
35fbd9fa1e immutable-arguments(#989): add a first-class unit test (closes #989)
the functionality as such is already covered,
but it seems important enough to warrant a dedicated test.


incidentally, Duration still lacked a default ctor.
Time values are default constructible, yet immutable.
2016-02-07 02:59:03 +01:00
9847888a00 make TimeSpan default constructible
...probably just an omission. TimeValue and Time are
also default constructible, and this makes sense, semantically.

Please note that Time values are *immutable* though.
Only TimeVar can be reassigned. This is so by design
2016-02-06 19:23:16 +01:00
1dddbdaacc improve the diagnositc representation for time values
- especially mark Offsets and Durations
- fix possible number-overflow (time values are 64 bit!)
2016-01-08 00:13:59 +01:00
7b7d12d99e add internal / diagnostic display for low-level time values and time spans
Initially I've deliberately omitted those, to nudge towards
using time quantisation and TCode formatting for any external
representation of time values.

While this recommendation is still valid, the overloaded
string conversion turns out to be helpful for unit testing
and diagnostics in compound data structures.
See Record<GenNode>
2015-09-25 03:12:04 +02:00
a640283e4c introduce typedef for Frame numbers (see #882) 2013-11-18 00:01:43 +01:00
bcbd05d7eb reorganise some boost::format usage
using our util::_Fmt front-end helps to reduce the code size,
since all usages rely on a single inclusion of boost::format

including boost::format via header can cause quite some code bloat


NOTE: partial solution, still some further includes to reorganise
2013-09-01 17:36:05 +02:00
2488478a12 file-level comment for time values
a recent discussion showed that it is rather likely
for a reader new to the whole time handling framework
to encounter this header first....
2013-08-13 01:27:37 +02:00
84281d5b60 WIP: CalcStream initialisation
especially: where to establish the effective Timings.

also fixed several compilation errors
2013-06-15 04:02:48 +02:00
5222384f8b try to circumvent ambiguity in overload resolution
we want to support various integral and rational factors
for linear chaining of time offsets
2012-10-10 05:20:13 +02:00
080d6913c6 fix a type converison problem
...better state explicitly we're requiring
a rational factor
2012-10-10 05:20:12 +02:00
9aec2a9806 allow for fractional scaling of time durations
implemented as extension to the linear combinations.
I decided to use the same "always floor" rule
as employed for time quantisation. Moreover,
we don't support floating point, only rationals
2012-10-10 05:20:12 +02:00
e7ae9a3082 introduce marker time values to designate corner cases 2011-12-09 01:00:50 +01:00
15a3694cca more complete unit test pass 2011-09-25 19:25:54 +02:00
9bd96a1b19 time-entities refactoring: Duration isn't an Offset
removed that inheritance relation; it was a typical
example of abusing inheritance and violated the
Liscov substitution principle. It is sufficient
to allow promotion of an offset into a Duration.
Note: Duration is the time metric
2011-09-25 19:25:53 +02:00
eed2b0f320 time::Control simple unit test pass 2011-09-25 19:25:52 +02:00
ef126283eb add symbolic constant for "neutral" time.
Note: it's rather arbitrary choosen,
because any time grid can define its own origin.
You must not assume that the origin of any time axis
is located at Time::ZERO !!
2011-05-16 04:37:03 +02:00
481875a78a add check for time point contained in TimeSpan 2011-05-16 04:02:26 +02:00
2035405251 add time Mutation to adjust by offset 2011-05-15 04:19:26 +02:00
5851332628 back to business: now able to implement time mutation messages 2011-05-15 04:19:25 +02:00
eb733df1bb proof-of-concept: implement simple mutation 2011-05-15 04:19:24 +02:00
4d6bb3d54c design outline for a limited time::Mutation capability 2011-05-15 04:19:24 +02:00
9364d717b0 implement total order on time intervals 2011-05-15 04:19:24 +02:00
9eb4f66372 draft more convenience handling for TimeSpan 2011-05-15 04:19:24 +02:00
eafbd4b1cb fix a comment 2011-05-15 04:19:22 +02:00
b843546922 cumulated build/release fixes
up to corresponding debian/0.pre.01-3
- compile issue (digxel.hpp)
- SCons missing config dependency on test-only
- 32/64bit fixes
2011-03-31 18:43:50 +02:00
faf579c4c5 enforce generally imutable time values 2011-01-22 23:20:12 +01:00
14f233f83b WIP: some more test coverage ... unveiling yet more bugs 2011-01-22 02:35:58 +01:00
bdc1800470 add support for offset linear combinations 2011-01-15 01:45:55 +01:00
debe032f49 basic quantisation now working and covered by unit test 2011-01-13 03:36:12 +01:00
e2cab1f512 some more smoothing of rough edges 2011-01-13 03:36:12 +01:00
edc2598f27 cover additional time handling convenience shortcuts 2011-01-13 03:36:12 +01:00
af9c799fc8 Fix time quantisation to circumvent the precision problem
required to re-arrange several functions in order
to use the new util::floordiv and to get all relevant
calculations into time.h
2011-01-13 03:36:12 +01:00
52eb4c4709 set an explicit artificial limit on the allowed time range
this is the first building block in an attempt to
protrect against time wraparound. The intention is
not to be airtight, but practically effective.

A really airtight solution would require writing
our own SafeInt class
2011-01-13 03:36:11 +01:00
3cf9974211 provide unary minus to flip a TimeVar around origin 2011-01-13 03:36:11 +01:00
48b3f39c49 improve and cover Time convenience handling shortcuts 2011-01-13 03:36:11 +01:00
b66b778c42 implement and test simple demo quantiser 2011-01-13 03:36:11 +01:00
159d3928d8 Timecode stub implementation...
now passes Compiler and Linker again
2011-01-13 03:36:10 +01:00
c40ba74bc6 WIP clarify ambiguity with fractional seconds
They are *not* intended to stand-in for gavl_time_t
Indeed, Time values should be handled as opaque
2011-01-13 03:36:09 +01:00