summaryrefslogtreecommitdiff
path: root/src/lib/types.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-06-21 22:33:02 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-19 23:36:56 +0100
commit491edba4e79656a045103a284c65b846a167d2ff (patch)
treec11e2a9f7b7f097a2320f2b6a21e69a1aab9b581 /src/lib/types.cc
parent26acd1ec8426d8be48c37ca20b3af26b4bc73fa7 (diff)
Add type for text content (CCAP/subtitle).
Diffstat (limited to 'src/lib/types.cc')
-rw-r--r--src/lib/types.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/types.cc b/src/lib/types.cc
index e3bedd667..68e00c8d5 100644
--- a/src/lib/types.cc
+++ b/src/lib/types.cc
@@ -19,6 +19,7 @@
*/
#include "types.h"
+#include "compose.hpp"
#include "dcpomatic_assert.h"
#include <dcp/raw_convert.h>
#include <libxml++/libxml++.h>
@@ -90,6 +91,31 @@ Crop::as_xml (xmlpp::Node* node) const
node->add_child("BottomCrop")->add_child_text (raw_convert<string> (bottom));
}
+TextType
+string_to_text_type (string s)
+{
+ if (s == "subtitle") {
+ return TEXT_SUBTITLE;
+ } else if (s == "ccap") {
+ return TEXT_CLOSED_CAPTION;
+ } else {
+ throw MetadataError (String::compose ("Unknown text type %1", s));
+ }
+}
+
+string
+text_type_to_string (TextType t)
+{
+ switch (t) {
+ case TEXT_SUBTITLE:
+ return "subtitle";
+ case TEXT_CLOSED_CAPTION:
+ return "ccap";
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+}
+
string
video_frame_type_to_string (VideoFrameType t)
{