summaryrefslogtreecommitdiff
path: root/src/reel.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-12-16 21:39:01 +0000
committerCarl Hetherington <cth@carlh.net>2015-12-16 21:39:01 +0000
commite330669de0f5d7d9d922dc69945cca74ac9800d9 (patch)
treec70a8486ef31d69187b3e18bb4c65917e60bc3fc /src/reel.cc
parent05c5ef180e7a54e0b6790b2bd8c334e48f1f069a (diff)
Add duration() methods to CPL and Reel.
Diffstat (limited to 'src/reel.cc')
-rw-r--r--src/reel.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/reel.cc b/src/reel.cc
index ddab12d3..3ab9993f 100644
--- a/src/reel.cc
+++ b/src/reel.cc
@@ -36,6 +36,7 @@
using std::string;
using std::list;
using std::cout;
+using std::max;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using namespace dcp;
@@ -185,3 +186,21 @@ Reel::resolve_refs (list<shared_ptr<Asset> > assets)
}
}
}
+
+int64_t
+Reel::duration () const
+{
+ int64_t d = 0;
+
+ if (_main_picture) {
+ d = max (d, _main_picture->duration ());
+ }
+ if (_main_sound) {
+ d = max (d, _main_sound->duration ());
+ }
+ if (_main_subtitle) {
+ d = max (d, _main_subtitle->duration ());
+ }
+
+ return d;
+}