X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_content_type.cc;h=82bd5fa018429c6ceea666cc580204e58b5a735d;hb=0882a398a0737568b49d1bcae6d4d24c4c39492d;hp=72a26e4072622db2ca88083071e0ccf0997136d6;hpb=bb767c7e338414beee132af3e96829c1448e214b;p=dcpomatic.git diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc index 72a26e407..82bd5fa01 100644 --- a/src/lib/dcp_content_type.cc +++ b/src/lib/dcp_content_type.cc @@ -24,13 +24,16 @@ #include #include "dcp_content_type.h" +#include "i18n.h" + using namespace std; vector DCPContentType::_dcp_content_types; -DCPContentType::DCPContentType (string p, string o) +DCPContentType::DCPContentType (string p, libdcp::ContentKind k, string d) : _pretty_name (p) - , _opendcp_name (o) + , _libdcp_kind (k) + , _dci_name (d) { } @@ -38,16 +41,16 @@ DCPContentType::DCPContentType (string p, string o) 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, N_("FTR"))); + _dcp_content_types.push_back (new DCPContentType (_("Short"), libdcp::SHORT, N_("SHR"))); + _dcp_content_types.push_back (new DCPContentType (_("Trailer"), libdcp::TRAILER, N_("TLR"))); + _dcp_content_types.push_back (new DCPContentType (_("Test"), libdcp::TEST, N_("TST"))); + _dcp_content_types.push_back (new DCPContentType (_("Transitional"), libdcp::TRANSITIONAL, N_("XSN"))); + _dcp_content_types.push_back (new DCPContentType (_("Rating"), libdcp::RATING, N_("RTG"))); + _dcp_content_types.push_back (new DCPContentType (_("Teaser"), libdcp::TEASER, N_("TSR"))); + _dcp_content_types.push_back (new DCPContentType (_("Policy"), libdcp::POLICY, N_("POL"))); + _dcp_content_types.push_back (new DCPContentType (_("Public Service Announcement"), libdcp::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA"))); + _dcp_content_types.push_back (new DCPContentType (_("Advertisement"), libdcp::ADVERTISEMENT, N_("ADV"))); } DCPContentType const * @@ -62,6 +65,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) {