+void
+Player::add_black_pieces ()
+{
+ list<DCPTimePeriod> full_left;
+ list<DCPTimePeriod> full_right;
+ list<DCPTimePeriod> full_both;
+ for (auto i: playlist()->content()) {
+ if (i->video && i->video->use() && i->can_be_played() && i->paths_valid()) {
+ auto period = DCPTimePeriod(i->position(), i->end(_film));
+ if (i->video->frame_type() == VideoFrameType::THREE_D_LEFT) {
+ full_left.push_back (period);
+ } else if (i->video->frame_type() == VideoFrameType::THREE_D_RIGHT) {
+ full_right.push_back (period);
+ } else {
+ full_both.push_back (period);
+ }
+ }
+ }
+
+ auto const whole = DCPTimePeriod(DCPTime(), _playback_length);
+
+ auto empty_both = subtract(subtract(subtract({whole}, full_left), full_right), full_both);
+ auto empty_left = subtract(subtract(subtract({whole}, full_left), full_both), empty_both);
+ auto empty_right = subtract(subtract(subtract({whole}, full_right), full_both), empty_both);
+
+ list<pair<DCPTimePeriod, Eyes>> periods;
+
+ for (auto left: empty_left) {
+ periods.push_back (make_pair(left, Eyes::LEFT));
+ }
+
+ for (auto right: empty_right) {
+ periods.push_back (make_pair(right, Eyes::RIGHT));
+ }
+
+ for (auto both: empty_both) {
+ periods.push_back (make_pair(both, Eyes::BOTH));
+ }
+
+ periods.sort([](std::pair<DCPTimePeriod, Eyes> const& a, std::pair<DCPTimePeriod, Eyes> const& b) {
+ return a.first < b.first;
+ });
+
+ for (auto period: periods) {
+ LOG_DEBUG_PLAYER("BlackContent in period %1", to_string(period.first));
+ auto content = make_shared<BlackContent>(period.first, period.second);
+ auto decoder = make_shared<BlackDecoder>(_film, content);
+ _pieces.push_back(make_shared<Piece>(content, decoder, FrameRateChange(_film->video_frame_rate(), _film->video_frame_rate())));
+ }
+}
+
+