From 491edba4e79656a045103a284c65b846a167d2ff Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 21 Jun 2018 22:33:02 +0100 Subject: Add type for text content (CCAP/subtitle). --- src/lib/types.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/lib/types.cc') 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 #include @@ -90,6 +91,31 @@ Crop::as_xml (xmlpp::Node* node) const node->add_child("BottomCrop")->add_child_text (raw_convert (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) { -- cgit v1.2.3