Tidying.
[dcpomatic.git] / src / lib / shuffler.cc
index a13e7f6de82c7f539f673f1e5dd9970a6a64141a..880826d4485c89ab2ac385bd32a802c0b8f21959 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
-#include "shuffler.h"
+
 #include "content_video.h"
 #include "dcpomatic_assert.h"
 #include "dcpomatic_log.h"
+#include "shuffler.h"
 #include <string>
 #include <iostream>
 
+
 using std::make_pair;
+using std::shared_ptr;
 using std::string;
 using std::weak_ptr;
-using std::shared_ptr;
 using boost::optional;
 
+
 int const Shuffler::_max_size = 64;
 
-struct Comparator
-{
-       bool operator()(Shuffler::Store const & a, Shuffler::Store const & b) {
-               if (a.second.frame != b.second.frame) {
-                       return a.second.frame < b.second.frame;
-               }
-               return a.second.eyes < b.second.eyes;
-       }
-};
 
 void
 Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
@@ -54,7 +48,7 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
                return;
        }
 
-       shared_ptr<Piece> piece = weak_piece.lock ();
+       auto piece = weak_piece.lock ();
        DCPOMATIC_ASSERT (piece);
 
        if (!_last && video.eyes == Eyes::LEFT) {
@@ -66,7 +60,12 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
        }
 
        _store.push_back (make_pair (weak_piece, video));
-       _store.sort (Comparator());
+       _store.sort ([](Shuffler::Store const & a, Shuffler::Store const & b) {
+               if (a.second.frame != b.second.frame) {
+                       return a.second.frame < b.second.frame;
+               }
+               return a.second.eyes < b.second.eyes;
+       });
 
        while (true) {
 
@@ -103,6 +102,7 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
        }
 }
 
+
 void
 Shuffler::clear ()
 {
@@ -111,6 +111,7 @@ Shuffler::clear ()
        _last = optional<ContentVideo>();
 }
 
+
 void
 Shuffler::flush ()
 {