No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / lib / subtitle_content.cc
index 228376c343a33dcfd7cde79ba513163a02815f94..a45b0a24f5a92f08eb10762e28ad4bb8d0a0624e 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic 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,
+    DCP-o-matic 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.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
@@ -24,7 +25,6 @@
 #include "font.h"
 #include "raw_convert.h"
 #include "content.h"
-#include "film.h"
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
@@ -51,8 +51,8 @@ int const SubtitleContentProperty::COLOUR = 508;
 int const SubtitleContentProperty::OUTLINE = 509;
 int const SubtitleContentProperty::OUTLINE_COLOUR = 510;
 
-SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film)
-       : ContentPart (parent, film)
+SubtitleContent::SubtitleContent (Content* parent)
+       : ContentPart (parent)
        , _use (false)
        , _burn (false)
        , _x_offset (0)
@@ -66,8 +66,18 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film)
 
 }
 
-SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
-       : ContentPart (parent, film)
+shared_ptr<SubtitleContent>
+SubtitleContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
+{
+       if (!node->optional_number_child<double>("SubtitleXOffset") && !node->optional_number_child<double>("SubtitleOffset")) {
+               return shared_ptr<SubtitleContent> ();
+       }
+
+       return shared_ptr<SubtitleContent> (new SubtitleContent (parent, node, version));
+}
+
+SubtitleContent::SubtitleContent (Content* parent, cxml::ConstNodePtr node, int version)
+       : ContentPart (parent)
        , _use (false)
        , _burn (false)
        , _x_offset (0)
@@ -115,8 +125,8 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film,
        connect_to_fonts ();
 }
 
-SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
-       : ContentPart (parent, film)
+SubtitleContent::SubtitleContent (Content* parent, vector<shared_ptr<Content> > c)
+       : ContentPart (parent)
 {
        shared_ptr<SubtitleContent> ref = c[0]->subtitle;
        DCPOMATIC_ASSERT (ref);