diff options
-rw-r--r-- | src/odr-padenc.cpp | 4 | ||||
-rw-r--r-- | src/sls.cpp | 20 | ||||
-rw-r--r-- | src/sls.h | 5 |
3 files changed, 19 insertions, 10 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp index 866b93e..d068e49 100644 --- a/src/odr-padenc.cpp +++ b/src/odr-padenc.cpp @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) PADPacketizer pad_packetizer(padlen); DLSManager dls_manager(&pad_packetizer); - SLSManager sls_manager; + SLSManager sls_manager(&pad_packetizer); std::list<slide_metadata_t> slides_to_transmit; History slides_history(History::MAXHISTORYLEN); @@ -310,7 +310,7 @@ int main(int argc, char *argv[]) it != slides_to_transmit.cend(); ++it) { - ret = sls_manager.encodeFile(pad_packetizer, it->filepath, it->fidx, raw_slides); + ret = sls_manager.encodeFile(it->filepath, it->fidx, raw_slides); if (ret != 1) fprintf(stderr, "ODR-PadEnc Error: cannot encode file '%s'\n", it->filepath.c_str()); diff --git a/src/sls.cpp b/src/sls.cpp index 024e664..28b0997 100644 --- a/src/sls.cpp +++ b/src/sls.cpp @@ -33,6 +33,7 @@ // --- History ----------------------------------------------------------------- const size_t History::MAXHISTORYLEN = 50; // How many slides to keep in history + int History::find(const fingerprint_t& fp) const { size_t i; @@ -47,6 +48,7 @@ int History::find(const fingerprint_t& fp) const return -1; } + void History::add(fingerprint_t& fp) { m_database.push_back(fp); @@ -56,6 +58,7 @@ void History::add(fingerprint_t& fp) } } + void History::disp_database() { size_t id; @@ -72,6 +75,7 @@ void History::disp_database() printf("-----------------\n"); } + int History::get_fidx(const char* filepath) { fingerprint_t fp; @@ -117,6 +121,7 @@ MOTHeader::MOTHeader(size_t body_size, int content_type, int content_subtype) data[6] |= content_subtype & 0xFF; } + void MOTHeader::IncrementHeaderSize(size_t size) { header_size += size; @@ -129,6 +134,7 @@ void MOTHeader::IncrementHeaderSize(size_t size) { data[5] |= (header_size << 7) & 0x80; } + void MOTHeader::AddExtensionFixedSize(int pli, int param_id, const uint8_t* data_field, size_t data_field_len) { AddParamHeader(pli, param_id); @@ -138,6 +144,7 @@ void MOTHeader::AddExtensionFixedSize(int pli, int param_id, const uint8_t* data IncrementHeaderSize(1 + data_field_len); } + void MOTHeader::AddExtensionVarSize(int param_id, const uint8_t* data_field, size_t data_field_len) { AddParamHeader(0b11, param_id); @@ -156,6 +163,7 @@ void MOTHeader::AddExtensionVarSize(int param_id, const uint8_t* data_field, siz IncrementHeaderSize(1 + (ext ? 2 : 1) + data_field_len); } + void MOTHeader::AddExtension(int param_id, const uint8_t* data_field, size_t data_field_len) { int pli; @@ -189,7 +197,6 @@ const int SLSManager::MINQUALITY = 40; // Do not allow the image comp const std::string SLSManager::SLS_PARAMS_SUFFIX = ".sls_params"; - void SLSManager::warnOnSmallerImage(size_t height, size_t width, const std::string& fname) { if (height < 240 || width < 320) fprintf(stderr, "ODR-PadEnc Warning: Image '%s' smaller than recommended size (%zu x %zu < 320 x 240 px)\n", fname.c_str(), width, height); @@ -278,7 +285,8 @@ size_t SLSManager::resizeImage(MagickWand* m_wand, unsigned char** blob, const s } #endif -int SLSManager::encodeFile(PADPacketizer& pad_packetizer, const std::string& fname, int fidx, bool raw_slides) + +int SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides) { int ret = 0; int nseg, lastseglen, i, last, curseglen; @@ -479,8 +487,8 @@ int SLSManager::encodeFile(PADPacketizer& pad_packetizer, const std::string& fna mscdg = packMscDG(&msc); dgli = PADPacketizer::CreateDataGroupLengthIndicator(mscdg->data.size()); - pad_packetizer.AddDG(dgli, false); - pad_packetizer.AddDG(mscdg, false); + pad_packetizer->AddDG(dgli, false); + pad_packetizer->AddDG(mscdg, false); for (i = 0; i < nseg; i++) { curseg = blob + i * MAXSEGLEN; @@ -497,8 +505,8 @@ int SLSManager::encodeFile(PADPacketizer& pad_packetizer, const std::string& fna mscdg = packMscDG(&msc); dgli = PADPacketizer::CreateDataGroupLengthIndicator(mscdg->data.size()); - pad_packetizer.AddDG(dgli, false); - pad_packetizer.AddDG(mscdg, false); + pad_packetizer->AddDG(dgli, false); + pad_packetizer->AddDG(mscdg, false); } ret = 1; @@ -213,6 +213,7 @@ private: unsigned short int datalen); DATA_GROUP* packMscDG(MSCDG* msc); + PADPacketizer* pad_packetizer; int cindex_header; int cindex_body; public: @@ -222,9 +223,9 @@ public: static const int MINQUALITY; static const std::string SLS_PARAMS_SUFFIX; - SLSManager() : cindex_header(0), cindex_body(0) {} + SLSManager(PADPacketizer* pad_packetizer) : pad_packetizer(pad_packetizer), cindex_header(0), cindex_body(0) {} - int encodeFile(PADPacketizer& pad_packetizer, const std::string& fname, int fidx, bool raw_slides); + int encodeFile(const std::string& fname, int fidx, bool raw_slides); }; #endif /* SLS_H_ */ |