diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-18 00:24:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-18 00:24:21 +0100 |
| commit | 6af628a0404e7135cb77cfa6d49a8419c883f2bf (patch) | |
| tree | d41d28980a36ee31bfaf18ebc7c20d230f70d994 | |
| parent | 7e8eb7e247c69918c5f35864a392cffa81924287 (diff) | |
Require instrinsic duration of ReelMarkersAsset to be specified on construction.
We need the intrinsic duration to match other assets in the reel,
so we can't just calculate it from the markers.
| -rw-r--r-- | src/reel_markers_asset.cc | 17 | ||||
| -rw-r--r-- | src/reel_markers_asset.h | 4 |
2 files changed, 3 insertions, 18 deletions
diff --git a/src/reel_markers_asset.cc b/src/reel_markers_asset.cc index c0ad6b57..ba0021cf 100644 --- a/src/reel_markers_asset.cc +++ b/src/reel_markers_asset.cc @@ -44,8 +44,8 @@ using boost::optional; using std::shared_ptr; using namespace dcp; -ReelMarkersAsset::ReelMarkersAsset (Fraction edit_rate, int64_t entry_point) - : ReelAsset (make_uuid(), edit_rate, 0, entry_point) +ReelMarkersAsset::ReelMarkersAsset (Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) + : ReelAsset (make_uuid(), edit_rate, intrinsic_duration, entry_point) { } @@ -70,14 +70,12 @@ void ReelMarkersAsset::set (Marker m, Time t) { _markers[m] = t; - update_duration (); } void ReelMarkersAsset::unset (Marker m) { _markers.erase (m); - update_duration (); } optional<Time> @@ -90,17 +88,6 @@ ReelMarkersAsset::get (Marker m) const return i->second; } -void -ReelMarkersAsset::update_duration () -{ - int const tcr = edit_rate().numerator / edit_rate().denominator; - _intrinsic_duration = 0; - for (map<Marker, Time>::const_iterator i = _markers.begin(); i != _markers.end(); ++i) { - _intrinsic_duration = max(_intrinsic_duration, i->second.as_editable_units(tcr)); - } - _duration = _intrinsic_duration; -} - xmlpp::Node* ReelMarkersAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const { diff --git a/src/reel_markers_asset.h b/src/reel_markers_asset.h index 0066a27d..46542614 100644 --- a/src/reel_markers_asset.h +++ b/src/reel_markers_asset.h @@ -40,7 +40,7 @@ namespace dcp { class ReelMarkersAsset : public ReelAsset { public: - ReelMarkersAsset (Fraction edit_rate, int64_t entry_point); + ReelMarkersAsset (Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); explicit ReelMarkersAsset (std::shared_ptr<const cxml::Node>); xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const; @@ -57,8 +57,6 @@ protected: std::string cpl_node_name (Standard) const; private: - void update_duration (); - std::map<Marker, Time> _markers; }; |
