Add some new channels to the enum.
[libdcp.git] / src / interop_subtitle_asset.cc
index 6c9c6b42a3be235eb817a183a8f59452badbbe59..f7e3896528cafc8fadd184b39d5a4789cae92c61 100644 (file)
@@ -137,22 +137,24 @@ InteropSubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptio
                return false;
        }
 
-       list<shared_ptr<InteropLoadFontNode> >::const_iterator i = _load_font_nodes.begin ();
-       list<shared_ptr<InteropLoadFontNode> >::const_iterator j = other->_load_font_nodes.begin ();
+       if (!options.load_font_nodes_can_differ) {
+               list<shared_ptr<InteropLoadFontNode> >::const_iterator i = _load_font_nodes.begin ();
+               list<shared_ptr<InteropLoadFontNode> >::const_iterator j = other->_load_font_nodes.begin ();
+
+               while (i != _load_font_nodes.end ()) {
+                       if (j == other->_load_font_nodes.end ()) {
+                               note (DCP_ERROR, "<LoadFont> nodes differ");
+                               return false;
+                       }
 
-       while (i != _load_font_nodes.end ()) {
-               if (j == other->_load_font_nodes.end ()) {
-                       note (DCP_ERROR, "<LoadFont> nodes differ");
-                       return false;
-               }
+                       if (**i != **j) {
+                               note (DCP_ERROR, "<LoadFont> nodes differ");
+                               return false;
+                       }
 
-               if (**i != **j) {
-                       note (DCP_ERROR, "<LoadFont> nodes differ");
-                       return false;
+                       ++i;
+                       ++j;
                }
-
-               ++i;
-               ++j;
        }
 
        if (_movie_title != other->_movie_title) {
@@ -274,3 +276,21 @@ InteropSubtitleAsset::add_to_pkl (shared_ptr<PKL> pkl, boost::filesystem::path r
                }
        }
 }
+
+
+void
+InteropSubtitleAsset::set_font_file (string load_id, boost::filesystem::path file)
+{
+       BOOST_FOREACH (Font& i, _fonts) {
+               if (i.load_id == load_id) {
+                       i.file = file;
+               }
+       }
+
+       BOOST_FOREACH (shared_ptr<InteropLoadFontNode> i, _load_font_nodes) {
+               if (i->id == load_id) {
+                       i->uri = file.filename().string();
+               }
+       }
+}
+