From 0ae08bf9a2ee1154db8097de5e6cc63710bdb704 Mon Sep 17 00:00:00 2001 From: Luigi Yucheng LIU Date: Mon, 25 Aug 2014 22:01:32 +0800 Subject: Improved management of Slideshow TID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A slide receives a new TID only when it is completely new, re-transmitted images retain their TID. Une diapositive recoit un nouveau TID seulement quand elle est complètement nouvelle, les images re-transmises conservent leur TID. --- src/mot-encoder.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp index 2b73c10..493c3d2 100644 --- a/src/mot-encoder.cpp +++ b/src/mot-encoder.cpp @@ -33,6 +33,7 @@ #include #include #include +#include // for transmission history #include #include #include @@ -266,6 +267,8 @@ int main(int argc, char *argv[]) MagickWandGenesis(); std::list slides_to_transmit; + std::map transmission_history; + std::map::iterator it_transmission_history; fidx = 0; while(1) { @@ -287,7 +290,19 @@ int main(int argc, char *argv[]) slide_metadata_t md; md.filepath = imagepath; - md.fidx = fidx; + + // if an image was transmitted before, it resumes its old file identity + it_transmission_history = transmission_history.find(pDirent->d_name); + if (it_transmission_history != transmission_history.end()) { + md.fidx = it_transmission_history->second; + } + else { + md.fidx = fidx; + + // update transmission history + transmission_history[pDirent->d_name] = md.fidx; + fidx++; + } slides_to_transmit.push_back(md); @@ -295,7 +310,6 @@ int main(int argc, char *argv[]) fprintf(stderr, "mot-encoder found slide %s\n", imagepath); } - fidx++; } } @@ -334,7 +348,7 @@ int main(int argc, char *argv[]) } slides_to_transmit.resize(0); - fidx = 0; // avoid increasing constantly TID + } else if (dls_file) { // only DLS // Always retransmit DLS, we want it to be updated frequently -- cgit v1.2.3