diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-04-21 00:18:34 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-04-21 00:18:34 +0200 |
| commit | f525fad0c38e198f35055e639184fa983a3d5d56 (patch) | |
| tree | 372cec9e0abcf5fc0646921110cfaa3f1c7dad6e /src/lib | |
| parent | 5c64790793651e0647bf4eb2de899750d5b6da9a (diff) | |
Add DCPContent::from_libdcp_kind.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dcp_content_type.cc | 14 | ||||
| -rw-r--r-- | src/lib/dcp_content_type.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc index 9ff903231..4fedd366c 100644 --- a/src/lib/dcp_content_type.cc +++ b/src/lib/dcp_content_type.cc @@ -70,6 +70,20 @@ DCPContentType::from_isdcf_name (string n) } DCPContentType const * +DCPContentType::from_libdcp_kind (dcp::ContentKind kind) +{ + BOOST_FOREACH (DCPContentType const * i, _dcp_content_types) { + if (i->libdcp_kind() == kind) { + return i; + } + } + + DCPOMATIC_ASSERT (false); + return 0; +} + + +DCPContentType const * DCPContentType::from_index (int n) { DCPOMATIC_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 2685e6edf..eea698217 100644 --- a/src/lib/dcp_content_type.h +++ b/src/lib/dcp_content_type.h @@ -51,6 +51,7 @@ public: } static DCPContentType const * from_isdcf_name (std::string); + static DCPContentType const * from_libdcp_kind (dcp::ContentKind); static DCPContentType const * from_index (int); static int as_index (DCPContentType const *); static std::vector<DCPContentType const *> all (); |
