Replace DCP parser with basic version that uses libdcp.
authorCarl Hetherington <cth@carlh.net>
Wed, 11 Jan 2017 10:57:09 +0000 (10:57 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 11 Jan 2017 11:23:42 +0000 (11:23 +0000)
26 files changed:
cscript
src/dcp/font.cc [deleted file]
src/dcp/font.h [deleted file]
src/dcp/interop_load_font.cc [deleted file]
src/dcp/interop_load_font.h [deleted file]
src/dcp/load_font.h [deleted file]
src/dcp/smpte_load_font.cc [deleted file]
src/dcp/smpte_load_font.h [deleted file]
src/dcp/subtitle.cc [deleted file]
src/dcp/subtitle.h [deleted file]
src/dcp/text.cc [deleted file]
src/dcp/text.h [deleted file]
src/dcp/wscript [deleted file]
src/dcp_reader.cc
src/dcp_reader.h
src/font_size.cc
src/font_size.h
src/interop_dcp_reader.cc [deleted file]
src/interop_dcp_reader.h [deleted file]
src/reader_factory.cc
src/smpte_dcp_reader.cc [deleted file]
src/smpte_dcp_reader.h [deleted file]
src/wscript
test/dcp_reader_test.cc
test/dcp_to_stl_binary_test.cc
wscript

diff --git a/cscript b/cscript
index 03f98d023f4adbb2645db28b42c15494a64ba847..6ce93191b46e6c4efb1017f6122f75d42e78753d 100644 (file)
--- a/cscript
+++ b/cscript
@@ -1,7 +1,7 @@
 import os
 
 def dependencies(target):
-    return (('asdcplib-cth', 'v0.1.3'), ('libcxml', 'v0.15.4'))
+    return (('asdcplib-cth', 'v0.1.3'), ('libcxml', 'v0.15.4'), ('libdcp', None))
 
 def build(target, options):
     cmd = './waf configure --prefix=%s' % target.directory
diff --git a/src/dcp/font.cc b/src/dcp/font.cc
deleted file mode 100644 (file)
index 64787c7..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "font.h"
-#include "text.h"
-#include <libcxml/cxml.h>
-#include <boost/foreach.hpp>
-
-using std::string;
-using std::list;
-using boost::shared_ptr;
-using boost::optional;
-using namespace sub;
-
-dcp::Font::Font (cxml::ConstNodePtr node)
-{
-       id = node->optional_string_attribute ("Id");
-       size = node->optional_number_attribute<int64_t> ("Size").get_value_or (0);
-       italic = node->optional_bool_attribute ("Italic");
-       optional<string> c = node->optional_string_attribute ("Color");
-       if (c) {
-               colour = Colour::from_argb_hex (c.get ());
-       }
-       optional<string> const e = node->optional_string_attribute ("Effect");
-       if (e) {
-               effect = string_to_effect (e.get ());
-       }
-       c = node->optional_string_attribute ("EffectColor");
-       if (c) {
-               effect_colour = Colour::from_argb_hex (c.get ());
-       }
-}
-
-dcp::Font::Font (std::list<boost::shared_ptr<Font> > const & font_nodes)
-       : size (0)
-       , italic (false)
-       , colour (Colour::from_argb_hex ("FFFFFFFF"))
-       , effect_colour (Colour::from_argb_hex ("FFFFFFFF"))
-{
-       for (list<shared_ptr<Font> >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) {
-               if ((*i)->id) {
-                       id = (*i)->id;
-               }
-               if ((*i)->size != 0) {
-                       size = (*i)->size;
-               }
-               if ((*i)->italic) {
-                       italic = (*i)->italic.get ();
-               }
-               if ((*i)->colour) {
-                       colour = (*i)->colour.get ();
-               }
-               if ((*i)->effect) {
-                       effect = (*i)->effect.get ();
-               }
-               if ((*i)->effect_colour) {
-                       effect_colour = (*i)->effect_colour.get ();
-               }
-       }
-}
diff --git a/src/dcp/font.h b/src/dcp/font.h
deleted file mode 100644 (file)
index a1d8223..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/dcp/font.h
- *  @brief Font class
- */
-
-#include "../colour.h"
-#include "../effect.h"
-#include "subtitle.h"
-#include <libcxml/cxml.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-#include <list>
-
-namespace sub {
-namespace dcp {
-
-/** @class Font
- *  @brief Helper class for parsing subtitle XML.
- */
-class Font 
-{
-public:
-       Font ()
-               : size (0)
-       {}
-       
-       Font (cxml::ConstNodePtr node);
-       Font (std::list<boost::shared_ptr<Font> > const & font_nodes);
-
-       boost::optional<std::string> id;
-       int size;
-       boost::optional<bool> italic;
-       boost::optional<Colour> colour;
-       boost::optional<Effect> effect;
-       boost::optional<Colour> effect_colour;
-};
-
-}
-
-}
diff --git a/src/dcp/interop_load_font.cc b/src/dcp/interop_load_font.cc
deleted file mode 100644 (file)
index 2ee3ee9..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "interop_load_font.h"
-#include <libcxml/cxml.h>
-
-using std::string;
-using boost::shared_ptr;
-using boost::optional;
-using namespace sub;
-
-dcp::InteropLoadFont::InteropLoadFont (string id_, string uri_)
-       : LoadFont (id_)
-       , uri (uri_)
-{
-
-}
-
-dcp::InteropLoadFont::InteropLoadFont (cxml::ConstNodePtr node)
-{
-       optional<string> x = node->optional_string_attribute ("Id");
-       if (!x) {
-               x = node->optional_string_attribute ("ID");
-       }
-       id = x.get_value_or ("");
-       
-       uri = node->string_attribute ("URI");
-}
-
-bool
-dcp::operator== (InteropLoadFont const & a, InteropLoadFont const & b)
-{
-       return a.id == b.id && a.uri == b.uri;
-}
-
-bool
-dcp::operator!= (InteropLoadFont const & a, InteropLoadFont const & b)
-{
-       return !(a == b);
-}
diff --git a/src/dcp/interop_load_font.h b/src/dcp/interop_load_font.h
deleted file mode 100644 (file)
index 373b26c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "load_font.h"
-#include <libcxml/cxml.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-
-namespace sub {
-namespace dcp {
-       
-class InteropLoadFont : public LoadFont
-{
-public:
-       InteropLoadFont () {}
-       InteropLoadFont (std::string id, std::string uri);
-       InteropLoadFont (cxml::ConstNodePtr node);
-
-       std::string uri;
-};
-
-bool operator== (InteropLoadFont const & a, InteropLoadFont const & b);
-bool operator!= (InteropLoadFont const & a, InteropLoadFont const & b);
-
-}
-
-}
diff --git a/src/dcp/load_font.h b/src/dcp/load_font.h
deleted file mode 100644 (file)
index f269c87..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <string>
-
-namespace sub {
-namespace dcp {
-
-class LoadFont
-{
-public:
-       LoadFont () {}
-       LoadFont (std::string id_)
-               : id (id_)
-       {}
-       
-       std::string id;
-};
-
-}
-
-}
diff --git a/src/dcp/smpte_load_font.cc b/src/dcp/smpte_load_font.cc
deleted file mode 100644 (file)
index d433cbf..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "smpte_load_font.h"
-#include <libcxml/cxml.h>
-
-using std::string;
-using boost::shared_ptr;
-using namespace sub;
-
-dcp::SMPTELoadFont::SMPTELoadFont (shared_ptr<const cxml::Node> node)
-       : LoadFont (node->string_attribute ("ID"))
-{
-       urn = node->content().substr (9);
-}
diff --git a/src/dcp/smpte_load_font.h b/src/dcp/smpte_load_font.h
deleted file mode 100644 (file)
index aba05c8..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "load_font.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-
-namespace cxml {
-       class Node;
-}
-
-namespace sub {
-namespace dcp {
-       
-class SMPTELoadFont : public LoadFont
-{
-public:
-       SMPTELoadFont (boost::shared_ptr<const cxml::Node> node);
-
-       std::string urn;
-};
-
-}
-
-}
diff --git a/src/dcp/subtitle.cc b/src/dcp/subtitle.cc
deleted file mode 100644 (file)
index 68ca559..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "../exceptions.h"
-#include "../raw_convert.h"
-#include "subtitle.h"
-#include <libcxml/cxml.h>
-#include <boost/lexical_cast.hpp>
-#include <boost/algorithm/string.hpp>
-
-using std::string;
-using std::vector;
-using std::list;
-using boost::optional;
-using boost::shared_ptr;
-using boost::lexical_cast;
-using boost::is_any_of;
-using namespace sub;
-
-dcp::Subtitle::Subtitle (boost::shared_ptr<const cxml::Node> node, optional<int> tcr)
-{
-       if (tcr) {
-               in = smpte_time (node, "TimeIn", tcr.get ()).get ();
-               out = smpte_time (node, "TimeOut", tcr.get ()).get ();
-       } else {
-               in = interop_time (node, "TimeIn").get ();
-               out = interop_time (node, "TimeOut").get ();
-       }
-
-       if (tcr) {
-               fade_up_time = smpte_time (node, "FadeUpTime", tcr.get ()).get_value_or (Time::from_hmsf (0, 0, 0, 2, Rational (tcr.get(), 1)));
-               fade_down_time = smpte_time (node, "FadeDownTime", tcr.get ()).get_value_or (Time::from_hmsf (0, 0, 0, 2, Rational (tcr.get (), 1)));
-       } else {
-               fade_up_time = interop_time (node, "FadeUpTime").get_value_or (Time::from_hms (0, 0, 0, 80));
-               if (fade_up_time > Time::from_hms (0, 0, 8, 0)) {
-                       fade_up_time = Time::from_hms (0, 0, 8, 0);
-               }
-               fade_down_time = interop_time (node, "FadeDownTime").get_value_or (Time::from_hms (0, 0, 0, 80));
-               if (fade_down_time > Time::from_hms (0, 0, 8, 0)) {
-                       fade_down_time = Time::from_hms (0, 0, 8, 0);
-               }
-       }
-}
-
-optional<Time>
-dcp::Subtitle::smpte_time (shared_ptr<const cxml::Node> node, string name, int tcr)
-{
-       optional<string> u = node->optional_string_attribute (name);
-       if (!u) {
-               return optional<Time> ();
-       }
-       
-       vector<string> b;
-       split (b, u.get (), is_any_of (":"));
-       if (b.size() != 4) {
-               boost::throw_exception (DCPError ("unrecognised time specification " + u.get ()));
-       }
-       
-       return Time::from_hmsf (
-               raw_convert<int> (b[0]),
-               raw_convert<int> (b[1]),
-               raw_convert<int> (b[2]),
-               raw_convert<int> (b[3]),
-               Rational (tcr, 1)
-               );
-}
-
-optional<Time>
-dcp::Subtitle::interop_time (shared_ptr<const cxml::Node> node, string name)
-{
-       optional<string> u = node->optional_string_attribute (name);
-       if (!u) {
-               return optional<Time> ();
-       }
-
-       if (u.get().find (":") != string::npos) {
-               /* HH:MM:SS:TTT or HH:MM:SS.sss */
-               vector<string> b;
-               split (b, u.get(), is_any_of (":."));
-               if (b.size() != 4) {
-                       boost::throw_exception (DCPError ("unrecognised time specification " + u.get ()));
-               }
-
-               if (u.get().find (".") != string::npos) {
-                       return Time::from_hms (
-                               raw_convert<int> (b[0]),
-                               raw_convert<int> (b[1]),
-                               raw_convert<int> (b[2]),
-                               rint (raw_convert<double> ("." + b[3]) * 1000)
-                               );
-               } else {
-                       return Time::from_hms (
-                               raw_convert<int> (b[0]),
-                               raw_convert<int> (b[1]),
-                               raw_convert<int> (b[2]),
-                               raw_convert<int> (b[3]) * 4
-                               );
-               }
-       } else {
-               return Time::from_hms (0, 0, 0, raw_convert<int> (u.get ()) * 4);
-       }
-}
-  
diff --git a/src/dcp/subtitle.h b/src/dcp/subtitle.h
deleted file mode 100644 (file)
index 672dc9a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef LIBSUB_DCP_SUBTITLE_H
-#define LIBSUB_DCP_SUBTITLE_H
-
-#include "../sub_time.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-#include <list>
-
-namespace cxml {
-       class Node;
-}
-
-namespace sub {
-namespace dcp {
-
-class Font;    
-class Text;
-
-class Subtitle 
-{
-public:
-       Subtitle () {}
-       Subtitle (boost::shared_ptr<const cxml::Node> node, boost::optional<int> tcr);
-
-       Time in;
-       Time out;
-       Time fade_up_time;
-       Time fade_down_time;
-
-private:
-       boost::optional<Time> smpte_time (boost::shared_ptr<const cxml::Node> node, std::string name, int tcr);
-       boost::optional<Time> interop_time (boost::shared_ptr<const cxml::Node> node, std::string name);
-};
-
-}
-
-}
-
-#endif
diff --git a/src/dcp/text.cc b/src/dcp/text.cc
deleted file mode 100644 (file)
index 313ebdd..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/text.cc
- *  @brief Text class for parsing DCP subtitle XML.
- */
-
-#include "../xml.h"
-#include "text.h"
-#include "font.h"
-#include <libcxml/cxml.h>
-#include <boost/foreach.hpp>
-
-using std::string;
-using std::list;
-using boost::shared_ptr;
-using boost::optional;
-using namespace sub;
-
-/** Read a &lt;Text&gt; node from a subtitle XML file, noting its contents
- *  in this object's member variables.
- *  @param node Node to read.
- */
-dcp::Text::Text (boost::shared_ptr<const cxml::Node> node)
-       : v_align (CENTRE_OF_SCREEN)
-{
-       optional<float> x = node->optional_number_attribute<float> ("VPosition");
-       if (!x) {
-               x = node->number_attribute<float> ("Vposition");
-       }
-       v_position = x.get ();
-       
-       optional<string> v = node->optional_string_attribute ("VAlign");
-       if (!v) {
-               v = node->optional_string_attribute ("Valign");
-       }
-       
-       if (v) {
-               if (v.get() == "top") {
-                       v_align = TOP_OF_SCREEN;
-               } else if (v.get() == "center") {
-                       v_align = CENTRE_OF_SCREEN;
-               } else if (v.get() == "bottom") {
-                       v_align = BOTTOM_OF_SCREEN;
-               } else {
-                       boost::throw_exception (DCPError ("unknown subtitle valign type"));
-               }
-       }
-}
diff --git a/src/dcp/text.h b/src/dcp/text.h
deleted file mode 100644 (file)
index f2c5059..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/text.h
- *  @brief Text class for parsing DCP subtitle XML.
- */
-
-#include "../vertical_reference.h"
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-namespace cxml {
-       class Node;
-}
-
-namespace sub {
-namespace dcp {
-
-class Font;
-
-/** @class Text
- *  @brief Parser for Text nodes from subtitle XML.
- */
-class Text
-{
-public:
-       /** Construct a default text node */
-       Text ()
-               : v_position (0)
-               , v_align (TOP_OF_SCREEN)
-       {}
-       
-       Text (boost::shared_ptr<const cxml::Node> node);
-
-       float v_position;
-       VerticalReference v_align;
-};
-
-}
-
-}
diff --git a/src/dcp/wscript b/src/dcp/wscript
deleted file mode 100644 (file)
index a70ef26..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# This is a dummy just so my waft script works
index 9727ef8cc9548589b759bb7a95e2695c83dc9f6e..ed48ac8f4b2bbde4df4dcd8cc64051db51d0e804 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2017 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 */
 
 #include "dcp_reader.h"
-#include "vertical_reference.h"
-#include "xml.h"
-#include "util.h"
-#include "dcp/font.h"
-#include "dcp/text.h"
-#include "dcp/subtitle.h"
-#include <libcxml/cxml.h>
-#include <libxml++/libxml++.h>
-#include <iostream>
+#include "compose.hpp"
+#include "exceptions.h"
+#include <dcp/subtitle_string.h>
+#include <dcp/interop_subtitle_asset.h>
+#include <dcp/smpte_subtitle_asset.h>
+#include <boost/foreach.hpp>
+#include <boost/filesystem.hpp>
 
 using std::list;
 using std::cout;
 using std::string;
+using std::exception;
 using boost::shared_ptr;
 using boost::optional;
 using namespace sub;
 
-void
-DCPReader::parse_common (cxml::NodePtr root, optional<int> tcr)
+static Time
+dcp_to_sub_time (dcp::Time t)
 {
-       _reel_number = root->string_child ("ReelNumber");
-       _language = root->string_child ("Language");
+       return Time::from_hms (t.h, t.m, t.s, t.e * 1000.0 / t.tcr);
+}
 
-       ParseState parse_state;
-       parse_node (root->node(), parse_state, tcr);
+static Colour
+dcp_to_sub_colour (dcp::Colour c)
+{
+       return Colour (c.r / 255.0, c.g / 255.0, c.b / 255.0);
 }
 
-void
-DCPReader::parse_node (xmlpp::Node const * node, ParseState& parse_state, optional<int> tcr)
+DCPReader::DCPReader (boost::filesystem::path file)
 {
-       xmlpp::Node::NodeList children = node->get_children ();
-       for (xmlpp::Node::NodeList::iterator i = children.begin(); i != children.end(); ++i) {
-               xmlpp::ContentNode const * c = dynamic_cast<xmlpp::ContentNode const *> (*i);
-               if (c) {
-                       maybe_add_subtitle (c->get_content (), parse_state);
-               }
+       shared_ptr<dcp::SubtitleAsset> sc;
+       string interop_error;
+       string smpte_error;
+
+       try {
+               sc.reset (new dcp::InteropSubtitleAsset (file));
+       } catch (exception& e) {
+               interop_error = e.what ();
+       }
 
-               xmlpp::Element* e = dynamic_cast<xmlpp::Element *> (*i);
-               if (e) {
-                       cxml::NodePtr n (new cxml::Node (e));
-                       if (n->name() == "Font") {
-                               parse_state.font_nodes.push_back (shared_ptr<dcp::Font> (new dcp::Font (n)));
-                               parse_node (e, parse_state, tcr);
-                               parse_state.font_nodes.pop_back ();
-                       } else if (n->name() == "Text") {
-                               parse_state.text_nodes.push_back (shared_ptr<dcp::Text> (new dcp::Text (n)));
-                               parse_node (e, parse_state, tcr);
-                               parse_state.text_nodes.pop_back ();
-                       } else if (n->name() == "Subtitle") {
-                               parse_state.subtitle_nodes.push_back (shared_ptr<dcp::Subtitle> (new dcp::Subtitle (n, tcr)));
-                               parse_node (e, parse_state, tcr);
-                               parse_state.subtitle_nodes.pop_back ();
-                       } else if (n->name() == "SubtitleList") {
-                               parse_node (e, parse_state, tcr);
-                       }
+       if (!sc) {
+               try {
+                       sc.reset (new dcp::SMPTESubtitleAsset (file));
+               } catch (exception& e) {
+                       smpte_error = e.what();
                }
        }
-}
 
-void
-DCPReader::maybe_add_subtitle (string text, ParseState const & parse_state)
-{
-       if (empty_or_white_space (text)) {
-               return;
+       if (!sc) {
+               throw DCPError (String::compose ("Could not read subtitles (%1 / %2)", interop_error, smpte_error));
        }
 
-       if (parse_state.text_nodes.empty() || parse_state.subtitle_nodes.empty ()) {
-               return;
-       }
 
-       dcp::Font effective_font (parse_state.font_nodes);
-       dcp::Text effective_text (*parse_state.text_nodes.back ());
-       dcp::Subtitle effective_subtitle (*parse_state.subtitle_nodes.back ());
-
-       RawSubtitle rs;
-
-       rs.text = text;
-       rs.font = effective_font.id;
-       rs.font_size.set_proportional (float (effective_font.size) / (72 * 11));
-       rs.effect = effective_font.effect;
-       rs.effect_colour = effective_font.effect_colour;
-       rs.colour = effective_font.colour.get();
-       rs.bold = false;
-       rs.italic = effective_font.italic.get();
-       rs.underline = false;
-       rs.vertical_position.proportional = float (effective_text.v_position) / 100;
-       rs.vertical_position.reference = effective_text.v_align;
-       rs.from = effective_subtitle.in;
-       rs.to = effective_subtitle.out;
-       rs.fade_up = effective_subtitle.fade_up_time;
-       rs.fade_down = effective_subtitle.fade_down_time;
-
-       _subs.push_back (rs);
+       BOOST_FOREACH (dcp::SubtitleString const & i, sc->subtitles ()) {
+               RawSubtitle rs;
+               rs.text = i.text ();
+               rs.font = i.font ();
+               rs.font_size = FontSize::from_proportional (i.size() / (72.0 * 11.0));
+
+               switch (i.effect ()) {
+               case BORDER:
+                       rs.effect = BORDER;
+                       break;
+               case SHADOW:
+                       rs.effect = SHADOW;
+                       break;
+               default:
+                       break;
+               }
+
+               rs.effect_colour = dcp_to_sub_colour (i.effect_colour());
+
+               rs.colour = dcp_to_sub_colour (i.colour());
+               rs.bold = i.bold ();
+               rs.italic = i.italic ();
+               rs.underline = i.underline ();
+
+               switch (i.h_align()) {
+               case dcp::HALIGN_LEFT:
+                       rs.horizontal_position = LEFT;
+                       break;
+               case dcp::HALIGN_CENTER:
+                       rs.horizontal_position = CENTRE;
+                       break;
+               case dcp::HALIGN_RIGHT:
+                       rs.horizontal_position = RIGHT;
+                       break;
+               }
+
+               rs.vertical_position.proportional = i.v_position();
+               switch (i.v_align()) {
+               case dcp::VALIGN_TOP:
+                       rs.vertical_position.reference = TOP_OF_SCREEN;
+                       break;
+               case dcp::VALIGN_CENTER:
+                       rs.vertical_position.reference = CENTRE_OF_SCREEN;
+                       break;
+               case dcp::VALIGN_BOTTOM:
+                       rs.vertical_position.reference = BOTTOM_OF_SCREEN;
+                       break;
+               }
+
+               rs.from = dcp_to_sub_time (i.in ());
+               rs.to = dcp_to_sub_time (i.out ());
+
+               rs.fade_up = dcp_to_sub_time (i.fade_up_time ());
+               rs.fade_down = dcp_to_sub_time (i.fade_down_time ());
+
+               _subs.push_back (rs);
+       }
 }
index 82a211c0ba53f4c06d20505343a5d4e14e456266..8f49dfd6e6d18d6f5e1db5170afdb6ffadeef879 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2017 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #define LIBSUB_DCP_READER_H
 
 #include "reader.h"
-#include <libcxml/cxml.h>
-#include <boost/shared_ptr.hpp>
 #include <boost/filesystem.hpp>
 
 namespace sub {
 
-namespace dcp {
-       class Font;
-       class Text;
-       class Subtitle;
-}
-
 /** @class DCPReader
  *  @brief A class which reads DCP subtitles.
  */
 class DCPReader : public Reader
 {
-protected:
-
-       struct ParseState {
-               std::list<boost::shared_ptr<dcp::Font> > font_nodes;
-               std::list<boost::shared_ptr<dcp::Text> > text_nodes;
-               std::list<boost::shared_ptr<dcp::Subtitle> > subtitle_nodes;
-       };
-
-       void parse_common (cxml::NodePtr root, boost::optional<int> tcr);
-
-       std::string _id;
-
-private:
-       void parse_node (xmlpp::Node const * node, ParseState& parse_state, boost::optional<int> tcr);
-       void maybe_add_subtitle (std::string text, ParseState const & parse_state);
-
-       std::string _reel_number;
-       std::string _language;
+public:
+       DCPReader (boost::filesystem::path file);
 };
 
 }
index 5e5fd4c98a9533d1dc4f7f205ca8ba04925fa671..a208867db00473309a9c5e870f17aa85dd65d8a1 100644 (file)
@@ -49,6 +49,14 @@ FontSize::from_points (int p)
        return s;
 }
 
+FontSize
+FontSize::from_proportional (float p)
+{
+       FontSize s;
+       s.set_proportional (p);
+       return s;
+}
+
 bool
 FontSize::specified () const
 {
index 2ff4a7c66d8f19bdad7512277343417b6c847511..4f49eb73505ae4ab7ef36932173bfa3af31c3b84 100644 (file)
@@ -55,6 +55,7 @@ public:
        int points (int screen_height_in_points) const;
 
        static FontSize from_points (int p);
+       static FontSize from_proportional (float p);
 
 private:
        /** as a proportion of screen height */
diff --git a/src/interop_dcp_reader.cc b/src/interop_dcp_reader.cc
deleted file mode 100644 (file)
index 5751dcd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "interop_dcp_reader.h"
-#include "dcp/interop_load_font.h"
-#include "xml.h"
-#include "dcp/font.h"
-#include <libcxml/cxml.h>
-#include <boost/foreach.hpp>
-
-using std::list;
-using boost::shared_ptr;
-using boost::optional;
-using namespace sub;
-
-InteropDCPReader::InteropDCPReader (boost::filesystem::path file)
-{
-       shared_ptr<cxml::Document> xml (new cxml::Document ("DCSubtitle"));
-       xml->read_file (file);
-       _id = xml->string_child ("SubtitleID");
-
-       _movie_title = xml->string_child ("MovieTitle");
-       _load_font_nodes = type_children<dcp::InteropLoadFont> (xml, "LoadFont");
-
-       parse_common (xml, optional<int> ());
-}
diff --git a/src/interop_dcp_reader.h b/src/interop_dcp_reader.h
deleted file mode 100644 (file)
index 1b8b447..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "dcp_reader.h"
-
-namespace sub {
-
-namespace dcp {
-       class InteropLoadFont;
-}
-
-class InteropDCPReader : public DCPReader
-{
-public:
-       InteropDCPReader (boost::filesystem::path file);
-
-private:
-       std::string _movie_title;
-       std::list<boost::shared_ptr<dcp::InteropLoadFont> > _load_font_nodes;
-};
-
-}
index 6c0259d94edb72224f4709908826eff5347407ba..5d38e4e9ec5a57365eed9c564bb89f59a8e1482e 100644 (file)
 */
 
 #include "reader_factory.h"
-#include "interop_dcp_reader.h"
-#include "smpte_dcp_reader.h"
 #include "stl_binary_reader.h"
 #include "stl_text_reader.h"
+#include "dcp_reader.h"
 #include <libxml++/libxml++.h>
 #include <boost/algorithm/string.hpp>
 #include <fstream>
@@ -39,21 +38,12 @@ sub::reader_factory (boost::filesystem::path file_name)
        transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
 
        if (ext == ".xml") {
-                /* XXX: unfortunate API weakness in libcxml; we can't find out what a
-                   file's root node name is.
-                */
-                xmlpp::DomParser parser (file_name.string ());
-                string const root = parser.get_document()->get_root_node()->get_name();
-                if (root == "DCSubtitle") {
-                        return shared_ptr<Reader> (new InteropDCPReader (file_name));
-                } else if (root == "SubtitleReel") {
-                        return shared_ptr<Reader> (new SMPTEDCPReader (file_name, false));
-                }
+               return shared_ptr<Reader> (new DCPReader (file_name));
         }
 
         if (ext == ".mxf") {
                 /* Assume this is some MXF-wrapped SMPTE subtitles */
-                return shared_ptr<Reader> (new SMPTEDCPReader (file_name, true));
+                return shared_ptr<Reader> (new DCPReader (file_name));
         }
 
        if (ext == ".stl") {
diff --git a/src/smpte_dcp_reader.cc b/src/smpte_dcp_reader.cc
deleted file mode 100644 (file)
index 7a3d94c..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "smpte_dcp_reader.h"
-#include "exceptions.h"
-#include "xml.h"
-#include "dcp/font.h"
-#include "dcp/smpte_load_font.h"
-#include <asdcp/KM_util.h>
-#include <asdcp/AS_DCP.h>
-#include <libcxml/cxml.h>
-#include <boost/foreach.hpp>
-
-using std::string;
-using std::list;
-using boost::shared_ptr;
-using namespace sub;
-
-SMPTEDCPReader::SMPTEDCPReader (boost::filesystem::path file, bool mxf)
-{
-       shared_ptr<cxml::Document> xml (new cxml::Document ("SubtitleReel"));
-
-       if (mxf) {
-               ASDCP::TimedText::MXFReader reader;
-               Kumu::Result_t r = reader.OpenRead (file.string().c_str ());
-               if (ASDCP_FAILURE (r)) {
-                       boost::throw_exception (MXFError ("could not open MXF file for reading"));
-               }
-
-               string s;
-               reader.ReadTimedTextResource (s, 0, 0);
-               xml->read_string (s);
-
-               ASDCP::WriterInfo info;
-               reader.FillWriterInfo (info);
-
-               char buffer[64];
-               Kumu::bin2UUIDhex (info.AssetUUID, ASDCP::UUIDlen, buffer, sizeof (buffer));
-               _id = buffer;
-       } else {
-               xml->read_file (file);
-               _id = xml->string_child("Id").substr (9);
-       }
-
-       _load_font_nodes = type_children<dcp::SMPTELoadFont> (xml, "LoadFont");
-
-       parse_common (xml, xml->number_child<int> ("TimeCodeRate"));
-}
diff --git a/src/smpte_dcp_reader.h b/src/smpte_dcp_reader.h
deleted file mode 100644 (file)
index e3257d3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "dcp_reader.h"
-
-namespace sub {
-
-namespace dcp {
-       class SMPTELoadFont;
-}
-
-class SMPTEDCPReader : public DCPReader
-{
-public:
-       SMPTEDCPReader (boost::filesystem::path file, bool mxf);
-
-private:
-       std::list<boost::shared_ptr<dcp::SMPTELoadFont> > _load_font_nodes;
-};
-
-}
index a22c7123d19b86c340a46108c61b363d7d7f3a81..162f537b457cc599df6ad150392f01c524510a4f 100644 (file)
@@ -17,14 +17,12 @@ def build(bld):
                  effect.cc
                  exceptions.cc
                  font_size.cc
-                 interop_dcp_reader.cc
                  iso6937.cc
                  iso6937_tables.cc
                  rational.cc
                  raw_subtitle.cc
                  reader.cc
                  reader_factory.cc
-                 smpte_dcp_reader.cc
                  ssa_reader.cc
                  stl_binary_reader.cc
                  stl_binary_tables.cc
@@ -37,11 +35,6 @@ def build(bld):
                  util.cc
                  vertical_reference.cc
                  vertical_position.cc
-                 dcp/font.cc
-                 dcp/interop_load_font.cc
-                 dcp/smpte_load_font.cc
-                 dcp/subtitle.cc
-                 dcp/text.cc
                  """
 
     headers = """
@@ -51,11 +44,9 @@ def build(bld):
               effect.h
               exceptions.h
               font_size.h
-              interop_dcp_reader.h
               rational.h
               raw_subtitle.h
               reader.h
-              smpte_dcp_reader.h
               ssa_reader.h
               stl_binary_tables.h
               stl_binary_reader.h
index aee51acf8f8ac22c037e6da14200d2451bb1ab0a..57d3d6616df26cc209489157bd06c8c37cfe3769 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-#include "interop_dcp_reader.h"
+#include "dcp_reader.h"
 #include "collect.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/optional/optional_io.hpp>
@@ -28,7 +28,7 @@ using boost::shared_ptr;
 /* Test reading of a DCP XML file */
 BOOST_AUTO_TEST_CASE (dcp_reader_test1)
 {
-       sub::InteropDCPReader reader ("test/data/test1.xml");
+       sub::DCPReader reader ("test/data/test1.xml");
        list<sub::Subtitle> subs = sub::collect<list<sub::Subtitle> > (reader.subtitles ());
 
        list<sub::Subtitle>::iterator i = subs.begin ();
@@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE (dcp_reader_test1)
 /* And another one */
 BOOST_AUTO_TEST_CASE (dcp_reader_test2)
 {
-       sub::InteropDCPReader reader ("test/data/test2.xml");
+       sub::DCPReader reader ("test/data/test2.xml");
        list<sub::Subtitle> subs = sub::collect<list<sub::Subtitle> > (reader.subtitles ());
 
        list<sub::Subtitle>::iterator i = subs.begin ();
index bf15bc6bf8522e542b5d3c5345bd2874a204c084..a461810830d8e83783587462bbc04bec52b7565e 100644 (file)
@@ -18,8 +18,7 @@
 */
 
 #include "test.h"
-#include "interop_dcp_reader.h"
-#include "smpte_dcp_reader.h"
+#include "dcp_reader.h"
 #include "stl_binary_writer.h"
 #include "collect.h"
 #include <boost/test/unit_test.hpp>
@@ -36,7 +35,7 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test1)
 
        boost::filesystem::path p = private_test / "fd586c30-6d38-48f2-8241-27359acf184c_sub.xml";
        sub::write_stl_binary (
-               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::DCPReader(p).subtitles ()),
                25,
                sub::LANGUAGE_FRENCH,
                "", "",
@@ -63,7 +62,7 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test2)
 
        boost::filesystem::path p = private_test / "93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.xml";
        sub::write_stl_binary (
-               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::DCPReader(p).subtitles ()),
                25,
                sub::LANGUAGE_FRENCH,
                "", "",
@@ -90,7 +89,7 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test3)
 
        boost::filesystem::path p = private_test / "Paddington_FTR_Subs_DE-FR_24fps_R1.xml";
        sub::write_stl_binary (
-               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::DCPReader(p).subtitles ()),
                25,
                sub::LANGUAGE_FRENCH,
                "", "",
@@ -112,7 +111,7 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test3)
 BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test4)
 {
        sub::write_stl_binary (
-               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader("test/data/test1.xml").subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::DCPReader("test/data/test1.xml").subtitles ()),
                25,
                sub::LANGUAGE_FRENCH,
                "", "",
@@ -134,7 +133,7 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test5)
 
        boost::filesystem::path p = private_test / "065d39ff-6723-4dbf-a94f-849cde82f5e1_sub.mxf";
        sub::write_stl_binary (
-               sub::collect<list<sub::Subtitle> > (sub::SMPTEDCPReader(p, true).subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::DCPReader(p).subtitles ()),
                25,
                sub::LANGUAGE_FRENCH,
                "", "",
@@ -161,7 +160,7 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test6)
 
        boost::filesystem::path p = private_test / "Paddington_FTR_FullSubs_DE_24fps.xml";
        sub::write_stl_binary (
-               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::DCPReader(p).subtitles ()),
                24,
                sub::LANGUAGE_GERMAN,
                "", "",
@@ -184,7 +183,7 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test7)
 {
        boost::filesystem::path p = "test/data/test3.xml";
        sub::write_stl_binary (
-               sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()),
+               sub::collect<list<sub::Subtitle> > (sub::DCPReader(p).subtitles ()),
                24,
                sub::LANGUAGE_GERMAN,
                "", "",
diff --git a/wscript b/wscript
index f37e2bbce9297788a26ea97f9c4fdad6762ccb9e..2f9388a1525dbd133599fc406a7d6fc3bb5c99b4 100644 (file)
--- a/wscript
+++ b/wscript
@@ -35,17 +35,19 @@ def configure(conf):
     conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL', mandatory=True)
 
     if conf.options.static:
+        conf.check_cfg(package='libcxml', atleast_version='0.14.0', args='--cflags', uselib_store='CXML', mandatory=True)
         conf.env.HAVE_CXML = 1
         conf.env.LIB_CXML = ['glibmm-2.4', 'glib-2.0', 'pcre', 'sigc-2.0', 'rt', 'xml++-2.6', 'xml2', 'pthread', 'lzma', 'dl', 'z']
         conf.env.STLIB_CXML = ['cxml']
-        conf.check_cfg(package='libcxml', atleast_version='0.14.0', args='--cflags', uselib_store='CXML', mandatory=True)
-        conf.env.HAVE_ASDCPLIB_CTH = 1
-        conf.env.STLIB_ASDCPLIB_CTH = ['asdcp-cth', 'kumu-cth']
-        conf.env.LIB_ASDCPLIB_CTH = ['ssl', 'crypto']
-        conf.check_cfg(package='libasdcp-cth', atleast_version='0.1.3', args='--cflags', uselib_store='ASDCPLIB_CTH', mandatory=True)
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.4.4', args='--cflags', uselib_store='DCP', mandatory=True)
+        conf.env.HAVE_DCP = 1
+        conf.env.STLIB_DCP = ['dcp-1.0']
+        conf.env.LIB_DCP = ['ssl', 'crypto']
     else:
         conf.check_cfg(package='libcxml', atleast_version='0.15.2', args='--cflags --libs', uselib_store='CXML', mandatory=True)
-        conf.check_cfg(package='libasdcp-cth', atleast_version='0.1.3', args='--cflags --libs', uselib_store='ASDCPLIB_CTH', mandatory=True)
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.4.4', args='--cflags --libs', uselib_store='DCP', mandatory=True)
+
+    conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
 
     boost_lib_suffix = ''
     if conf.env.TARGET_WINDOWS: