2 Copyright (C) 2014-2019 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 "player_text.h"
24 #include "dcpomatic_socket.h"
26 #include <dcp/raw_convert.h>
27 #include <libxml++/libxml++.h>
28 #include <boost/foreach.hpp>
31 using boost::shared_ptr;
32 using dcp::raw_convert;
33 using namespace dcpomatic;
36 PlayerText::add_metadata (xmlpp::Node* node) const
38 BOOST_FOREACH (shared_ptr<Font> i, fonts) {
39 /* XXX: transferring a font file for every frame that needs it seems a bit wasteful,
40 but probably not so bad in the great scheme of things.
42 i->transfer_xml (node->add_child("Font"));
45 BOOST_FOREACH (BitmapText i, bitmap) {
46 i.transfer_xml (node->add_child("Bitmap"));
49 BOOST_FOREACH (StringText i, string) {
50 i.transfer_xml (node->add_child("String"));
55 PlayerText::send_binary (shared_ptr<Socket> socket) const
57 BOOST_FOREACH (shared_ptr<Font> i, fonts) {
58 i->transfer_binary (socket);
61 BOOST_FOREACH (BitmapText i, bitmap) {
62 i.transfer_binary (socket);
67 PlayerText::add_fonts (list<shared_ptr<Font> > fonts_)
69 BOOST_FOREACH (shared_ptr<Font> i, fonts_) {
71 BOOST_FOREACH (shared_ptr<Font> j, fonts) {
83 operator== (PlayerText const & a, PlayerText const & b)
85 return deep_equals(a.fonts, b.fonts) && deep_equals(a.bitmap, b.bitmap) && deep_equals(a.string, b.string);
89 operator!= (PlayerText const & a, PlayerText const & b)