X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_content_type.cc;h=1c96979e4cb77470a5bc84a63b1a6609a06f4471;hb=284d33037f878e6e3bc97238e0c18b0bbb92b990;hp=321aa61da494c2a9955e3b6a128f13e994ba4a5c;hpb=c7c8c894df8c2bb98aeed84011dd28da94afa392;p=dcpomatic.git diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc index 321aa61da..1c96979e4 100644 --- a/src/lib/dcp_content_type.cc +++ b/src/lib/dcp_content_type.cc @@ -28,9 +28,10 @@ using namespace std; vector DCPContentType::_dcp_content_types; -DCPContentType::DCPContentType (string p, string d) +DCPContentType::DCPContentType (string p, libdcp::ContentKind k, string d) : _pretty_name (p) - , _dcp_name (d) + , _libdcp_kind (k) + , _dci_name (d) { } @@ -38,16 +39,16 @@ DCPContentType::DCPContentType (string p, string d) void DCPContentType::setup_dcp_content_types () { - _dcp_content_types.push_back (new DCPContentType ("Feature", "feature")); - _dcp_content_types.push_back (new DCPContentType ("Short", "short")); - _dcp_content_types.push_back (new DCPContentType ("Trailer", "trailer")); - _dcp_content_types.push_back (new DCPContentType ("Test", "test")); - _dcp_content_types.push_back (new DCPContentType ("Transitional", "transitional")); - _dcp_content_types.push_back (new DCPContentType ("Rating", "rating")); - _dcp_content_types.push_back (new DCPContentType ("Teaser", "teaster")); - _dcp_content_types.push_back (new DCPContentType ("Policy", "policy")); - _dcp_content_types.push_back (new DCPContentType ("Public Service Announcement", "psa")); - _dcp_content_types.push_back (new DCPContentType ("Advertisement", "advertisement")); + _dcp_content_types.push_back (new DCPContentType ("Feature", libdcp::FEATURE, "FTR")); + _dcp_content_types.push_back (new DCPContentType ("Short", libdcp::SHORT, "SHR")); + _dcp_content_types.push_back (new DCPContentType ("Trailer", libdcp::TRAILER, "TLR")); + _dcp_content_types.push_back (new DCPContentType ("Test", libdcp::TEST, "TST")); + _dcp_content_types.push_back (new DCPContentType ("Transitional", libdcp::TRANSITIONAL, "XSN")); + _dcp_content_types.push_back (new DCPContentType ("Rating", libdcp::RATING, "RTG")); + _dcp_content_types.push_back (new DCPContentType ("Teaser", libdcp::TEASER, "TSR")); + _dcp_content_types.push_back (new DCPContentType ("Policy", libdcp::POLICY, "POL")); + _dcp_content_types.push_back (new DCPContentType ("Public Service Announcement", libdcp::PUBLIC_SERVICE_ANNOUNCEMENT, "PSA")); + _dcp_content_types.push_back (new DCPContentType ("Advertisement", libdcp::ADVERTISEMENT, "ADV")); } DCPContentType const * @@ -62,6 +63,18 @@ DCPContentType::from_pretty_name (string n) return 0; } +DCPContentType const * +DCPContentType::from_dci_name (string n) +{ + for (vector::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) {