From d22e839b94af048bdeaba61e427bcd2f07b4a3ee Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 8 Sep 2015 01:10:38 +0100 Subject: Fix analysis of audio when the subject is later in the playlist than some other long piece of content. Small optimisation to AudioBuffers to extend size logarithmically. --- src/lib/playlist.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/lib/playlist.cc') diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index a1b209a11..4aff1015d 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -263,6 +263,7 @@ Playlist::best_dcp_frame_rate () const return best->dcp; } +/** @return length of the playlist from time 0 to the last thing on the playlist */ DCPTime Playlist::length () const { @@ -274,6 +275,22 @@ Playlist::length () const return len; } +/** @return position of the first thing on the playlist, if it's not empty */ +optional +Playlist::start () const +{ + if (_content.empty ()) { + return optional (); + } + + DCPTime start = DCPTime::max (); + BOOST_FOREACH (shared_ptr i, _content) { + start = min (start, i->position ()); + } + + return start; +} + void Playlist::reconnect () { -- cgit v1.2.3