diff options
Diffstat (limited to 'src/lib/playlist.cc')
| -rw-r--r-- | src/lib/playlist.cc | 17 |
1 files changed, 17 insertions, 0 deletions
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<DCPTime> +Playlist::start () const +{ + if (_content.empty ()) { + return optional<DCPTime> (); + } + + DCPTime start = DCPTime::max (); + BOOST_FOREACH (shared_ptr<Content> i, _content) { + start = min (start, i->position ()); + } + + return start; +} + void Playlist::reconnect () { |
