From 1128833ac03260534ba8fb0bb373cc5909a1946c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Thu, 3 Jul 2014 19:26:01 +0200 Subject: mot-encoder sorts slides in alphabetical order --- src/mot-encoder.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp index d7a2509..97a6f20 100644 --- a/src/mot-encoder.cpp +++ b/src/mot-encoder.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,12 @@ struct slide_metadata_t { // index, values from 0 to 9999, rolls over int fidx; + + // This is used to define the order in which several discovered + // slides are transmitted + bool operator<(const slide_metadata_t& other) const { + return this->filepath < other.filepath; + } }; /* typedef struct { @@ -247,7 +254,7 @@ int main(int argc, char *argv[]) MagickWandGenesis(); - std::deque slides_to_transmit; + std::list slides_to_transmit; fidx = 0; while(1) { @@ -279,7 +286,11 @@ int main(int argc, char *argv[]) } } - std::deque::iterator it; + // Sort the list in alphabetic order + slides_to_transmit.sort(); + + // Encode the slides + std::list::iterator it; for (it = slides_to_transmit.begin(); it != slides_to_transmit.end(); ++it) { -- cgit v1.2.3