/*
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/>.
*/
#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>
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)
}
-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)
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");
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);
{
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;
-}