Supporters update.
[dcpomatic.git] / src / lib / playlist.cc
index 80037b5755fcbfc0057a1bbd30392b9d37312d68..85957e106803be886e4f5a85016f15cc21282282 100644 (file)
@@ -629,32 +629,26 @@ void
 Playlist::move_later (shared_ptr<const Film> film, shared_ptr<Content> c)
 {
        auto cont = content ();
-       auto i = cont.begin();
-       while (i != cont.end() && *i != c) {
-               ++i;
-       }
 
-       DCPOMATIC_ASSERT (i != cont.end());
-
-       ContentList::iterator next = i;
-       ++next;
+       auto iter = std::find(cont.begin(), cont.end(), c);
+       DCPOMATIC_ASSERT(iter != cont.end());
 
+       ContentList::iterator next = std::next(iter);
        if (next == cont.end()) {
+               /* This content is already at the end */
                return;
        }
 
-       auto next_c = *next;
-
-       next_c->set_position (film, c->position());
-       c->set_position (film, c->position() + next_c->length_after_trim(film));
+       (*next)->set_position(film, c->position());
+       c->set_position(film, c->position() + (*next)->length_after_trim(film));
 }
 
 
 int64_t
 Playlist::required_disk_space (shared_ptr<const Film> film, int j2k_bandwidth, int audio_channels, int audio_frame_rate) const
 {
-       int64_t video = uint64_t (j2k_bandwidth / 8) * length(film).seconds();
-       int64_t audio = uint64_t (audio_channels * audio_frame_rate * 3) * length(film).seconds();
+       int64_t video = uint64_t(j2k_bandwidth / 8) * length(film).seconds();
+       int64_t audio = uint64_t(audio_channels) * audio_frame_rate * 3 * length(film).seconds();
 
        for (auto i: content()) {
                auto d = dynamic_pointer_cast<DCPContent> (i);
@@ -663,7 +657,7 @@ Playlist::required_disk_space (shared_ptr<const Film> film, int j2k_bandwidth, i
                                video -= uint64_t (j2k_bandwidth / 8) * d->length_after_trim(film).seconds();
                        }
                        if (d->reference_audio()) {
-                               audio -= uint64_t (audio_channels * audio_frame_rate * 3) * d->length_after_trim(film).seconds();
+                               audio -= uint64_t(audio_channels) * audio_frame_rate * 3 * d->length_after_trim(film).seconds();
                        }
                }
        }
@@ -690,7 +684,7 @@ Playlist::content_summary (shared_ptr<const Film> film, DCPTimePeriod period) co
                }
 
                if (score > best_score) {
-                       best_summary = i->path(0).leaf().string();
+                       best_summary = i->path(0).filename().string();
                        best_score = score;
                }
        }