No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / lib / subtitle_content.cc
index 2066793fb94e79b966d53aa73bc0c85c6f56558f..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>
@@ -47,13 +47,12 @@ int const SubtitleContentProperty::USE = 504;
 int const SubtitleContentProperty::BURN = 505;
 int const SubtitleContentProperty::LANGUAGE = 506;
 int const SubtitleContentProperty::FONTS = 507;
-int const SubtitleContentProperty::VIDEO_FRAME_RATE = 508;
-int const SubtitleContentProperty::COLOUR = 509;
-int const SubtitleContentProperty::OUTLINE = 510;
-int const SubtitleContentProperty::OUTLINE_COLOUR = 511;
+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)
@@ -67,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)
@@ -86,7 +95,6 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film,
                node->optional_number_child<int>("OutlineGreen").get_value_or(255),
                node->optional_number_child<int>("OutlineBlue").get_value_or(255)
                )
-       , _frame_rate (node->optional_number_child<double>("SubtitleFrameRate"))
 {
        if (version >= 32) {
                _use = node->bool_child ("UseSubtitles");
@@ -117,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);
@@ -316,27 +324,3 @@ SubtitleContent::set_language (string language)
 {
        maybe_set (_language, language, SubtitleContentProperty::LANGUAGE);
 }
-
-void
-SubtitleContent::set_video_frame_rate (double r)
-{
-       maybe_set (_frame_rate, r, SubtitleContentProperty::VIDEO_FRAME_RATE);
-}
-
-double
-SubtitleContent::video_frame_rate () const
-{
-       {
-               boost::mutex::scoped_lock lm (_mutex);
-               if (_frame_rate) {
-                       return _frame_rate.get ();
-               }
-       }
-
-       /* No frame rate specified, so assume this content has been
-          prepared for any concurrent video content.
-       */
-       shared_ptr<const Film> film = _film.lock ();
-       DCPOMATIC_ASSERT (film);
-       return film->active_frame_rate_change(_parent->position()).source;
-}