aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuigi Yucheng LIU <luigi.liu@laposte.net>2014-08-25 22:01:32 +0800
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-08-27 18:37:47 +0200
commit0ae08bf9a2ee1154db8097de5e6cc63710bdb704 (patch)
tree303998c14e70f82d1a6bb4fed4c80d11766c694a /src
parentc67b38712c02c25cb997df7a7b998203a2c6f9b4 (diff)
downloadODR-AudioEnc-0ae08bf9a2ee1154db8097de5e6cc63710bdb704.tar.gz
ODR-AudioEnc-0ae08bf9a2ee1154db8097de5e6cc63710bdb704.tar.bz2
ODR-AudioEnc-0ae08bf9a2ee1154db8097de5e6cc63710bdb704.zip
Improved management of Slideshow TID
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.
Diffstat (limited to 'src')
-rw-r--r--src/mot-encoder.cpp20
1 files 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 <vector>
#include <deque>
#include <list>
+#include <map> // for transmission history
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -266,6 +267,8 @@ int main(int argc, char *argv[])
MagickWandGenesis();
std::list<slide_metadata_t> slides_to_transmit;
+ std::map<std::string, int> transmission_history;
+ std::map<std::string, int>::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