summaryrefslogtreecommitdiff
path: root/src/lib/content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-07-14 14:23:50 +0100
committerCarl Hetherington <cth@carlh.net>2015-07-14 14:23:50 +0100
commit23b69b228ed5b34b59e1789de4bff052bc905ae4 (patch)
treef2c4f3bdfd80d1fe3d3b3dc7800e2d2589693680 /src/lib/content.cc
parentf509c806965f4a381eec454e7f55a70fd676f302 (diff)
Express trims using ContentTime so that they do not change
when DCP frame rate is changed (#637).
Diffstat (limited to 'src/lib/content.cc')
-rw-r--r--src/lib/content.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 2b4f02b90..65c005157 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -88,9 +88,9 @@ Content::Content (shared_ptr<const Film> film, cxml::ConstNodePtr node)
_paths.push_back ((*i)->content ());
}
_digest = node->optional_string_child ("Digest").get_value_or ("X");
- _position = DCPTime (node->number_child<double> ("Position"));
- _trim_start = DCPTime (node->number_child<double> ("TrimStart"));
- _trim_end = DCPTime (node->number_child<double> ("TrimEnd"));
+ _position = DCPTime (node->number_child<DCPTime::Type> ("Position"));
+ _trim_start = ContentTime (node->number_child<ContentTime::Type> ("TrimStart"));
+ _trim_end = ContentTime (node->number_child<ContentTime::Type> ("TrimEnd"));
}
Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
@@ -101,11 +101,11 @@ Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
, _change_signals_frequent (false)
{
for (size_t i = 0; i < c.size(); ++i) {
- if (i > 0 && c[i]->trim_start() > DCPTime()) {
+ if (i > 0 && c[i]->trim_start() > ContentTime ()) {
throw JoinError (_("Only the first piece of content to be joined can have a start trim."));
}
- if (i < (c.size() - 1) && c[i]->trim_end () > DCPTime()) {
+ if (i < (c.size() - 1) && c[i]->trim_end () > ContentTime ()) {
throw JoinError (_("Only the last piece of content to be joined can have an end trim."));
}
@@ -172,7 +172,7 @@ Content::set_position (DCPTime p)
}
void
-Content::set_trim_start (DCPTime t)
+Content::set_trim_start (ContentTime t)
{
{
boost::mutex::scoped_lock lm (_mutex);
@@ -183,7 +183,7 @@ Content::set_trim_start (DCPTime t)
}
void
-Content::set_trim_end (DCPTime t)
+Content::set_trim_end (ContentTime t)
{
{
boost::mutex::scoped_lock lm (_mutex);
@@ -221,7 +221,9 @@ Content::technical_summary () const
DCPTime
Content::length_after_trim () const
{
- return max (DCPTime (), full_length() - trim_start() - trim_end());
+ shared_ptr<const Film> film = _film.lock ();
+ DCPOMATIC_ASSERT (film);
+ return max (DCPTime (), full_length() - DCPTime (trim_start() - trim_end(), film->active_frame_rate_change (position ())));
}
/** @return string which includes everything about how this content affects