X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_content_type.cc;h=4fedd366c896c15adae703f09ce38a0f53729a67;hb=8f8730cadb3dae36e8aa7b7c732a7c162eac0fb6;hp=b2455ba21b8f6f316524b976e12116262e44e2f9;hpb=0a3de908ae0f62dd8d7d5aaaa96e2ddab891b5a8;p=dcpomatic.git diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc index b2455ba21..4fedd366c 100644 --- a/src/lib/dcp_content_type.cc +++ b/src/lib/dcp_content_type.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -24,7 +24,7 @@ #include "dcp_content_type.h" #include "dcpomatic_assert.h" -#include +#include #include "i18n.h" @@ -53,20 +53,36 @@ DCPContentType::setup_dcp_content_types () _dcp_content_types.push_back (new DCPContentType (_("Policy"), dcp::POLICY, N_("POL"))); _dcp_content_types.push_back (new DCPContentType (_("Public Service Announcement"), dcp::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA"))); _dcp_content_types.push_back (new DCPContentType (_("Advertisement"), dcp::ADVERTISEMENT, N_("ADV"))); + _dcp_content_types.push_back (new DCPContentType (_("Episode"), dcp::EPISODE, N_("EPS"))); + _dcp_content_types.push_back (new DCPContentType (_("Promo"), dcp::PROMO, N_("PRO"))); } DCPContentType const * DCPContentType::from_isdcf_name (string n) { - for (vector::const_iterator i = _dcp_content_types.begin(); i != _dcp_content_types.end(); ++i) { - if ((*i)->isdcf_name() == n) { - return *i; + BOOST_FOREACH (DCPContentType const * i, _dcp_content_types) { + if (i->isdcf_name() == n) { + return i; } } 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) {