summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-05 15:58:50 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-05 15:58:50 +0000
commitf75cc4ebbffea7a7953af20e8a2ea124767bf949 (patch)
treeb483ddcf71280b73bdc11bc4865748e76b3857ff /src/lib
parent994ef64ef0cecd69898ab81432e5c5efef7ef97b (diff)
Various fixes to make tests pass again.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/playlist.cc8
-rw-r--r--src/lib/util.cc15
2 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc
index 621b99dd7..c54b24c1c 100644
--- a/src/lib/playlist.cc
+++ b/src/lib/playlist.cc
@@ -82,14 +82,14 @@ Playlist::maybe_sequence_video ()
_sequencing_video = true;
ContentList cl = _content;
- Time last = 0;
+ Time next = 0;
for (ContentList::iterator i = _content.begin(); i != _content.end(); ++i) {
if (!dynamic_pointer_cast<VideoContent> (*i)) {
continue;
}
- (*i)->set_position (last);
- last = (*i)->end ();
+ (*i)->set_position (next);
+ next = (*i)->end() + 1;
}
/* This won't change order, so it does not need a sort */
@@ -260,7 +260,7 @@ Playlist::length () const
{
Time len = 0;
for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) {
- len = max (len, (*i)->end ());
+ len = max (len, (*i)->end() + 1);
}
return len;
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 15efcc099..96b834fcc 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -763,12 +763,17 @@ FrameRateConversion::FrameRateConversion (float source, int dcp)
, repeat (1)
, change_speed (false)
{
- if (source > (dcp * 2)) {
+ if (fabs (source / 2.0 - dcp) < fabs (source - dcp)) {
+ /* The difference between source and DCP frame rate will be lower
+ (i.e. better) if we skip.
+ */
skip = true;
- }
-
- if (source < dcp) {
- repeat = floor (dcp / source);
+ } else if (fabs (source * 2 - dcp) < fabs (source - dcp)) {
+ /* The difference between source and DCP frame rate would be better
+ if we repeated each frame once; it may be better still if we
+ repeated more than once. Work out the required repeat.
+ */
+ repeat = round (dcp / source);
}
change_speed = !about_equal (source * factor(), dcp);