Get progress during formatting.
[dcpomatic.git] / src / lib / dcp_content_type.cc
index 03c1bf59ff207638f4ce018297ddfe68a7e5f891..e1b05852cf8c0e614fcfb74d5a5754101ae4c85f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -24,7 +24,6 @@
 
 #include "dcp_content_type.h"
 #include "dcpomatic_assert.h"
-#include <cassert>
 
 #include "i18n.h"
 
@@ -43,24 +42,26 @@ DCPContentType::DCPContentType (string p, dcp::ContentKind k, string d)
 void
 DCPContentType::setup_dcp_content_types ()
 {
-       _dcp_content_types.push_back (new DCPContentType (_("Feature"), dcp::FEATURE, N_("FTR")));
-       _dcp_content_types.push_back (new DCPContentType (_("Short"), dcp::SHORT, N_("SHR")));
-       _dcp_content_types.push_back (new DCPContentType (_("Trailer"), dcp::TRAILER, N_("TLR")));
-       _dcp_content_types.push_back (new DCPContentType (_("Test"), dcp::TEST, N_("TST")));
-       _dcp_content_types.push_back (new DCPContentType (_("Transitional"), dcp::TRANSITIONAL, N_("XSN")));
-       _dcp_content_types.push_back (new DCPContentType (_("Rating"), dcp::RATING, N_("RTG")));
-       _dcp_content_types.push_back (new DCPContentType (_("Teaser"), dcp::TEASER, N_("TSR")));
-       _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(_("Feature"), dcp::ContentKind::FEATURE, N_("FTR")));
+       _dcp_content_types.push_back (new DCPContentType(_("Short"), dcp::ContentKind::SHORT, N_("SHR")));
+       _dcp_content_types.push_back (new DCPContentType(_("Trailer"), dcp::ContentKind::TRAILER, N_("TLR")));
+       _dcp_content_types.push_back (new DCPContentType(_("Test"), dcp::ContentKind::TEST, N_("TST")));
+       _dcp_content_types.push_back (new DCPContentType(_("Transitional"), dcp::ContentKind::TRANSITIONAL, N_("XSN")));
+       _dcp_content_types.push_back (new DCPContentType(_("Rating"), dcp::ContentKind::RATING, N_("RTG")));
+       _dcp_content_types.push_back (new DCPContentType(_("Teaser"), dcp::ContentKind::TEASER, N_("TSR")));
+       _dcp_content_types.push_back (new DCPContentType(_("Policy"), dcp::ContentKind::POLICY, N_("POL")));
+       _dcp_content_types.push_back (new DCPContentType(_("Public Service Announcement"), dcp::ContentKind::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA")));
+       _dcp_content_types.push_back (new DCPContentType(_("Advertisement"), dcp::ContentKind::ADVERTISEMENT, N_("ADV")));
+       _dcp_content_types.push_back (new DCPContentType(_("Episode"), dcp::ContentKind::EPISODE, N_("EPS")));
+       _dcp_content_types.push_back (new DCPContentType(_("Promo"), dcp::ContentKind::PROMO, N_("PRO")));
 }
 
 DCPContentType const *
-DCPContentType::from_pretty_name (string n)
+DCPContentType::from_isdcf_name (string n)
 {
-       for (vector<DCPContentType const *>::const_iterator i = _dcp_content_types.begin(); i != _dcp_content_types.end(); ++i) {
-               if ((*i)->pretty_name() == n) {
-                       return *i;
+       for (auto i: _dcp_content_types) {
+               if (i->isdcf_name() == n) {
+                       return i;
                }
        }
 
@@ -68,17 +69,19 @@ DCPContentType::from_pretty_name (string n)
 }
 
 DCPContentType const *
-DCPContentType::from_isdcf_name (string n)
+DCPContentType::from_libdcp_kind (dcp::ContentKind kind)
 {
-       for (vector<DCPContentType const *>::const_iterator i = _dcp_content_types.begin(); i != _dcp_content_types.end(); ++i) {
-               if ((*i)->isdcf_name() == n) {
-                       return *i;
+       for (auto i: _dcp_content_types) {
+               if (i->libdcp_kind() == kind) {
+                       return i;
                }
        }
 
+       DCPOMATIC_ASSERT (false);
        return 0;
 }
 
+
 DCPContentType const *
 DCPContentType::from_index (int n)
 {