From: Carl Hetherington Date: Mon, 20 Apr 2020 22:18:34 +0000 (+0200) Subject: Add DCPContent::from_libdcp_kind. X-Git-Tag: v2.15.53~1^2~6 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=f525fad0c38e198f35055e639184fa983a3d5d56;p=dcpomatic.git Add DCPContent::from_libdcp_kind. --- 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 @@ -69,6 +69,20 @@ DCPContentType::from_isdcf_name (string n) return 0; } +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) { 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 all ();