From 63e1812a2fefdf37cfd58d6257f62acd1210c5c5 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 2 Oct 2021 15:07:40 +0100 Subject: [PATCH] Log lines, comments --- osdopenvg.cc | 4 ++-- osdvector.cc | 36 +++++++++++++++++++----------------- osdvector.h | 3 +++ surfacevector.cc | 8 +++++--- surfacevector.h | 1 + tcp.cc | 2 -- 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/osdopenvg.cc b/osdopenvg.cc index 8717d4e..795988d 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -1447,7 +1447,7 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) if (info->lindex & 0xffffffff) static_image = false; Message* m = new Message(); - // We have a pictures! send a message to ourself, to switch to gui thread // FIXME MQSUB + // We have a pictures! send a message to ourself, to switch to gui thread m->from = this; m->to = this; m->data = reinterpret_cast(handle); @@ -1462,7 +1462,7 @@ unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command) m->message = Message::NEW_PICTURE_STATIC; m->tag = info->lindex >> 32LL; } - MessageQueue::getInstance()->postMessage(m); // inform control about new picture + MessageQueue::getInstance()->postMessage(m); delete info; break; diff --git a/osdvector.cc b/osdvector.cc index 57621a7..71a6d30 100644 --- a/osdvector.cc +++ b/osdvector.cc @@ -116,6 +116,8 @@ bool MagickDecoder::getDecodedPicture(struct OsdVector::PictureInfo& pict_inf) OsdVector::OsdVector() { + logger = LogNT::getInstance(); + setlocale(LC_CTYPE, "C.UTF-8"); #ifdef PICTURE_DECODER_MAGICK reader.addDecoder(new MagickDecoder(&reader)); @@ -143,7 +145,7 @@ bool OsdVector::screenShot(const char* fileName) if (!screenShotInternal(mem, width, height, true)) { - LogNT::getInstance()->debug(TAG, "Screenshot failed!"); + logger->debug(TAG, "Screenshot failed!"); free(mem); return false; } @@ -154,7 +156,7 @@ bool OsdVector::screenShot(const char* fileName) } catch ( Exception& error_ ) { - LogNT::getInstance()->debug("MagickEncoder", "Libmagick: {}", error_.what()); + logger->debug("MagickEncoder", "Libmagick: {}", error_.what()); return false; } @@ -289,7 +291,7 @@ void OsdVector::updateOrAddSurface(const SurfaceVector* surf, float x, float y, SurfacesIterator si; #if DEV - LogNT::getInstance()->trace(TAG, "updateOrAddSurface, surfaces.length {}", surfaces.size()); + logger->trace(TAG, "updateOrAddSurface, surfaces.length {}", surfaces.size()); dumpStyles(); #endif @@ -341,19 +343,19 @@ void OsdVector::updateOrAddSurface(const SurfaceVector* surf, float x, float y, cleanupOrphanedRefs(); #if DEV - LogNT::getInstance()->trace(TAG, "After UOAS:"); + logger->trace(TAG, "After UOAS:"); dumpStyles(); #endif // OSDOVG-ROD-EXPERIMENT - LogNT::getInstance()->trace(TAG, "EXPERIMENT - call doRender"); + logger->trace(TAG, "EXPERIMENT - call doRender"); doRender(); } void OsdVector::removeSurface(const SurfaceVector* surf) { std::lock_guard lg(surfaces_mutex); // FIXME - Can block here on shutdown if a timer is fired just as the wrong time - LogNT::getInstance()->trace("OsdVector-348", "EXPERIMENT - removeSurface"); + logger->trace("OsdVector-348", "EXPERIMENT - removeSurface"); for (auto i = surfaces.begin(); i != surfaces.end(); i++) { if (i->surface == surf) @@ -458,7 +460,7 @@ void OsdVector::removeLoadIndexRef(const LoadIndex ref) } tvmedias_loaded.erase(ref); - // LogNT::getInstance()->debug(TAG, "TVMedia removeLoadIndexRef {} {:#x}",tvmedias_load.size(),ref); + // logger->debug(TAG, "TVMedia removeLoadIndexRef {} {:#x}",tvmedias_load.size(),ref); tvmedias_load.erase(tvmedias_load_inv[ref]); tvmedias_load_inv.erase(ref); @@ -692,13 +694,13 @@ void OsdVector::dumpStyles() for(i = drawstyleHandles.begin(); i != drawstyleHandles.end(); i++) { const DrawStyle* test = &(i->first); - LogNT::getInstance()->debug(TAG, "DumpStyles: {} {}", (void*)test , i->second); + logger->debug(TAG, "DumpStyles: {} {}", (void*)test , i->second); } std::map::iterator i2; for (i2 = drawstyleHandlesRefCounts.begin(); i2 != drawstyleHandlesRefCounts.end(); i2++) { - LogNT::getInstance()->debug(TAG, "DumpStylesRef: {} {}", i2->first, i2->second); + logger->debug(TAG, "DumpStylesRef: {} {}", i2->first, i2->second); } } #endif @@ -709,11 +711,11 @@ LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image) LoadIndex loadindex = 0; surfaces_mutex.lock(); - if (tvmedias.find(tvmedia) == tvmedias.end()) + if (tvmedias.find(tvmedia) == tvmedias.end()) // if not found, return a loadIndex from loadTVMedia(tvmedia) { loadindex = loadTVMedia(tvmedia); } - else + else // if found, return a real imageIndex. incImageRef(image_handle). EXCEPT: If it's not found in images_ref (???) in which case do same as above. { image_handle = tvmedias[tvmedia]; @@ -736,11 +738,11 @@ LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image) return loadindex; } -LoadIndex OsdVector::loadTVMedia(TVMediaInfo& tvmedia) +LoadIndex OsdVector::loadTVMedia(TVMediaInfo& tvmedia) // insert a tvmedia for loading { LoadIndex index = 0; - if (tvmedias_load.find(tvmedia) == tvmedias_load.end()) + if (tvmedias_load.find(tvmedia) == tvmedias_load.end()) // if not found in tvmedias_load { switch (tvmedia.getType()) { @@ -790,7 +792,7 @@ void OsdVector::informPicture(LoadIndex index, ImageIndex imageIndex) //Beware for thread safety ImageIndex image_index = 0; - LogNT::getInstance()->debug(TAG, "TVMedia Picture for request id {:#x} arrived {:#x}", index, imageIndex); + logger->debug(TAG, "TVMedia Picture for load-id {:#x} arrived index {:#x}", index, imageIndex); surfaces_mutex.lock(); TVMediaInfo tvmedia = tvmedias_load_inv[index]; @@ -824,13 +826,13 @@ void OsdVector::processMessage(Message* m) { case Message::NEW_PICTURE: { - //LogNT::getInstance()->debug(TAG, "TVMedia NEW_PICTURE"); + //logger->debug(TAG, "TVMedia NEW_PICTURE"); informPicture(m->tag, reinterpret_cast(m->data)); break; } case Message::NEW_PICTURE_STATIC: { - //LogNT::getInstance()->debug(TAG, "TVMedia NEW_PICTURE {:#x} {:#x}", m->tag, m->parameter); + //logger->debug(TAG, "TVMedia NEW_PICTURE {:#x} {:#x}", m->tag, m->parameter); informPicture(static_cast(m->tag) << 32LL, reinterpret_cast(m->data)); break; } @@ -980,7 +982,7 @@ void OsdVector::PictureReader::threadMethod() while (itty != decoders.end()) { - if ((*itty)->getDecodedPicture(pictinf)) + if ((*itty)->getDecodedPicture(pictinf)) // FIXME somewhere around here?, or in getDecodedPicture, try SA optimisation { todos = true; osdvector->createPicture(pictinf); diff --git a/osdvector.h b/osdvector.h index d9aa510..60e43ef 100644 --- a/osdvector.h +++ b/osdvector.h @@ -37,6 +37,8 @@ #include "vdr.h" #include "teletextdecodervbiebu.h" +class LogNT; + enum SVGCommandInstr { DrawNoop, @@ -334,6 +336,7 @@ class OsdVector : public Osd, public MessageReceiver PictureReader* getPictReader() { return &reader; }; protected: + LogNT* logger{}; PictureReader reader; diff --git a/surfacevector.cc b/surfacevector.cc index 035cf7b..2b0e133 100644 --- a/surfacevector.cc +++ b/surfacevector.cc @@ -24,8 +24,11 @@ #include "staticartwork.h" #include "surfacevector.h" +const static char* TAG = "SurfaceVector"; + SurfaceVector::SurfaceVector(OsdVector* vosd) { + logger = LogNT::getInstance(); osd = vosd; commands.reserve(2048); } @@ -268,14 +271,13 @@ void SurfaceVector::drawTVMedia(TVMediaInfo& tvmedia, float x, float y, float w if (image) { - //Log::getInstance()->log("SurfaceVector", Log::DEBUG, "TVMedia Add instru image %d %d", load_index,image); + logger->trace(TAG, "drawTVMedia: i=true, Add instr PaintImage load_index={} image={}", load_index, image); commands.push_back(SVGCommand::PaintImage(x, y, width, height, image, 0, corner)); } else { - + logger->trace(TAG, "drawTVMedia: i=false, Add instr PaintImageLoading {} {}", load_index, image); commands.push_back(SVGCommand::PaintImageLoading(load_index, x, y, width, height, corner)); - //Log::getInstance()->log("SurfaceVector", Log::DEBUG, "TVMedia Add instru image loading %d %d", load_index,image); } command_mutex.unlock(); diff --git a/surfacevector.h b/surfacevector.h index ce20315..57f9cfa 100644 --- a/surfacevector.h +++ b/surfacevector.h @@ -68,6 +68,7 @@ class SurfaceVector : public Surface bool screenShot(const char* /* fileName */) { return false; } protected: + LogNT* logger{}; int removeCommands(float x, float y, float width, float height); diff --git a/tcp.cc b/tcp.cc index 7debd2c..6b8f366 100644 --- a/tcp.cc +++ b/tcp.cc @@ -212,8 +212,6 @@ bool TCP::waitForConnect(int) return false; } - logger->trace(TAG, "waitForConnect(): selectResult = {}", selectResult); - if ((selectResult == 1) && FD_ISSET(sockfd, &writefds)) { logger->info(TAG, "Connected"); -- 2.39.5