Cleanup: remove unused variable.
[dcpomatic.git] / src / lib / writer.cc
index 2dd46f0b2324f4516364b319ab2a1561542cba26..a369447232f5aa99aa03d70a10fa5232d090833b 100644 (file)
@@ -153,19 +153,11 @@ Writer::write (shared_ptr<const Data> encoded, Frame frame, Eyes eyes)
        qi.reel = video_reel (frame);
        qi.frame = frame - _reels[qi.reel].start ();
 
-       if (film()->three_d() && eyes == Eyes::BOTH) {
-               /* 2D material in a 3D DCP; fake the 3D */
-               qi.eyes = Eyes::LEFT;
-               _queue.push_back (qi);
-               ++_queued_full_in_memory;
-               qi.eyes = Eyes::RIGHT;
-               _queue.push_back (qi);
-               ++_queued_full_in_memory;
-       } else {
-               qi.eyes = eyes;
-               _queue.push_back (qi);
-               ++_queued_full_in_memory;
-       }
+       DCPOMATIC_ASSERT((film()->three_d() && eyes != Eyes::BOTH) || (!film()->three_d() && eyes == Eyes::BOTH));
+
+       qi.eyes = eyes;
+       _queue.push_back(qi);
+       ++_queued_full_in_memory;
 
        /* Now there's something to do: wake anything wait()ing on _empty_condition */
        _empty_condition.notify_all ();
@@ -657,14 +649,17 @@ Writer::finish (boost::filesystem::path output_dcp)
                cpl->set_sign_language_video_language (*film()->sign_language_video_language());
        }
 
-       auto ac = film()->mapped_audio_channels();
-       dcp::MCASoundField field = (
-               find(ac.begin(), ac.end(), static_cast<int>(dcp::Channel::BSL)) != ac.end() ||
-               find(ac.begin(), ac.end(), static_cast<int>(dcp::Channel::BSR)) != ac.end()
-               ) ? dcp::MCASoundField::SEVEN_POINT_ONE : dcp::MCASoundField::FIVE_POINT_ONE;
+       dcp::MCASoundField field;
+       if (film()->audio_channels() == 2) {
+               field = dcp::MCASoundField::STEREO;
+       } else if (film()->audio_channels() <= 6) {
+               field = dcp::MCASoundField::FIVE_POINT_ONE;
+       } else {
+               field = dcp::MCASoundField::SEVEN_POINT_ONE;
+       }
 
        dcp::MainSoundConfiguration msc (field, film()->audio_channels());
-       for (auto i: ac) {
+       for (auto i: film()->mapped_audio_channels()) {
                if (static_cast<int>(i) < film()->audio_channels()) {
                        msc.set_mapping (i, static_cast<dcp::Channel>(i));
                }
@@ -676,8 +671,8 @@ Writer::finish (boost::filesystem::path output_dcp)
 
        auto active_area = film()->active_area();
        if (active_area.width > 0 && active_area.height > 0) {
-               /* It's not allowed to have a zero active area width or height */
-               cpl->set_main_picture_active_area (active_area);
+               /* It's not allowed to have a zero active area width or height, and the sizes must be multiples of 2 */
+               cpl->set_main_picture_active_area({ active_area.width & ~1, active_area.height & ~1});
        }
 
        auto sl = film()->subtitle_languages().second;