Add DCPContent::from_libdcp_kind.
authorCarl Hetherington <cth@carlh.net>
Mon, 20 Apr 2020 22:18:34 +0000 (00:18 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 20 Apr 2020 22:18:34 +0000 (00:18 +0200)
src/lib/dcp_content_type.cc
src/lib/dcp_content_type.h

index 9ff903231340529db8704ac1e6188e5b097b8b69..4fedd366c896c15adae703f09ce38a0f53729a67 100644 (file)
@@ -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)
 {
index 2685e6edfd20b8857060ef1735fae36c74160754..eea698217ca5e59a79e0addbed9e1bf4211cf62f 100644 (file)
@@ -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 ();