2 Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
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.
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.
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/>.
22 #include "compose.hpp"
23 #include "dcpomatic_assert.h"
24 #include "exceptions.h"
25 #include "text_type.h"
35 string_to_text_type(string s)
38 return TextType::UNKNOWN;
39 } else if (s == "open-subtitle") {
40 return TextType::OPEN_SUBTITLE;
41 } else if (s == "closed-caption") {
42 return TextType::CLOSED_CAPTION;
44 throw MetadataError(String::compose("Unknown text type %1", s));
49 text_type_to_string(TextType t)
52 case TextType::UNKNOWN:
54 case TextType::OPEN_SUBTITLE:
55 return "open-subtitle";
56 case TextType::CLOSED_CAPTION:
57 return "closed-caption";
59 DCPOMATIC_ASSERT(false);
64 text_type_to_name(TextType t)
67 case TextType::UNKNOWN:
68 return _("Timed text");
69 case TextType::OPEN_SUBTITLE:
70 return _("Open subtitles");
71 case TextType::CLOSED_CAPTION:
72 return _("Closed captions");
74 DCPOMATIC_ASSERT(false);