diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-01-16 23:36:16 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-01-16 23:36:16 +0000 |
| commit | e9ee53e42d7f8bbcd2a454ee9de5f3e66ec06b03 (patch) | |
| tree | 10aaec3604bf0a8770fea1ffd322d82714a31c51 /src/lib/util.h | |
| parent | c7292767fe4935da750423461a41224b3e0a8e37 (diff) | |
Add some tests and hopefully clarify the DCPFrameRate class.
Diffstat (limited to 'src/lib/util.h')
| -rw-r--r-- | src/lib/util.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/lib/util.h b/src/lib/util.h index 50e7410d6..1fd2c0150 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -62,6 +62,19 @@ typedef int SourceFrame; struct DCPFrameRate { DCPFrameRate (float); + + /** @return factor by which to multiply a source frame rate + to get the effective rate after any skip or repeat has happened. + */ + float factor () const { + if (skip) { + return 0.5; + } else if (repeat) { + return 2; + } + + return 1; + } /** frames per second for the DCP */ int frames_per_second; @@ -69,16 +82,16 @@ struct DCPFrameRate bool skip; /** true to repeat every frame once */ bool repeat; - /** true if this DCP will run its video faster than the source - * without taking into account `skip' and `repeat'. - * (i.e. run_fast will be true if + /** true if this DCP will run its video faster or slower than the source + * without taking into account `repeat'. + * (e.g. change_speed will be true if * source is 29.97fps, DCP is 30fps * source is 14.50fps, DCP is 30fps * but not if * source is 15.00fps, DCP is 30fps * source is 12.50fps, DCP is 25fps) */ - bool run_fast; + bool change_speed; }; enum ContentType { |
