diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_content_type.cc | 12 | ||||
| -rw-r--r-- | src/lib/dcp_content_type.h | 1 | ||||
| -rw-r--r-- | src/lib/film.cc | 14 |
3 files changed, 22 insertions, 5 deletions
diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc index aae805308..1c96979e4 100644 --- a/src/lib/dcp_content_type.cc +++ b/src/lib/dcp_content_type.cc @@ -64,6 +64,18 @@ DCPContentType::from_pretty_name (string n) } DCPContentType const * +DCPContentType::from_dci_name (string n) +{ + for (vector<DCPContentType const *>::const_iterator i = _dcp_content_types.begin(); i != _dcp_content_types.end(); ++i) { + if ((*i)->dci_name() == n) { + return *i; + } + } + + return 0; +} + +DCPContentType const * DCPContentType::from_index (int n) { assert (n >= 0 && n < int (_dcp_content_types.size ())); diff --git a/src/lib/dcp_content_type.h b/src/lib/dcp_content_type.h index 2b6e60a19..960bb0129 100644 --- a/src/lib/dcp_content_type.h +++ b/src/lib/dcp_content_type.h @@ -50,6 +50,7 @@ public: } static DCPContentType const * from_pretty_name (std::string); + static DCPContentType const * from_dci_name (std::string); static DCPContentType const * from_index (int); static int as_index (DCPContentType const *); static std::vector<DCPContentType const *> all (); diff --git a/src/lib/film.cc b/src/lib/film.cc index e759b761c..59f79e666 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -72,7 +72,7 @@ using boost::starts_with; using boost::optional; using libdcp::Size; -int const Film::state_version = 2; +int const Film::state_version = 3; /** Construct a Film object in a given directory, reading any metadata * file that exists in that directory. An exception will be thrown if @@ -374,7 +374,7 @@ Film::write_metadata () const f << "content " << _content << "\n"; f << "trust_content_header " << (_trust_content_header ? "1" : "0") << "\n"; if (_dcp_content_type) { - f << "dcp_content_type " << _dcp_content_type->pretty_name () << "\n"; + f << "dcp_content_type " << _dcp_content_type->dci_name () << "\n"; } if (_format) { f << "format " << _format->as_metadata () << "\n"; @@ -478,7 +478,11 @@ Film::read_metadata () } else if (k == "trust_content_header") { _trust_content_header = (v == "1"); } else if (k == "dcp_content_type") { - _dcp_content_type = DCPContentType::from_pretty_name (v); + if (version < 3) { + _dcp_content_type = DCPContentType::from_pretty_name (v); + } else { + _dcp_content_type = DCPContentType::from_dci_name (v); + } } else if (k == "format") { _format = Format::from_metadata (v); } else if (k == "left_crop") { @@ -493,9 +497,9 @@ Film::read_metadata () _filters.push_back (Filter::from_id (v)); } else if (k == "scaler") { _scaler = Scaler::from_id (v); - } else if ( ((!version || version < 2) && k == "trim_start") || k == "trim_start") { + } else if ( ((!version || version < 2) && k == "dcp_trim_start") || k == "trim_start") { _trim_start = atoi (v.c_str ()); - } else if ( ((!version || version < 2) && k == "trim_end") || k == "trim_end") { + } else if ( ((!version || version < 2) && k == "dcp_trim_end") || k == "trim_end") { _trim_end = atoi (v.c_str ()); } else if (k == "dcp_ab") { _dcp_ab = (v == "1"); |
