117ff3b16d79a0b3029c3d7ac3a9656fef0ea831
[dcpomatic.git] / src / lib / dcp_content_type.h
1 /*
2     Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #ifndef DCPOMATIC_DCP_CONTENT_TYPE_H
23 #define DCPOMATIC_DCP_CONTENT_TYPE_H
24
25
26 /** @file src/dcp_content_type.h
27  *  @brief DCPContentType class.
28  */
29
30
31 #include <dcp/dcp.h>
32 #include <string>
33 #include <vector>
34
35
36 /** @class DCPContentType
37  *  @brief A description of the type of content for a DCP (e.g. feature, trailer etc.)
38  */
39 class DCPContentType
40 {
41 public:
42         DCPContentType (std::string, dcp::ContentKind, std::string);
43
44         /** @return user-visible `pretty' name */
45         std::string pretty_name () const {
46                 return _pretty_name;
47         }
48
49         dcp::ContentKind libdcp_kind () const {
50                 return _libdcp_kind;
51         }
52
53         std::string isdcf_name () const {
54                 return _isdcf_name;
55         }
56
57         static DCPContentType const * from_isdcf_name (std::string);
58         static DCPContentType const * from_libdcp_kind (dcp::ContentKind);
59         static DCPContentType const * from_index (int);
60         static boost::optional<int> as_index (DCPContentType const *);
61         static std::vector<DCPContentType const *> all ();
62         static void setup_dcp_content_types ();
63
64 private:
65         std::string _pretty_name;
66         dcp::ContentKind _libdcp_kind;
67         std::string _isdcf_name;
68
69         /** All available DCP content types */
70         static std::vector<DCPContentType> _dcp_content_types;
71 };
72
73
74 #endif