From e9ee53e42d7f8bbcd2a454ee9de5f3e66ec06b03 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 16 Jan 2013 23:36:16 +0000 Subject: Add some tests and hopefully clarify the DCPFrameRate class. --- src/lib/util.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/lib/util.h') 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 { -- cgit v1.2.3