2 Copyright (C) 2013-2017 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "ffmpeg_subtitle_stream.h"
23 #include <dcp/raw_convert.h>
24 DCPOMATIC_DISABLE_WARNINGS
25 #include <libxml++/libxml++.h>
26 DCPOMATIC_ENABLE_WARNINGS
34 using dcp::raw_convert;
36 /** Construct a SubtitleStream from a value returned from to_string().
37 * @param node String returned from to_string().
38 * @param version State file version.
40 FFmpegSubtitleStream::FFmpegSubtitleStream (cxml::ConstNodePtr node, int version)
44 boost::mutex::scoped_lock lm (_mutex);
45 for (auto i: node->node_children ("Colour")) {
46 _colours[RGBA(i->node_child("From"))] = RGBA (i->node_child("To"));
52 FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const
54 FFmpegStream::as_xml (root);
56 boost::mutex::scoped_lock lm (_mutex);
57 for (map<RGBA, RGBA>::const_iterator i = _colours.begin(); i != _colours.end(); ++i) {
58 xmlpp::Node* node = root->add_child("Colour");
59 i->first.as_xml (node->add_child("From"));
60 i->second.as_xml (node->add_child("To"));
65 FFmpegSubtitleStream::colours () const
67 boost::mutex::scoped_lock lm (_mutex);
72 FFmpegSubtitleStream::set_colour (RGBA from, RGBA to)
74 boost::mutex::scoped_lock lm (_mutex);