Only add fonts to assets when they are required.
[dcpomatic.git] / src / lib / writer.cc
index b0bd4aaff4766c3ab27c7d859f97cd27c5988951..d42b23478f469e68e4c650f03b5606c918e2ec57 100644 (file)
@@ -23,6 +23,7 @@
 #include "audio_mapping.h"
 #include "compose.hpp"
 #include "config.h"
+#include "constants.h"
 #include "cross.h"
 #include "dcp_content_type.h"
 #include "dcp_video.h"
@@ -592,7 +593,7 @@ Writer::finish (boost::filesystem::path output_dcp)
        /* Add reels */
 
        for (auto& i: _reels) {
-               cpl->add (i.create_reel(_reel_assets, _fonts, _chosen_interop_font, output_dcp, _have_subtitles, _have_closed_captions));
+               cpl->add(i.create_reel(_reel_assets, output_dcp, _have_subtitles, _have_closed_captions));
        }
 
        /* Add metadata */
@@ -651,14 +652,12 @@ Writer::finish (boost::filesystem::path output_dcp)
                field = dcp::MCASoundField::SEVEN_POINT_ONE;
        }
 
-       dcp::MainSoundConfiguration msc (field, film()->audio_channels());
+       dcp::MainSoundConfiguration msc(field, MAX_DCP_AUDIO_CHANNELS);
        for (auto i: film()->mapped_audio_channels()) {
-               if (static_cast<int>(i) < film()->audio_channels()) {
-                       msc.set_mapping (i, static_cast<dcp::Channel>(i));
-               }
+               msc.set_mapping(i, static_cast<dcp::Channel>(i));
        }
 
-       cpl->set_main_sound_configuration (msc.to_string());
+       cpl->set_main_sound_configuration(msc);
        cpl->set_main_sound_sample_rate (film()->audio_frame_rate());
        cpl->set_main_picture_stored_area (film()->frame_size());
 
@@ -843,7 +842,7 @@ Writer::write (PlayerText text, TextType type, optional<DCPTextTrack> track, DCP
                period = back_off(period);
        }
 
-       (*reel)->write(text, type, track, period, _fonts);
+       (*reel)->write(text, type, track, period, _fonts, _chosen_interop_font);
 }
 
 
@@ -1017,7 +1016,7 @@ Writer::write_hanging_text (ReelWriter& reel)
        vector<HangingText> new_hanging_texts;
        for (auto i: _hanging_texts) {
                if (i.period.from == reel.period().from) {
-                       reel.write (i.text, i.type, i.track, i.period, _fonts);
+                       reel.write(i.text, i.type, i.track, i.period, _fonts, _chosen_interop_font);
                } else {
                        new_hanging_texts.push_back (i);
                }