+
+TextType
+string_to_text_type (string s)
+{
+ if (s == "unknown") {
+ return TEXT_UNKNOWN;
+ } else if (s == "open-subtitle") {
+ return TEXT_OPEN_SUBTITLE;
+ } else if (s == "closed-caption") {
+ 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_UNKNOWN:
+ return "unknown";
+ case TEXT_OPEN_SUBTITLE:
+ return "open-subtitle";
+ case TEXT_CLOSED_CAPTION:
+ return "closed-caption";
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+}
+
+string
+text_type_to_name (TextType t)
+{
+ switch (t) {
+ case TEXT_UNKNOWN:
+ return _("Timed text");
+ case TEXT_OPEN_SUBTITLE:
+ return _("Open subtitles");
+ case TEXT_CLOSED_CAPTION:
+ return _("Closed captions");
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+}
+
+string
+video_frame_type_to_string (VideoFrameType t)
+{
+ switch (t) {
+ case VIDEO_FRAME_TYPE_2D:
+ return "2d";
+ case VIDEO_FRAME_TYPE_3D:
+ return "3d";
+ case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
+ return "3d-left-right";
+ case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
+ return "3d-top-bottom";
+ case VIDEO_FRAME_TYPE_3D_ALTERNATE:
+ return "3d-alternate";
+ case VIDEO_FRAME_TYPE_3D_LEFT:
+ return "3d-left";
+ case VIDEO_FRAME_TYPE_3D_RIGHT:
+ return "3d-right";
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+
+ DCPOMATIC_ASSERT (false);
+}
+
+VideoFrameType
+string_to_video_frame_type (string s)
+{
+ if (s == "2d") {
+ return VIDEO_FRAME_TYPE_2D;
+ } else if (s == "3d") {
+ return VIDEO_FRAME_TYPE_3D;
+ } else if (s == "3d-left-right") {
+ return VIDEO_FRAME_TYPE_3D_LEFT_RIGHT;
+ } else if (s == "3d-top-bottom") {
+ return VIDEO_FRAME_TYPE_3D_TOP_BOTTOM;
+ } else if (s == "3d-alternate") {
+ return VIDEO_FRAME_TYPE_3D_ALTERNATE;
+ } else if (s == "3d-left") {
+ return VIDEO_FRAME_TYPE_3D_LEFT;
+ } else if (s == "3d-right") {
+ return VIDEO_FRAME_TYPE_3D_RIGHT;
+ }
+
+ DCPOMATIC_ASSERT (false);
+}
+
+CPLSummary::CPLSummary (boost::filesystem::path p)
+ : dcp_directory (p.leaf().string())
+{
+ dcp::DCP dcp (p);
+ list<dcp::VerificationNote> notes;
+ dcp.read (¬es);
+ if (!notes.empty()) {
+ throw dcp::ReadError(dcp::note_to_string(notes.front()));
+ }
+
+ cpl_id = dcp.cpls().front()->id();
+ cpl_annotation_text = dcp.cpls().front()->annotation_text();
+ cpl_file = dcp.cpls().front()->file().get();
+
+ encrypted = false;
+ BOOST_FOREACH (shared_ptr<dcp::CPL> j, dcp.cpls()) {
+ BOOST_FOREACH (shared_ptr<const dcp::ReelMXF> k, j->reel_mxfs()) {
+ if (k->key_id()) {
+ encrypted = true;
+ }
+ }
+ }
+
+ last_write_time = boost::filesystem::last_write_time (p);
+}