/*
Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of libdcp.
+
+ libdcp 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,
+ libdcp 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 libdcp. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+
+ You must obey the GNU General Public License in all respects
+ for all of the code used other than OpenSSL. If you modify
+ file(s) with this exception, you may extend this exception to your
+ version of the file(s), but you are not obligated to do so. If you
+ do not wish to do so, delete this exception statement from your
+ version. If you delete this exception statement from all source
+ files in the program, then also delete it here.
*/
#include "interop_subtitle_asset.h"
_movie_title = xml->string_child ("MovieTitle");
_load_font_nodes = type_children<dcp::InteropLoadFontNode> (xml, "LoadFont");
- list<cxml::NodePtr> f = xml->node_children ("Font");
list<shared_ptr<dcp::FontNode> > font_nodes;
- BOOST_FOREACH (cxml::NodePtr& i, f) {
- font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, 250)));
+ BOOST_FOREACH (cxml::NodePtr const & i, xml->node_children ("Font")) {
+ font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, optional<int>(), INTEROP)));
+ }
+
+ list<shared_ptr<dcp::SubtitleNode> > subtitle_nodes;
+ BOOST_FOREACH (cxml::NodePtr const & i, xml->node_children ("Subtitle")) {
+ subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, optional<int>(), INTEROP)));
}
- parse_subtitles (xml, font_nodes);
+ parse_subtitles (xml, font_nodes, subtitle_nodes);
}
InteropSubtitleAsset::InteropSubtitleAsset ()
}
-Glib::ustring
+string
InteropSubtitleAsset::xml_as_string () const
{
xmlpp::Document doc;
throw FileError ("Could not open file for writing", p, -1);
}
- Glib::ustring const s = xml_as_string ();
- fwrite (s.c_str(), 1, s.bytes(), f);
+ string const s = xml_as_string ();
+ /* length() here gives bytes not characters */
+ fwrite (s.c_str(), 1, s.length(), f);
fclose (f);
_file = p;
++j;
}
if (j != _fonts.end ()) {
- fwrite (j->data.data.get(), 1, j->data.size, f);
+ fwrite (j->data.data().get(), 1, j->data.size(), f);
j->file = file;
}
fclose (f);
}
void
-InteropSubtitleAsset::resolve_fonts (list<shared_ptr<Object> > objects)
+InteropSubtitleAsset::resolve_fonts (list<shared_ptr<Asset> > assets)
{
- BOOST_FOREACH (shared_ptr<Object> i, objects) {
+ BOOST_FOREACH (shared_ptr<Asset> i, assets) {
shared_ptr<FontAsset> font = dynamic_pointer_cast<FontAsset> (i);
if (!font) {
continue;