From 280568029622c5e99d4b90d55b0cebe12cb24e93 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 8 Aug 2023 18:32:03 +0200 Subject: [PATCH] Move ContentSorter out of the header, and use a default constructor. --- src/lib/playlist.cc | 39 ++++++++++++++++++--------------------- src/lib/playlist.h | 9 ++------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index df7c95cc0..80037b575 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -58,10 +58,26 @@ using namespace boost::placeholders; #endif -Playlist::Playlist () +class ContentSorter { +public: + bool operator()(shared_ptr a, shared_ptr b) + { + if (a->position() != b->position()) { + return a->position() < b->position(); + } -} + /* Put video before audio if they start at the same time */ + if (a->video && !b->video) { + return true; + } else if (!a->video && b->video) { + return false; + } + + /* Last resort */ + return a->digest() < b->digest(); + } +}; Playlist::~Playlist () @@ -542,25 +558,6 @@ Playlist::set_sequence (bool s) } -bool -ContentSorter::operator() (shared_ptr a, shared_ptr b) -{ - if (a->position() != b->position()) { - return a->position() < b->position(); - } - - /* Put video before audio if they start at the same time */ - if (a->video && !b->video) { - return true; - } else if (!a->video && b->video) { - return false; - } - - /* Last resort */ - return a->digest() < b->digest(); -} - - /** @return content in ascending order of position */ ContentList Playlist::content () const diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 2d68d3f39..e2662eb45 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -36,12 +36,6 @@ class Film; -struct ContentSorter -{ - bool operator() (std::shared_ptr a, std::shared_ptr b); -}; - - /** @class Playlist * @brief A set of Content objects with knowledge of how they should be arranged into * a DCP. @@ -49,7 +43,8 @@ struct ContentSorter class Playlist { public: - Playlist (); + Playlist() = default; + ~Playlist (); Playlist (Playlist const&) = delete; -- 2.30.2