diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-06-01 22:45:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-06-01 22:45:58 +0100 |
| commit | 6a18a737ef8dfbfbe909afe8266f104a2125b5fb (patch) | |
| tree | c244025af0ae2a8866f5a15941ea4055954bd3ae /src/lib/content.cc | |
| parent | 7a0c2256cbf94d2434ba6e7485517df0a7f894af (diff) | |
Store video frame rate in XML (#883).
Diffstat (limited to 'src/lib/content.cc')
| -rw-r--r-- | src/lib/content.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 7afbf924f..66b0d477e 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -95,6 +95,7 @@ Content::Content (shared_ptr<const Film> film, cxml::ConstNodePtr node) _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")); + _video_frame_rate = node->optional_number_child<double> ("VideoFrameRate"); } Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c) @@ -102,6 +103,7 @@ Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c) , _position (c.front()->position ()) , _trim_start (c.front()->trim_start ()) , _trim_end (c.back()->trim_end ()) + , _video_frame_rate (c.front()->video_frame_rate()) , _change_signals_frequent (false) { for (size_t i = 0; i < c.size(); ++i) { @@ -113,6 +115,17 @@ Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c) throw JoinError (_("Only the last piece of content to be joined can have an end trim.")); } + if ( + (_video_frame_rate && !c[i]->_video_frame_rate) || + (!_video_frame_rate && c[i]->_video_frame_rate) + ) { + throw JoinError (_("Content to be joined must have the same video frame rate")); + } + + if (_video_frame_rate && fabs (_video_frame_rate.get() - c[i]->_video_frame_rate.get()) > VIDEO_FRAME_RATE_EPSILON) { + throw JoinError (_("Content to be joined must have the same video frame rate")); + } + for (size_t j = 0; j < c[i]->number_of_paths(); ++j) { _paths.push_back (c[i]->path (j)); } @@ -131,6 +144,9 @@ Content::as_xml (xmlpp::Node* node) const node->add_child("Position")->add_child_text (raw_convert<string> (_position.get ())); node->add_child("TrimStart")->add_child_text (raw_convert<string> (_trim_start.get ())); node->add_child("TrimEnd")->add_child_text (raw_convert<string> (_trim_end.get ())); + if (_video_frame_rate) { + node->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate.get())); + } } void |
