Add add_fonts() to Piece.
authorCarl Hetherington <cth@carlh.net>
Tue, 23 Jun 2020 20:50:54 +0000 (22:50 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 1 Dec 2020 15:38:52 +0000 (16:38 +0100)
src/lib/piece.h
src/lib/player.cc

index deeecfa2f82ce7f77f5ecc7efc77634a48d03f98..31fbfc2568354f314a146dda4c2ccea5aeade3b7 100644 (file)
@@ -45,6 +45,8 @@ public:
        dcpomatic::ContentTime dcp_to_content_time (boost::shared_ptr<const Film> film, dcpomatic::DCPTime t) const;
        dcpomatic::DCPTime content_time_to_dcp (dcpomatic::ContentTime t) const;
 
+       void add_fonts (std::list<boost::shared_ptr<dcpomatic::Font> >& fonts) const;
+
 private:
        std::vector<boost::shared_ptr<Content> > _content;
        std::vector<boost::shared_ptr<Decoder> > _decoder;
index 2aa23bc1588f66599d07482d7f64a4009589e6fe..9445d63b8cb0ce678595b705dac57fe4ca3ed981 100644 (file)
@@ -394,13 +394,7 @@ Player::get_subtitle_fonts ()
 
        list<shared_ptr<Font> > fonts;
        BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
-               BOOST_FOREACH (shared_ptr<TextContent> j, i->content->text) {
-                       /* XXX: things may go wrong if there are duplicate font IDs
-                          with different font files.
-                       */
-                       list<shared_ptr<Font> > f = j->fonts ();
-                       copy (f.begin(), f.end(), back_inserter (fonts));
-               }
+               i->add_fonts (fonts);
        }
 
        return fonts;