diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-12-16 21:39:01 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-12-16 21:39:01 +0000 |
| commit | e330669de0f5d7d9d922dc69945cca74ac9800d9 (patch) | |
| tree | c70a8486ef31d69187b3e18bb4c65917e60bc3fc /src/reel.cc | |
| parent | 05c5ef180e7a54e0b6790b2bd8c334e48f1f069a (diff) | |
Add duration() methods to CPL and Reel.
Diffstat (limited to 'src/reel.cc')
| -rw-r--r-- | src/reel.cc | 19 |
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; +} |
