summaryrefslogtreecommitdiff
path: root/src/lib/types.cc
diff options
context:
space:
mode:
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)
{